@fluxhub/fluxhub-lib 19.0.212 → 19.0.213
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.
|
@@ -425,6 +425,21 @@ class UtilityService {
|
|
|
425
425
|
this.titleService = titleService;
|
|
426
426
|
this.translateService = translateService;
|
|
427
427
|
}
|
|
428
|
+
/**
|
|
429
|
+
* Log di debug attivo SOLO sul dev server ng-serve (localhost:4200):
|
|
430
|
+
* in produzione non stampa nulla. È STATICO di proposito: così è
|
|
431
|
+
* richiamabile ovunque senza iniettare UtilityService — anche dentro gli
|
|
432
|
+
* HTTP interceptor, dove iniettare un service che usa HttpClient darebbe
|
|
433
|
+
* un cyclic dependency ("Cannot instantiate cyclic dependency! HttpClient").
|
|
434
|
+
* Uso: UtilityService.dlog('[TAG]', valore, ...);
|
|
435
|
+
*/
|
|
436
|
+
static dlog(...args) {
|
|
437
|
+
if (typeof window !== 'undefined' &&
|
|
438
|
+
window.location.hostname === 'localhost' &&
|
|
439
|
+
window.location.port === '4200') {
|
|
440
|
+
console.log(...args);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
428
443
|
set_home_title(s) {
|
|
429
444
|
setTimeout(() => {
|
|
430
445
|
// Se la stringa è valida, usa il translate service
|
|
@@ -31951,6 +31966,27 @@ class win_select_level_v2 {
|
|
|
31951
31966
|
updateButtons() {
|
|
31952
31967
|
this.buttons = [];
|
|
31953
31968
|
}
|
|
31969
|
+
/**
|
|
31970
|
+
* Classe CSS FontAwesome per l'icona dello step. Il valore (scelto con
|
|
31971
|
+
* FHIconPicker) puo` essere: classe completa ("fa-solid fa-check",
|
|
31972
|
+
* "fa-brands fa-github"), nome con prefisso ("fa-check") o nome semplice
|
|
31973
|
+
* ("check"). Se manca lo stile assume "fa-solid". Gestisce anche i vecchi
|
|
31974
|
+
* valori FontAwesome 4 ("fa fa-check").
|
|
31975
|
+
*/
|
|
31976
|
+
iconClass(v) {
|
|
31977
|
+
const raw = (v || "").trim();
|
|
31978
|
+
if (!raw)
|
|
31979
|
+
return "";
|
|
31980
|
+
// gia` una classe completa con lo stile (solid/brands/regular/light/thin/duotone/sharp)
|
|
31981
|
+
if (/\bfa-(solid|brands|regular|light|thin|duotone|sharp)\b/.test(raw))
|
|
31982
|
+
return raw;
|
|
31983
|
+
// vecchia sintassi FA4 "fa fa-check" -> usala cosi` com'e`
|
|
31984
|
+
if (/\bfa\b/.test(raw))
|
|
31985
|
+
return raw;
|
|
31986
|
+
// nome icona, con o senza prefisso "fa-" -> assume lo stile solid
|
|
31987
|
+
const name = raw.startsWith("fa-") ? raw : "fa-" + raw;
|
|
31988
|
+
return "fa-solid " + name;
|
|
31989
|
+
}
|
|
31954
31990
|
onBeforeClose(event) {
|
|
31955
31991
|
event.preventDefault();
|
|
31956
31992
|
this.close();
|
|
@@ -31992,7 +32028,7 @@ class win_select_level_v2 {
|
|
|
31992
32028
|
[style.background-color]="'#fafafa'"
|
|
31993
32029
|
[style.color]="app.color"
|
|
31994
32030
|
(click)="sel(app)">
|
|
31995
|
-
<i *ngIf="app.icon && app.icon!=''" [ngClass]="
|
|
32031
|
+
<i *ngIf="app.icon && app.icon!=''" [ngClass]="iconClass(app.icon)" aria-hidden="true"></i>
|
|
31996
32032
|
<span>{{ app.description | translate }}</span>
|
|
31997
32033
|
</div>
|
|
31998
32034
|
</div>
|
|
@@ -32024,7 +32060,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
|
|
|
32024
32060
|
[style.background-color]="'#fafafa'"
|
|
32025
32061
|
[style.color]="app.color"
|
|
32026
32062
|
(click)="sel(app)">
|
|
32027
|
-
<i *ngIf="app.icon && app.icon!=''" [ngClass]="
|
|
32063
|
+
<i *ngIf="app.icon && app.icon!=''" [ngClass]="iconClass(app.icon)" aria-hidden="true"></i>
|
|
32028
32064
|
<span>{{ app.description | translate }}</span>
|
|
32029
32065
|
</div>
|
|
32030
32066
|
</div>
|
|
@@ -35155,6 +35191,12 @@ class AuthHttpRequestInterceptor {
|
|
|
35155
35191
|
this.appService = appService;
|
|
35156
35192
|
this.http = http;
|
|
35157
35193
|
}
|
|
35194
|
+
// Log di debug attivi SOLO sul dev server ng-serve (localhost:4200): in
|
|
35195
|
+
// produzione non stampano nulla. Delego a UtilityService.dlog (statico, così
|
|
35196
|
+
// non devo iniettare il service qui ed evito cyclic dependency con HttpClient).
|
|
35197
|
+
dlog(...args) {
|
|
35198
|
+
UtilityService.dlog('[AUTHDBG]', ...args);
|
|
35199
|
+
}
|
|
35158
35200
|
intercept(request, next) {
|
|
35159
35201
|
const token = this.getJwtToken();
|
|
35160
35202
|
if (token && token !== 'ZZ') {
|
|
@@ -35166,11 +35208,12 @@ class AuthHttpRequestInterceptor {
|
|
|
35166
35208
|
if (error instanceof HttpErrorResponse &&
|
|
35167
35209
|
error.status === 400 &&
|
|
35168
35210
|
error.error === 'Invalid client request') {
|
|
35169
|
-
|
|
35211
|
+
this.dlog('400 Invalid client request su', request.url, '-> LOGOUT immediato');
|
|
35170
35212
|
this.loginservice.logout();
|
|
35171
35213
|
return throwError(error);
|
|
35172
35214
|
}
|
|
35173
35215
|
if (error instanceof HttpErrorResponse && error.status === 401) {
|
|
35216
|
+
this.dlog('401 su', request.url, '-> handle401Error');
|
|
35174
35217
|
return this.handle401Error(request, next);
|
|
35175
35218
|
}
|
|
35176
35219
|
else {
|
|
@@ -35188,35 +35231,43 @@ class AuthHttpRequestInterceptor {
|
|
|
35188
35231
|
handle401Error(request, next) {
|
|
35189
35232
|
const refreshToken = localStorage.getItem(this.appService.COMPANY_KEY + 'refreshToken');
|
|
35190
35233
|
const token = localStorage.getItem(this.appService.COMPANY_KEY + 'token');
|
|
35234
|
+
this.dlog('handle401Error url=', request.url, 'hasToken=', !!token, 'hasRefresh=', !!refreshToken, 'isRefreshing=', this.isRefreshing);
|
|
35191
35235
|
if (!token || !refreshToken) {
|
|
35236
|
+
this.dlog('>> SKIP refresh: token o refreshToken mancante -> replay senza refresh');
|
|
35192
35237
|
return next.handle(request);
|
|
35193
35238
|
}
|
|
35194
35239
|
if (!this.isRefreshing) {
|
|
35195
35240
|
this.isRefreshing = true;
|
|
35196
35241
|
this.refreshTokenSubject.next(null);
|
|
35242
|
+
this.dlog('>> CHIAMO token/refresh ...');
|
|
35197
35243
|
return this.refreshToken(token, refreshToken).pipe(switchMap((res) => {
|
|
35198
35244
|
this.isRefreshing = false;
|
|
35199
35245
|
const newToken = localStorage.getItem(this.appService.COMPANY_KEY + 'token');
|
|
35246
|
+
this.dlog('token/refresh risposta=', res, 'newToken presente=', !!newToken);
|
|
35200
35247
|
// refresh fallito (ND / risposta non valida): NON ritentare col token
|
|
35201
35248
|
// stantio, sblocca i waiter con il sentinel e fai logout pulito.
|
|
35202
35249
|
if (!res ||
|
|
35203
35250
|
(res.accessToken || 'ND') === 'ND' ||
|
|
35204
35251
|
!newToken ||
|
|
35205
35252
|
newToken === AuthHttpRequestInterceptor.REFRESH_FAILED) {
|
|
35253
|
+
this.dlog('>> REFRESH FALLITO -> LOGOUT');
|
|
35206
35254
|
this.refreshTokenSubject.next(AuthHttpRequestInterceptor.REFRESH_FAILED);
|
|
35207
35255
|
this.loginservice.logout();
|
|
35208
35256
|
return throwError(() => new Error('Refresh token non valido'));
|
|
35209
35257
|
}
|
|
35258
|
+
this.dlog('>> REFRESH OK -> ritento la request originale col nuovo token');
|
|
35210
35259
|
this.refreshTokenSubject.next(newToken);
|
|
35211
35260
|
return next.handle(this.addToken(request, newToken));
|
|
35212
35261
|
}), catchError((error) => {
|
|
35213
35262
|
this.isRefreshing = false;
|
|
35263
|
+
this.dlog('>> token/refresh ERRORE HTTP -> LOGOUT', error?.status, error?.message);
|
|
35214
35264
|
this.refreshTokenSubject.next(AuthHttpRequestInterceptor.REFRESH_FAILED);
|
|
35215
35265
|
this.loginservice.logout();
|
|
35216
35266
|
return throwError(() => error);
|
|
35217
35267
|
}));
|
|
35218
35268
|
}
|
|
35219
35269
|
else {
|
|
35270
|
+
this.dlog('>> refresh gia in corso: mi accodo (waiter)');
|
|
35220
35271
|
return this.refreshTokenSubject.pipe(filter((t) => t != null), take(1), switchMap((jwt) => {
|
|
35221
35272
|
// se il refresh in corso è fallito, fallisci anche tu invece di
|
|
35222
35273
|
// ritentare col token vecchio (evita la raffica di 401)
|