vc-error-handlers 0.1.92 → 0.1.94

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Component, Input, Directive, ViewChild, NgModule, Optional, InjectionToken, ErrorHandler } from '@angular/core';
2
+ import { Injectable, Component, Input, Directive, ViewChild, NgModule, EventEmitter, Output, Optional, InjectionToken, ErrorHandler } from '@angular/core';
3
3
  import { Subject, throwError } from 'rxjs';
4
4
  import * as i3 from '@angular/router';
5
5
  import { NavigationStart, NavigationEnd, NavigationError } from '@angular/router';
@@ -38,49 +38,6 @@ var ErrorStatusCode;
38
38
  ErrorStatusCode[ErrorStatusCode["JSChunkUnavailable"] = 600] = "JSChunkUnavailable";
39
39
  })(ErrorStatusCode || (ErrorStatusCode = {}));
40
40
 
41
- const VCOMPLY_LOGO_URL = 'https://cdn.v-comply.com/logo/prod/v-logo.svg';
42
- const API_TIMEOUT_TIME = 1000 * 15;
43
- const ERROR_CONFIG = {
44
- PAGE_NOT_FOUND: {
45
- imageUrl: 'https://cdn.v-comply.com/application/images/Error-page-illustration.svg',
46
- title: 'Oops!',
47
- description: "The page you're looking for doesn't exist.",
48
- details: 'Please check the URL or return to the homepage.',
49
- buttonText: 'GO TO DASHBOARD',
50
- },
51
- UNAUTHORIZED: {
52
- imageUrl: 'https://cdn.v-comply.com/application/images/Error-page-illustration.svg',
53
- title: 'Oops!',
54
- description: "You don't have permission to access this page.",
55
- details: 'If you believe this is an error, please contact',
56
- email: 'help@v-comply.com',
57
- support: 'for support',
58
- buttonText: 'CONTACT SUPPORT',
59
- mail: 'mailto:help@v-comply.com',
60
- },
61
- SESSION_EXPIRED: {
62
- heading: 'Session Expired!',
63
- description: 'Your session has expired. Please log in again to continue using the app.',
64
- buttonText: 'LOGIN',
65
- },
66
- CHUNK_UNAVAILABLE: {
67
- heading: 'Oops!',
68
- description: 'We are unable to load the data.',
69
- buttonText: 'REFRESH',
70
- },
71
- SERVER_ERROR: {
72
- imageUrl: 'https://cdn.v-comply.com/application/images/Error-page-illustration.svg',
73
- title: 'Oops!',
74
- description: 'We are unable to load the data.',
75
- details: 'Please refresh this page or try again later.',
76
- buttonText: 'REFRESH',
77
- snackBarMessage: `Oops! Something went wrong. Please try again later.`,
78
- },
79
- NETWORK_UNAVAILABLE: {
80
- offlineMessage: "You're currently offline.Please check your internet connection and try again.",
81
- },
82
- };
83
-
84
41
  const PAGE_LEVEL_API_CONFIG = [
85
42
  {
86
43
  method: 'POST',
@@ -122,6 +79,12 @@ const COMPONENT_LEVEL_API_CONFIG = [
122
79
  query: { type: 'inactive' },
123
80
  body: null,
124
81
  },
82
+ {
83
+ method: 'GET',
84
+ path: '/organization/?mode=organisationUsersList',
85
+ query: { type: 'power_users_small' },
86
+ body: null,
87
+ },
125
88
  {
126
89
  method: 'GET',
127
90
  path: '/Global-Dashboard/ManageDashboards',
@@ -136,7 +99,7 @@ const COMPONENT_LEVEL_API_CONFIG = [
136
99
  },
137
100
  {
138
101
  method: 'GET',
139
- path: '/grc_object/?mode=grcObject/getGRCTypeList',
102
+ path: '/grc_object/?mode=grc/getGRCList',
140
103
  query: null,
141
104
  body: null,
142
105
  },
@@ -165,13 +128,13 @@ const COMPONENT_LEVEL_API_CONFIG = [
165
128
  body: null,
166
129
  },
167
130
  {
168
- method: 'GET',
131
+ method: 'POST',
169
132
  path: '/compliance_post/?mode=rcProfile',
170
133
  query: null,
171
134
  body: null,
172
135
  },
173
136
  {
174
- method: 'GET',
137
+ method: 'POST',
175
138
  path: '/organization_post/?mode=userProfile',
176
139
  query: null,
177
140
  body: null,
@@ -187,7 +150,49 @@ const COMPONENT_LEVEL_API_CONFIG = [
187
150
  path: '/organization/?mode=groupDetails',
188
151
  query: null,
189
152
  body: null,
190
- }
153
+ },
154
+ {
155
+ method: 'POST',
156
+ path: '/compliance_post?mode=report/list',
157
+ query: null,
158
+ body: null,
159
+ },
160
+ {
161
+ method: 'GET',
162
+ path: '/organization/?mode=memberholidaylist',
163
+ query: null,
164
+ body: null,
165
+ },
166
+ {
167
+ method: 'GET',
168
+ path: '/grc_object/?mode=activity/activityLogList',
169
+ query: null,
170
+ body: null,
171
+ },
172
+ {
173
+ method: 'GET',
174
+ path: '/grc_object/?mode=activity/viewList',
175
+ query: null,
176
+ body: null,
177
+ },
178
+ {
179
+ method: 'GET',
180
+ path: '/program/categoriesList?owner_list=1',
181
+ query: null,
182
+ body: null,
183
+ },
184
+ {
185
+ method: 'POST',
186
+ path: '/risk/?mode=category/list',
187
+ query: null,
188
+ body: null,
189
+ },
190
+ {
191
+ method: 'POST',
192
+ path: '/organization_post/?mode=memberDetailsbyIds',
193
+ query: null,
194
+ body: null,
195
+ },
191
196
  ];
192
197
 
193
198
  class SnackBarService {
@@ -292,14 +297,13 @@ class GlobalErrorService {
292
297
  }
293
298
  handleServerError(error, request) {
294
299
  if (this.isPageLevelError(error, request)) {
300
+ console.log('page level error');
295
301
  this.publishGlobalError(error);
296
302
  }
297
303
  else if (this.isComponentLevelError(error, request)) {
304
+ console.log('component level error');
298
305
  this.publishLocalError(error, request);
299
306
  }
300
- else {
301
- this.showServerSnackBarError();
302
- }
303
307
  }
304
308
  publishGlobalError(error) {
305
309
  this.globalError$.next(error);
@@ -307,10 +311,6 @@ class GlobalErrorService {
307
311
  publishLocalError(error, request) {
308
312
  this.localError$.next({ error, request });
309
313
  }
310
- showServerSnackBarError() {
311
- const message = ERROR_CONFIG.SERVER_ERROR.snackBarMessage;
312
- this.snackBarService.show(message, 'error');
313
- }
314
314
  isPageLevelError(error, request) {
315
315
  const { method, path, query, body } = this.parseRequest(request);
316
316
  const pageCode = this.getPageCode();
@@ -335,9 +335,11 @@ class GlobalErrorService {
335
335
  params.keys().forEach((key) => {
336
336
  query[key] = params.get(key);
337
337
  });
338
+ console.log('query', query, 'body', body, 'path', path, 'method', method, 'params', params);
338
339
  const isConfigFound = this.componentLevelApiConfig.some((apiConfig) => {
339
340
  if (apiConfig.method !== method)
340
341
  return false;
342
+ console.log('apiConfig.path', apiConfig.path, path.includes(apiConfig.path));
341
343
  if (!path.includes(apiConfig.path))
342
344
  return false;
343
345
  const isQuerySubset = this.utilService.isJsonSubset(query, apiConfig.query);
@@ -409,6 +411,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
409
411
  }]
410
412
  }] });
411
413
 
414
+ const VCOMPLY_LOGO_URL = 'https://cdn.v-comply.com/logo/prod/v-logo.svg';
415
+ const API_TIMEOUT_TIME = 1000 * 15;
416
+ const ERROR_CONFIG = {
417
+ PAGE_NOT_FOUND: {
418
+ imageUrl: 'https://cdn.v-comply.com/application/images/Error-page-illustration.svg',
419
+ title: 'Oops!',
420
+ description: "The page you're looking for doesn't exist.",
421
+ details: 'Please check the URL or return to the homepage.',
422
+ buttonText: 'GO TO DASHBOARD',
423
+ },
424
+ UNAUTHORIZED: {
425
+ imageUrl: 'https://cdn.v-comply.com/application/images/Error-page-illustration.svg',
426
+ title: 'Oops!',
427
+ description: "You don't have permission to access this page.",
428
+ details: 'If you believe this is an error, please contact',
429
+ email: 'help@v-comply.com',
430
+ support: 'for support',
431
+ buttonText: 'CONTACT SUPPORT',
432
+ mail: 'mailto:help@v-comply.com',
433
+ },
434
+ SESSION_EXPIRED: {
435
+ heading: 'Session Expired!',
436
+ description: 'Your session has expired. Please log in again to continue using the app.',
437
+ buttonText: 'LOGIN',
438
+ },
439
+ CHUNK_UNAVAILABLE: {
440
+ heading: 'Oops!',
441
+ description: 'We are unable to load the data.',
442
+ buttonText: 'REFRESH',
443
+ },
444
+ SERVER_ERROR: {
445
+ imageUrl: 'https://cdn.v-comply.com/application/images/Error-page-illustration.svg',
446
+ title: 'Oops!',
447
+ description: 'We are unable to load the data.',
448
+ details: 'Please refresh this page or try again later.',
449
+ buttonText: 'REFRESH',
450
+ snackBarMessage: `Oops! Something went wrong. Please try again later.`,
451
+ },
452
+ COMPONENT_LEVEL_SERVER_ERROR: {
453
+ imageUrl: 'https://cdn.v-comply.com/application/images/sad-emoji-icon.svg',
454
+ title: 'Oops!',
455
+ description: 'We are unable to load the data.',
456
+ details: 'Please refresh this section or try again later.',
457
+ buttonText: 'RETRY',
458
+ },
459
+ NETWORK_UNAVAILABLE: {
460
+ offlineMessage: "You're currently offline. Please check your internet connection and try again.",
461
+ },
462
+ };
463
+
412
464
  class SnackBarComponent {
413
465
  constructor(snackbarService) {
414
466
  this.snackbarService = snackbarService;
@@ -1003,10 +1055,7 @@ class PageNotFoundComponent {
1003
1055
  this.currentYear = new Date().getFullYear();
1004
1056
  }
1005
1057
  redirectToHome() {
1006
- const currentUrl = window.location.href;
1007
- if (currentUrl.includes('organization')) {
1008
- this.router.navigate(['/global-dashboard/compliance_dashboard']);
1009
- }
1058
+ window.location.replace('/global-dashboard/compliance_dashboard');
1010
1059
  }
1011
1060
  }
1012
1061
  PageNotFoundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: PageNotFoundComponent, deps: [{ token: i3.Router }], target: i0.ɵɵFactoryTarget.Component });
@@ -1074,6 +1123,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
1074
1123
  `, 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"] }]
1075
1124
  }], ctorParameters: function () { return [{ type: i3.Router }]; } });
1076
1125
 
1126
+ class ComponentLevelServerErrorComponent {
1127
+ constructor() {
1128
+ this.errorConfig = ERROR_CONFIG.COMPONENT_LEVEL_SERVER_ERROR;
1129
+ this.VcomplyLogo = VCOMPLY_LOGO_URL;
1130
+ this.onClick = new EventEmitter();
1131
+ }
1132
+ }
1133
+ ComponentLevelServerErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ComponentLevelServerErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1134
+ 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: `
1135
+ <div class="errorPage">
1136
+ <div class="errorPage-inner">
1137
+ <div class="errorPage-inner-image">
1138
+ <img
1139
+ [src]="errorConfig.imageUrl"
1140
+ alt="Error Image"
1141
+ width="246"
1142
+ height="178"
1143
+ />
1144
+ </div>
1145
+ <div class="errorPage-inner-bottom">
1146
+ <div class="errorPage-heading">{{ errorConfig.title }}</div>
1147
+ <div class="errorPage-text">{{ errorConfig.description }}</div>
1148
+ <div class="errorPage-details">{{ errorConfig.details }}</div>
1149
+ <button class="errorPage-btn" (click)="onClick.emit(true)">
1150
+ {{ errorConfig.buttonText }}
1151
+ <i class="icons">&#xe92b;</i>
1152
+ </button>
1153
+ </div>
1154
+ </div>
1155
+ </div>
1156
+ `, isInline: true, styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";.errorPage{background:#fff;display:flex;align-items:center;justify-content:center;border-radius:2px;width:100%;height:100%}.errorPage-inner{text-align:center}.errorPage-inner-image{width:16rem;margin:0 auto}.errorPage-inner-bottom{margin-top:1rem}.errorPage-inner-bottom .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-bottom .errorPage-text{color:#141724;font-size:19px;font-weight:500;line-height:1.75rem;margin-bottom:.5rem}.errorPage-inner-bottom .errorPage-details{color:#565a6f;font-size:13px;line-height:20px;margin-bottom:1.75rem}.errorPage-inner-bottom .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-bottom .errorPage-btn i{font-size:14px;margin-left:.25rem}\n"] });
1157
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ComponentLevelServerErrorComponent, decorators: [{
1158
+ type: Component,
1159
+ args: [{ selector: 'lib-vc-error-component-server-error', template: `
1160
+ <div class="errorPage">
1161
+ <div class="errorPage-inner">
1162
+ <div class="errorPage-inner-image">
1163
+ <img
1164
+ [src]="errorConfig.imageUrl"
1165
+ alt="Error Image"
1166
+ width="246"
1167
+ height="178"
1168
+ />
1169
+ </div>
1170
+ <div class="errorPage-inner-bottom">
1171
+ <div class="errorPage-heading">{{ errorConfig.title }}</div>
1172
+ <div class="errorPage-text">{{ errorConfig.description }}</div>
1173
+ <div class="errorPage-details">{{ errorConfig.details }}</div>
1174
+ <button class="errorPage-btn" (click)="onClick.emit(true)">
1175
+ {{ errorConfig.buttonText }}
1176
+ <i class="icons">&#xe92b;</i>
1177
+ </button>
1178
+ </div>
1179
+ </div>
1180
+ </div>
1181
+ `, styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";.errorPage{background:#fff;display:flex;align-items:center;justify-content:center;border-radius:2px;width:100%;height:100%}.errorPage-inner{text-align:center}.errorPage-inner-image{width:16rem;margin:0 auto}.errorPage-inner-bottom{margin-top:1rem}.errorPage-inner-bottom .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-bottom .errorPage-text{color:#141724;font-size:19px;font-weight:500;line-height:1.75rem;margin-bottom:.5rem}.errorPage-inner-bottom .errorPage-details{color:#565a6f;font-size:13px;line-height:20px;margin-bottom:1.75rem}.errorPage-inner-bottom .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-bottom .errorPage-btn i{font-size:14px;margin-left:.25rem}\n"] }]
1182
+ }], propDecorators: { onClick: [{
1183
+ type: Output
1184
+ }] } });
1185
+
1077
1186
  class SnackBarModule {
1078
1187
  }
1079
1188
  SnackBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: SnackBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -1176,13 +1285,15 @@ VcErrorHandlersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", v
1176
1285
  SessionExpiredComponent,
1177
1286
  ChunkUnavailableComponent,
1178
1287
  ServerErrorComponent,
1179
- ErrorModalComponent], imports: [CommonModule, DialogModule, SnackBarModule], exports: [VcErrorHandlersComponent,
1288
+ ErrorModalComponent,
1289
+ ComponentLevelServerErrorComponent], imports: [CommonModule, DialogModule, SnackBarModule], exports: [VcErrorHandlersComponent,
1180
1290
  PageNotFoundComponent,
1181
1291
  UnauthorizedComponent,
1182
1292
  SessionExpiredComponent,
1183
1293
  ChunkUnavailableComponent,
1184
1294
  ServerErrorComponent,
1185
- ErrorModalComponent] });
1295
+ ErrorModalComponent,
1296
+ ComponentLevelServerErrorComponent] });
1186
1297
  VcErrorHandlersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: VcErrorHandlersModule, providers: [
1187
1298
  { provide: ErrorHandler, useClass: SentryErrorHandler },
1188
1299
  { provide: HTTP_INTERCEPTORS, useClass: HttpReqInterceptor, multi: true },
@@ -1198,6 +1309,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
1198
1309
  ChunkUnavailableComponent,
1199
1310
  ServerErrorComponent,
1200
1311
  ErrorModalComponent,
1312
+ ComponentLevelServerErrorComponent,
1201
1313
  ],
1202
1314
  imports: [CommonModule, DialogModule, SnackBarModule],
1203
1315
  exports: [
@@ -1208,6 +1320,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
1208
1320
  ChunkUnavailableComponent,
1209
1321
  ServerErrorComponent,
1210
1322
  ErrorModalComponent,
1323
+ ComponentLevelServerErrorComponent,
1211
1324
  ],
1212
1325
  providers: [
1213
1326
  { provide: ErrorHandler, useClass: SentryErrorHandler },
@@ -1225,4 +1338,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
1225
1338
  * Generated bundle index. Do not edit.
1226
1339
  */
1227
1340
 
1228
- export { AuthService, ChunkUnavailableComponent, ErrorModalComponent, FOR_ROOT_SENTRY_OPTIONS_TOKEN, GlobalErrorService, HttpReqInterceptor, PageNotFoundComponent, RouterService, ServerErrorComponent, SessionExpiredComponent, UnauthorizedComponent, VcErrorHandlersComponent, VcErrorHandlersModule, VcErrorHandlersService };
1341
+ export { AuthService, ChunkUnavailableComponent, ComponentLevelServerErrorComponent, ErrorModalComponent, FOR_ROOT_SENTRY_OPTIONS_TOKEN, GlobalErrorService, HttpReqInterceptor, PageNotFoundComponent, RouterService, ServerErrorComponent, SessionExpiredComponent, UnauthorizedComponent, VcErrorHandlersComponent, VcErrorHandlersModule, VcErrorHandlersService };
1342
+ //# sourceMappingURL=vc-error-handlers.mjs.map