@open-rlb/ng-app 3.0.18 → 3.0.20

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,9 +1,9 @@
1
1
  import * as i1$3 from '@angular/common/http';
2
2
  import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
3
3
  import * as i0 from '@angular/core';
4
- import { InjectionToken, Injectable, Inject, Optional, EventEmitter, importProvidersFrom, makeStateKey, makeEnvironmentProviders, Pipe, Input, Component, PLATFORM_ID, NgModule, Directive, inject, APP_INITIALIZER, isDevMode } from '@angular/core';
4
+ import { InjectionToken, Injectable, Inject, Optional, EventEmitter, importProvidersFrom, makeStateKey, makeEnvironmentProviders, Pipe, Input, Component, PLATFORM_ID, NgModule, Directive, inject, provideAppInitializer, isDevMode } from '@angular/core';
5
5
  import * as i2 from '@angular/router';
6
- import { NavigationEnd, RoutesRecognized, RouterModule, Router, provideRouter, withDebugTracing } from '@angular/router';
6
+ import { NavigationEnd, RoutesRecognized, RouterModule, Router, provideRouter } from '@angular/router';
7
7
  import * as i1$4 from '@angular/service-worker';
8
8
  import { provideServiceWorker } from '@angular/service-worker';
9
9
  import * as i1$8 from '@ngrx/effects';
@@ -1283,13 +1283,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
1283
1283
  }] });
1284
1284
 
