@arsedizioni/ars-utils 18.2.365 → 18.2.371

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 (118) hide show
  1. package/clipper.common/common/services/clipper.service.d.ts +1 -1
  2. package/clipper.ui/ui/document-menu/document-menu.component.d.ts +1 -1
  3. package/esm2022/clipper.common/common/common.module.mjs +4 -4
  4. package/esm2022/clipper.common/common/definitions.mjs +11 -11
  5. package/esm2022/clipper.common/common/interceptors/auth.interceptor.mjs +3 -3
  6. package/esm2022/clipper.common/common/services/clipper.service.mjs +24 -18
  7. package/esm2022/clipper.ui/ui/browser-dialog/browser-dialog.component.mjs +5 -5
  8. package/esm2022/clipper.ui/ui/document/document.component.mjs +3 -3
  9. package/esm2022/clipper.ui/ui/document-index/document-index.component.mjs +3 -3
  10. package/esm2022/clipper.ui/ui/document-manager/document-manager.mjs +3 -3
  11. package/esm2022/clipper.ui/ui/document-menu/document-menu.component.mjs +3 -3
  12. package/esm2022/clipper.ui/ui/references/references.component.mjs +5 -5
  13. package/esm2022/clipper.ui/ui/search-calendar/search-calendar.component.mjs +3 -3
  14. package/esm2022/clipper.ui/ui/search-dialog/search-dialog.component.mjs +5 -5
  15. package/esm2022/clipper.ui/ui/search-facets/search-facets.component.mjs +3 -3
  16. package/esm2022/clipper.ui/ui/search-free-text-help/search-free-text-help.component.mjs +3 -3
  17. package/esm2022/clipper.ui/ui/search-free-text-query-builder/search-free-text-query-builder.component.mjs +3 -3
  18. package/esm2022/clipper.ui/ui/search-result-item/search-result-item.component.mjs +4 -4
  19. package/esm2022/clipper.ui/ui/search-result-manager/search-result-manager.mjs +3 -3
  20. package/esm2022/core/core.module.mjs +8 -8
  21. package/esm2022/core/dateFnsAdapter.mjs +3 -3
  22. package/esm2022/core/directives/autoFocusDirective.mjs +3 -3
  23. package/esm2022/core/directives/changeDateIntervalDirective.mjs +3 -3
  24. package/esm2022/core/directives/copyClipboardDirective.mjs +4 -4
  25. package/esm2022/core/directives/validators.mjs +33 -33
  26. package/esm2022/core/pipes/format.pipe.mjs +4 -4
  27. package/esm2022/core/pipes/replace.pipe.mjs +4 -4
  28. package/esm2022/core/pipes/safe-html.pipe.mjs +4 -4
  29. package/esm2022/core/pipes/safe-url.pipe.mjs +4 -4
  30. package/esm2022/core/pipes/search-callback.pipe.mjs +3 -3
  31. package/esm2022/core/pipes/search-filter.pipe.mjs +4 -4
  32. package/esm2022/core/services/broadcast.service.mjs +3 -3
  33. package/esm2022/core/services/environment.service.mjs +3 -3
  34. package/esm2022/core/services/screen.service.mjs +3 -3
  35. package/esm2022/core/services/theme.service.mjs +3 -3
  36. package/esm2022/evolution.common/arsedizioni-ars-utils-evolution.common.mjs +5 -0
  37. package/esm2022/evolution.common/common/common.module.mjs +16 -0
  38. package/esm2022/evolution.common/common/definitions.mjs +358 -0
  39. package/esm2022/evolution.common/common/interceptors/auth.interceptor.mjs +83 -0
  40. package/esm2022/evolution.common/common/messages.mjs +8 -0
  41. package/esm2022/evolution.common/common/services/evolution.service.mjs +357 -0
  42. package/esm2022/evolution.common/public_api.mjs +5 -0
  43. package/esm2022/help/components/help-viewer/help-viewer.component.mjs +7 -7
  44. package/esm2022/help/help.module.mjs +4 -4
  45. package/esm2022/help/services/help.service.mjs +3 -3
  46. package/esm2022/public_api.mjs +2 -1
  47. package/esm2022/support.common/common/common.module.mjs +4 -4
  48. package/esm2022/support.common/common/interceptors/auth.interceptor.mjs +41 -35
  49. package/esm2022/support.common/common/messages.mjs +2 -1
  50. package/esm2022/support.common/common/services/support.service.mjs +37 -70
  51. package/esm2022/support.ui/ui/notifications-browser/notification/notification.component.mjs +3 -3
  52. package/esm2022/support.ui/ui/notifications-browser/notifications-browser.component.mjs +4 -4
  53. package/esm2022/tinymce/full-screen-editor/full-screen-editor.component.mjs +3 -3
  54. package/esm2022/tinymce/tinymce.module.mjs +4 -4
  55. package/esm2022/ui/ui/dialogs/busy/busy-dialog.component.mjs +3 -3
  56. package/esm2022/ui/ui/dialogs/confirm/confirm-dialog.component.mjs +4 -4
  57. package/esm2022/ui/ui/dialogs/credentials/credentials-dialog.component.mjs +4 -4
  58. package/esm2022/ui/ui/dialogs/info/info-dialog.component.mjs +3 -3
  59. package/esm2022/ui/ui/dialogs/recover-password/recover-password-dialog.component.mjs +3 -3
  60. package/esm2022/ui/ui/dialogs/reset-password/reset-password-dialog.component.mjs +3 -3
  61. package/esm2022/ui/ui/dialogs/toast/toast.component.mjs +3 -3
  62. package/esm2022/ui/ui/paginatorIntl.mjs +3 -3
  63. package/esm2022/ui/ui/services/dialog.service.mjs +3 -3
  64. package/esm2022/ui/ui/services/ui.service.mjs +3 -3
  65. package/esm2022/ui/ui/ui.module.mjs +4 -4
  66. package/esm2022/ui.application/ui/components/button-selector/button-selector.component.mjs +3 -3
  67. package/esm2022/ui.application/ui/components/button-toggle/button-toggle.component.mjs +3 -3
  68. package/esm2022/ui.application/ui/components/calendar-empty-header/calendar-empy-header.component.mjs +3 -3
  69. package/esm2022/ui.application/ui/components/chips-selector/chips-selector.component.mjs +3 -3
  70. package/esm2022/ui.application/ui/components/file-input/file-input.component.mjs +3 -3
  71. package/esm2022/ui.application/ui/components/file-preview/file-preview.component.mjs +3 -3
  72. package/esm2022/ui.application/ui/components/filter-bar/filter-bar.component.mjs +3 -3
  73. package/esm2022/ui.application/ui/dialogs/prompt/prompt-dialog.component.mjs +4 -4
  74. package/esm2022/ui.application/ui/dialogs/prompt-date/prompt-date-dialog.component.mjs +4 -4
  75. package/esm2022/ui.application/ui/dialogs/prompt-time/prompt-time-dialog.component.mjs +3 -3
  76. package/esm2022/ui.application/ui/dialogs/select/select-dialog.component.mjs +4 -4
  77. package/esm2022/ui.application/ui/dialogs/select-file/select-file-dialog.component.mjs +4 -4
  78. package/esm2022/ui.application/ui/dialogs/select-picture/select-picture-dialog.component.mjs +4 -4
  79. package/esm2022/ui.application/ui/dialogs/select-tree/select-tree-dialog.component.mjs +7 -7
  80. package/esm2022/ui.application/ui/dialogs/send-to/send-to-dialog.component.mjs +4 -4
  81. package/esm2022/ui.application/ui/directives/resize-table-column.directive.mjs +3 -3
  82. package/esm2022/ui.application/ui/services/applicationDialog.service.mjs +3 -3
  83. package/esm2022/ui.application/ui/ui.module.mjs +4 -4
  84. package/esm2022/ui.oauth/ui/components/login/login-oauth.component.mjs +3 -3
  85. package/esm2022/ui.oauth/ui/ui.module.mjs +4 -4
  86. package/evolution.common/common/common.module.d.ts +10 -0
  87. package/evolution.common/common/definitions.d.ts +166 -0
  88. package/evolution.common/common/interceptors/auth.interceptor.d.ts +24 -0
  89. package/evolution.common/common/messages.d.ts +6 -0
  90. package/evolution.common/common/services/evolution.service.d.ts +123 -0
  91. package/evolution.common/index.d.ts +5 -0
  92. package/evolution.common/public_api.d.ts +1 -0
  93. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +40 -34
  94. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs.map +1 -1
  95. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +42 -42
  96. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
  97. package/fesm2022/arsedizioni-ars-utils-core.mjs +89 -89
  98. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +817 -0
  99. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs.map +1 -0
  100. package/fesm2022/arsedizioni-ars-utils-help.mjs +13 -13
  101. package/fesm2022/arsedizioni-ars-utils-help.mjs.map +1 -1
  102. package/fesm2022/arsedizioni-ars-utils-support.common.mjs +78 -107
  103. package/fesm2022/arsedizioni-ars-utils-support.common.mjs.map +1 -1
  104. package/fesm2022/arsedizioni-ars-utils-support.ui.mjs +6 -6
  105. package/fesm2022/arsedizioni-ars-utils-support.ui.mjs.map +1 -1
  106. package/fesm2022/arsedizioni-ars-utils-tinymce.mjs +7 -7
  107. package/fesm2022/arsedizioni-ars-utils-ui.application.mjs +58 -58
  108. package/fesm2022/arsedizioni-ars-utils-ui.application.mjs.map +1 -1
  109. package/fesm2022/arsedizioni-ars-utils-ui.mjs +34 -34
  110. package/fesm2022/arsedizioni-ars-utils-ui.mjs.map +1 -1
  111. package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs +7 -7
  112. package/fesm2022/arsedizioni-ars-utils.mjs +1 -0
  113. package/fesm2022/arsedizioni-ars-utils.mjs.map +1 -1
  114. package/package.json +18 -12
  115. package/public_api.d.ts +1 -0
  116. package/support.common/common/interceptors/auth.interceptor.d.ts +8 -0
  117. package/support.common/common/messages.d.ts +1 -0
  118. package/support.common/common/services/support.service.d.ts +15 -26
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, signal, Injectable, NgModule } from '@angular/core';
3
- import { timer, EMPTY, throwError, of, catchError as catchError$1 } from 'rxjs';
4
- import { HttpClient, HttpHeaders } from '@angular/common/http';
3
+ import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
4
+ import { throwError, of, catchError as catchError$1, switchMap } from 'rxjs';
5
5
  import { BroadcastService, SystemUtils } from '@arsedizioni/ars-utils/core';
