vc-error-handlers 0.1.98 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/esm2022/lib/configuration.mjs +7 -0
  2. package/{esm2020 → esm2022}/lib/featureFlag/feature-flag.directive.mjs +27 -27
  3. package/esm2022/lib/featureFlag/feature-flag.module.mjs +20 -0
  4. package/esm2022/lib/featureFlag/feature-flag.service.mjs +98 -0
  5. package/{esm2020 → esm2022}/lib/shared/components/chunk-unavailable/chunk-unavailable.component.mjs +35 -35
  6. package/esm2022/lib/shared/components/component-level-server-error/component-level-server-error.component.mjs +65 -0
  7. package/{esm2020 → esm2022}/lib/shared/components/error-modal/error-modal.component.mjs +45 -45
  8. package/esm2022/lib/shared/components/page-not-found/page-not-found.component.mjs +92 -0
  9. package/esm2022/lib/shared/components/server-error/server-error.component.mjs +83 -0
  10. package/{esm2020 → esm2022}/lib/shared/components/session-expired/session-expired.component.mjs +35 -35
  11. package/esm2022/lib/shared/components/unauthorized/unauthorized.component.mjs +103 -0
  12. package/{esm2020 → esm2022}/lib/shared/constants/api-config.constants.mjs +239 -239
  13. package/{esm2020 → esm2022}/lib/shared/constants/error-handling.constants.mjs +62 -62
  14. package/{esm2020 → esm2022}/lib/shared/errorhandler/chunk-error.handler.mjs +18 -18
  15. package/{esm2020 → esm2022}/lib/shared/errorhandler/sentry-error.handler.mjs +47 -47
  16. package/{esm2020 → esm2022}/lib/shared/interceptors/http.interceptor.mjs +35 -35
  17. package/{esm2020 → esm2022}/lib/shared/services/global-error.service.mjs +115 -115
  18. package/{esm2020 → esm2022}/lib/shared/services/router.service.mjs +19 -19
  19. package/{esm2020 → esm2022}/lib/shared/services/util.service.mjs +48 -48
  20. package/{esm2020 → esm2022}/lib/shared/types/global-error.types.mjs +15 -15
  21. package/{esm2020 → esm2022}/lib/ui-kit/dialog/dialog-config.mjs +2 -2
  22. package/esm2022/lib/ui-kit/dialog/dialog-injector.mjs +15 -0
  23. package/{esm2020 → esm2022}/lib/ui-kit/dialog/dialog-ref.mjs +12 -12
  24. package/{esm2020 → esm2022}/lib/ui-kit/dialog/dialog.component.mjs +85 -85
  25. package/esm2022/lib/ui-kit/dialog/dialog.module.mjs +21 -0
  26. package/{esm2020 → esm2022}/lib/ui-kit/dialog/dialog.service.mjs +52 -52
  27. package/{esm2020 → esm2022}/lib/ui-kit/dialog/insertion.directive.mjs +16 -16
  28. package/{esm2020 → esm2022}/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.mjs +50 -50
  29. package/esm2022/lib/ui-kit/snack-bar/snack-bar.module.mjs +18 -0
  30. package/{esm2020 → esm2022}/lib/ui-kit/snack-bar/snack-bar.service.mjs +32 -32
  31. package/{esm2020 → esm2022}/lib/vc-error-handlers.component.mjs +85 -85
  32. package/esm2022/lib/vc-error-handlers.module.mjs +84 -0
  33. package/{esm2020 → esm2022}/lib/vc-error-handlers.service.mjs +14 -14
  34. package/{esm2020 → esm2022}/public-api.mjs +16 -16
  35. package/{esm2020 → esm2022}/vc-error-handlers.mjs +4 -4
  36. package/{fesm2020 → fesm2022}/vc-error-handlers.mjs +1286 -1359
  37. package/fesm2022/vc-error-handlers.mjs.map +1 -0
  38. package/{vc-error-handlers.d.ts → index.d.ts} +5 -5
  39. package/lib/configuration.d.ts +5 -4
  40. package/lib/featureFlag/feature-flag.directive.d.ts +13 -13
  41. package/lib/featureFlag/feature-flag.module.d.ts +8 -8
  42. package/lib/featureFlag/feature-flag.service.d.ts +21 -19
  43. package/lib/shared/components/chunk-unavailable/chunk-unavailable.component.d.ts +20 -20
  44. package/lib/shared/components/component-level-server-error/component-level-server-error.component.d.ts +19 -19
  45. package/lib/shared/components/error-modal/error-modal.component.d.ts +21 -21
  46. package/lib/shared/components/page-not-found/page-not-found.component.d.ts +23 -23
  47. package/lib/shared/components/server-error/server-error.component.d.ts +19 -19
  48. package/lib/shared/components/session-expired/session-expired.component.d.ts +20 -20
  49. package/lib/shared/components/unauthorized/unauthorized.component.d.ts +23 -23
  50. package/lib/shared/constants/api-config.constants.d.ts +20 -20
  51. package/lib/shared/constants/error-handling.constants.d.ts +62 -62
  52. package/lib/shared/errorhandler/chunk-error.handler.d.ts +7 -7
  53. package/lib/shared/errorhandler/sentry-error.handler.d.ts +14 -14
  54. package/lib/shared/interceptors/http.interceptor.d.ts +13 -13
  55. package/lib/shared/services/global-error.service.d.ts +31 -31
  56. package/lib/shared/services/router.service.d.ts +6 -6
  57. package/lib/shared/services/util.service.d.ts +15 -15
  58. package/lib/shared/types/global-error.types.d.ts +27 -27
  59. package/lib/ui-kit/dialog/dialog-config.d.ts +6 -6
  60. package/lib/ui-kit/dialog/dialog-injector.d.ts +7 -7
  61. package/lib/ui-kit/dialog/dialog-ref.d.ts +7 -7
  62. package/lib/ui-kit/dialog/dialog.component.d.ts +33 -33
  63. package/lib/ui-kit/dialog/dialog.module.d.ts +9 -9
  64. package/lib/ui-kit/dialog/dialog.service.d.ts +17 -17
  65. package/lib/ui-kit/dialog/insertion.directive.d.ts +8 -8
  66. package/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.d.ts +20 -20
  67. package/lib/ui-kit/snack-bar/snack-bar.module.d.ts +8 -8
  68. package/lib/ui-kit/snack-bar/snack-bar.service.d.ts +11 -11
  69. package/lib/vc-error-handlers.component.d.ts +26 -26
  70. package/lib/vc-error-handlers.module.d.ts +26 -26
  71. package/lib/vc-error-handlers.service.d.ts +6 -6
  72. package/package.json +7 -13
  73. package/public-api.d.ts +13 -13
  74. package/environments/environment.d.ts +0 -39
  75. package/esm2020/environments/environment.mjs +0 -75
  76. package/esm2020/lib/configuration.mjs +0 -6
  77. package/esm2020/lib/featureFlag/feature-flag.module.mjs +0 -22
  78. package/esm2020/lib/featureFlag/feature-flag.service.mjs +0 -95
  79. package/esm2020/lib/shared/components/component-level-server-error/component-level-server-error.component.mjs +0 -64
  80. package/esm2020/lib/shared/components/page-not-found/page-not-found.component.mjs +0 -91
  81. package/esm2020/lib/shared/components/server-error/server-error.component.mjs +0 -82
  82. package/esm2020/lib/shared/components/unauthorized/unauthorized.component.mjs +0 -102
  83. package/esm2020/lib/ui-kit/dialog/dialog-injector.mjs +0 -15
  84. package/esm2020/lib/ui-kit/dialog/dialog.module.mjs +0 -21
  85. package/esm2020/lib/ui-kit/snack-bar/snack-bar.module.mjs +0 -18
  86. package/esm2020/lib/vc-error-handlers.module.mjs +0 -84
  87. package/fesm2015/vc-error-handlers.mjs +0 -1679
  88. package/fesm2015/vc-error-handlers.mjs.map +0 -1
  89. package/fesm2020/vc-error-handlers.mjs.map +0 -1