1285
1285
  class AuthenticationService {
1286
- constructor(oidcSecurityService, cookiesService, router, parseJwtService, store, log, envConfig, authConfig) {
1286
+ constructor(oidcSecurityService, cookiesService, router, parseJwtService, store, log, localStorage, envConfig, authConfig) {
1287
1287
  this.oidcSecurityService = oidcSecurityService;
1288
1288
  this.cookiesService = cookiesService;
1289
1289
  this.router = router;
1290
1290
  this.parseJwtService = parseJwtService;
1291
1291
  this.store = store;
1292
1292
  this.log = log;
1293
+ this.localStorage = localStorage;
1293
1294
  this.envConfig = envConfig;
1294
1295
  this.authConfig = authConfig;
1295
1296
  this.logger = this.log.for(this.constructor.name);
@@ -1324,11 +1325,11 @@ class AuthenticationService {
1324
1325
  this.store.dispatch(AuthActions.setCurrentProvider({
1325
1326
  currentProvider: authenticatedConfig.configId
1326
1327
  }));
1327
- const redirect = localStorage.getItem('loginRedirectUrl');
1328
+ const redirect = this.localStorage.readLocal('loginRedirectUrl');
1328
1329
  //const redirect = this.cookiesService.getCookie('loginRedirectUrl');
1329
1330
  this.logger.info(`Correct provider dispatched, redirectUrl: ${redirect}`);
1330
1331
  if (redirect) {
1331
- localStorage.removeItem('loginRedirectUrl');
1332
+ this.localStorage.removeLocal('loginRedirectUrl');
1332
1333
  // this.cookiesService.deleteCookie('loginRedirectUrl');
1333
1334
  // setTimeout to prevent NavigationCancel
1334
1335
  // this allows current angular navigation cycle (handle URL with code/state) to complete
@@ -1361,7 +1362,7 @@ class AuthenticationService {
1361
1362
  login(targetUrl) {
1362
1363
  const returnUrl = targetUrl || this.router.url || '/';
1363
1364
  // this.cookiesService.setCookie('loginRedirectUrl', returnUrl, 1);
1364
- localStorage.setItem('loginRedirectUrl', returnUrl);
1365
+ this.localStorage.writeLocal('loginRedirectUrl', returnUrl);
1365
1366
  this.logger.log(`call login method, loginRedirectUrl: ${returnUrl}`);
1366
1367
  // electron
1367
1368
  if (typeof (process) !== 'undefined' &&
@@ -1419,7 +1420,7 @@ class AuthenticationService {
1419
1420
  matchRoles(roles) {
1420
1421
  return this.accessToken$.pipe(map(token => this.parseJwtService.parseJwt(token)), map(payload => payload['roles']), map(userRoles => roles.some(role => userRoles.includes(role))));
1421
1422
  }
1422
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthenticationService, deps: [{ token: i1$5.OidcSecurityService }, { token: CookiesService }, { token: i2.Router }, { token: ParseJwtService }, { token: i1$1.Store }, { token: AppLoggerService }, { token: RLB_CFG_ENV, optional: true }, { token: RLB_CFG_AUTH, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1423
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthenticationService, deps: [{ token: i1$5.OidcSecurityService }, { token: CookiesService }, { token: i2.Router }, { token: ParseJwtService }, { token: i1$1.Store }, { token: AppLoggerService }, { token: AppStorageService }, { token: RLB_CFG_ENV, optional: true }, { token: RLB_CFG_AUTH, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1423
1424
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthenticationService, providedIn: 'root' }); }
1424
1425
  }
1425
1426
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AuthenticationService, decorators: [{
@@ -1427,7 +1428,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
1427
1428
  args: [{
1428
1429
  providedIn: 'root'
1429
1430
  }]
1430
- }], ctorParameters: () => [{ type: i1$5.OidcSecurityService }, { type: CookiesService }, { type: i2.Router }, { type: ParseJwtService }, { type: i1$1.Store }, { type: AppLoggerService }, { type: undefined, decorators: [{
1431
+ }], ctorParameters: () => [{ type: i1$5.OidcSecurityService }, { type: CookiesService }, { type: i2.Router }, { type: ParseJwtService }, { type: i1$1.Store }, { type: AppLoggerService }, { type: AppStorageService }, { type: undefined, decorators: [{
1431
1432
  type: Optional
1432
1433
  }, {
1433
1434
  type: Inject,
@@ -3003,10 +3004,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
3003
3004
  }]
3004
3005
  }] });
3005
3006
 
3006
- function authInitializer(authService) {
3007
- return () => authService.checkAuthMultiple();
3008
- }
3009
-
3010
3007
  const verifyDeactivate = (component, currentRoute, currentState, nextState) => {
3011
3008
  return component.verifyDeactivate();
3012
3009
  };
@@ -3030,6 +3027,13 @@ function provideRlbConfig(env) {
3030
3027
  enabled: !isDevMode(),
3031
3028
  registrationStrategy: 'registerWhenStable:15000',
3032
3029
  }),
3030
+ provideAppInitializer(() => {
3031
+ inject(AppsService);
3032
+ }),
3033
+ provideAppInitializer(() => {
3034
+ const authService = inject(AuthenticationService);
3035
+ return authService.checkAuthMultiple();
3036
+ }),
3033
3037
  { provide: RLB_CFG, useValue: env },
3034
3038
  { provide: RLB_CFG_ENV, useValue: env.environment },
3035
3039
  { provide: RLB_CFG_CMS, useValue: env.cms },
@@ -3052,12 +3056,18 @@ function provideRlbConfig(env) {
3052
3056
  },
3053
3057
  multi: true,
3054
3058
  },
3055
- {
3056
- provide: APP_INITIALIZER,
3057
- useFactory: authInitializer,
3058
- deps: [AuthenticationService],
3059
- multi: true
3060
- },
3059
+ // {
3060
+ // provide: APP_INITIALIZER,
3061
+ // useFactory: authInitializer,
3062
+ // deps: [AuthenticationService],
3063
+ // multi: true
3064
+ // },
3065
+ // {
3066
+ // provide: APP_INITIALIZER,
3067
+ // useFactory: appsServiceInitializer,
3068
+ // deps: [AppsService],
3069
+ // multi: true
3070
+ // },
3061
3071
  ];
3062
3072
  }
3063
3073
  function provideApp(app) {
@@ -3069,7 +3079,7 @@ function provideApp(app) {
3069
3079
  }, multi: true
3070
3080
  },];
3071
3081
  if (app.routes) {
3072
- providers.push(provideRouter(app.routes, withDebugTracing()));
3082
+ providers.push(provideRouter(app.routes));
3073
3083
  }
3074
3084
  if (app.providers) {
3075
3085
  providers.push(...app.providers);