6
- import { switchMap, shareReplay, catchError, map } from 'rxjs/operators';
6
+ import { catchError, map } from 'rxjs/operators';
7
7
  import { DialogService } from '@arsedizioni/ars-utils/ui';
8
8
 
9
9
  const SupportMessages = {
@@ -15,6 +15,7 @@ const SupportMessages = {
15
15
  LOGIN_COMPLETED: '§support-login-completed',
16
16
  LOGIN_DISCONNECTED: '§support-login-disconnected',
17
17
  LOGOUT_COMPLETED: '§support-logout-completed',
18
+ LOGOUT: '§support-logout',
18
19
  // Notifications
19
20
  NOTIFICATION_READ: '§support-notification-read',
20
21
  };
@@ -44,13 +45,8 @@ var SupportProductModule;
44
45
 
45
46
  class SupportService {
46
47
  constructor() {
47
- this.REFRESH_INTERVAL = 60000 * 50; //50 min
48
48
  this.httpClient = inject(HttpClient);
49
49
  this.broadcastService = inject(BroadcastService);
50
- this.refreshing = false;
51
- this.tokenRefreshInterval = this.REFRESH_INTERVAL;
52
- this.tokenRefreshTimer = null;
53
- this.tokenRefreshTimerSubscription = null;
54
50
  this.broadcastServiceSubscription = null;
55
51
  this._loginInfo = null;
56
52
  this._serviceUri = "https://support.arsedizioni.it";
@@ -70,9 +66,6 @@ class SupportService {
70
66
  }
71
67
  ngOnDestroy() {
72
68
  // Clean-up
73
- if (this.tokenRefreshTimerSubscription) {
74
- this.tokenRefreshTimerSubscription.unsubscribe();
75
- }
76
69
  if (this.broadcastServiceSubscription) {
77
70
  this.broadcastServiceSubscription.unsubscribe();
78
71
  }
@@ -80,25 +73,23 @@ class SupportService {
80
73
  /**
81
74
  * Initialize service
82
75
  * @param serviceUri : the service uri
83
- * @param tokenRefreshInterval : the token refresh interval
84
76
  * @param products: the supported products
85
77
  * @param products: the supported products
86
78
  */
87
- initialize(serviceUri = null, tokenRefreshInterval = this.REFRESH_INTERVAL, products = SupportProduct.None, productModules = SupportProductModule.None) {
79
+ initialize(serviceUri = null, products = SupportProduct.None, productModules = SupportProductModule.None) {
88
80
  // Create unique client id
89
81
  if (!localStorage.getItem('support_client_id'))
90
82
  localStorage.setItem('support_client_id', SystemUtils.generateUUID());
91
83
  // Initialize
92
84
  this._serviceUri = serviceUri;
93
- this.tokenRefreshInterval = tokenRefreshInterval;
94
85
  this.products = products;
95
86
  this.productModules = productModules;
96
87
  // React to message broadcasting
97
88
  if (!this.broadcastServiceSubscription) {
98
- this.broadcastServiceSubscription = this.broadcastService.getMessage().subscribe(message => {
89
+ this.broadcastServiceSubscription = this.broadcastService.getMessage().subscribe((message) => {
99
90
  if (message.id === SupportMessages.LOGIN_CHANGED) {
100
91
  setTimeout(() => {
101
- this.login(message.data.email, message.data.oauth, message.data.oauthAccessToken).subscribe(r => {
92
+ this.login(message.data.email, message.data.oauth, message.data.oauthAccessToken).subscribe((r) => {
102
93
  if (r.success) {
103
94
  this.countUnreadNotifications();
104
95
  }
@@ -127,52 +118,28 @@ class SupportService {
127
118
  if (!this.loggedIn() && this.getToken()) {
128
119
  // Auto login
129
120
  this.loggedIn.set(true);
130
- // Start refresh timer
131
- this.enableTokenRefresh();
121
+ // Notify
122
+ this.broadcastService.sendMessage(SupportMessages.LOGIN_COMPLETED);
132
123
  }
133
124
  }
134
125
  /**
135
126
  * Set JWT token
136
- * @param token : The token to store
127
+ * @param value : the login result
137
128
  */
138
- setToken(token) {
139
- sessionStorage.setItem('support_jwt', token);
140
- if (token) {
141
- this.enableTokenRefresh();
142
- }
143
- }
144
- /**
145
- * Enable JWT token auto refresh
146
- */
147
- enableTokenRefresh() {
148
- if (!this.tokenRefreshTimerSubscription) {
149
- this.tokenRefreshTimer =
150
- timer(this.tokenRefreshInterval, this.tokenRefreshInterval)
151
- .pipe(switchMap(() => {
152
- if (this.refreshing || !this.loggedIn())
153
- return EMPTY;
154
- this.refreshing = true;
155
- this.refresh().subscribe({
156
- error: () => { this.refreshing = false; },
157
- complete: () => { this.refreshing = false; }
158
- });
159
- return EMPTY;
160
- }), shareReplay(1));
161
- this.tokenRefreshTimerSubscription = this.tokenRefreshTimer.subscribe();
162
- }
129
+ setToken(value) {
130
+ sessionStorage.setItem('support_jwt', value.token);
131
+ sessionStorage.setItem('support_jwt_refresh', value.refreshToken ?? '');
163
132
  }
164
133
  /**
165
134
  * Return current JWT token
166
- * @returns: the string JWT token or string empty if none
135
+ * @param refresh: true to get the refresh token. Default is false.
167
136
  */
168
- getToken() {
169
- let token = sessionStorage.getItem('support_jwt');
170
- if (token) {
171
- if (token[0] === '"')
172
- token = token.substring(1, token.length - 1);
173
- return token;
137
+ getToken(refresh = false) {
138
+ let token = sessionStorage.getItem(refresh ? 'support_jwt_refresh' : 'support_jwt');
139
+ if (token && token[0] === '"') {
140
+ return token.substring(1, token.length - 1);
174
141
  }
175
- return '';
142
+ return token ?? '';
176
143
  }
177
144
  /**
178
145
  * Perform login
@@ -198,12 +165,14 @@ class SupportService {
198
165
  .pipe(catchError(err => {
199
166
  this.loggingIn.set(false);
200
167
  return throwError(() => err);
201
- }), map(r => {
168
+ }), map((r) => {
202
169
  this.loggingIn.set(false);
203
170
  if (r.success) {
204
- this.setToken(r.value.token);
171
+ this.setToken(r.value);
205
172
  this._loginInfo = r.value.context;
206
173
  this.loggedIn.set(true);
174
+ // Notify
175
+ this.broadcastService.sendMessage(SupportMessages.LOGIN_COMPLETED);
207
176
  }
208
177
  return r;
209
178
  }));
@@ -213,7 +182,10 @@ class SupportService {
213
182
  */
214
183
  logout() {
215
184
  return this.httpClient
216
- .post(this._serviceUri + '/logout', {}).pipe(map(r => { return r; }), catchError((_e) => {
185
+ .post(this._serviceUri + '/logout', {}).pipe(map(r => {
186
+ this.clear();
187
+ return r;
188
+ }), catchError((_e) => {
217
189
  this.clear();
218
190
  return of([]);
219
191
  }));
@@ -222,15 +194,11 @@ class SupportService {
222
194
  * Reset login refresh timer and logins state
223
195
  */
224
196
  reset() {
225
- // Clear subscriptions
226
- if (this.tokenRefreshTimerSubscription) {
227
- this.tokenRefreshTimerSubscription.unsubscribe();
228
- this.tokenRefreshTimerSubscription = null;
229
- }
230
- this.tokenRefreshTimer = null;
231
197
  // Clear login info
232
198
  this._loginInfo = null;
233
199
  this.loggedIn.set(false);
200
+ // Notify
201
+ this.broadcastService.sendMessage(SupportMessages.LOGOUT_COMPLETED);
234
202
  }
235
203
  /**
236
204
  * Clear login data
@@ -240,15 +208,15 @@ class SupportService {
240
208
  this.reset();
241
209
  // Clear local storage
242
210
  sessionStorage.removeItem('support_jwt');
211
+ sessionStorage.removeItem('support_jwt_refresh');
243
212
  }
244
213
  /**
245
- * Perform token refresh
246
- */
214
+ * Perform token refresh
215
+ */
247
216
  refresh() {
248
- return this.httpClient.post(this._serviceUri + '/refresh', {}).pipe(map(r => {
217
+ return this.httpClient.get(this._serviceUri + '/refresh2/?token=' + this.getToken(true)).pipe(map((r) => {
249
218
  // Update token
250
- this.setToken(r.value.token);
251
- //console.log("token-refreshed: " + r.value.token);
219
+ this.setToken(r.value);
252
220
  }));
253
221
  }
254
222
  /**
@@ -267,7 +235,7 @@ class SupportService {
267
235
  * Count unread notifications
268
236
  */
269
237
  countUnreadNotifications() {
270
- this.httpClient.get(this._serviceUri + '/notifications/count-unread/?products=' + (this.products ?? 0) + "&modules=" + (this.productModules ?? 0)).subscribe(r => {
238
+ this.httpClient.get(this._serviceUri + '/notifications/count-unread/?products=' + (this.products ?? 0) + "&modules=" + (this.productModules ?? 0)).subscribe((r) => {
271
239
  if (r.success) {
272
240
  this.unreadNotifications.set(r.value > 0 ? r.value : null);
273
241
  }
@@ -305,10 +273,10 @@ class SupportService {
305
273
  dowloadNotificationDocument(documentId) {
306
274
  return this.httpClient.get(this._serviceUri + '/documents/download/' + documentId, { responseType: 'blob' });
307
275
  }
308
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SupportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
309
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SupportService, providedIn: 'root' }); }
276
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SupportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
277
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SupportService, providedIn: 'root' }); }
310
278
  }
311
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SupportService, decorators: [{
279
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SupportService, decorators: [{
312
280
  type: Injectable,
313
281
  args: [{
314
282
  providedIn: 'root',
@@ -318,44 +286,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImpor
318
286
  class SupportAuthInterceptor {
319
287
  constructor() {
320
288
  this.supportService = inject(SupportService);
289
+ this.broadcastService = inject(BroadcastService);
321
290
  this.dialogService = inject(DialogService);
291
+ this.lastErrorTime = -1;
322
292
  }
323
293
  intercept(request, next) {
324
294
  if (request.url.startsWith(this.supportService.serviceUri)) {
325
295
  request = request.clone({ withCredentials: true });
326
296
  return next.handle(this.addTokenToRequest(request))
327
- .pipe(catchError$1(err => {
328
- // Get the message
329
- let message = err.error?.message || err.message || "Impossibile eseguire l'operazione richiesta.";
330
- let invalidSession = err.status === 401;
331
- switch (err.status) {
332
- case 0:
333
- case 500:
334
- case 502:
335
- case 503:
336
- case 504:
337
- message = null; // No messages
338
- break;
339
- case 403:
340
- message = "<p>Non hai i permessi necessari per eseguire l'operazione richiesta.</p>";
341
- break;
342
- default:
343
- message = '<p>' + message.replaceAll('\r\n', '</p><p>') + '</p>';
344
- break;
297
+ .pipe(catchError$1(error => {
298
+ this.dialogService.clearBusy();
299
+ if (error instanceof HttpErrorResponse &&
300
+ !request.url.includes("/login") &&
301
+ error.status === 401) {
302
+ return this.handle401Error(request, next);
345
303
  }
346
- // Display message
347
- if (message) {
348
- setTimeout(() => {
349
- this.dialogService.error(message, null, 'Errore in ARS Support', 'Ok', 500, invalidSession ? 5000 : null).afterClosed().subscribe(() => {
350
- if (invalidSession) {
351
- if (this.supportService.loggedIn()) {
352
- this.supportService.reset();
353
- }
354
- }
355
- });
356
- }, 250);
304
+ const errorTime = new Date().getTime();
305
+ if (errorTime - this.lastErrorTime > 5000) {
306
+ this.lastErrorTime = errorTime;
307
+ const invalidSession = error.status == "403";
308
+ this.dialogService.error("<p>" + (error.error?.message ?? error.message ?? "Impossibile eseguire l'operazione richiesta.").replaceAll("\r\n", "</p><p>") + "</p>", null, "Errore in ARS Support", undefined, undefined, invalidSession ? 5000 : 15000).afterClosed().subscribe(() => {
309
+ if (invalidSession) {
310
+ this.broadcastService.sendMessage(SupportMessages.LOGOUT);
311
+ }
312
+ });
357
313
  }
358
- return throwError(() => err);
314
+ return throwError(() => error);
315
+ }));
316
+ }
317
+ return next.handle(request);
318
+ }
319
+ /**
320
+ * Handle 401 error
321
+ * @param request : the request
322
+ * @param next : the http handler
323
+ */
324
+ handle401Error(request, next) {
325
+ if (this.supportService.loggedIn()) {
326
+ return this.supportService.refresh().pipe(switchMap(() => {
327
+ return next.handle(this.addTokenToRequest(request));
328
+ }), catchError$1(error => {
329
+ return throwError(() => error);
359
330
  }));
360
331
  }
361
332
  return next.handle(request);
@@ -380,19 +351,19 @@ class SupportAuthInterceptor {
380
351
  }
381
352
  return request;
382
353
  }
383
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SupportAuthInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
384
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SupportAuthInterceptor }); }
354
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SupportAuthInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
355
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SupportAuthInterceptor }); }
385
356
  }
386
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SupportAuthInterceptor, decorators: [{
357
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: SupportAuthInterceptor, decorators: [{
387
358
  type: Injectable
388
359
  }] });
389
360
 
390
361
  class ArsSupportCommonModule {
391
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: ArsSupportCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
392
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.4", ngImport: i0, type: ArsSupportCommonModule }); }
393
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: ArsSupportCommonModule }); }
362
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: ArsSupportCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
363
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.1", ngImport: i0, type: ArsSupportCommonModule }); }
364
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: ArsSupportCommonModule }); }
394
365
  }
395
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: ArsSupportCommonModule, decorators: [{
366
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: ArsSupportCommonModule, decorators: [{
396
367
  type: NgModule
397
368
  }] });
398
369
 
@@ -1 +1 @@
1
- {"version":3,"file":"arsedizioni-ars-utils-support.common.mjs","sources":["../../../projects/ars-utils/support.common/common/messages.ts","../../../projects/ars-utils/support.common/common/definitions.ts","../../../projects/ars-utils/support.common/common/services/support.service.ts","../../../projects/ars-utils/support.common/common/interceptors/auth.interceptor.ts","../../../projects/ars-utils/support.common/common/common.module.ts","../../../projects/ars-utils/support.common/public_api.ts","../../../projects/ars-utils/support.common/arsedizioni-ars-utils-support.common.ts"],"sourcesContent":["export const SupportMessages = {\r\n /**\r\n * Messages\r\n */\r\n\r\n // Login\r\n LOGIN_CHANGED: '§support-login-changed',\r\n LOGIN_COMPLETED: '§support-login-completed',\r\n LOGIN_DISCONNECTED: '§support-login-disconnected',\r\n LOGOUT_COMPLETED: '§support-logout-completed',\r\n\r\n // Notifications\r\n NOTIFICATION_READ: '§support-notification-read',\r\n};\r\n","import { LoginResult } from '@arsedizioni/ars-utils/core';\r\n\r\n\r\nexport interface SupportUserInfo {\r\n\r\n id: number;\r\n groups?: number | null;\r\n groupNames?: string | null;\r\n displayName?: string | null;\r\n dashboard?: string | null;\r\n sessionId?: string | null;\r\n email?: string | null;\r\n customerId?: number | null;\r\n companyName?: string | null;\r\n role: number;\r\n scopes?: string[] | null;\r\n sla: number;\r\n isCommercial?: boolean | null;\r\n isAdministrator: boolean;\r\n isGuest: boolean;\r\n isUser: boolean;\r\n isOperator: boolean;\r\n isTemporary: boolean;\r\n}\r\n\r\nexport interface SupportLoginResult extends LoginResult<SupportUserInfo> { } \r\n\r\nexport interface SupportLoginInfo {\r\n context: SupportUserInfo;\r\n userCredentials?: string | null;\r\n}\r\n\r\n\r\nexport interface SupportNotificationsSearchParams {\r\n any?: string | null;\r\n products?: number | null;\r\n productModules?: number | null;\r\n first?: number | null;\r\n count?: number | null;\r\n}\r\n\r\nexport interface SupportNotificationsSearchResult {\r\n interval?: string | null;\r\n items?: SupportNotificationInfo[] | null;\r\n total?: number | null;\r\n}\r\n\r\nexport interface SupportNotificationInfo {\r\n id: number;\r\n products: number;\r\n productNames?: string | null;\r\n productModules?: number | null;\r\n productModuleNames?: string | null;\r\n publishingDate?: Date | null;\r\n title: string;\r\n text: string;\r\n state: number;\r\n isPublished: boolean;\r\n isInternal: boolean;\r\n isRead: boolean;\r\n}\r\n\r\nexport interface SupportNotificationsMarkParams {\r\n ids: number[];\r\n unmark: boolean;\r\n}\r\n\r\nexport enum SupportProduct {\r\n None = 0,\r\n Clipper = 1,\r\n Evolution = 1 << 1,\r\n DGInfo = 1 << 2\r\n}\r\n\r\nexport enum SupportProductModule {\r\n None = 0,\r\n EvoFormazione = 1,\r\n EvoDPI = 1 << 1,\r\n EvoSorveglianzaSanitaria = 1 << 2,\r\n EvoRegistroEScadenzario = 1 << 3,\r\n EvoAttrezzatureEImpianti = 1 << 4,\r\n EvoMonitoraggio = 1 << 5,\r\n EvoBollettino = 1 << 6,\r\n DgiADR = 1 << 7,\r\n DgiRID = 1 << 8,\r\n DgiIMDG = 1 << 9,\r\n DgiCLP = 1 << 10,\r\n}\r\n","import { HttpClient, HttpHeaders } from '@angular/common/http';\r\nimport { Injectable, OnDestroy, inject, signal } from '@angular/core';\r\nimport { ApiResult, BroadcastService, SystemUtils } from '@arsedizioni/ars-utils/core';\r\nimport { EMPTY, Observable, of, Subscription, throwError, timer } from 'rxjs';\r\nimport { catchError, map, shareReplay, switchMap } from 'rxjs/operators';\r\nimport { SupportMessages } from '../messages';\r\nimport { SupportLoginResult, SupportNotificationInfo, SupportNotificationsMarkParams, SupportNotificationsSearchParams, SupportNotificationsSearchResult, SupportProduct, SupportProductModule, SupportUserInfo } from '../definitions';\r\n\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class SupportService implements OnDestroy {\r\n\r\n private readonly REFRESH_INTERVAL = 60000 * 50; //50 min\r\n\r\n private httpClient = inject(HttpClient);\r\n private broadcastService = inject(BroadcastService);\r\n private refreshing: boolean = false;\r\n private tokenRefreshInterval: number = this.REFRESH_INTERVAL;\r\n private tokenRefreshTimer?: Observable<number | void> | null = null;\r\n private tokenRefreshTimerSubscription?: Subscription | null = null;\r\n private broadcastServiceSubscription?: Subscription | null = null;\r\n\r\n\r\n private _loginInfo: SupportUserInfo = null;\r\n get loginInfo(): SupportUserInfo { return this._loginInfo };\r\n set loginInfo(value: SupportUserInfo) {\r\n this._loginInfo = value;\r\n }\r\n\r\n private _serviceUri: string = \"https://support.arsedizioni.it\"\r\n get serviceUri(): string {\r\n return this._serviceUri;\r\n }\r\n\r\n public products: SupportProduct = SupportProduct.None;\r\n public productModules: SupportProductModule = SupportProductModule.None;\r\n\r\n public readonly unreadNotifications = signal<number | null>(null);\r\n public readonly loggedIn = signal<boolean>(false);\r\n public readonly loggingIn = signal<boolean>(false);\r\n\r\n ngOnDestroy() {\r\n // Clean-up\r\n if (this.tokenRefreshTimerSubscription) {\r\n this.tokenRefreshTimerSubscription.unsubscribe();\r\n }\r\n if (this.broadcastServiceSubscription) {\r\n this.broadcastServiceSubscription.unsubscribe();\r\n }\r\n }\r\n\r\n /**\r\n * Initialize service\r\n * @param serviceUri : the service uri\r\n * @param tokenRefreshInterval : the token refresh interval\r\n * @param products: the supported products\r\n * @param products: the supported products\r\n */\r\n initialize(\r\n serviceUri: string = null,\r\n tokenRefreshInterval: number = this.REFRESH_INTERVAL,\r\n products: SupportProduct = SupportProduct.None,\r\n productModules: SupportProductModule = SupportProductModule.None) {\r\n\r\n // Create unique client id\r\n if (!localStorage.getItem('support_client_id'))\r\n localStorage.setItem('support_client_id', SystemUtils.generateUUID());\r\n\r\n // Initialize\r\n this._serviceUri = serviceUri;\r\n this.tokenRefreshInterval = tokenRefreshInterval;\r\n this.products = products;\r\n this.productModules = productModules;\r\n\r\n // React to message broadcasting\r\n if (!this.broadcastServiceSubscription) {\r\n this.broadcastServiceSubscription = this.broadcastService.getMessage().subscribe(message => {\r\n if (message.id === SupportMessages.LOGIN_CHANGED) {\r\n setTimeout(() => {\r\n this.login(message.data.email, message.data.oauth, message.data.oauthAccessToken).subscribe(r => {\r\n if (r.success) {\r\n this.countUnreadNotifications();\r\n }\r\n });\r\n }, 500);\r\n } else if (message.id === SupportMessages.LOGOUT_COMPLETED ||\r\n message.id === SupportMessages.LOGIN_DISCONNECTED) {\r\n if (!this.loggedIn()) {\r\n this.clear();\r\n } else {\r\n this.logout().subscribe({\r\n complete: () => {\r\n this.clear();\r\n }\r\n });\r\n }\r\n } else if (message.id === SupportMessages.NOTIFICATION_READ) {\r\n this.countUnreadNotifications();\r\n }\r\n });\r\n }\r\n\r\n // Eveluate current session storage in case of page refresh (F5)\r\n if (!this.loggedIn() && this.getToken()) {\r\n // Auto login\r\n this.loggedIn.set(true);\r\n\r\n // Start refresh timer\r\n this.enableTokenRefresh();\r\n }\r\n }\r\n\r\n /**\r\n * Set JWT token\r\n * @param token : The token to store\r\n */\r\n private setToken(token: string) {\r\n sessionStorage.setItem('support_jwt', token);\r\n if (token) {\r\n this.enableTokenRefresh();\r\n }\r\n }\r\n\r\n /**\r\n * Enable JWT token auto refresh\r\n */\r\n private enableTokenRefresh() {\r\n if (!this.tokenRefreshTimerSubscription) {\r\n this.tokenRefreshTimer =\r\n timer(this.tokenRefreshInterval, this.tokenRefreshInterval)\r\n .pipe(\r\n switchMap(() => {\r\n if (this.refreshing || !this.loggedIn()) return EMPTY;\r\n this.refreshing = true;\r\n this.refresh().subscribe(\r\n {\r\n error: () => { this.refreshing = false; },\r\n complete: () => { this.refreshing = false; }\r\n });\r\n return EMPTY;\r\n }),\r\n shareReplay(1));\r\n this.tokenRefreshTimerSubscription = this.tokenRefreshTimer.subscribe();\r\n }\r\n }\r\n\r\n /**\r\n * Return current JWT token\r\n * @returns: the string JWT token or string empty if none\r\n */\r\n getToken(): string {\r\n let token = sessionStorage.getItem('support_jwt');\r\n if (token) {\r\n if (token[0] === '\"') token = token.substring(1, token.length - 1);\r\n return token;\r\n }\r\n return '';\r\n }\r\n\r\n\r\n /**\r\n* Perform login \r\n* @param email: the guest email\r\n* @param oauth: the optional open authentication supported\r\n* @param oauthAccessToken: the optional oauth2 access token\r\n* @returns: the login result\r\n*/\r\n login(email: string | null | undefined = null,\r\n oauth: number | null | undefined = null,\r\n oauthAccessToken: string | null | undefined = null) {\r\n this.clear();\r\n this.loggingIn.set(true);\r\n return this.httpClient\r\n .post<ApiResult<SupportLoginResult>>(\r\n this._serviceUri + '/login',\r\n {\r\n user: oauth > 0 ? null : email,\r\n clientId: localStorage.getItem(\"support_client_id\"),\r\n OAUTH: oauth\r\n },\r\n {\r\n headers:\r\n !oauth\r\n ? new HttpHeaders()\r\n : new HttpHeaders()\r\n .set(\"Authorization\", oauthAccessToken)\r\n })\r\n .pipe(\r\n catchError(err => {\r\n this.loggingIn.set(false);\r\n return throwError(() => err);\r\n }),\r\n map(r => {\r\n this.loggingIn.set(false);\r\n if (r.success) {\r\n this.setToken(r.value.token);\r\n this._loginInfo = r.value.context;\r\n this.loggedIn.set(true);\r\n }\r\n return r;\r\n })\r\n );\r\n\r\n }\r\n\r\n /**\r\n * Perform logout\r\n */\r\n logout() {\r\n return this.httpClient\r\n .post<any>(this._serviceUri + '/logout', {}).pipe(\r\n map(r => { return r; }),\r\n catchError((_e) => {\r\n this.clear();\r\n return of([]);\r\n }));\r\n\r\n }\r\n\r\n /**\r\n * Reset login refresh timer and logins state\r\n */\r\n reset() {\r\n // Clear subscriptions\r\n if (this.tokenRefreshTimerSubscription) {\r\n this.tokenRefreshTimerSubscription.unsubscribe();\r\n this.tokenRefreshTimerSubscription = null;\r\n }\r\n this.tokenRefreshTimer = null;\r\n\r\n // Clear login info\r\n this._loginInfo = null;\r\n this.loggedIn.set(false);\r\n }\r\n\r\n /**\r\n * Clear login data\r\n */\r\n clear() {\r\n // Reset login\r\n this.reset();\r\n\r\n // Clear local storage\r\n sessionStorage.removeItem('support_jwt');\r\n }\r\n\r\n /**\r\n * Perform token refresh\r\n */\r\n private refresh() {\r\n return this.httpClient.post<ApiResult<SupportLoginResult>>(\r\n this._serviceUri + '/refresh', {}\r\n ).pipe(map(r => {\r\n // Update token\r\n this.setToken(r.value.token);\r\n //console.log(\"token-refreshed: \" + r.value.token);\r\n }));\r\n }\r\n\r\n /**\r\n * Navigate to support service\r\n */\r\n open() {\r\n let uri = this.serviceUri ?? '';\r\n if (uri.endsWith('/api'))\r\n uri = uri.substring(0, uri.length - 4)\r\n window.open(uri);\r\n }\r\n\r\n ////\r\n // NOTIFICATIONS\r\n ////\r\n\r\n /**\r\n * Count unread notifications\r\n */\r\n countUnreadNotifications() {\r\n this.httpClient.get<ApiResult<number>>(\r\n this._serviceUri + '/notifications/count-unread/?products=' + (this.products ?? 0) + \"&modules=\" + (this.productModules ?? 0)\r\n ).subscribe(r => {\r\n if (r.success) {\r\n this.unreadNotifications.set(r.value > 0 ? r.value : null)\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Query notifications\r\n * @param params: query parameters\r\n */\r\n queryNotifications(params: SupportNotificationsSearchParams) {\r\n params.products = this.products ?? 0;\r\n params.productModules = this.productModules ?? 0;\r\n return this.httpClient.post<ApiResult<SupportNotificationsSearchResult>>(\r\n this._serviceUri + '/notifications',\r\n params\r\n );\r\n }\r\n\r\n /**\r\n * Retrieve a notification\r\n * @param id: the notification id\r\n */\r\n getNotification(id: number) {\r\n return this.httpClient.get<ApiResult<SupportNotificationInfo>>(\r\n this._serviceUri +\r\n '/notifications/' +\r\n id\r\n );\r\n }\r\n\r\n /**\r\n * Mark a group of notifications as read\r\n * @param ids: the array of notification's ids to set as read\r\n */\r\n markNotifications(params: SupportNotificationsMarkParams) {\r\n return this.httpClient.post<ApiResult<boolean>>(\r\n this._serviceUri + '/notifications/mark',\r\n params\r\n );\r\n }\r\n\r\n /**\r\n * Download a notification document\r\n * @param documentId : the notification document id\r\n */\r\n dowloadNotificationDocument(documentId: number) {\r\n return this.httpClient.get(\r\n this._serviceUri + '/documents/download/' + documentId,\r\n { responseType: 'blob' }\r\n );\r\n }\r\n}\r\n","import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';\r\nimport { Injectable, inject } from '@angular/core';\r\nimport { Observable, catchError, throwError } from 'rxjs';\r\nimport { SupportService } from '../services/support.service';\r\nimport { DialogService } from '@arsedizioni/ars-utils/ui';\r\n\r\n@Injectable()\r\nexport class SupportAuthInterceptor implements HttpInterceptor {\r\n\r\n private supportService = inject(SupportService);\r\n private dialogService = inject(DialogService);\r\n\r\n intercept(\r\n request: HttpRequest<any>,\r\n next: HttpHandler\r\n ): Observable<HttpEvent<any>> { \r\n if (request.url.startsWith(this.supportService.serviceUri)) {\r\n request = request.clone({ withCredentials: true });\r\n return next.handle(this.addTokenToRequest(request))\r\n .pipe(\r\n catchError(err => {\r\n // Get the message\r\n let message = err.error?.message || err.message || \"Impossibile eseguire l'operazione richiesta.\";\r\n let invalidSession = err.status === 401;\r\n switch (err.status) {\r\n case 0:\r\n case 500:\r\n case 502:\r\n case 503:\r\n case 504:\r\n message = null; // No messages\r\n break;\r\n case 403:\r\n message = \"<p>Non hai i permessi necessari per eseguire l'operazione richiesta.</p>\";\r\n break;\r\n default:\r\n message = '<p>' + message.replaceAll('\\r\\n', '</p><p>') + '</p>';\r\n break;\r\n }\r\n // Display message\r\n if (message) {\r\n setTimeout(() => {\r\n this.dialogService.error(message, null, 'Errore in ARS Support', 'Ok', 500, invalidSession ? 5000 : null).afterClosed().subscribe(() => {\r\n if (invalidSession) {\r\n if (this.supportService.loggedIn()) {\r\n this.supportService.reset();\r\n }\r\n }\r\n });\r\n }, 250);\r\n }\r\n return throwError(() => err);\r\n }));\r\n } \r\n return next.handle(request); \r\n }\r\n\r\n\r\n /**\r\n * Add token to request\r\n * @param request : the request\r\n * @param token: the token or null to use curre3nt\r\n */\r\n private addTokenToRequest(\r\n request: HttpRequest<any>,\r\n token: string = null\r\n ): HttpRequest<any> {\r\n if (request.url.startsWith(this.supportService.serviceUri)) {\r\n if (!token) token = this.supportService.getToken();\r\n if (token) {\r\n return request.clone({\r\n setHeaders: {\r\n Authorization: 'Bearer ' + token,\r\n 'ngsw-bypass': 'ngsw-bypass'\r\n },\r\n });\r\n }\r\n }\r\n return request;\r\n }\r\n\r\n}\r\n","import { NgModule } from '@angular/core';\r\n\r\n@NgModule()\r\nexport class ArsSupportCommonModule {}\r\n\r\n// Other exports\r\nexport * from './messages';\r\nexport * from './definitions';\r\nexport * from './interceptors/auth.interceptor';\r\nexport * from './services/support.service';\r\n","/*\r\n * Public API Surface of ars-utils\r\n */\r\nexport * from './common/common.module';\r\nexport * from './common/messages';\r\nexport * from './common/definitions';\r\nexport * from './common/services/support.service';\r\n\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["catchError"],"mappings":";;;;;;;;AAAa,MAAA,eAAe,GAAG;AAC7B;;AAEG;;AAGH,IAAA,aAAa,EAAE,wBAAwB;AACvC,IAAA,eAAe,EAAE,0BAA0B;AAC3C,IAAA,kBAAkB,EAAE,6BAA6B;AACjD,IAAA,gBAAgB,EAAE,2BAA2B;;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B;AAGD;;;;AAIG;AACK,IAAA,iBAAiB,CACrB,OAAyB,EACzB,KAAA,GAAgB,IAAI,EAAA;AAEtB,QAAA,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE;AAC1D,YAAA,IAAI,CAAC,KAAK;AAAE,gBAAA,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;YACnD,IAAI,KAAK,EAAE;gBACT,OAAO,OAAO,CAAC,KAAK,CAAC;AACnB,oBAAA,UAAU,EAAE;wBACV,aAAa,EAAE,SAAS,GAAG,KAAK;AAChC,wBAAA,aAAa,EAAE,aAAa;AAC7B,qBAAA;AACF,iBAAA,CAAC,CAAC;aACJ;SACF;AACD,QAAA,OAAO,OAAO,CAAC;KAChB;8GAxEU,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;kHAAtB,sBAAsB,EAAA,CAAA,CAAA,EAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC,UAAU;;;MCHE,sBAAsB,CAAA;8GAAtB,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;+GAAtB,sBAAsB,EAAA,CAAA,CAAA,EAAA;+GAAtB,sBAAsB,EAAA,CAAA,CAAA,EAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC,QAAQ;;;ACFT;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"arsedizioni-ars-utils-support.common.mjs","sources":["../../../projects/ars-utils/support.common/common/messages.ts","../../../projects/ars-utils/support.common/common/definitions.ts","../../../projects/ars-utils/support.common/common/services/support.service.ts","../../../projects/ars-utils/support.common/common/interceptors/auth.interceptor.ts","../../../projects/ars-utils/support.common/common/common.module.ts","../../../projects/ars-utils/support.common/public_api.ts","../../../projects/ars-utils/support.common/arsedizioni-ars-utils-support.common.ts"],"sourcesContent":["export const SupportMessages = {\r\n /**\r\n * Messages\r\n */\r\n\r\n // Login\r\n LOGIN_CHANGED: '§support-login-changed',\r\n LOGIN_COMPLETED: '§support-login-completed',\r\n LOGIN_DISCONNECTED: '§support-login-disconnected',\r\n LOGOUT_COMPLETED: '§support-logout-completed',\r\n LOGOUT: '§support-logout',\r\n\r\n // Notifications\r\n NOTIFICATION_READ: '§support-notification-read',\r\n};\r\n","import { LoginResult } from '@arsedizioni/ars-utils/core';\r\n\r\n\r\nexport interface SupportUserInfo {\r\n\r\n id: number;\r\n groups?: number | null;\r\n groupNames?: string | null;\r\n displayName?: string | null;\r\n dashboard?: string | null;\r\n sessionId?: string | null;\r\n email?: string | null;\r\n customerId?: number | null;\r\n companyName?: string | null;\r\n role: number;\r\n scopes?: string[] | null;\r\n sla: number;\r\n isCommercial?: boolean | null;\r\n isAdministrator: boolean;\r\n isGuest: boolean;\r\n isUser: boolean;\r\n isOperator: boolean;\r\n isTemporary: boolean;\r\n}\r\n\r\nexport interface SupportLoginResult extends LoginResult<SupportUserInfo> { } \r\n\r\nexport interface SupportLoginInfo {\r\n context: SupportUserInfo;\r\n userCredentials?: string | null;\r\n}\r\n\r\n\r\nexport interface SupportNotificationsSearchParams {\r\n any?: string | null;\r\n products?: number | null;\r\n productModules?: number | null;\r\n first?: number | null;\r\n count?: number | null;\r\n}\r\n\r\nexport interface SupportNotificationsSearchResult {\r\n interval?: string | null;\r\n items?: SupportNotificationInfo[] | null;\r\n total?: number | null;\r\n}\r\n\r\nexport interface SupportNotificationInfo {\r\n id: number;\r\n products: number;\r\n productNames?: string | null;\r\n productModules?: number | null;\r\n productModuleNames?: string | null;\r\n publishingDate?: Date | null;\r\n title: string;\r\n text: string;\r\n state: number;\r\n isPublished: boolean;\r\n isInternal: boolean;\r\n isRead: boolean;\r\n}\r\n\r\nexport interface SupportNotificationsMarkParams {\r\n ids: number[];\r\n unmark: boolean;\r\n}\r\n\r\nexport enum SupportProduct {\r\n None = 0,\r\n Clipper = 1,\r\n Evolution = 1 << 1,\r\n DGInfo = 1 << 2\r\n}\r\n\r\nexport enum SupportProductModule {\r\n None = 0,\r\n EvoFormazione = 1,\r\n EvoDPI = 1 << 1,\r\n EvoSorveglianzaSanitaria = 1 << 2,\r\n EvoRegistroEScadenzario = 1 << 3,\r\n EvoAttrezzatureEImpianti = 1 << 4,\r\n EvoMonitoraggio = 1 << 5,\r\n EvoBollettino = 1 << 6,\r\n DgiADR = 1 << 7,\r\n DgiRID = 1 << 8,\r\n DgiIMDG = 1 << 9,\r\n DgiCLP = 1 << 10,\r\n}\r\n","import { HttpClient, HttpHeaders } from '@angular/common/http';\r\nimport { Injectable, OnDestroy, inject, signal } from '@angular/core';\r\nimport { ApiResult, BroadcastMessageInfo, BroadcastService, SystemUtils } from '@arsedizioni/ars-utils/core';\r\nimport { of, Subscription, throwError } from 'rxjs';\r\nimport { catchError, map } from 'rxjs/operators';\r\nimport { SupportMessages } from '../messages';\r\nimport { SupportLoginResult, SupportNotificationInfo, SupportNotificationsMarkParams, SupportNotificationsSearchParams, SupportNotificationsSearchResult, SupportProduct, SupportProductModule, SupportUserInfo } from '../definitions';\r\n\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class SupportService implements OnDestroy {\r\n\r\n\r\n private httpClient = inject(HttpClient);\r\n private broadcastService = inject(BroadcastService);\r\n private broadcastServiceSubscription?: Subscription | null = null;\r\n private _loginInfo: SupportUserInfo | null = null;\r\n get loginInfo(): SupportUserInfo | null { return this._loginInfo };\r\n set loginInfo(value: SupportUserInfo | null) {\r\n this._loginInfo = value;\r\n }\r\n\r\n private _serviceUri: string = \"https://support.arsedizioni.it\"\r\n get serviceUri(): string {\r\n return this._serviceUri;\r\n }\r\n\r\n public products: SupportProduct = SupportProduct.None;\r\n public productModules: SupportProductModule = SupportProductModule.None;\r\n\r\n public readonly unreadNotifications = signal<number | null>(null);\r\n public readonly loggedIn = signal<boolean>(false);\r\n public readonly loggingIn = signal<boolean>(false);\r\n\r\n ngOnDestroy() {\r\n // Clean-up\r\n if (this.broadcastServiceSubscription) {\r\n this.broadcastServiceSubscription.unsubscribe();\r\n }\r\n }\r\n\r\n /**\r\n * Initialize service\r\n * @param serviceUri : the service uri\r\n * @param products: the supported products\r\n * @param products: the supported products\r\n */\r\n initialize(\r\n serviceUri: string = null,\r\n products: SupportProduct = SupportProduct.None,\r\n productModules: SupportProductModule = SupportProductModule.None) {\r\n\r\n // Create unique client id\r\n if (!localStorage.getItem('support_client_id'))\r\n localStorage.setItem('support_client_id', SystemUtils.generateUUID());\r\n\r\n // Initialize\r\n this._serviceUri = serviceUri;\r\n this.products = products;\r\n this.productModules = productModules;\r\n\r\n // React to message broadcasting\r\n if (!this.broadcastServiceSubscription) {\r\n this.broadcastServiceSubscription = this.broadcastService.getMessage().subscribe((message: BroadcastMessageInfo) => {\r\n if (message.id === SupportMessages.LOGIN_CHANGED) {\r\n setTimeout(() => {\r\n this.login(message.data.email, message.data.oauth, message.data.oauthAccessToken).subscribe((r: ApiResult<SupportLoginResult>) => {\r\n if (r.success) {\r\n this.countUnreadNotifications();\r\n }\r\n });\r\n }, 500);\r\n } else if (message.id === SupportMessages.LOGOUT_COMPLETED ||\r\n message.id === SupportMessages.LOGIN_DISCONNECTED) {\r\n if (!this.loggedIn()) {\r\n this.clear();\r\n } else {\r\n this.logout().subscribe({\r\n complete: () => {\r\n this.clear();\r\n }\r\n });\r\n }\r\n } else if (message.id === SupportMessages.NOTIFICATION_READ) {\r\n this.countUnreadNotifications();\r\n }\r\n });\r\n }\r\n\r\n // Eveluate current session storage in case of page refresh (F5)\r\n if (!this.loggedIn() && this.getToken()) {\r\n // Auto login\r\n this.loggedIn.set(true);\r\n // Notify\r\n this.broadcastService.sendMessage(SupportMessages.LOGIN_COMPLETED);\r\n }\r\n }\r\n\r\n /**\r\n * Set JWT token\r\n * @param value : the login result\r\n */\r\n private setToken(value: SupportLoginResult) {\r\n sessionStorage.setItem('support_jwt', value.token);\r\n sessionStorage.setItem('support_jwt_refresh', value.refreshToken ?? '');\r\n }\r\n\r\n\r\n /**\r\n * Return current JWT token\r\n * @param refresh: true to get the refresh token. Default is false.\r\n */\r\n getToken(refresh: boolean = false): string {\r\n let token = sessionStorage.getItem(refresh ? 'support_jwt_refresh' : 'support_jwt');\r\n if (token && token[0] === '\"') {\r\n return token.substring(1, token.length - 1);\r\n }\r\n return token ?? '';\r\n }\r\n\r\n\r\n /**\r\n* Perform login \r\n* @param email: the guest email\r\n* @param oauth: the optional open authentication supported\r\n* @param oauthAccessToken: the optional oauth2 access token\r\n* @returns: the login result\r\n*/\r\n login(email: string | null | undefined = null,\r\n oauth: number | null | undefined = null,\r\n oauthAccessToken: string | null | undefined = null) {\r\n this.clear();\r\n this.loggingIn.set(true);\r\n return this.httpClient\r\n .post<ApiResult<SupportLoginResult>>(\r\n this._serviceUri + '/login',\r\n {\r\n user: oauth > 0 ? null : email,\r\n clientId: localStorage.getItem(\"support_client_id\"),\r\n OAUTH: oauth\r\n },\r\n {\r\n headers:\r\n !oauth\r\n ? new HttpHeaders()\r\n : new HttpHeaders()\r\n .set(\"Authorization\", oauthAccessToken)\r\n })\r\n .pipe(\r\n catchError(err => {\r\n this.loggingIn.set(false);\r\n return throwError(() => err);\r\n }),\r\n map((r: ApiResult<SupportLoginResult>) => {\r\n this.loggingIn.set(false);\r\n if (r.success) {\r\n this.setToken(r.value);\r\n this._loginInfo = r.value.context;\r\n this.loggedIn.set(true);\r\n // Notify\r\n this.broadcastService.sendMessage(SupportMessages.LOGIN_COMPLETED);\r\n }\r\n return r;\r\n })\r\n );\r\n\r\n }\r\n\r\n /**\r\n * Perform logout\r\n */\r\n logout() {\r\n return this.httpClient\r\n .post<any>(this._serviceUri + '/logout', {}).pipe(\r\n map(r => {\r\n this.clear();\r\n return r;\r\n }),\r\n catchError((_e) => {\r\n this.clear();\r\n return of([]);\r\n }));\r\n\r\n }\r\n\r\n /**\r\n * Reset login refresh timer and logins state\r\n */\r\n reset() {\r\n // Clear login info\r\n this._loginInfo = null;\r\n this.loggedIn.set(false);\r\n\r\n // Notify\r\n this.broadcastService.sendMessage(SupportMessages.LOGOUT_COMPLETED);\r\n }\r\n\r\n /**\r\n * Clear login data\r\n */\r\n clear() {\r\n // Reset login\r\n this.reset();\r\n\r\n // Clear local storage\r\n sessionStorage.removeItem('support_jwt');\r\n sessionStorage.removeItem('support_jwt_refresh');\r\n }\r\n\r\n /**\r\n * Perform token refresh\r\n */\r\n refresh() {\r\n return this.httpClient.get<ApiResult<SupportLoginResult>>(\r\n this._serviceUri + '/refresh2/?token=' + this.getToken(true)\r\n ).pipe(map((r: ApiResult<SupportLoginResult>) => {\r\n // Update token\r\n this.setToken(r.value);\r\n }));\r\n }\r\n\r\n /**\r\n * Navigate to support service\r\n */\r\n open() {\r\n let uri = this.serviceUri ?? '';\r\n if (uri.endsWith('/api'))\r\n uri = uri.substring(0, uri.length - 4)\r\n window.open(uri);\r\n }\r\n\r\n ////\r\n // NOTIFICATIONS\r\n ////\r\n\r\n /**\r\n * Count unread notifications\r\n */\r\n countUnreadNotifications() {\r\n this.httpClient.get<ApiResult<number>>(\r\n this._serviceUri + '/notifications/count-unread/?products=' + (this.products ?? 0) + \"&modules=\" + (this.productModules ?? 0)\r\n ).subscribe((r: ApiResult<number>) => {\r\n if (r.success) {\r\n this.unreadNotifications.set(r.value > 0 ? r.value : null)\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Query notifications\r\n * @param params: query parameters\r\n */\r\n queryNotifications(params: SupportNotificationsSearchParams) {\r\n params.products = this.products ?? 0;\r\n params.productModules = this.productModules ?? 0;\r\n return this.httpClient.post<ApiResult<SupportNotificationsSearchResult>>(\r\n this._serviceUri + '/notifications',\r\n params\r\n );\r\n }\r\n\r\n /**\r\n * Retrieve a notification\r\n * @param id: the notification id\r\n */\r\n getNotification(id: number) {\r\n return this.httpClient.get<ApiResult<SupportNotificationInfo>>(\r\n this._serviceUri +\r\n '/notifications/' +\r\n id\r\n );\r\n }\r\n\r\n /**\r\n * Mark a group of notifications as read\r\n * @param ids: the array of notification's ids to set as read\r\n */\r\n markNotifications(params: SupportNotificationsMarkParams) {\r\n return this.httpClient.post<ApiResult<boolean>>(\r\n this._serviceUri + '/notifications/mark',\r\n params\r\n );\r\n }\r\n\r\n /**\r\n * Download a notification document\r\n * @param documentId : the notification document id\r\n */\r\n dowloadNotificationDocument(documentId: number) {\r\n return this.httpClient.get(\r\n this._serviceUri + '/documents/download/' + documentId,\r\n { responseType: 'blob' }\r\n );\r\n }\r\n}\r\n","import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';\r\nimport { Injectable, inject } from '@angular/core';\r\nimport { Observable, catchError, switchMap, throwError } from 'rxjs';\r\nimport { SupportService } from '../services/support.service';\r\nimport { DialogService } from '@arsedizioni/ars-utils/ui';\r\nimport { BroadcastService } from '@arsedizioni/ars-utils/core';\r\nimport { SupportMessages } from '../messages';\r\n\r\n@Injectable()\r\nexport class SupportAuthInterceptor implements HttpInterceptor {\r\n\r\n private supportService = inject(SupportService);\r\n private broadcastService = inject(BroadcastService);\r\n private dialogService = inject(DialogService);\r\n private lastErrorTime: number = -1;\r\n\r\n intercept(\r\n request: HttpRequest<any>,\r\n next: HttpHandler\r\n ): Observable<HttpEvent<any>> { \r\n if (request.url.startsWith(this.supportService.serviceUri)) {\r\n request = request.clone({ withCredentials: true });\r\n return next.handle(this.addTokenToRequest(request))\r\n .pipe(\r\n catchError(error => {\r\n this.dialogService.clearBusy();\r\n if (\r\n error instanceof HttpErrorResponse &&\r\n !request.url.includes(\"/login\") &&\r\n error.status === 401\r\n ) {\r\n return this.handle401Error(request, next);\r\n }\r\n const errorTime = new Date().getTime();\r\n if (errorTime - this.lastErrorTime > 5000) {\r\n this.lastErrorTime = errorTime;\r\n const invalidSession = error.status == \"403\";\r\n this.dialogService.error(\r\n \"<p>\" + (error.error?.message ?? error.message ?? \"Impossibile eseguire l'operazione richiesta.\").replaceAll(\"\\r\\n\", \"</p><p>\") + \"</p>\",\r\n null,\r\n \"Errore in ARS Support\",\r\n undefined,\r\n undefined,\r\n invalidSession ? 5000 : 15000).afterClosed().subscribe(() => {\r\n if (invalidSession) {\r\n this.broadcastService.sendMessage(SupportMessages.LOGOUT);\r\n }\r\n });\r\n }\r\n return throwError(() => error);\r\n }));\r\n } \r\n return next.handle(request); \r\n }\r\n\r\n /**\r\n * Handle 401 error\r\n * @param request : the request\r\n * @param next : the http handler\r\n */\r\n private handle401Error(request: HttpRequest<any>, next: HttpHandler) {\r\n if (this.supportService.loggedIn()) {\r\n return this.supportService.refresh().pipe(\r\n switchMap(() => {\r\n return next.handle(this.addTokenToRequest(request));\r\n }),\r\n catchError(error => {\r\n return throwError(() => error);\r\n })\r\n );\r\n }\r\n return next.handle(request);\r\n }\r\n\r\n /**\r\n * Add token to request\r\n * @param request : the request\r\n * @param token: the token or null to use curre3nt\r\n */\r\n private addTokenToRequest(\r\n request: HttpRequest<any>,\r\n token: string = null\r\n ): HttpRequest<any> {\r\n if (request.url.startsWith(this.supportService.serviceUri)) {\r\n if (!token) token = this.supportService.getToken();\r\n if (token) {\r\n return request.clone({\r\n setHeaders: {\r\n Authorization: 'Bearer ' + token,\r\n 'ngsw-bypass': 'ngsw-bypass'\r\n },\r\n });\r\n }\r\n }\r\n return request;\r\n }\r\n\r\n}\r\n","import { NgModule } from '@angular/core';\r\n\r\n@NgModule()\r\nexport class ArsSupportCommonModule {}\r\n\r\n// Other exports\r\nexport * from './messages';\r\nexport * from './definitions';\r\nexport * from './interceptors/auth.interceptor';\r\nexport * from './services/support.service';\r\n","/*\r\n * Public API Surface of ars-utils\r\n */\r\nexport * from './common/common.module';\r\nexport * from './common/messages';\r\nexport * from './common/definitions';\r\nexport * from './common/services/support.service';\r\n\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\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