@@ -1,1679 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, Component, Input, Directive, ViewChild, NgModule, EventEmitter, Output, Optional, InjectionToken, ErrorHandler } from '@angular/core';
3
- import { Subject, throwError } from 'rxjs';
4
- import * as i3 from '@angular/router';
5
- import { NavigationStart, NavigationEnd, NavigationError } from '@angular/router';
6
- import * as i2 from '@angular/common';
7
- import { CommonModule } from '@angular/common';
8
- import * as i1 from '@vcomply/authorizer';
9
- import * as i1$1 from '@angular/common/http';
10
- import { HttpResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
11
- import { retry, timeout, tap, catchError } from 'rxjs/operators';
12
- import * as Sentry from '@sentry/angular-ivy';
13
-
14
- class VcErrorHandlersService {
15
- constructor() { }
16
- }
17
- VcErrorHandlersService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
18
- VcErrorHandlersService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersService, providedIn: 'root' });
19
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersService, decorators: [{
20
- type: Injectable,
21
- args: [{
22
- providedIn: 'root'
23
- }]
24
- }], ctorParameters: function () { return []; } });
25
-
26
- var ErrorStatusCode;
27
- (function (ErrorStatusCode) {
28
- ErrorStatusCode[ErrorStatusCode["URLNotFound"] = 404] = "URLNotFound";
29
- ErrorStatusCode[ErrorStatusCode["UnauthorizedAccess"] = 403] = "UnauthorizedAccess";
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["BadGateway"] = 502] = "BadGateway";
35
- ErrorStatusCode[ErrorStatusCode["RequestTimeout"] = 504] = "RequestTimeout";
36
- // Network unavailability/offline case
37
- ErrorStatusCode[ErrorStatusCode["NetworkUnavailable"] = 0] = "NetworkUnavailable";
38
- // Application-specific errors
39
- ErrorStatusCode[ErrorStatusCode["JSChunkUnavailable"] = 600] = "JSChunkUnavailable";
40
- })(ErrorStatusCode || (ErrorStatusCode = {}));
41
-
42
- const PAGE_LEVEL_API_CONFIG = [
43
- {
44
- method: '',
45
- path: '',
46
- query: null,
47
- body: null,
48
- pageCodes: [''],
49
- },
50
- ];
51
- const COMPONENT_LEVEL_API_CONFIG = [
52
- {
53
- method: 'GET',
54
- path: '/organization/?mode=organisationUsersList',
55
- query: { type: 'active' },
56
- body: null,
57
- },
58
- {
59
- method: 'GET',
60
- path: '/organization/?mode=organisationUsersList',
61
- query: { type: 'power_users' },
62
- body: null,
63
- },
64
- {
65
- method: 'GET',
66
- path: '/organization/?mode=organisationUsersList',
67
- query: { type: 'light_users' },
68
- body: null,
69
- },
70
- {
71
- method: 'GET',
72
- path: '/organization/?mode=organisationUsersList',
73
- query: { type: 'inactive' },
74
- body: null,
75
- },
76
- {
77
- method: 'GET',
78
- path: '/organization/?mode=organisationUsersList',
79
- query: { type: 'power_users_small' },
80
- body: null,
81
- },
82
- {
83
- method: 'GET',
84
- path: '/Global-Dashboard/ManageDashboards',
85
- query: null,
86
- body: null,
87
- },
88
- {
89
- method: 'GET',
90
- path: '/Global-Dashboard/MyDashboard',
91
- query: null,
92
- body: null,
93
- },
94
- {
95
- method: 'GET',
96
- path: '/grc_object/?mode=grc/getGRCList',
97
- query: null,
98
- body: null,
99
- },
100
- {
101
- method: 'GET',
102
- path: '/compliance/?mode=responsibilityCenterTree',
103
- query: null,
104
- body: null,
105
- },
106
- {
107
- method: 'GET',
108
- path: '/organization/?mode=rcholidaylist',
109
- query: null,
110
- body: null,
111
- },
112
- {
113
- method: 'GET',
114
- path: '/organization/?mode=roles/getRoles',
115
- query: null,
116
- body: null,
117
- },
118
- {
119
- method: 'GET',
120
- path: '/organization/?mode=groupsList',
121
- query: null,
122
- body: null,
123
- },
124
- {
125
- method: 'POST',
126
- path: '/compliance_post/?mode=rcProfile',
127
- query: null,
128
- body: null,
129
- },
130
- {
131
- method: 'POST',
132
- path: '/organization_post/?mode=userProfile',
133
- query: null,
134
- body: null,
135
- },
136
- {
137
- method: 'GET',
138
- path: '/organization/?mode=roles/roleById',
139
- query: null,
140
- body: null,
141
- },
142
- {
143
- method: 'GET',
144
- path: '/organization/?mode=groupDetails',
145
- query: null,
146
- body: null,
147
- },
148
- {
149
- method: 'POST',
150
- path: '/compliance_post?mode=report/list',
151
- query: null,
152
- body: null,
153
- },
154
- {
155
- method: 'GET',
156
- path: '/organization/?mode=memberholidaylist',
157
- query: null,
158
- body: null,
159
- },
160
- {
161
- method: 'GET',
162
- path: '/grc_object/?mode=activity/activityLogList',
163
- query: null,
164
- body: null,
165
- },
166
- {
167
- method: 'GET',
168
- path: '/grc_object/?mode=activity/viewList',
169
- query: null,
170
- body: null,
171
- },
172
- {
173
- method: 'GET',
174
- path: '/program/categoriesList?owner_list=1',
175
- query: null,
176
- body: null,
177
- },
178
- {
179
- method: 'POST',
180
- path: '/risk/?mode=category/list',
181
- query: null,
182
- body: null,
183
- },
184
- {
185
- method: 'POST',
186
- path: 'memberDetailsbyIds',
187
- query: null,
188
- body: null,
189
- },
190
- {
191
- method: 'GET',
192
- path: '/organization?mode=signatureDetails',
193
- query: null,
194
- body: null,
195
- },
196
- {
197
- method: 'GET',
198
- path: '/program/responsibilityList',
199
- query: null,
200
- body: null,
201
- },
202
- {
203
- method: 'GET',
204
- path: '/program/getLinkedPolicies',
205
- query: null,
206
- body: null,
207
- },
208
- {
209
- method: 'POST',
210
- path: 'risk/list',
211
- query: null,
212
- body: null,
213
- },
214
- {
215
- method: 'GET',
216
- path: '/program/assignee',
217
- query: null,
218
- body: null,
219
- },
220
- {
221
- method: 'GET',
222
- path: '/program/evidence/getEvidences/b-cycle-header',
223
- query: null,
224
- body: null,
225
- },
226
- {
227
- method: 'GET',
228
- path: '/program/activity-logs',
229
- query: null,
230
- body: null,
231
- },
232
- {
233
- method: 'GET',
234
- path: '/program/activity-logs-views',
235
- query: null,
236
- body: null,
237
- },
238
- {
239
- method: 'POST',
240
- path: '/Assessment/?mode=category/list',
241
- query: null,
242
- body: null,
243
- },
244
- {
245
- method: 'POST',
246
- path: '/Assessment/?mode=assessment/list',
247
- query: null,
248
- body: null,
249
- },
250
- {
251
- method: 'GET',
252
- path: '/Assessment/?mode=assessment/fetchQuestionsByAssessmentId',
253
- query: null,
254
- body: null,
255
- },
256
- {
257
- method: 'POST',
258
- path: '/Assessment/?mode=assessment/responseSummary',
259
- query: null,
260
- body: null,
261
- },
262
- {
263
- method: 'GET',
264
- path: '/Assessment/?mode=assessment/logs',
265
- query: null,
266
- body: null,
267
- },
268
- {
269
- method: 'GET',
270
- path: '/program/subCategories',
271
- query: null,
272
- body: null,
273
- },
274
- {
275
- method: 'POST',
276
- path: '/Assessment/?mode=assessment/getAssessmentById',
277
- query: null,
278
- body: null,
279
- },
280
- ];
281
-
282
- class SnackBarService {
283
- constructor() {
284
- this.snackbarSubject = new Subject();
285
- this.snackbarState = this.snackbarSubject.asObservable();
286
- }
287
- show(message, type) {
288
- this.snackbarSubject.next({
289
- show: true,
290
- message,
291
- icon: type,
292
- });
293
- }
294
- hide() {
295
- this.snackbarSubject.next({
296
- show: false,
297
- message: '',
298
- icon: '',
299
- });
300
- }
301
- }
302
- SnackBarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
303
- SnackBarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarService, providedIn: 'root' });
304
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarService, decorators: [{
305
- type: Injectable,
306
- args: [{
307
- providedIn: 'root',
308
- }]
309
- }], ctorParameters: function () { return []; } });
310
-
311
- class UtilsService {
312
- isJsonSubset(parentJson, subsetJson) {
313
- for (let key in subsetJson) {
314
- if (!parentJson.hasOwnProperty(key) ||
315
- parentJson[key] !== subsetJson[key]) {
316
- return false;
317
- }
318
- }
319
- return true;
320
- }
321
- extractQueryParams(params) {
322
- const query = {};
323
- params.keys().forEach((key) => {
324
- query[key] = params.get(key);
325
- });
326
- return query;
327
- }
328
- isStringEqual(apiMethod, requestMethod) {
329
- return apiMethod === requestMethod;
330
- }
331
- isSubstringInString(apiPath, requestPath) {
332
- return requestPath.includes(apiPath);
333
- }
334
- isSubsetOfObject(apiQuery, requestQuery) {
335
- if (!apiQuery)
336
- return true;
337
- return this.isJsonSubset(requestQuery, apiQuery);
338
- }
339
- isSubsetOfArray(apiBody, requestBody) {
340
- if (!apiBody)
341
- return true;
342
- return this.isJsonSubset(apiBody, requestBody);
343
- }
344
- isValueInArray(apiPageCodes, pageCode) {
345
- return apiPageCodes.includes(pageCode);
346
- }
347
- }
348
- UtilsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
349
- UtilsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UtilsService, providedIn: 'root' });
350
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UtilsService, decorators: [{
351
- type: Injectable,
352
- args: [{
353
- providedIn: 'root',
354
- }]
355
- }] });
356
-
357
- class GlobalErrorService {
358
- constructor(snackBarService, utilService, router) {
359
- this.snackBarService = snackBarService;
360
- this.utilService = utilService;
361
- this.router = router;
362
- this.globalError$ = new Subject();
363
- this.localError$ = new Subject();
364
- this.pageLevelApiConfig = PAGE_LEVEL_API_CONFIG;
365
- this.componentLevelApiConfig = COMPONENT_LEVEL_API_CONFIG;
366
- }
367
- handleSoftErrors(event) {
368
- const xData = event.headers.get('X-Data');
369
- if (xData) {
370
- const parsedData = JSON.parse(xData);
371
- const statusCode = parsedData.statusCode;
372
- const statusMessage = parsedData.message;
373
- if (statusCode && statusCode !== 0) {
374
- this.snackBarService.show(statusMessage || 'Error occurred', 'error');
375
- }
376
- }
377
- }
378
- handleError(error, request) {
379
- if (this.isUnauthenticated(error) ||
380
- this.isUnauthorizedAccess(error) ||
381
- this.isNetworkUnavailable(error)) {
382
- this.publishGlobalError(error);
383
- }
384
- else if (this.isServerError(error)) {
385
- this.handleServerError(error, request);
386
- }
387
- else {
388
- this.handleSoftErrors(error);
389
- }
390
- }
391
- isServerError(error) {
392
- const serverErrorCodes = [
393
- ErrorStatusCode.InternalServerError,
394
- ErrorStatusCode.ServiceUnavailable,
395
- ErrorStatusCode.BadGateway,
396
- ErrorStatusCode.RequestTimeout,
397
- ];
398
- return serverErrorCodes.includes(error.status);
399
- }
400
- isUnauthenticated(error) {
401
- return error.status === ErrorStatusCode.Unauthenticated;
402
- }
403
- isUnauthorizedAccess(error) {
404
- return error.status === ErrorStatusCode.UnauthorizedAccess;
405
- }
406
- isNetworkUnavailable(error) {
407
- return error.status === ErrorStatusCode.NetworkUnavailable;
408
- }
409
- handleServerError(error, request) {
410
- if (this.isPageLevelError(error, request)) {
411
- this.publishGlobalError(error);
412
- }
413
- else if (this.isComponentLevelError(error, request)) {
414
- this.publishLocalError(error, request);
415
- }
416
- }
417
- publishGlobalError(error) {
418
- this.globalError$.next(error);
419
- }
420
- publishLocalError(error, request) {
421
- this.localError$.next({ error, request });
422
- }
423
- isPageLevelError(error, request) {
424
- const requestDetails = {
425
- method: request.method,
426
- path: request.url,
427
- query: this.utilService.extractQueryParams(request.params),
428
- body: request.body,
429
- pageCode: this.getPageCode(),
430
- };
431
- return this.pageLevelApiConfig.some((apiConfig) => this.isApiConfigMatching(apiConfig, requestDetails));
432
- }
433
- isComponentLevelError(error, request) {
434
- const requestDetails = {
435
- method: request.method,
436
- path: request.url,
437
- query: this.utilService.extractQueryParams(request.params),
438
- body: request.body,
439
- };
440
- return this.componentLevelApiConfig.some((apiConfig) => this.isApiConfigMatching(apiConfig, requestDetails));
441
- }
442
- getPageCode() {
443
- var _a;
444
- const currentRoute = this.router.routerState.snapshot.root.firstChild;
445
- return (_a = currentRoute === null || currentRoute === void 0 ? void 0 : currentRoute.data) === null || _a === void 0 ? void 0 : _a.pageCode;
446
- }
447
- isApiConfigMatching(apiConfig, requestDetails) {
448
- return (this.utilService.isStringEqual(apiConfig.method, requestDetails.method) &&
449
- this.utilService.isSubstringInString(apiConfig.path, requestDetails.path) &&
450
- this.utilService.isSubsetOfObject(apiConfig.query, requestDetails.query) &&
451
- this.utilService.isSubsetOfArray(apiConfig.body, requestDetails.body) &&
452
- (!apiConfig.pageCodes ||
453
- this.utilService.isValueInArray(apiConfig.pageCodes, requestDetails.pageCode || '')));
454
- }
455
- }
456
- GlobalErrorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GlobalErrorService, deps: [{ token: SnackBarService }, { token: UtilsService }, { token: i3.Router }], target: i0.ɵɵFactoryTarget.Injectable });
457
- GlobalErrorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GlobalErrorService, providedIn: 'root' });
458
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: GlobalErrorService, decorators: [{
459
- type: Injectable,
460
- args: [{
461
- providedIn: 'root',
462
- }]
463
- }], ctorParameters: function () { return [{ type: SnackBarService }, { type: UtilsService }, { type: i3.Router }]; } });
464
-
465
- class RouterService {
466
- redirectToLogin() {
467
- window.location.href =
468
- `https://${window.location.host}/` +
469
- 'signin?redirectURL=' +
470
- encodeURIComponent(window.location.href);
471
- }
472
- }
473
- RouterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: RouterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
474
- RouterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: RouterService, providedIn: 'root' });
475
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: RouterService, decorators: [{
476
- type: Injectable,
477
- args: [{
478
- providedIn: 'root',
479
- }]
480
- }] });
481
-
482
- const VCOMPLY_LOGO_URL = 'https://cdn.v-comply.com/logo/prod/v-logo.svg';
483
- const API_TIMEOUT_TIME = 1000 * 15;
484
- const ORGANISATION_NAME = 'VCOMPLY TECHNOLOGIES, INC.';
485
- const ERROR_FEATURE_FLAG = 'ff_error_handling';
486
- const ERROR_CONFIG = {
487
- PAGE_NOT_FOUND: {
488
- imageUrl: 'https://cdn.v-comply.com/application/images/Error-page-illustration.svg',
489
- title: 'Oops!',
490
- description: "The page you're looking for doesn't exist.",
491
- details: 'Please check the URL or return to the homepage.',
492
- buttonText: 'GO TO DASHBOARD',
493
- },
494
- UNAUTHORIZED: {
495
- imageUrl: 'https://cdn.v-comply.com/application/images/Error-page-illustration.svg',
496
- title: 'Oops!',
497
- description: "You don't have permission to access this page.",
498
- details: 'If you believe this is an error, please contact',
499
- email: 'help@v-comply.com',
500
- support: 'for support',
501
- buttonText: 'CONTACT SUPPORT',
502
- mail: 'mailto:help@v-comply.com',
503
- },
504
- SESSION_EXPIRED: {
505
- heading: 'Session Expired!',
506
- description: 'Your session has expired. Please log in again to continue using the app.',
507
- buttonText: 'LOGIN',
508
- },
509
- CHUNK_UNAVAILABLE: {
510
- heading: 'Oops!',
511
- description: 'Something went wrong. Please refresh the page or try again later.',
512
- buttonText: 'REFRESH',
513
- },
514
- SERVER_ERROR: {
515
- imageUrl: 'https://cdn.v-comply.com/application/images/Error-page-illustration.svg',
516
- title: 'Oops!',
517
- description: 'We are unable to load the data.',
518
- details: 'Please refresh this page or try again later.',
519
- buttonText: 'REFRESH',
520
- snackBarMessage: `Oops! Something went wrong. Please try again later.`,
521
- },
522
- COMPONENT_LEVEL_SERVER_ERROR: {
523
- imageUrl: 'https://cdn.v-comply.com/application/images/sad-emoji-icon.svg',
524
- title: 'Oops!',
525
- description: 'We are unable to load the data.',
526
- details: 'Please refresh this section or try again later.',
527
- buttonText: 'RETRY',
528
- },
529
- NETWORK_UNAVAILABLE: {
530
- offlineMessage: "You're currently offline. Please check your internet connection and try again.",
531
- },
532
- };
533
- const REDIRECTION_URL = {
534
- compliance_dashboard: '/global-dashboard/compliance_dashboard',
535
- };
536
- const MODAL_ERROR_TYPES = {
537
- CHUNK_NOT_FOUND: 'chunk_not_found',
538
- SESSION_EXPIRED: 'session_expired',
539
- };
540
- const ALT_IMAGE_TEXT = {
541
- ERROR_IMAGE: 'Error Image',
542
- VCOMPLY_LOGO: 'VComply',
543
- };
544
-
545
- class SnackBarComponent {
546
- constructor(snackbarService) {
547
- this.snackbarService = snackbarService;
548
- this.show = false;
549
- this.message = '--';
550
- this.icon = '';
551
- this.type = 'alert';
552
- this.icons = {
553
- success: '',
554
- warning: '',
555
- info: '',
556
- alert: '',
557
- error: '',
558
- };
559
- }
560
- ngOnInit() {
561
- this.snackbarSubscription = this.snackbarService.snackbarState.subscribe((state) => {
562
- if (state.icon && Object.keys(this.icons).includes(state === null || state === void 0 ? void 0 : state.icon)) {
563
- this.icon = this.icons[state.icon];
564
- this.type = state === null || state === void 0 ? void 0 : state.icon;
565
- }
566
- this.message = state.message;
567
- this.show = state.show;
568
- });
569
- }
570
- setAutoClose() {
571
- setTimeout(() => {
572
- this.show = false;
573
- this.close();
574
- }, 3000);
575
- }
576
- close() {
577
- this.show = false;
578
- this.snackbarService.hide();
579
- }
580
- ngOnDestroy() {
581
- this.snackbarSubscription.unsubscribe();
582
- }
583
- }
584
- SnackBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarComponent, deps: [{ token: SnackBarService }], target: i0.ɵɵFactoryTarget.Component });
585
- 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: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
586
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarComponent, decorators: [{
587
- type: Component,
588
- 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"] }]
589
- }], ctorParameters: function () { return [{ type: SnackBarService }]; } });
590
-
591
- class DialogConfig {
592
- }
593
-
594
- class ErrorModalComponent {
595
- constructor(authService, dialogConfig, routerService) {
596
- this.authService = authService;
597
- this.dialogConfig = dialogConfig;
598
- this.routerService = routerService;
599
- this.errorTypes = MODAL_ERROR_TYPES;
600
- this.data = {
601
- heading: 'Message',
602
- description: 'Description',
603
- buttonText: 'Click Action',
604
- };
605
- this.setDataConfig();
606
- }
607
- setDataConfig() {
608
- var _a, _b;
609
- this.data = (_a = this.dialogConfig.data) === null || _a === void 0 ? void 0 : _a.errorConfig;
610
- this.errorType = (_b = this.dialogConfig.data) === null || _b === void 0 ? void 0 : _b.errorType;
611
- }
612
- onContinueAction() {
613
- switch (this.errorType) {
614
- case this.errorTypes.SESSION_EXPIRED:
615
- this.authService.logout();
616
- this.routerService.redirectToLogin();
617
- break;
618
- case this.errorTypes.CHUNK_NOT_FOUND:
619
- window.location.reload();
620
- break;
621
- }
622
- }
623
- }
624
- ErrorModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ErrorModalComponent, deps: [{ token: i1.AuthorizerService }, { token: DialogConfig }, { token: RouterService }], target: i0.ɵɵFactoryTarget.Component });
625
- ErrorModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ErrorModalComponent, selector: "lib-vc-error-modal", inputs: { errorType: "errorType" }, ngImport: i0, template: ` <div class="error-dialog-box">
626
- <div class="error-dialog-box-top">{{ data.heading }}</div>
627
- <div class="error-dialog-box-mid">
628
- {{ data.description }}
629
- </div>
630
- <div class="error-dialog-box-bottom">
631
- <button (click)="onContinueAction()" class="logIn-btn">
632
- {{ data.buttonText }}
633
- </button>
634
- </div>
635
- </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"] });
636
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ErrorModalComponent, decorators: [{
637
- type: Component,
638
- args: [{ selector: 'lib-vc-error-modal', template: ` <div class="error-dialog-box">
639
- <div class="error-dialog-box-top">{{ data.heading }}</div>
640
- <div class="error-dialog-box-mid">
641
- {{ data.description }}
642
- </div>
643
- <div class="error-dialog-box-bottom">
644
- <button (click)="onContinueAction()" class="logIn-btn">
645
- {{ data.buttonText }}
646
- </button>
647
- </div>
648
- </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"] }]
649
- }], ctorParameters: function () { return [{ type: i1.AuthorizerService }, { type: DialogConfig }, { type: RouterService }]; }, propDecorators: { errorType: [{
650
- type: Input
651
- }] } });
652
-
653
- class InsertionDirective {
654
- constructor(viewContainerRef) {
655
- this.viewContainerRef = viewContainerRef;
656
- }
657
- }
658
- InsertionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: InsertionDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
659
- InsertionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: InsertionDirective, selector: "[appInsertion]", ngImport: i0 });
660
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: InsertionDirective, decorators: [{
661
- type: Directive,
662
- args: [{
663
- selector: '[appInsertion]',
664
- }]
665
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; } });
666
-
667
- class DialogRef {
668
- constructor() {
669
- this.afterDialogClosed = new Subject();
670
- this.afterClosed = this.afterDialogClosed.asObservable();
671
- }
672
- close(result) {
673
- // debugger
674
- this.afterDialogClosed.next(result);
675
- document.body.style.overflow = 'auto';
676
- }
677
- }
678
-
679
- class DialogComponent {
680
- constructor(componentFactoryResolver, cd, dialogRef, config, router) {
681
- this.componentFactoryResolver = componentFactoryResolver;
682
- this.cd = cd;
683
- this.dialogRef = dialogRef;
684
- this.config = config;
685
- this.router = router;
686
- this.animation = true;
687
- this.onDialogClose = new Subject();
688
- this.onClose = this.onDialogClose.asObservable();
689
- // this.componentRef = this.componentRef;
690
- // this.animate = this.animate;
691
- // this.insertionPoint = this.insertionPoint;
692
- // this.childComponentType = this.childComponentType;
693
- }
694
- ngOnInit() {
695
- this.position = this.config.position;
696
- this.background = this.config.background;
697
- document.body.style.overflow = 'hidden';
698
- setTimeout(() => {
699
- this.animation = false;
700
- }, 200);
701
- this.routeAction();
702
- }
703
- routeAction() {
704
- this.router.events.subscribe((event) => {
705
- if (event instanceof NavigationStart) {
706
- // Show loading indicator
707
- }
708
- if (event instanceof NavigationEnd) {
709
- // Hide loading indicator
710
- this.dialogRef.close();
711
- }
712
- if (event instanceof NavigationError) {
713
- // Hide loading indicator
714
- // Present error to user
715
- }
716
- });
717
- }
718
- ngAfterViewInit() {
719
- this.loadChildComponent(this.childComponentType);
720
- this.cd.detectChanges();
721
- }
722
- onOverlayClicked(evt) {
723
- // this.dialogRef.close();
724
- }
725
- onDialogClicked(evt) {
726
- evt.stopPropagation();
727
- }
728
- loadChildComponent(componentType) {
729
- const componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentType);
730
- const viewContainerRef = this.insertionPoint.viewContainerRef;
731
- viewContainerRef.clear();
732
- this.componentRef = viewContainerRef.createComponent(componentFactory);
733
- }
734
- ngOnDestroy() {
735
- if (this.componentRef) {
736
- this.componentRef.destroy();
737
- }
738
- }
739
- close(data) {
740
- this.onDialogClose.next(data);
741
- document.body.style.overflow = 'auto';
742
- }
743
- }
744
- 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 });
745
- 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: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: InsertionDirective, selector: "[appInsertion]" }] });
746
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogComponent, decorators: [{
747
- type: Component,
748
- 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"] }]
749
- }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i0.ChangeDetectorRef }, { type: DialogRef }, { type: DialogConfig }, { type: i3.Router }]; }, propDecorators: { insertionPoint: [{
750
- type: ViewChild,
751
- args: [InsertionDirective, { static: true }]
752
- }] } });
753
-
754
- class DialogModule {
755
- }
756
- DialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
757
- DialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogModule, declarations: [DialogComponent, InsertionDirective], imports: [CommonModule], exports: [DialogComponent] });
758
- DialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogModule, providers: [DialogRef], imports: [[CommonModule]] });
759
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogModule, decorators: [{
760
- type: NgModule,
761
- args: [{
762
- imports: [CommonModule],
763
- declarations: [DialogComponent, InsertionDirective],
764
- providers: [DialogRef],
765
- exports: [DialogComponent]
766
- }]
767
- }] });
768
-
769
- class DialogInjector {
770
- constructor(parentDialogInjector, dialogAdditionalTokens) {
771
- this.parentDialogInjector = parentDialogInjector;
772
- this.dialogAdditionalTokens = dialogAdditionalTokens;
773
- }
774
- // get(token: any, notFoundValue?: any){return; }
775
- get(token, notFoundValue, flags) {
776
- const value = this.dialogAdditionalTokens.get(token);
777
- if (value) {
778
- return value;
779
- }
780
- return this.parentDialogInjector.get(token, notFoundValue);
781
- }
782
- }
783
-
784
- class DialogService {
785
- constructor(componentFactoryResolver, appRef, injector) {
786
- this.componentFactoryResolver = componentFactoryResolver;
787
- this.appRef = appRef;
788
- this.injector = injector;
789
- }
790
- open(componentType, config) {
791
- const dialogRef = this.appendDialogComponentToBody(config);
792
- this.dialogComponentRef.instance.childComponentType = componentType;
793
- return dialogRef;
794
- }
795
- appendDialogComponentToBody(config) {
796
- const map = new WeakMap();
797
- map.set(DialogConfig, config);
798
- const dialogRef = new DialogRef();
799
- map.set(DialogRef, dialogRef);
800
- const sub = dialogRef.afterClosed.subscribe(() => {
801
- this.removeDialogComponentFromBody();
802
- sub.unsubscribe();
803
- });
804
- const componentFactory = this.componentFactoryResolver.resolveComponentFactory(DialogComponent);
805
- const componentRef = componentFactory.create(new DialogInjector(this.injector, map));
806
- this.appRef.attachView(componentRef.hostView);
807
- const domElem = componentRef.hostView.rootNodes[0];
808
- document.body.appendChild(domElem);
809
- this.dialogComponentRef = componentRef;
810
- this.dialogComponentRef.instance.onClose.subscribe(() => {
811
- this.removeDialogComponentFromBody();
812
- });
813
- return dialogRef;
814
- }
815
- removeDialogComponentFromBody() {
816
- this.appRef.detachView(this.dialogComponentRef.hostView);
817
- this.dialogComponentRef.destroy();
818
- }
819
- }
820
- 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 });
821
- DialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogService, providedIn: DialogModule });
822
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: DialogService, decorators: [{
823
- type: Injectable,
824
- args: [{
825
- providedIn: DialogModule,
826
- }]
827
- }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i0.ApplicationRef }, { type: i0.Injector }]; } });
828
-
829
- class SessionExpiredComponent {
830
- constructor(dialogService) {
831
- this.dialogService = dialogService;
832
- this.errorConfig = ERROR_CONFIG.SESSION_EXPIRED;
833
- this.errorTypes = MODAL_ERROR_TYPES;
834
- }
835
- ngOnInit() {
836
- this.openSessionExpiredModal();
837
- }
838
- openSessionExpiredModal() {
839
- this.dialogService.open(ErrorModalComponent, {
840
- data: {
841
- errorType: this.errorTypes.SESSION_EXPIRED,
842
- errorConfig: this.errorConfig,
843
- },
844
- position: 'center',
845
- background: 'whiteBlur',
846
- });
847
- }
848
- }
849
- SessionExpiredComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SessionExpiredComponent, deps: [{ token: DialogService }], target: i0.ɵɵFactoryTarget.Component });
850
- SessionExpiredComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: SessionExpiredComponent, selector: "lib-vc-error-session-expired", ngImport: i0, template: ``, isInline: true });
851
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SessionExpiredComponent, decorators: [{
852
- type: Component,
853
- args: [{
854
- selector: 'lib-vc-error-session-expired',
855
- template: ``,
856
- }]
857
- }], ctorParameters: function () { return [{ type: DialogService }]; } });
858
-
859
- class UnauthorizedComponent {
860
- constructor() {
861
- this.currentYear = new Date().getFullYear();
862
- this.errorConfig = ERROR_CONFIG.UNAUTHORIZED;
863
- this.VcomplyLogo = VCOMPLY_LOGO_URL;
864
- this.altImageText = ALT_IMAGE_TEXT;
865
- this.organisationName = ORGANISATION_NAME;
866
- }
867
- redirectToSupport() {
868
- window.location.href = this.errorConfig.mail;
869
- }
870
- }
871
- UnauthorizedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UnauthorizedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
872
- UnauthorizedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: UnauthorizedComponent, selector: "lib-vc-error-unauthorized", ngImport: i0, template: `
873
- <div class="errorPage">
874
- <div class="errorPage-top">
875
- <img
876
- [src]="VcomplyLogo"
877
- [alt]="altImageText.VCOMPLY_LOGO"
878
- width="24"
879
- height="24"
880
- />
881
- </div>
882
- <div class="errorPage-container">
883
- <div class="errorPage-inner">
884
- <div class="errorPage-inner-image">
885
- <img
886
- [src]="errorConfig.imageUrl"
887
- [alt]="altImageText.ERROR_IMAGE"
888
- width="246"
889
- height="178"
890
- />
891
- </div>
892
- <div class="errorPage-inner-right">
893
- <div class="errorPage-heading">{{ errorConfig.title }}</div>
894
- <div class="errorPage-text">{{ errorConfig.description }}</div>
895
- <div class="errorPage-details">
896
- {{ errorConfig.details }}
897
- <a [href]="'mailto:' + errorConfig.email">{{
898
- errorConfig.email
899
- }}</a>
900
- {{ errorConfig.support }}.
901
- </div>
902
- <button class="errorPage-btn" (click)="redirectToSupport()">
903
- {{ errorConfig.buttonText }} <i class="icons">&#xe96a;</i>
904
- </button>
905
- </div>
906
- </div>
907
- <div class="errorPage-copyright">
908
- &copy;&nbsp;{{ currentYear }}, {{ organisationName }}
909
- </div>
910
- </div>
911
- </div>
912
- `, 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;position:relative}.errorPage-inner{display:flex;align-items:center}.errorPage-inner-image{width:16rem}.errorPage-inner-right{margin-left:2rem;width:calc(100% - 18rem)}.errorPage-inner-right .errorPage-heading{-webkit-text-fill-color:#e3e3e9;-webkit-text-stroke-color:#a9aab6;-webkit-text-stroke-width:1px;color:#e3e3e9;font-size:78px;font-weight:bold;line-height:110px;margin-bottom:1.5rem}.errorPage-inner-right .errorPage-text{color:#141724;font-size:19px;font-weight:500;line-height:1.75rem;margin-bottom:.5rem}.errorPage-inner-right .errorPage-details{color:#565a6f;font-size:13px;line-height:20px;margin-bottom:1.75rem}.errorPage-inner-right .errorPage-btn{background:#1e5dd3;border-radius:.25rem;border:none;color:#fff;display:inline-flex;align-items:center;font-size:11px;font-weight:500;line-height:2rem;padding:0 1rem}.errorPage-inner-right .errorPage-btn i{font-size:14px;margin-left:.25rem}.errorPage-copyright{font-size:11px;color:#787a8c;font-weight:500;position:absolute;bottom:8px;right:16px;line-height:16px}\n"] });
913
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: UnauthorizedComponent, decorators: [{
914
- type: Component,
915
- args: [{ selector: 'lib-vc-error-unauthorized', template: `
916
- <div class="errorPage">
917
- <div class="errorPage-top">
918
- <img
919
- [src]="VcomplyLogo"
920
- [alt]="altImageText.VCOMPLY_LOGO"
921
- width="24"
922
- height="24"
923
- />
924
- </div>
925
- <div class="errorPage-container">
926
- <div class="errorPage-inner">
927
- <div class="errorPage-inner-image">
928
- <img
929
- [src]="errorConfig.imageUrl"
930
- [alt]="altImageText.ERROR_IMAGE"
931
- width="246"
932
- height="178"
933
- />
934
- </div>
935
- <div class="errorPage-inner-right">
936
- <div class="errorPage-heading">{{ errorConfig.title }}</div>
937
- <div class="errorPage-text">{{ errorConfig.description }}</div>
938
- <div class="errorPage-details">
939
- {{ errorConfig.details }}
940
- <a [href]="'mailto:' + errorConfig.email">{{
941
- errorConfig.email
942
- }}</a>
943
- {{ errorConfig.support }}.
944
- </div>
945
- <button class="errorPage-btn" (click)="redirectToSupport()">
946
- {{ errorConfig.buttonText }} <i class="icons">&#xe96a;</i>
947
- </button>
948
- </div>
949
- </div>
950
- <div class="errorPage-copyright">
951
- &copy;&nbsp;{{ currentYear }}, {{ organisationName }}
952
- </div>
953
- </div>
954
- </div>
955
- `, styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";.errorPage{background:#161b2f;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:9999}.errorPage-top{width:100%;height:3rem;display:flex;align-items:center;padding-left:.75rem}.errorPage-container{background:#f2f2f5;border-radius:.75rem;border:1px solid #e3e3e9;box-shadow:0 4px 8px #1d5dd31a;height:calc(100vh - 3.75rem);display:flex;align-items:center;justify-content:center;padding:0 4rem;margin:0 .75rem;position:relative}.errorPage-inner{display:flex;align-items:center}.errorPage-inner-image{width:16rem}.errorPage-inner-right{margin-left:2rem;width:calc(100% - 18rem)}.errorPage-inner-right .errorPage-heading{-webkit-text-fill-color:#e3e3e9;-webkit-text-stroke-color:#a9aab6;-webkit-text-stroke-width:1px;color:#e3e3e9;font-size:78px;font-weight:bold;line-height:110px;margin-bottom:1.5rem}.errorPage-inner-right .errorPage-text{color:#141724;font-size:19px;font-weight:500;line-height:1.75rem;margin-bottom:.5rem}.errorPage-inner-right .errorPage-details{color:#565a6f;font-size:13px;line-height:20px;margin-bottom:1.75rem}.errorPage-inner-right .errorPage-btn{background:#1e5dd3;border-radius:.25rem;border:none;color:#fff;display:inline-flex;align-items:center;font-size:11px;font-weight:500;line-height:2rem;padding:0 1rem}.errorPage-inner-right .errorPage-btn i{font-size:14px;margin-left:.25rem}.errorPage-copyright{font-size:11px;color:#787a8c;font-weight:500;position:absolute;bottom:8px;right:16px;line-height:16px}\n"] }]
956
- }] });
957
-
958
- class ChunkUnavailableComponent {
959
- constructor(dialogService) {
960
- this.dialogService = dialogService;
961
- this.errorConfig = ERROR_CONFIG.CHUNK_UNAVAILABLE;
962
- this.errorType = MODAL_ERROR_TYPES;
963
- }
964
- ngOnInit() {
965
- this.openSessionExpiredModal();
966
- }
967
- openSessionExpiredModal() {
968
- this.dialogService.open(ErrorModalComponent, {
969
- data: {
970
- errorType: this.errorType.CHUNK_NOT_FOUND,
971
- errorConfig: this.errorConfig,
972
- },
973
- position: 'center',
974
- background: 'whiteBlur',
975
- });
976
- }
977
- }
978
- ChunkUnavailableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChunkUnavailableComponent, deps: [{ token: DialogService }], target: i0.ɵɵFactoryTarget.Component });
979
- ChunkUnavailableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ChunkUnavailableComponent, selector: "lib-vc-error-chunk-unavailable", ngImport: i0, template: ``, isInline: true });
980
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChunkUnavailableComponent, decorators: [{
981
- type: Component,
982
- args: [{
983
- selector: 'lib-vc-error-chunk-unavailable',
984
- template: ``,
985
- }]
986
- }], ctorParameters: function () { return [{ type: DialogService }]; } });
987
-
988
- class ServerErrorComponent {
989
- constructor() {
990
- this.errorConfig = ERROR_CONFIG.SERVER_ERROR;
991
- this.VcomplyLogo = VCOMPLY_LOGO_URL;
992
- this.altImageText = ALT_IMAGE_TEXT;
993
- }
994
- refreshPage() {
995
- window.location.reload();
996
- }
997
- }
998
- ServerErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ServerErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
999
- ServerErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ServerErrorComponent, selector: "lib-vc-error-server-error", ngImport: i0, template: `
1000
- <div class="errorPage">
1001
- <div class="errorPage-top">
1002
- <img
1003
- [src]="VcomplyLogo"
1004
- [alt]="altImageText.VCOMPLY_LOGO"
1005
- width="24"
1006
- height="24"
1007
- />
1008
- </div>
1009
- <div class="errorPage-container">
1010
- <div class="errorPage-inner">
1011
- <div class="errorPage-inner-image">
1012
- <img
1013
- [src]="errorConfig.imageUrl"
1014
- [alt]="altImageText.ERROR_IMAGE"
1015
- width="246"
1016
- height="178"
1017
- />
1018
- </div>
1019
- <div class="errorPage-inner-right">
1020
- <div class="errorPage-heading">{{ errorConfig.title }}</div>
1021
- <div class="errorPage-text">{{ errorConfig.description }}</div>
1022
- <div class="errorPage-details">{{ errorConfig.details }}</div>
1023
- <button class="errorPage-btn" (click)="refreshPage()">
1024
- {{ errorConfig.buttonText }} <i class="icons">&#xe92b;</i>
1025
- </button>
1026
- </div>
1027
- </div>
1028
- </div>
1029
- </div>
1030
- `, 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;position:relative}.errorPage-inner{display:flex;align-items:center}.errorPage-inner-image{width:16rem}.errorPage-inner-right{margin-left:2rem;width:calc(100% - 18rem)}.errorPage-inner-right .errorPage-heading{-webkit-text-fill-color:#e3e3e9;-webkit-text-stroke-color:#a9aab6;-webkit-text-stroke-width:1px;color:#e3e3e9;font-size:78px;font-weight:bold;line-height:110px;margin-bottom:1.5rem}.errorPage-inner-right .errorPage-text{color:#141724;font-size:19px;font-weight:500;line-height:1.75rem;margin-bottom:.5rem}.errorPage-inner-right .errorPage-details{color:#565a6f;font-size:13px;line-height:20px;margin-bottom:1.75rem}.errorPage-inner-right .errorPage-btn{background:#1e5dd3;border-radius:.25rem;border:none;color:#fff;display:inline-flex;align-items:center;font-size:11px;font-weight:500;line-height:2rem;padding:0 1rem}.errorPage-inner-right .errorPage-btn i{font-size:14px;margin-left:.25rem}.errorPage-copyright{font-size:11px;color:#787a8c;font-weight:500;position:absolute;bottom:8px;right:16px;line-height:16px}\n"] });
1031
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ServerErrorComponent, decorators: [{
1032
- type: Component,
1033
- args: [{ selector: 'lib-vc-error-server-error', template: `
1034
- <div class="errorPage">
1035
- <div class="errorPage-top">
1036
- <img
1037
- [src]="VcomplyLogo"
1038
- [alt]="altImageText.VCOMPLY_LOGO"
1039
- width="24"
1040
- height="24"
1041
- />
1042
- </div>
1043
- <div class="errorPage-container">
1044
- <div class="errorPage-inner">
1045
- <div class="errorPage-inner-image">
1046
- <img
1047
- [src]="errorConfig.imageUrl"
1048
- [alt]="altImageText.ERROR_IMAGE"
1049
- width="246"
1050
- height="178"
1051
- />
1052
- </div>
1053
- <div class="errorPage-inner-right">
1054
- <div class="errorPage-heading">{{ errorConfig.title }}</div>
1055
- <div class="errorPage-text">{{ errorConfig.description }}</div>
1056
- <div class="errorPage-details">{{ errorConfig.details }}</div>
1057
- <button class="errorPage-btn" (click)="refreshPage()">
1058
- {{ errorConfig.buttonText }} <i class="icons">&#xe92b;</i>
1059
- </button>
1060
- </div>
1061
- </div>
1062
- </div>
1063
- </div>
1064
- `, styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";.errorPage{background:#161b2f;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:9999}.errorPage-top{width:100%;height:3rem;display:flex;align-items:center;padding-left:.75rem}.errorPage-container{background:#f2f2f5;border-radius:.75rem;border:1px solid #e3e3e9;box-shadow:0 4px 8px #1d5dd31a;height:calc(100vh - 3.75rem);display:flex;align-items:center;justify-content:center;padding:0 4rem;margin:0 .75rem;position:relative}.errorPage-inner{display:flex;align-items:center}.errorPage-inner-image{width:16rem}.errorPage-inner-right{margin-left:2rem;width:calc(100% - 18rem)}.errorPage-inner-right .errorPage-heading{-webkit-text-fill-color:#e3e3e9;-webkit-text-stroke-color:#a9aab6;-webkit-text-stroke-width:1px;color:#e3e3e9;font-size:78px;font-weight:bold;line-height:110px;margin-bottom:1.5rem}.errorPage-inner-right .errorPage-text{color:#141724;font-size:19px;font-weight:500;line-height:1.75rem;margin-bottom:.5rem}.errorPage-inner-right .errorPage-details{color:#565a6f;font-size:13px;line-height:20px;margin-bottom:1.75rem}.errorPage-inner-right .errorPage-btn{background:#1e5dd3;border-radius:.25rem;border:none;color:#fff;display:inline-flex;align-items:center;font-size:11px;font-weight:500;line-height:2rem;padding:0 1rem}.errorPage-inner-right .errorPage-btn i{font-size:14px;margin-left:.25rem}.errorPage-copyright{font-size:11px;color:#787a8c;font-weight:500;position:absolute;bottom:8px;right:16px;line-height:16px}\n"] }]
1065
- }] });
1066
-
1067
- class VcErrorHandlersComponent {
1068
- constructor(errorService, snackBarService) {
1069
- this.errorService = errorService;
1070
- this.snackBarService = snackBarService;
1071
- this.errorConfig = ERROR_CONFIG.NETWORK_UNAVAILABLE;
1072
- this.unauthorized = false;
1073
- this.sessionExpired = false;
1074
- this.chunkUnavailable = false;
1075
- this.serverError = false;
1076
- this.isOnline = navigator.onLine;
1077
- this.onNetworkOnline = () => {
1078
- this.isOnline = true;
1079
- this.hideSnackBar();
1080
- };
1081
- this.onNetworkOffline = () => {
1082
- this.isOnline = false;
1083
- this.showOfflineSnackBar();
1084
- };
1085
- this.subscribeGlobalError();
1086
- }
1087
- ngOnInit() {
1088
- this.subscribeNetworkDetection();
1089
- }
1090
- ngOnDestroy() {
1091
- window.removeEventListener('online', this.onNetworkOnline);
1092
- window.removeEventListener('offline', this.onNetworkOffline);
1093
- }
1094
- subscribeGlobalError() {
1095
- this.errorService.globalError$.subscribe((error) => {
1096
- this.handleError(error);
1097
- });
1098
- }
1099
- handleError(error) {
1100
- const errorHandlers = {
1101
- [ErrorStatusCode.Unauthenticated]: () => (this.sessionExpired = true),
1102
- [ErrorStatusCode.UnauthorizedAccess]: () => (this.unauthorized = true),
1103
- [ErrorStatusCode.JSChunkUnavailable]: () => (this.chunkUnavailable = true),
1104
- [ErrorStatusCode.NetworkUnavailable]: () => this.handleNetworkError(),
1105
- };
1106
- if (errorHandlers[error.status]) {
1107
- errorHandlers[error.status]();
1108
- }
1109
- else if (this.errorService.isServerError(error)) {
1110
- this.serverError = true;
1111
- }
1112
- }
1113
- subscribeNetworkDetection() {
1114
- window.addEventListener('online', this.onNetworkOnline);
1115
- window.addEventListener('offline', this.onNetworkOffline);
1116
- }
1117
- handleNetworkError() {
1118
- if (!this.isOnline) {
1119
- this.showOfflineSnackBar();
1120
- }
1121
- }
1122
- showOfflineSnackBar() {
1123
- this.snackBarService.show(this.errorConfig.offlineMessage, 'error');
1124
- }
1125
- hideSnackBar() {
1126
- this.snackBarService.hide();
1127
- }
1128
- }
1129
- VcErrorHandlersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersComponent, deps: [{ token: GlobalErrorService }, { token: SnackBarService }], target: i0.ɵɵFactoryTarget.Component });
1130
- VcErrorHandlersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: VcErrorHandlersComponent, selector: "lib-vc-error-handlers", ngImport: i0, template: `
1131
- <app-snack-bar></app-snack-bar>
1132
- <lib-vc-error-session-expired
1133
- *ngIf="sessionExpired"
1134
- ></lib-vc-error-session-expired>
1135
- <lib-vc-error-unauthorized *ngIf="unauthorized"></lib-vc-error-unauthorized>
1136
- <lib-vc-error-chunk-unavailable
1137
- *ngIf="chunkUnavailable"
1138
- ></lib-vc-error-chunk-unavailable>
1139
- <lib-vc-error-server-error *ngIf="serverError"></lib-vc-error-server-error>
1140
- `, isInline: true, components: [{ type: SnackBarComponent, selector: "app-snack-bar" }, { type: SessionExpiredComponent, selector: "lib-vc-error-session-expired" }, { type: UnauthorizedComponent, selector: "lib-vc-error-unauthorized" }, { type: ChunkUnavailableComponent, selector: "lib-vc-error-chunk-unavailable" }, { type: ServerErrorComponent, selector: "lib-vc-error-server-error" }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1141
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersComponent, decorators: [{
1142
- type: Component,
1143
- args: [{
1144
- selector: 'lib-vc-error-handlers',
1145
- template: `
1146
- <app-snack-bar></app-snack-bar>
1147
- <lib-vc-error-session-expired
1148
- *ngIf="sessionExpired"
1149
- ></lib-vc-error-session-expired>
1150
- <lib-vc-error-unauthorized *ngIf="unauthorized"></lib-vc-error-unauthorized>
1151
- <lib-vc-error-chunk-unavailable
1152
- *ngIf="chunkUnavailable"
1153
- ></lib-vc-error-chunk-unavailable>
1154
- <lib-vc-error-server-error *ngIf="serverError"></lib-vc-error-server-error>
1155
- `,
1156
- }]
1157
- }], ctorParameters: function () { return [{ type: GlobalErrorService }, { type: SnackBarService }]; } });
1158
-
1159
- class PageNotFoundComponent {
1160
- constructor() {
1161
- this.errorConfig = ERROR_CONFIG.PAGE_NOT_FOUND;
1162
- this.VcomplyLogo = VCOMPLY_LOGO_URL;
1163
- this.altImageText = ALT_IMAGE_TEXT;
1164
- this.currentYear = new Date().getFullYear();
1165
- this.redirectionUrl = REDIRECTION_URL;
1166
- this.organisationName = ORGANISATION_NAME;
1167
- }
1168
- redirectToHome() {
1169
- window.location.replace(this.redirectionUrl.compliance_dashboard);
1170
- }
1171
- }
1172
- PageNotFoundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: PageNotFoundComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1173
- PageNotFoundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: PageNotFoundComponent, selector: "lib-vc-error-page-not-found", ngImport: i0, template: `
1174
- <div class="errorPage">
1175
- <div class="errorPage-top">
1176
- <img
1177
- [src]="VcomplyLogo"
1178
- [alt]="altImageText.VCOMPLY_LOGO"
1179
- width="24"
1180
- height="24"
1181
- />
1182
- </div>
1183
- <div class="errorPage-container">
1184
- <div class="errorPage-inner">
1185
- <div class="errorPage-inner-image">
1186
- <img
1187
- [src]="errorConfig.imageUrl"
1188
- [alt]="altImageText.ERROR_IMAGE"
1189
- width="246"
1190
- height="178"
1191
- />
1192
- </div>
1193
- <div class="errorPage-inner-right">
1194
- <div class="errorPage-heading">{{ errorConfig.title }}</div>
1195
- <div class="errorPage-text">{{ errorConfig.description }}</div>
1196
- <div class="errorPage-details">{{ errorConfig.details }}</div>
1197
- <button class="errorPage-btn" (click)="redirectToHome()">
1198
- {{ errorConfig.buttonText }} <i class="icons">&#xe96a;</i>
1199
- </button>
1200
- </div>
1201
- </div>
1202
- <div class="errorPage-copyright">
1203
- &copy;&nbsp;{{ currentYear }}, {{ organisationName }}
1204
- </div>
1205
- </div>
1206
- </div>
1207
- `, 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;position:relative}.errorPage-inner{display:flex;align-items:center}.errorPage-inner-image{width:16rem}.errorPage-inner-right{margin-left:2rem;width:calc(100% - 18rem)}.errorPage-inner-right .errorPage-heading{-webkit-text-fill-color:#e3e3e9;-webkit-text-stroke-color:#a9aab6;-webkit-text-stroke-width:1px;color:#e3e3e9;font-size:78px;font-weight:bold;line-height:110px;margin-bottom:1.5rem}.errorPage-inner-right .errorPage-text{color:#141724;font-size:19px;font-weight:500;line-height:1.75rem;margin-bottom:.5rem}.errorPage-inner-right .errorPage-details{color:#565a6f;font-size:13px;line-height:20px;margin-bottom:1.75rem}.errorPage-inner-right .errorPage-btn{background:#1e5dd3;border-radius:.25rem;border:none;color:#fff;display:inline-flex;align-items:center;font-size:11px;font-weight:500;line-height:2rem;padding:0 1rem}.errorPage-inner-right .errorPage-btn i{font-size:14px;margin-left:.25rem}.errorPage-copyright{font-size:11px;color:#787a8c;font-weight:500;position:absolute;bottom:8px;right:16px;line-height:16px}\n"] });
1208
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: PageNotFoundComponent, decorators: [{
1209
- type: Component,
1210
- args: [{ selector: 'lib-vc-error-page-not-found', template: `
1211
- <div class="errorPage">
1212
- <div class="errorPage-top">
1213
- <img
1214
- [src]="VcomplyLogo"
1215
- [alt]="altImageText.VCOMPLY_LOGO"
1216
- width="24"
1217
- height="24"
1218
- />
1219
- </div>
1220
- <div class="errorPage-container">
1221
- <div class="errorPage-inner">
1222
- <div class="errorPage-inner-image">
1223
- <img
1224
- [src]="errorConfig.imageUrl"
1225
- [alt]="altImageText.ERROR_IMAGE"
1226
- width="246"
1227
- height="178"
1228
- />
1229
- </div>
1230
- <div class="errorPage-inner-right">
1231
- <div class="errorPage-heading">{{ errorConfig.title }}</div>
1232
- <div class="errorPage-text">{{ errorConfig.description }}</div>
1233
- <div class="errorPage-details">{{ errorConfig.details }}</div>
1234
- <button class="errorPage-btn" (click)="redirectToHome()">
1235
- {{ errorConfig.buttonText }} <i class="icons">&#xe96a;</i>
1236
- </button>
1237
- </div>
1238
- </div>
1239
- <div class="errorPage-copyright">
1240
- &copy;&nbsp;{{ currentYear }}, {{ organisationName }}
1241
- </div>
1242
- </div>
1243
- </div>
1244
- `, styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";.errorPage{background:#161b2f;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:9999}.errorPage-top{width:100%;height:3rem;display:flex;align-items:center;padding-left:.75rem}.errorPage-container{background:#f2f2f5;border-radius:.75rem;border:1px solid #e3e3e9;box-shadow:0 4px 8px #1d5dd31a;height:calc(100vh - 3.75rem);display:flex;align-items:center;justify-content:center;padding:0 4rem;margin:0 .75rem;position:relative}.errorPage-inner{display:flex;align-items:center}.errorPage-inner-image{width:16rem}.errorPage-inner-right{margin-left:2rem;width:calc(100% - 18rem)}.errorPage-inner-right .errorPage-heading{-webkit-text-fill-color:#e3e3e9;-webkit-text-stroke-color:#a9aab6;-webkit-text-stroke-width:1px;color:#e3e3e9;font-size:78px;font-weight:bold;line-height:110px;margin-bottom:1.5rem}.errorPage-inner-right .errorPage-text{color:#141724;font-size:19px;font-weight:500;line-height:1.75rem;margin-bottom:.5rem}.errorPage-inner-right .errorPage-details{color:#565a6f;font-size:13px;line-height:20px;margin-bottom:1.75rem}.errorPage-inner-right .errorPage-btn{background:#1e5dd3;border-radius:.25rem;border:none;color:#fff;display:inline-flex;align-items:center;font-size:11px;font-weight:500;line-height:2rem;padding:0 1rem}.errorPage-inner-right .errorPage-btn i{font-size:14px;margin-left:.25rem}.errorPage-copyright{font-size:11px;color:#787a8c;font-weight:500;position:absolute;bottom:8px;right:16px;line-height:16px}\n"] }]
1245
- }] });
1246
-
1247
- class ComponentLevelServerErrorComponent {
1248
- constructor() {
1249
- this.errorConfig = ERROR_CONFIG.COMPONENT_LEVEL_SERVER_ERROR;
1250
- this.altImageText = ALT_IMAGE_TEXT;
1251
- this.VcomplyLogo = VCOMPLY_LOGO_URL;
1252
- this.onClick = new EventEmitter();
1253
- }
1254
- }
1255
- ComponentLevelServerErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ComponentLevelServerErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1256
- ComponentLevelServerErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ComponentLevelServerErrorComponent, selector: "lib-vc-error-component-server-error", outputs: { onClick: "onClick" }, ngImport: i0, template: `
1257
- <div class="serverError">
1258
- <div class="serverError-inner">
1259
- <div class="serverError-inner-image">
1260
- <img
1261
- [src]="errorConfig.imageUrl"
1262
- [alt]="altImageText.ERROR_IMAGE"
1263
- width="106"
1264
- height="76"
1265
- />
1266
- </div>
1267
- <div class="serverError-inner-bottom">
1268
- <div class="serverError-heading">{{ errorConfig.title }}</div>
1269
- <div class="serverError-text">{{ errorConfig.description }}</div>
1270
- <div class="serverError-details">{{ errorConfig.details }}</div>
1271
- <button class="serverError-btn" (click)="onClick.emit(true)">
1272
- {{ errorConfig.buttonText }}
1273
- <i class="icons">&#xe92b;</i>
1274
- </button>
1275
- </div>
1276
- </div>
1277
- </div>
1278
- `, isInline: true, styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";.serverError{background:#fff;display:flex;align-items:center;justify-content:center;border-radius:2px;width:100%;height:100%}.serverError-inner{text-align:center}.serverError-inner-image{width:16rem;margin:0 auto}.serverError-inner-bottom{margin-top:1rem}.serverError-inner-bottom .serverError-heading{-webkit-text-fill-color:#e3e3e9;-webkit-text-stroke-color:#a9aab6;-webkit-text-stroke-width:1px;color:#e3e3e9;font-size:40px;font-weight:bold;line-height:56px;margin-bottom:1.5rem}.serverError-inner-bottom .serverError-text{color:#141724;font-size:19px;font-weight:500;line-height:1.75rem;margin-bottom:.5rem}.serverError-inner-bottom .serverError-details{color:#565a6f;font-size:13px;line-height:20px;margin-bottom:2rem}.serverError-inner-bottom .serverError-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}.serverError-inner-bottom .serverError-btn i{font-size:12px;margin-left:8px}\n"] });
1279
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ComponentLevelServerErrorComponent, decorators: [{
1280
- type: Component,
1281
- args: [{ selector: 'lib-vc-error-component-server-error', template: `
1282
- <div class="serverError">
1283
- <div class="serverError-inner">
1284
- <div class="serverError-inner-image">
1285
- <img
1286
- [src]="errorConfig.imageUrl"
1287
- [alt]="altImageText.ERROR_IMAGE"
1288
- width="106"
1289
- height="76"
1290
- />
1291
- </div>
1292
- <div class="serverError-inner-bottom">
1293
- <div class="serverError-heading">{{ errorConfig.title }}</div>
1294
- <div class="serverError-text">{{ errorConfig.description }}</div>
1295
- <div class="serverError-details">{{ errorConfig.details }}</div>
1296
- <button class="serverError-btn" (click)="onClick.emit(true)">
1297
- {{ errorConfig.buttonText }}
1298
- <i class="icons">&#xe92b;</i>
1299
- </button>
1300
- </div>
1301
- </div>
1302
- </div>
1303
- `, styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";.serverError{background:#fff;display:flex;align-items:center;justify-content:center;border-radius:2px;width:100%;height:100%}.serverError-inner{text-align:center}.serverError-inner-image{width:16rem;margin:0 auto}.serverError-inner-bottom{margin-top:1rem}.serverError-inner-bottom .serverError-heading{-webkit-text-fill-color:#e3e3e9;-webkit-text-stroke-color:#a9aab6;-webkit-text-stroke-width:1px;color:#e3e3e9;font-size:40px;font-weight:bold;line-height:56px;margin-bottom:1.5rem}.serverError-inner-bottom .serverError-text{color:#141724;font-size:19px;font-weight:500;line-height:1.75rem;margin-bottom:.5rem}.serverError-inner-bottom .serverError-details{color:#565a6f;font-size:13px;line-height:20px;margin-bottom:2rem}.serverError-inner-bottom .serverError-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}.serverError-inner-bottom .serverError-btn i{font-size:12px;margin-left:8px}\n"] }]
1304
- }], propDecorators: { onClick: [{
1305
- type: Output
1306
- }] } });
1307
-
1308
- class SnackBarModule {
1309
- }
1310
- SnackBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1311
- SnackBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarModule, declarations: [SnackBarComponent], imports: [CommonModule], exports: [SnackBarComponent] });
1312
- SnackBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarModule, imports: [[CommonModule]] });
1313
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarModule, decorators: [{
1314
- type: NgModule,
1315
- args: [{
1316
- declarations: [SnackBarComponent],
1317
- imports: [CommonModule],
1318
- exports: [SnackBarComponent],
1319
- }]
1320
- }] });
1321
-
1322
- // This file can be replaced during build by using the `fileReplacements` array.
1323
- // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
1324
- // The list of file replacements can be found in `angular.json`.
1325
- let domainName = 'devapi.v-comply.com';
1326
- let apiBaseUrl = 'https://api-uat1.v-comply.com';
1327
- switch (window.location.host) {
1328
- case 'dev.v-comply.com':
1329
- domainName = 'devapi.v-comply.com';
1330
- apiBaseUrl = 'https://api-uat1.v-comply.com';
1331
- break;
1332
- case 'beta.v-comply.com':
1333
- domainName = 'betaapi.v-comply.com';
1334
- apiBaseUrl = 'https://api-staging.v-comply.com';
1335
- break;
1336
- case 'test.v-comply.com':
1337
- domainName = 'devapi.v-comply.com';
1338
- break;
1339
- case 'eu.v-comply.com':
1340
- domainName = 'euapi.v-comply.com';
1341
- break;
1342
- default:
1343
- domainName = 'api.v-comply.com';
1344
- break;
1345
- }
1346
- const PORT_EDITOR = 8081;
1347
- const PORT_CONTENT_SAVE = 8834;
1348
- let endPoint = 'https://devapi.v-comply.com/';
1349
- const environment = {
1350
- production: false,
1351
- appUrl: 'http://localhost:4200/',
1352
- apiBaseUrl: 'https://api-uat1.v-comply.com',
1353
- authEndpoint: `${endPoint}VcomplyAuth/`,
1354
- orgEndpoint_TL: `${endPoint}organization_pwt/?mode=`,
1355
- s3Url: '',
1356
- s3BucketUrl: `${endPoint}globals?mode=bucket`,
1357
- s3Bucket: '',
1358
- profile: '/profile_pic/thumb/',
1359
- assessmentEnpoint: `${endPoint}Assessment/?mode=`,
1360
- organizationPost: `${endPoint}organization_post/?mode=`,
1361
- organizationGet: `${endPoint}organization/?mode=`,
1362
- complianceGet: `${endPoint}compliance/?mode=`,
1363
- compliancePost: `${endPoint}compliance_post/?mode=`,
1364
- fileUploadEndPoint: 'https://upload-uat1.v-comply.com/fileupload/?destination=',
1365
- assuranceGet: `${endPoint}assurance/?mode=`,
1366
- policyGet: `${endPoint}policy/?mode=`,
1367
- saveDoc: 'https://dev-node.v-comply.com/saveContent?bypass-token=true&id=',
1368
- docxUpload: 'https://dev-node.v-comply.com/ImportDocument',
1369
- fileUpload: 'https://dev-node.v-comply.com/importFiles',
1370
- policyPost: `${endPoint}policy_post/?mode=`,
1371
- policyPut: `${endPoint}policy_put/?mode=`,
1372
- responsibilityPost: `${endPoint}responsibilities_post/?mode=`,
1373
- linkDoc: 'https://dev-node.v-comply.com' + '/ImportDocument',
1374
- linkPdf: 'https://dev-node.v-comply.com' + '/extractDocs',
1375
- assuranceApi: 'https://devapi.v-comply.com/Assurance/',
1376
- assurance: 'https://devapi.v-comply.com/Assurance/',
1377
- programEndpoint: 'https://devapi.v-comply.com/program',
1378
- risk: 'https://devapi.v-comply.com/risk/?mode=',
1379
- risk_put: 'https://devapi.v-comply.com/risk_put/?mode=',
1380
- riskPdfPost: 'https://devapi.v-comply.com/risk_pdf_post?mode=',
1381
- riskPost: 'https://devapi.v-comply.com/risk_post/?mode=',
1382
- riskGet: 'https://devapi.v-comply.com/risk/?mode=',
1383
- baseUrl: 'https://devapi.v-comply.com/',
1384
- grc_get: 'https://devapi.v-comply.com/grc_object/?mode=',
1385
- leftMenuLogo: 'https://cdn.v-comply.com/logo/prod/v-logo.svg?v=1.0',
1386
- vLoader: 'https://cdn.v-comply.com/logo/prod/v-icon-loader.svg?v=1.0',
1387
- };
1388
- /*
1389
- * For easier debugging in development mode, you can import the following file
1390
- * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
1391
- *
1392
- * This import should be commented out in production mode because it will have a negative impact
1393
- * on performance if an error is thrown.
1394
- */
1395
- // import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
1396
-
1397
- class FeatureFlagService {
1398
- constructor(http, authorizer) {
1399
- this.http = http;
1400
- this.authorizer = authorizer;
1401
- this.flagFetchError = false;
1402
- this.featuresMap = {};
1403
- this.AWSFlags = {};
1404
- }
1405
- fetchFlags() {
1406
- return this.http.get(environment.baseUrl + 'features').pipe(retry(2));
1407
- }
1408
- loadConfig() {
1409
- if (this.flagSubscription) {
1410
- this.flagSubscription.unsubscribe();
1411
- }
1412
- return new Promise((resolve, reject) => {
1413
- this.flagSubscription = this.fetchFlags().subscribe({
1414
- next: (res) => {
1415
- try {
1416
- resolve(true);
1417
- this.flagFetchError = false;
1418
- this.AWSFlags = res;
1419
- this.buildFeatureFlags(this.authorizer.getOrganizationId());
1420
- }
1421
- catch (error) {
1422
- reject(error);
1423
- }
1424
- },
1425
- error: (err) => {
1426
- reject(true);
1427
- this.flagFetchError = true;
1428
- console.log('An error occurred while fetching feature flags', err);
1429
- },
1430
- });
1431
- });
1432
- }
1433
- buildFeatureFlags(orgId) {
1434
- orgId = orgId === null || orgId === void 0 ? void 0 : orgId.toString();
1435
- const enabledFeatures = {};
1436
- Object.keys(this.AWSFlags).forEach((flag) => {
1437
- var _a, _b;
1438
- const flagObj = this.AWSFlags[flag];
1439
- enabledFeatures[flag] = false;
1440
- if (flagObj) {
1441
- if ((flagObj === null || flagObj === void 0 ? void 0 : flagObj.enabled) && !flagObj.hasOwnProperty('enabledOrgIds')) {
1442
- enabledFeatures[flag] = true;
1443
- }
1444
- else if ((flagObj === null || flagObj === void 0 ? void 0 : flagObj.enabled) &&
1445
- flagObj.hasOwnProperty('enabledOrgIds') &&
1446
- ((_a = flagObj === null || flagObj === void 0 ? void 0 : flagObj.enabledOrgIds) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1447
- if ((_b = flagObj === null || flagObj === void 0 ? void 0 : flagObj.enabledOrgIds) === null || _b === void 0 ? void 0 : _b.includes(orgId)) {
1448
- enabledFeatures[flag] = true;
1449
- }
1450
- else {
1451
- enabledFeatures[flag] = false;
1452
- }
1453
- }
1454
- else {
1455
- if (flagObj === null || flagObj === void 0 ? void 0 : flagObj.enabled) {
1456
- enabledFeatures[flag] = true;
1457
- }
1458
- else {
1459
- enabledFeatures[flag] = false;
1460
- }
1461
- }
1462
- }
1463
- else {
1464
- enabledFeatures[flag] = true;
1465
- }
1466
- });
1467
- this.featuresMap = enabledFeatures;
1468
- }
1469
- isFeatureEnabled(featureFlag) {
1470
- if (this.featuresMap.hasOwnProperty(featureFlag)) {
1471
- return this.featuresMap[featureFlag];
1472
- }
1473
- else {
1474
- return true;
1475
- }
1476
- }
1477
- }
1478
- FeatureFlagService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FeatureFlagService, deps: [{ token: i1$1.HttpClient }, { token: i1.AuthorizerService }], target: i0.ɵɵFactoryTarget.Injectable });
1479
- FeatureFlagService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FeatureFlagService, providedIn: 'root' });
1480
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FeatureFlagService, decorators: [{
1481
- type: Injectable,
1482
- args: [{
1483
- providedIn: 'root',
1484
- }]
1485
- }], ctorParameters: function () { return [{ type: i1$1.HttpClient }, { type: i1.AuthorizerService }]; } });
1486
-
1487
- class FeatureFlagDirective {
1488
- constructor(tpl, vcr, featureFlagService) {
1489
- this.tpl = tpl;
1490
- this.vcr = vcr;
1491
- this.featureFlagService = featureFlagService;
1492
- }
1493
- ngOnInit() {
1494
- const isEnabled = this.featureFlagService.isFeatureEnabled(this.featureFlag);
1495
- if (isEnabled) {
1496
- this.vcr.createEmbeddedView(this.tpl);
1497
- }
1498
- }
1499
- }
1500
- FeatureFlagDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FeatureFlagDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: FeatureFlagService }], target: i0.ɵɵFactoryTarget.Directive });
1501
- FeatureFlagDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.1", type: FeatureFlagDirective, selector: "[featureFlag]", inputs: { featureFlag: "featureFlag" }, ngImport: i0 });
1502
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FeatureFlagDirective, decorators: [{
1503
- type: Directive,
1504
- args: [{
1505
- selector: "[featureFlag]"
1506
- }]
1507
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: FeatureFlagService }]; }, propDecorators: { featureFlag: [{
1508
- type: Input
1509
- }] } });
1510
-
1511
- class FeatureFlagModule {
1512
- }
1513
- FeatureFlagModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FeatureFlagModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1514
- FeatureFlagModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FeatureFlagModule, declarations: [FeatureFlagDirective], imports: [CommonModule], exports: [FeatureFlagDirective] });
1515
- FeatureFlagModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FeatureFlagModule, imports: [[
1516
- CommonModule
1517
- ]] });
1518
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: FeatureFlagModule, decorators: [{
1519
- type: NgModule,
1520
- args: [{
1521
- declarations: [FeatureFlagDirective],
1522
- imports: [
1523
- CommonModule
1524
- ],
1525
- exports: [FeatureFlagDirective]
1526
- }]
1527
- }] });
1528
-
1529
- class Configurations {
1530
- constructor() {
1531
- this.sentryConfig = {};
1532
- }
1533
- }
1534
-
1535
- class SentryErrorHandler {
1536
- constructor(authorizerService, errorService, config) {
1537
- this.authorizerService = authorizerService;
1538
- this.errorService = errorService;
1539
- if (config === null || config === void 0 ? void 0 : config.sentryConfig) {
1540
- const SENTRY_CONFIG = config.sentryConfig;
1541
- Sentry.init({
1542
- dsn: SENTRY_CONFIG === null || SENTRY_CONFIG === void 0 ? void 0 : SENTRY_CONFIG.DSN,
1543
- integrations: [
1544
- new Sentry.BrowserTracing({
1545
- tracePropagationTargets: SENTRY_CONFIG.ALLOW_ORIGIN,
1546
- routingInstrumentation: Sentry.routingInstrumentation,
1547
- }),
1548
- ],
1549
- tracesSampleRate: SENTRY_CONFIG.TRACES_SAMPLE_RATE,
1550
- replaysSessionSampleRate: SENTRY_CONFIG.REPLAY_SESSION_SAMPLE_RATE,
1551
- replaysOnErrorSampleRate: SENTRY_CONFIG.REPLAY_ON_ERROR_SAMPLE_RATE,
1552
- });
1553
- Sentry.setUser({ userDetails: this.authorizerService.getUser() });
1554
- }
1555
- }
1556
- handleError(error) {
1557
- const ERROR = (error === null || error === void 0 ? void 0 : error.originalError) || error;
1558
- this.handleChunkError(ERROR);
1559
- Sentry.captureException(ERROR);
1560
- }
1561
- handleChunkError(error) {
1562
- const chunkFailedMessage = /Loading chunk [\d]+ failed/;
1563
- if (chunkFailedMessage.test(error === null || error === void 0 ? void 0 : error.message)) {
1564
- window.location.reload();
1565
- }
1566
- }
1567
- }
1568
- SentryErrorHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SentryErrorHandler, deps: [{ token: i1.AuthorizerService }, { token: GlobalErrorService }, { token: Configurations, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
1569
- SentryErrorHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SentryErrorHandler });
1570
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SentryErrorHandler, decorators: [{
1571
- type: Injectable
1572
- }], ctorParameters: function () {
1573
- return [{ type: i1.AuthorizerService }, { type: GlobalErrorService }, { type: Configurations, decorators: [{
1574
- type: Optional
1575
- }] }];
1576
- } });
1577
-
1578
- class HttpReqInterceptor {
1579
- constructor(errorService, featureFlagService) {
1580
- this.errorService = errorService;
1581
- this.featureFlagService = featureFlagService;
1582
- }
1583
- intercept(req, next) {
1584
- if (this.featureFlagService.isFeatureEnabled(ERROR_FEATURE_FLAG)) {
1585
- return next.handle(req).pipe(timeout(API_TIMEOUT_TIME), tap((event) => {
1586
- if (event instanceof HttpResponse) {
1587
- this.errorService.handleSoftErrors(event);
1588
- }
1589
- }), catchError((error) => {
1590
- this.errorService.handleError(error, req);
1591
- return throwError(error);
1592
- }));
1593
- }
1594
- else {
1595
- return next.handle(req);
1596
- }
1597
- }
1598
- }
1599
- HttpReqInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: HttpReqInterceptor, deps: [{ token: GlobalErrorService }, { token: FeatureFlagService }], target: i0.ɵɵFactoryTarget.Injectable });
1600
- HttpReqInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: HttpReqInterceptor });
1601
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: HttpReqInterceptor, decorators: [{
1602
- type: Injectable
1603
- }], ctorParameters: function () { return [{ type: GlobalErrorService }, { type: FeatureFlagService }]; } });
1604
-
1605
- const FOR_ROOT_SENTRY_OPTIONS_TOKEN = new InjectionToken('forRoot() SentryErrorHandler options');
1606
- class VcErrorHandlersModule {
1607
- constructor(loadConfig) {
1608
- this.loadConfig = loadConfig;
1609
- this.loadConfig.loadConfig();
1610
- }
1611
- static forRoot(environmentConfig) {
1612
- return {
1613
- ngModule: VcErrorHandlersModule,
1614
- providers: [{ provide: Configurations, useValue: environmentConfig }],
1615
- };
1616
- }
1617
- }
1618
- VcErrorHandlersModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersModule, deps: [{ token: FeatureFlagService }], target: i0.ɵɵFactoryTarget.NgModule });
1619
- VcErrorHandlersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersModule, bootstrap: [VcErrorHandlersComponent], declarations: [VcErrorHandlersComponent,
1620
- PageNotFoundComponent,
1621
- UnauthorizedComponent,
1622
- SessionExpiredComponent,
1623
- ChunkUnavailableComponent,
1624
- ServerErrorComponent,
1625
- ErrorModalComponent,
1626
- ComponentLevelServerErrorComponent], imports: [CommonModule, DialogModule, SnackBarModule, FeatureFlagModule], exports: [VcErrorHandlersComponent,
1627
- PageNotFoundComponent,
1628
- UnauthorizedComponent,
1629
- SessionExpiredComponent,
1630
- ChunkUnavailableComponent,
1631
- ServerErrorComponent,
1632
- ErrorModalComponent,
1633
- ComponentLevelServerErrorComponent] });
1634
- VcErrorHandlersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersModule, providers: [
1635
- { provide: ErrorHandler, useClass: SentryErrorHandler },
1636
- { provide: HTTP_INTERCEPTORS, useClass: HttpReqInterceptor, multi: true },
1637
- ], imports: [[CommonModule, DialogModule, SnackBarModule, FeatureFlagModule]] });
1638
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersModule, decorators: [{
1639
- type: NgModule,
1640
- args: [{
1641
- declarations: [
1642
- VcErrorHandlersComponent,
1643
- PageNotFoundComponent,
1644
- UnauthorizedComponent,
1645
- SessionExpiredComponent,
1646
- ChunkUnavailableComponent,
1647
- ServerErrorComponent,
1648
- ErrorModalComponent,
1649
- ComponentLevelServerErrorComponent,
1650
- ],
1651
- imports: [CommonModule, DialogModule, SnackBarModule, FeatureFlagModule],
1652
- exports: [
1653
- VcErrorHandlersComponent,
1654
- PageNotFoundComponent,
1655
- UnauthorizedComponent,
1656
- SessionExpiredComponent,
1657
- ChunkUnavailableComponent,
1658
- ServerErrorComponent,
1659
- ErrorModalComponent,
1660
- ComponentLevelServerErrorComponent,
1661
- ],
1662
- providers: [
1663
- { provide: ErrorHandler, useClass: SentryErrorHandler },
1664
- { provide: HTTP_INTERCEPTORS, useClass: HttpReqInterceptor, multi: true },
1665
- ],
1666
- bootstrap: [VcErrorHandlersComponent],
1667
- }]
1668
- }], ctorParameters: function () { return [{ type: FeatureFlagService }]; } });
1669
-
1670
- /*
1671
- * Public API Surface of vc-error-handlers
1672
- */
1673
-
1674
- /**
1675
- * Generated bundle index. Do not edit.
1676
- */
1677
-
1678
- export { ChunkUnavailableComponent, ComponentLevelServerErrorComponent, ErrorModalComponent, FOR_ROOT_SENTRY_OPTIONS_TOKEN, GlobalErrorService, HttpReqInterceptor, PageNotFoundComponent, RouterService, ServerErrorComponent, SessionExpiredComponent, UnauthorizedComponent, VcErrorHandlersComponent, VcErrorHandlersModule, VcErrorHandlersService };
1679
- //# sourceMappingURL=vc-error-handlers.mjs.map