@arsedizioni/ars-utils 19.3.13 → 19.3.14

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.
@@ -4,7 +4,6 @@ import * as i0 from "@angular/core";
4
4
  export declare class ClipperAuthInterceptor implements HttpInterceptor {
5
5
  private clipperService;
6
6
  private broadcastService;
7
- private dialogService;
8
7
  private lastErrorTime;
9
8
  intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
10
9
  /**
@@ -15,6 +15,7 @@ export declare class ArsCoreModule {
15
15
  static ɵinj: i0.ɵɵInjectorDeclaration<ArsCoreModule>;
16
16
  }
17
17
  export * from './definitions';
18
+ export * from './messages';
18
19
  export * from './selectable';
19
20
  export * from './services/broadcast.service';
20
21
  export * from './services/environment.service';
@@ -36,6 +36,12 @@ export declare class FileInfo implements Validated {
36
36
  valid: boolean;
37
37
  isValid(): boolean;
38
38
  }
39
+ export interface ErrorInfo {
40
+ invalidateSession?: boolean;
41
+ title?: string;
42
+ message?: string;
43
+ errorStatus?: number;
44
+ }
39
45
  export interface NameValueItem<T> {
40
46
  name: string;
41
47
  value: T;
@@ -0,0 +1,7 @@
1
+ export declare const UtilsMessages: {
2
+ /**
3
+ * Messages
4
+ */
5
+ UTILS_ERROR_MESSAGE: string;
6
+ UTILS_DIALOGS_SELECT_OPTIONS_CHANGED: string;
7
+ };
@@ -4,7 +4,6 @@ import * as i0 from "@angular/core";
4
4
  export declare class EvolutionAuthInterceptor implements HttpInterceptor {
5
5
  private evolutionService;
6
6
  private broadcastService;
7
- private dialogService;
8
7
  private lastErrorTime;
9
8
  intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
10
9
  /**
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { signal, computed, inject, Injectable, NgModule } from '@angular/core';
3
3
  import { HttpClient, HttpHeaders, HttpRequest, HttpErrorResponse } from '@angular/common/http';
4
- import { BroadcastService, SystemUtils } from '@arsedizioni/ars-utils/core';
4
+ import { BroadcastService, SystemUtils, UtilsMessages } from '@arsedizioni/ars-utils/core';
5
+ import { EMPTY, throwError, of, catchError as catchError$1, switchMap } from 'rxjs';
5
6
  import { DialogService } from '@arsedizioni/ars-utils/ui';
6
- import { EMPTY, throwError, of, finalize as finalize$1, catchError as catchError$1, switchMap } from 'rxjs';
7
7
  import { catchError, map, finalize } from 'rxjs/operators';
8
8
 
9
9
  const ClipperMessages = {
@@ -3187,14 +3187,13 @@ class ClipperAuthInterceptor {
3187
3187
  constructor() {
3188
3188
  this.clipperService = inject(ClipperService);
3189
3189
  this.broadcastService = inject(BroadcastService);
3190
- this.dialogService = inject(DialogService);
3191
3190
  this.lastErrorTime = -1;
3192
3191
  }
3193
3192
  intercept(request, next) {
3194
3193
  if (request.url.startsWith(this.clipperService.serviceUri)) {
3195
3194
  request = request.clone({ withCredentials: true });
3196
3195
  return next.handle(this.addTokenToRequest(request))
3197
- .pipe(finalize$1(() => this.dialogService.clearBusy()), catchError$1(error => {
3196
+ .pipe(catchError$1(error => {
3198
3197
  if (error.url.startsWith(this.clipperService.serviceUri)) {
3199
3198
  if (error instanceof HttpErrorResponse &&
3200
3199
  error.status === 401 &&
@@ -3218,11 +3217,11 @@ class ClipperAuthInterceptor {
3218
3217
  message = (error.error?.message ?? error.message ?? "Impossibile eseguire l'operazione richiesta.").replaceAll("\r\n", "</p><p>");
3219
3218
  break;
3220
3219
  }
3221
- const invalidSession = errorStatus === 405 || errorStatus === 410;
3222
- this.dialogService.error("<p>" + message + "</p>", null, "Errore in Clipper", undefined, undefined, invalidSession ? 5000 : 15000).afterClosed().subscribe(() => {
3223
- if (invalidSession) {
3224
- this.broadcastService.sendMessage(ClipperMessages.LOGOUT);
3225
- }
3220
+ this.broadcastService.sendMessage(UtilsMessages.UTILS_ERROR_MESSAGE, {
3221
+ invalidateSession: errorStatus === 405 || errorStatus === 410,
3222
+ message: message,
3223
+ title: "Errore in Clipper",
3224
+ errorStatus: errorStatus
3226
3225
  });
3227
3226
  }
3228
3227
  }