@abp/ng.core 7.0.0-rc.5 → 7.0.0

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 (50) hide show
  1. package/esm2020/lib/abstracts/auth.guard.mjs +17 -0
  2. package/esm2020/lib/abstracts/auth.service.mjs +42 -0
  3. package/esm2020/lib/abstracts/index.mjs +3 -1
  4. package/esm2020/lib/core.module.mjs +6 -34
  5. package/esm2020/lib/guards/index.mjs +1 -2
  6. package/esm2020/lib/interceptors/api.interceptor.mjs +11 -40
  7. package/esm2020/lib/models/auth.mjs +1 -1
  8. package/esm2020/lib/models/environment.mjs +1 -1
  9. package/esm2020/lib/models/index.mjs +2 -2
  10. package/esm2020/lib/services/index.mjs +1 -3
  11. package/esm2020/lib/tokens/check-authentication-state.mjs +3 -0
  12. package/esm2020/lib/tokens/index.mjs +4 -1
  13. package/esm2020/lib/tokens/manage-profile.token.mjs +3 -12
  14. package/esm2020/lib/tokens/pipe-to-login.token.mjs +3 -0
  15. package/esm2020/lib/tokens/set-token-response-to-storage.token.mjs +3 -0
  16. package/esm2020/lib/utils/index.mjs +1 -2
  17. package/esm2020/lib/utils/initial-utils.mjs +15 -18
  18. package/esm2020/public-api.mjs +2 -2
  19. package/fesm2015/abp-ng.core.mjs +188 -522
  20. package/fesm2015/abp-ng.core.mjs.map +1 -1
  21. package/fesm2020/abp-ng.core.mjs +188 -505
  22. package/fesm2020/abp-ng.core.mjs.map +1 -1
  23. package/lib/{guards → abstracts}/auth.guard.d.ts +3 -6
  24. package/lib/{services → abstracts}/auth.service.d.ts +17 -7
  25. package/lib/abstracts/index.d.ts +2 -0
  26. package/lib/core.module.d.ts +7 -10
  27. package/lib/guards/index.d.ts +0 -1
  28. package/lib/interceptors/api.interceptor.d.ts +7 -9
  29. package/lib/models/auth.d.ts +5 -0
  30. package/lib/models/environment.d.ts +1 -1
  31. package/lib/models/index.d.ts +1 -1
  32. package/lib/services/index.d.ts +0 -2
  33. package/lib/tokens/check-authentication-state.d.ts +3 -0
  34. package/lib/tokens/index.d.ts +3 -0
  35. package/lib/tokens/pipe-to-login.token.d.ts +3 -0
  36. package/lib/tokens/set-token-response-to-storage.token.d.ts +3 -0
  37. package/lib/utils/index.d.ts +0 -1
  38. package/lib/utils/initial-utils.d.ts +1 -170
  39. package/package.json +2 -2
  40. package/public-api.d.ts +1 -1
  41. package/esm2020/lib/guards/auth.guard.mjs +0 -29
  42. package/esm2020/lib/handlers/oauth-configuration.handler.mjs +0 -37
  43. package/esm2020/lib/services/auth.service.mjs +0 -44
  44. package/esm2020/lib/services/timeout-limited-oauth.service.mjs +0 -16
  45. package/esm2020/lib/strategies/auth-flow.strategy.mjs +0 -190
  46. package/esm2020/lib/utils/auth-utils.mjs +0 -42
  47. package/lib/handlers/oauth-configuration.handler.d.ts +0 -13
  48. package/lib/services/timeout-limited-oauth.service.d.ts +0 -7
  49. package/lib/strategies/auth-flow.strategy.d.ts +0 -393
  50. package/lib/utils/auth-utils.d.ts +0 -175
@@ -1,19 +1,17 @@
1
1
  import * as i0 from '@angular/core';
2
- import { ChangeDetectorRef, Component, Input, InjectionToken, Injectable, Inject, isDevMode, Optional, SkipSelf, Directive, EventEmitter, Output, Self, Injector, Pipe, NgModule, APP_INITIALIZER, LOCALE_ID, NgModuleFactory, Compiler, ComponentFactoryResolver, ApplicationRef, inject } from '@angular/core';
2
+ import { ChangeDetectorRef, Component, Input, Injectable, InjectionToken, Inject, isDevMode, Optional, SkipSelf, Directive, EventEmitter, Output, Self, Injector, Pipe, NgModule, APP_INITIALIZER, LOCALE_ID, NgModuleFactory, Compiler, ComponentFactoryResolver, ApplicationRef } from '@angular/core';
3
+ import { of, BehaviorSubject, Subject, throwError, Subscription, combineLatest, from, fromEvent, ReplaySubject, lastValueFrom, Observable, timer, concat } from 'rxjs';
3
4
  import * as i1$1 from '@angular/router';
4
5
  import { PRIMARY_OUTLET, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ActivatedRoute, Router, RouterModule } from '@angular/router';
5
- import { BehaviorSubject, Subject, throwError, Subscription, combineLatest, from, fromEvent, ReplaySubject, of, timer, pipe, Observable, concat } from 'rxjs';
6
- import { map, distinctUntilChanged, filter, catchError, switchMap, take, tap, debounceTime, mapTo, takeUntil, finalize, retryWhen, delay, shareReplay } from 'rxjs/operators';
6
+ import { map, distinctUntilChanged, filter, catchError, switchMap, take, tap, debounceTime, mapTo, takeUntil, retryWhen, delay, shareReplay, finalize } from 'rxjs/operators';
7
7
  import compare from 'just-compare';
8
8
  import { __rest, __awaiter } from 'tslib';
9
9
  import * as i1 from '@angular/common/http';
10
- import { HttpParams, HttpHeaders, HttpClient, HttpClientModule, HttpClientXsrfModule, HTTP_INTERCEPTORS } from '@angular/common/http';
10
+ import { HttpParams, HttpClient, HttpClientModule, HttpClientXsrfModule } from '@angular/common/http';
11
11
  import * as i5 from '@angular/common';
12
12
  import { registerLocaleData, DOCUMENT, DatePipe, DATE_PIPE_DEFAULT_TIMEZONE, CommonModule } from '@angular/common';
13
13
  import * as i1$2 from '@angular/forms';
14
14
  import { FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
15
- import * as i1$3 from 'angular-oauth2-oidc';
16
- import { OAuthStorage, OAuthService, OAuthErrorEvent, OAuthInfoEvent, OAuthModule } from 'angular-oauth2-oidc';
17
15
  import clone from 'just-clone';
18
16
 
19
17
  // Not an abstract class on purpose. Do not change!
@@ -73,6 +71,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
73
71
  type: Input
74
72
  }] } });
75
73
 
74
+ class AuthGuard {
75
+ canActivate() {
76
+ console.error('You should add @abp/ng-oauth packages or create your own auth packages.');
77
+ return false;
78
+ }
79
+ }
80
+ AuthGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
81
+ AuthGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthGuard, providedIn: 'root' });
82
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthGuard, decorators: [{
83
+ type: Injectable,
84
+ args: [{
85
+ providedIn: 'root',
86
+ }]
87
+ }] });
88
+
89
+ /**
90
+ * Abstract service for Authentication.
91
+ */
92
+ class AuthService {
93
+ constructor() { }
94
+ warningMessage() {
95
+ console.error('You should add @abp/ng-oauth packages or create your own auth packages.');
96
+ }
97
+ init() {
98
+ this.warningMessage();
99
+ return Promise.resolve(undefined);
100
+ }
101
+ login(params) {
102
+ this.warningMessage();
103
+ return of(undefined);
104
+ }
105
+ logout(queryParams) {
106
+ this.warningMessage();
107
+ return of(undefined);
108
+ }
109
+ navigateToLogin(queryParams) { }
110
+ get isInternalAuth() {
111
+ throw new Error('not implemented');
112
+ return false;
113
+ }
114
+ get isAuthenticated() {
115
+ this.warningMessage();
116
+ return false;
117
+ }
118
+ }
119
+ AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
120
+ AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthService, providedIn: 'root' });
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthService, decorators: [{
122
+ type: Injectable,
123
+ args: [{
124
+ providedIn: 'root',
125
+ }]
126
+ }], ctorParameters: function () { return []; } });
127
+
76
128
  function pushValueTo(array) {
77
129
  return (element) => {
78
130
  array.push(element);
@@ -2248,36 +2300,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
2248
2300
  args: ['click.stop']
2249
2301
  }] } });
2250
2302
 
2251
- class OAuthConfigurationHandler {
2252
- constructor(oAuthService, environmentService, options) {
2253
- this.oAuthService = oAuthService;
2254
- this.environmentService = environmentService;
2255
- this.options = options;
2256
- this.listenToSetEnvironment();
2257
- }
2258
- listenToSetEnvironment() {
2259
- this.environmentService
2260
- .createOnUpdateStream(state => state)
2261
- .pipe(map(environment => environment.oAuthConfig), filter(config => !compare(config, this.options.environment.oAuthConfig)))
2262
- .subscribe(config => {
2263
- this.oAuthService.configure(config);
2264
- });
2265
- }
2266
- }
2267
- OAuthConfigurationHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: OAuthConfigurationHandler, deps: [{ token: i1$3.OAuthService }, { token: EnvironmentService }, { token: CORE_OPTIONS }], target: i0.ɵɵFactoryTarget.Injectable });
2268
- OAuthConfigurationHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: OAuthConfigurationHandler, providedIn: 'root' });
2269
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: OAuthConfigurationHandler, decorators: [{
2270
- type: Injectable,
2271
- args: [{
2272
- providedIn: 'root',
2273
- }]
2274
- }], ctorParameters: function () {
2275
- return [{ type: i1$3.OAuthService }, { type: EnvironmentService }, { type: undefined, decorators: [{
2276
- type: Inject,
2277
- args: [CORE_OPTIONS]
2278
- }] }];
2279
- } });
2280
-
2281
2303
  class RoutesHandler {
2282
2304
  constructor(routes, router) {
2283
2305
  this.routes = routes;
@@ -2320,141 +2342,6 @@ function flatRoutes(routes, parent) {
2320
2342
  }, []);
2321
2343
  }
2322
2344
 
2323
- const TENANT_KEY = new InjectionToken('TENANT_KEY');
2324
-
2325
- function getPathName(url) {
2326
- const { pathname } = new URL(url, window.location.origin);
2327
- return pathname;
2328
- }
2329
- class WebHttpUrlEncodingCodec {
2330
- encodeKey(k) {
2331
- return encodeURIComponent(k);
2332
- }
2333
- encodeValue(v) {
2334
- return encodeURIComponent(v);
2335
- }
2336
- decodeKey(k) {
2337
- return decodeURIComponent(k);
2338
- }
2339
- decodeValue(v) {
2340
- return decodeURIComponent(v);
2341
- }
2342
- }
2343
-
2344
- const LOADER_DELAY = new InjectionToken('LOADER_DELAY');
2345
-
2346
- class HttpWaitService {
2347
- constructor(injector) {
2348
- this.store = new InternalStore({
2349
- requests: [],
2350
- filteredRequests: [],
2351
- });
2352
- this.destroy$ = new Subject();
2353
- this.delay = injector.get(LOADER_DELAY, 500);
2354
- }
2355
- getLoading() {
2356
- return !!this.applyFilter(this.store.state.requests).length;
2357
- }
2358
- getLoading$() {
2359
- return this.store
2360
- .sliceState(({ requests }) => requests)
2361
- .pipe(map(requests => !!this.applyFilter(requests).length), switchMap(condition => condition
2362
- ? this.delay === 0
2363
- ? of(true)
2364
- : timer(this.delay).pipe(mapTo(true), takeUntil(this.destroy$))
2365
- : of(false)), tap(() => this.destroy$.next()));
2366
- }
2367
- updateLoading$() {
2368
- return this.store.sliceUpdate(({ requests }) => !!this.applyFilter(requests).length);
2369
- }
2370
- clearLoading() {
2371
- this.store.patch({ requests: [] });
2372
- }
2373
- addRequest(request) {
2374
- this.store.patch({ requests: [...this.store.state.requests, request] });
2375
- }
2376
- deleteRequest(request) {
2377
- const requests = this.store.state.requests.filter(r => r !== request);
2378
- this.store.patch({ requests });
2379
- }
2380
- addFilter(request) {
2381
- const requests = Array.isArray(request) ? request : [request];
2382
- const filteredRequests = [
2383
- ...this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r))),
2384
- ...requests,
2385
- ];
2386
- this.store.patch({ filteredRequests });
2387
- }
2388
- removeFilter(request) {
2389
- const requests = Array.isArray(request) ? request : [request];
2390
- const filteredRequests = this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r)));
2391
- this.store.patch({ filteredRequests });
2392
- }
2393
- applyFilter(requests) {
2394
- const { filteredRequests } = this.store.state;
2395
- return requests.filter(({ method, url }) => !filteredRequests.find(filteredRequest => this.isSameRequest(filteredRequest, { method, endpoint: getPathName(url) })));
2396
- }
2397
- isSameRequest(filteredRequest, request) {
2398
- const { method, endpoint } = filteredRequest;
2399
- return endpoint === request.endpoint && method === request.method;
2400
- }
2401
- }
2402
- HttpWaitService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: HttpWaitService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
2403
- HttpWaitService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: HttpWaitService, providedIn: 'root' });
2404
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: HttpWaitService, decorators: [{
2405
- type: Injectable,
2406
- args: [{
2407
- providedIn: 'root',
2408
- }]
2409
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
2410
-
2411
- class ApiInterceptor {
2412
- constructor(oAuthService, sessionState, httpWaitService, tenantKey) {
2413
- this.oAuthService = oAuthService;
2414
- this.sessionState = sessionState;
2415
- this.httpWaitService = httpWaitService;
2416
- this.tenantKey = tenantKey;
2417
- }
2418
- intercept(request, next) {
2419
- this.httpWaitService.addRequest(request);
2420
- return next
2421
- .handle(request.clone({
2422
- setHeaders: this.getAdditionalHeaders(request.headers),
2423
- }))
2424
- .pipe(finalize(() => this.httpWaitService.deleteRequest(request)));
2425
- }
2426
- getAdditionalHeaders(existingHeaders) {
2427
- const headers = {};
2428
- const token = this.oAuthService.getAccessToken();
2429
- if (!(existingHeaders === null || existingHeaders === void 0 ? void 0 : existingHeaders.has('Authorization')) && token) {
2430
- headers['Authorization'] = `Bearer ${token}`;
2431
- }
2432
- const lang = this.sessionState.getLanguage();
2433
- if (!(existingHeaders === null || existingHeaders === void 0 ? void 0 : existingHeaders.has('Accept-Language')) && lang) {
2434
- headers['Accept-Language'] = lang;
2435
- }
2436
- const tenant = this.sessionState.getTenant();
2437
- if (!(existingHeaders === null || existingHeaders === void 0 ? void 0 : existingHeaders.has(this.tenantKey)) && (tenant === null || tenant === void 0 ? void 0 : tenant.id)) {
2438
- headers[this.tenantKey] = tenant.id;
2439
- }
2440
- headers['X-Requested-With'] = 'XMLHttpRequest';
2441
- return headers;
2442
- }
2443
- }
2444
- ApiInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ApiInterceptor, deps: [{ token: i1$3.OAuthService }, { token: SessionStateService }, { token: HttpWaitService }, { token: TENANT_KEY }], target: i0.ɵɵFactoryTarget.Injectable });
2445
- ApiInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ApiInterceptor, providedIn: 'root' });
2446
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ApiInterceptor, decorators: [{
2447
- type: Injectable,
2448
- args: [{
2449
- providedIn: 'root',
2450
- }]
2451
- }], ctorParameters: function () {
2452
- return [{ type: i1$3.OAuthService }, { type: SessionStateService }, { type: HttpWaitService }, { type: undefined, decorators: [{
2453
- type: Inject,
2454
- args: [TENANT_KEY]
2455
- }] }];
2456
- } });
2457
-
2458
2345
  class LocalizationPipe {
2459
2346
  constructor(localization) {
2460
2347
  this.localization = localization;
@@ -2612,277 +2499,13 @@ const LocaleProvider = {
2612
2499
  deps: [LocalizationService],
2613
2500
  };
2614
2501
 
2615
- const cookieKey = 'rememberMe';
2616
- const storageKey = 'passwordFlow';
2617
- function pipeToLogin(params, injector) {
2618
- const configState = injector.get(ConfigStateService);
2619
- const router = injector.get(Router);
2620
- return pipe(switchMap(() => configState.refreshAppState()), tap(() => {
2621
- setRememberMe(params.rememberMe);
2622
- if (params.redirectUrl)
2623
- router.navigate([params.redirectUrl]);
2624
- }));
2625
- }
2626
- function setTokenResponseToStorage(injector, tokenRes) {
2627
- const { access_token, refresh_token, scope: grantedScopes, expires_in } = tokenRes;
2628
- const storage = injector.get(OAuthStorage);
2629
- storage.setItem('access_token', access_token);
2630
- storage.setItem('refresh_token', refresh_token);
2631
- storage.setItem('access_token_stored_at', '' + Date.now());
2632
- if (grantedScopes) {
2633
- storage.setItem('granted_scopes', JSON.stringify(grantedScopes.split(' ')));
2634
- }
2635
- if (expires_in) {
2636
- const expiresInMilliSeconds = expires_in * 1000;
2637
- const now = new Date();
2638
- const expiresAt = now.getTime() + expiresInMilliSeconds;
2639
- storage.setItem('expires_at', '' + expiresAt);
2640
- }
2641
- }
2642
- function setRememberMe(remember) {
2643
- removeRememberMe();
2644
- localStorage.setItem(storageKey, 'true');
2645
- document.cookie = `${cookieKey}=true; path=/${remember ? ' ;expires=Fri, 31 Dec 9999 23:59:59 GMT' : ''}`;
2646
- }
2647
- function removeRememberMe() {
2648
- localStorage.removeItem(storageKey);
2649
- document.cookie = cookieKey + '= ; path=/; expires = Thu, 01 Jan 1970 00:00:00 GMT';
2650
- }
2651
-
2652
- const oAuthStorage = localStorage;
2653
- class AuthFlowStrategy {
2654
- constructor(injector) {
2655
- this.injector = injector;
2656
- this.catchError = err => {
2657
- this.httpErrorReporter.reportError(err);
2658
- return of(null);
2659
- };
2660
- this.httpErrorReporter = injector.get(HttpErrorReporterService);
2661
- this.environment = injector.get(EnvironmentService);
2662
- this.configState = injector.get(ConfigStateService);
2663
- this.oAuthService = injector.get(OAuthService);
2664
- this.sessionState = injector.get(SessionStateService);
2665
- this.oAuthConfig = this.environment.getEnvironment().oAuthConfig;
2666
- this.tenantKey = injector.get(TENANT_KEY);
2667
- this.listenToOauthErrors();
2668
- }
2669
- init() {
2670
- return __awaiter(this, void 0, void 0, function* () {
2671
- const shouldClear = shouldStorageClear(this.environment.getEnvironment().oAuthConfig.clientId, oAuthStorage);
2672
- if (shouldClear)
2673
- clearOAuthStorage(oAuthStorage);
2674
- this.oAuthService.configure(this.oAuthConfig);
2675
- this.oAuthService.events
2676
- .pipe(filter(event => event.type === 'token_refresh_error'))
2677
- .subscribe(() => this.navigateToLogin());
2678
- return this.oAuthService
2679
- .loadDiscoveryDocument()
2680
- .then(() => {
2681
- if (this.oAuthService.hasValidAccessToken() || !this.oAuthService.getRefreshToken()) {
2682
- return Promise.resolve();
2683
- }
2684
- return this.refreshToken();
2685
- })
2686
- .catch(this.catchError);
2687
- });
2688
- }
2689
- refreshToken() {
2690
- return this.oAuthService.refreshToken().catch(() => clearOAuthStorage());
2691
- }
2692
- listenToOauthErrors() {
2693
- this.oAuthService.events
2694
- .pipe(filter(event => event instanceof OAuthErrorEvent), tap(() => clearOAuthStorage()), switchMap(() => this.configState.refreshAppState()))
2695
- .subscribe();
2696
- }
2697
- }
2698
- class AuthCodeFlowStrategy extends AuthFlowStrategy {
2699
- constructor() {
2700
- super(...arguments);
2701
- this.isInternalAuth = false;
2702
- }
2703
- init() {
2704
- const _super = Object.create(null, {
2705
- init: { get: () => super.init }
2706
- });
2707
- return __awaiter(this, void 0, void 0, function* () {
2708
- return _super.init.call(this)
2709
- .then(() => this.oAuthService.tryLogin().catch(noop))
2710
- .then(() => this.oAuthService.setupAutomaticSilentRefresh({}, 'access_token'));
2711
- });
2712
- }
2713
- navigateToLogin(queryParams) {
2714
- this.oAuthService.initCodeFlow('', this.getCultureParams(queryParams));
2715
- }
2716
- checkIfInternalAuth(queryParams) {
2717
- this.oAuthService.initCodeFlow('', this.getCultureParams(queryParams));
2718
- return false;
2719
- }
2720
- logout(queryParams) {
2721
- return from(this.oAuthService.revokeTokenAndLogout(this.getCultureParams(queryParams)));
2722
- }
2723
- login(queryParams) {
2724
- this.oAuthService.initCodeFlow('', this.getCultureParams(queryParams));
2725
- return of(null);
2726
- }
2727
- getCultureParams(queryParams) {
2728
- const lang = this.sessionState.getLanguage();
2729
- const culture = { culture: lang, 'ui-culture': lang };
2730
- return Object.assign(Object.assign({}, (lang && culture)), queryParams);
2731
- }
2732
- }
2733
- class AuthPasswordFlowStrategy extends AuthFlowStrategy {
2734
- constructor() {
2735
- super(...arguments);
2736
- this.isInternalAuth = true;
2737
- this.cookieKey = 'rememberMe';
2738
- this.storageKey = 'passwordFlow';
2739
- }
2740
- listenToTokenExpiration() {
2741
- this.oAuthService.events
2742
- .pipe(filter(event => event instanceof OAuthInfoEvent &&
2743
- event.type === 'token_expires' &&
2744
- event.info === 'access_token'))
2745
- .subscribe(() => {
2746
- if (this.oAuthService.getRefreshToken()) {
2747
- this.refreshToken();
2748
- }
2749
- else {
2750
- this.oAuthService.logOut();
2751
- removeRememberMe();
2752
- this.configState.refreshAppState().subscribe();
2753
- }
2754
- });
2755
- }
2756
- init() {
2757
- const _super = Object.create(null, {
2758
- init: { get: () => super.init }
2759
- });
2760
- return __awaiter(this, void 0, void 0, function* () {
2761
- if (!getCookieValueByName(this.cookieKey) && localStorage.getItem(this.storageKey)) {
2762
- this.oAuthService.logOut();
2763
- }
2764
- return _super.init.call(this).then(() => this.listenToTokenExpiration());
2765
- });
2766
- }
2767
- navigateToLogin(queryParams) {
2768
- const router = this.injector.get(Router);
2769
- router.navigate(['/account/login'], { queryParams });
2770
- }
2771
- checkIfInternalAuth() {
2772
- return true;
2773
- }
2774
- login(params) {
2775
- const tenant = this.sessionState.getTenant();
2776
- return from(this.oAuthService.fetchTokenUsingPasswordFlow(params.username, params.password, new HttpHeaders(Object.assign({}, (tenant && tenant.id && { [this.tenantKey]: tenant.id }))))).pipe(this.pipeToLogin(params));
2777
- }
2778
- pipeToLogin(params) {
2779
- const router = this.injector.get(Router);
2780
- return pipe(switchMap(() => this.configState.refreshAppState()), tap(() => {
2781
- setRememberMe(params.rememberMe);
2782
- if (params.redirectUrl)
2783
- router.navigate([params.redirectUrl]);
2784
- }));
2785
- }
2786
- logout(queryParams) {
2787
- const router = this.injector.get(Router);
2788
- return from(this.oAuthService.revokeTokenAndLogout(queryParams)).pipe(switchMap(() => this.configState.refreshAppState()), tap(() => {
2789
- router.navigateByUrl('/');
2790
- removeRememberMe();
2791
- }));
2792
- }
2793
- refreshToken() {
2794
- return this.oAuthService.refreshToken().catch(() => {
2795
- clearOAuthStorage();
2796
- removeRememberMe();
2797
- });
2798
- }
2799
- }
2800
- const AUTH_FLOW_STRATEGY = {
2801
- Code(injector) {
2802
- return new AuthCodeFlowStrategy(injector);
2803
- },
2804
- Password(injector) {
2805
- return new AuthPasswordFlowStrategy(injector);
2806
- },
2807
- };
2808
- function clearOAuthStorage(storage = oAuthStorage) {
2809
- const keys = [
2810
- 'access_token',
2811
- 'id_token',
2812
- 'refresh_token',
2813
- 'nonce',
2814
- 'PKCE_verifier',
2815
- 'expires_at',
2816
- 'id_token_claims_obj',
2817
- 'id_token_expires_at',
2818
- 'id_token_stored_at',
2819
- 'access_token_stored_at',
2820
- 'granted_scopes',
2821
- 'session_state',
2822
- ];
2823
- keys.forEach(key => storage.removeItem(key));
2824
- }
2825
- function shouldStorageClear(clientId, storage) {
2826
- const key = 'abpOAuthClientId';
2827
- if (!storage.getItem(key)) {
2828
- storage.setItem(key, clientId);
2829
- return false;
2830
- }
2831
- const shouldClear = storage.getItem(key) !== clientId;
2832
- if (shouldClear)
2833
- storage.setItem(key, clientId);
2834
- return shouldClear;
2835
- }
2836
- function getCookieValueByName(name) {
2837
- const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
2838
- return match ? match[2] : '';
2839
- }
2502
+ const TENANT_KEY = new InjectionToken('TENANT_KEY');
2840
2503
 
2841
2504
  Date.prototype.toLocalISOString = function () {
2842
2505
  const timezoneOffset = this.getTimezoneOffset();
2843
2506
  return new Date(this.getTime() - timezoneOffset * 60000).toISOString();
2844
2507
  };
2845
2508
 
2846
- class AuthService {
2847
- constructor(injector) {
2848
- this.injector = injector;
2849
- }
2850
- get isInternalAuth() {
2851
- return this.strategy.isInternalAuth;
2852
- }
2853
- init() {
2854
- return __awaiter(this, void 0, void 0, function* () {
2855
- const environmentService = this.injector.get(EnvironmentService);
2856
- return environmentService
2857
- .getEnvironment$()
2858
- .pipe(map(env => env === null || env === void 0 ? void 0 : env.oAuthConfig), filter(oAuthConfig => !!oAuthConfig), tap(oAuthConfig => {
2859
- this.strategy =
2860
- oAuthConfig.responseType === 'code'
2861
- ? AUTH_FLOW_STRATEGY.Code(this.injector)
2862
- : AUTH_FLOW_STRATEGY.Password(this.injector);
2863
- }), switchMap(() => from(this.strategy.init())), take(1))
2864
- .toPromise();
2865
- });
2866
- }
2867
- logout(queryParams) {
2868
- return this.strategy.logout(queryParams);
2869
- }
2870
- navigateToLogin(queryParams) {
2871
- this.strategy.navigateToLogin(queryParams);
2872
- }
2873
- login(params) {
2874
- return this.strategy.login(params);
2875
- }
2876
- }
2877
- AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
2878
- AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthService, providedIn: 'root' });
2879
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthService, decorators: [{
2880
- type: Injectable,
2881
- args: [{
2882
- providedIn: 'root',
2883
- }]
2884
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
2885
-
2886
2509
  const APP_INIT_ERROR_HANDLERS = new InjectionToken('APP_INIT_ERROR_HANDLERS');
2887
2510
 
2888
2511
  function getRemoteEnv(injector, environment) {
@@ -3053,6 +2676,8 @@ function replaceTenantNameWithinEnvironment(injector, tenancyName, placeholder =
3053
2676
  return environmentService.setState(environment);
3054
2677
  }
3055
2678
 
2679
+ const CHECK_AUTHENTICATION_STATE_FN_KEY = new InjectionToken('CHECK_AUTHENTICATION_STATE_FN_KEY');
2680
+
3056
2681
  function getInitialData(injector) {
3057
2682
  const fn = () => __awaiter(this, void 0, void 0, function* () {
3058
2683
  const environmentService = injector.get(EnvironmentService);
@@ -3061,12 +2686,16 @@ function getInitialData(injector) {
3061
2686
  environmentService.setState(options.environment);
3062
2687
  yield getRemoteEnv(injector, options.environment);
3063
2688
  yield parseTenantFromUrl(injector);
3064
- yield injector.get(AuthService).init();
2689
+ const authService = injector.get(AuthService, undefined, { optional: true });
2690
+ const checkAuthenticationState = injector.get(CHECK_AUTHENTICATION_STATE_FN_KEY, noop, {
2691
+ optional: true,
2692
+ });
2693
+ if (authService) {
2694
+ yield authService.init();
2695
+ }
3065
2696
  if (options.skipGetAppConfiguration)
3066
2697
  return;
3067
- return configState
3068
- .refreshAppState()
3069
- .pipe(tap(() => checkAccessToken(injector)), tap(() => {
2698
+ const result$ = configState.refreshAppState().pipe(tap(() => checkAuthenticationState(injector)), tap(() => {
3070
2699
  const currentTenant = configState.getOne('currentTenant');
3071
2700
  injector.get(SessionStateService).setTenant(currentTenant);
3072
2701
  }), catchError(error => {
@@ -3075,18 +2704,11 @@ function getInitialData(injector) {
3075
2704
  appInitErrorHandlers.forEach(func => func(error));
3076
2705
  }
3077
2706
  return throwError(error);
3078
- }))
3079
- .toPromise();
2707
+ }));
2708
+ yield lastValueFrom(result$);
3080
2709
  });
3081
2710
  return fn;
3082
2711
  }
3083
- function checkAccessToken(injector) {
3084
- const configState = injector.get(ConfigStateService);
3085
- const oAuth = injector.get(OAuthService);
3086
- if (oAuth.hasValidAccessToken() && !configState.getDeep('currentUser.id')) {
3087
- clearOAuthStorage();
3088
- }
3089
- }
3090
2712
  function localeInitializer(injector) {
3091
2713
  const fn = () => {
3092
2714
  const sessionState = injector.get(SessionStateService);
@@ -3216,6 +2838,25 @@ function generatePassword(length = 8) {
3216
2838
  return password.sort(() => 0.5 - Math.random()).join('');
3217
2839
  }
3218
2840
 
2841
+ function getPathName(url) {
2842
+ const { pathname } = new URL(url, window.location.origin);
2843
+ return pathname;
2844
+ }
2845
+ class WebHttpUrlEncodingCodec {
2846
+ encodeKey(k) {
2847
+ return encodeURIComponent(k);
2848
+ }
2849
+ encodeValue(v) {
2850
+ return encodeURIComponent(v);
2851
+ }
2852
+ decodeKey(k) {
2853
+ return decodeURIComponent(k);
2854
+ }
2855
+ decodeValue(v) {
2856
+ return decodeURIComponent(v);
2857
+ }
2858
+ }
2859
+
3219
2860
  class CrossOriginStrategy {
3220
2861
  constructor(crossorigin, integrity) {
3221
2862
  this.crossorigin = crossorigin;
@@ -3335,6 +2976,73 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
3335
2976
  args: [{ providedIn: 'root' }]
3336
2977
  }] });
3337
2978
 
2979
+ const LOADER_DELAY = new InjectionToken('LOADER_DELAY');
2980
+
2981
+ class HttpWaitService {
2982
+ constructor(injector) {
2983
+ this.store = new InternalStore({
2984
+ requests: [],
2985
+ filteredRequests: [],
2986
+ });
2987
+ this.destroy$ = new Subject();
2988
+ this.delay = injector.get(LOADER_DELAY, 500);
2989
+ }
2990
+ getLoading() {
2991
+ return !!this.applyFilter(this.store.state.requests).length;
2992
+ }
2993
+ getLoading$() {
2994
+ return this.store
2995
+ .sliceState(({ requests }) => requests)
2996
+ .pipe(map(requests => !!this.applyFilter(requests).length), switchMap(condition => condition
2997
+ ? this.delay === 0
2998
+ ? of(true)
2999
+ : timer(this.delay).pipe(mapTo(true), takeUntil(this.destroy$))
3000
+ : of(false)), tap(() => this.destroy$.next()));
3001
+ }
3002
+ updateLoading$() {
3003
+ return this.store.sliceUpdate(({ requests }) => !!this.applyFilter(requests).length);
3004
+ }
3005
+ clearLoading() {
3006
+ this.store.patch({ requests: [] });
3007
+ }
3008
+ addRequest(request) {
3009
+ this.store.patch({ requests: [...this.store.state.requests, request] });
3010
+ }
3011
+ deleteRequest(request) {
3012
+ const requests = this.store.state.requests.filter(r => r !== request);
3013
+ this.store.patch({ requests });
3014
+ }
3015
+ addFilter(request) {
3016
+ const requests = Array.isArray(request) ? request : [request];
3017
+ const filteredRequests = [
3018
+ ...this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r))),
3019
+ ...requests,
3020
+ ];
3021
+ this.store.patch({ filteredRequests });
3022
+ }
3023
+ removeFilter(request) {
3024
+ const requests = Array.isArray(request) ? request : [request];
3025
+ const filteredRequests = this.store.state.filteredRequests.filter(f => !requests.some(r => this.isSameRequest(f, r)));
3026
+ this.store.patch({ filteredRequests });
3027
+ }
3028
+ applyFilter(requests) {
3029
+ const { filteredRequests } = this.store.state;
3030
+ return requests.filter(({ method, url }) => !filteredRequests.find(filteredRequest => this.isSameRequest(filteredRequest, { method, endpoint: getPathName(url) })));
3031
+ }
3032
+ isSameRequest(filteredRequest, request) {
3033
+ const { method, endpoint } = filteredRequest;
3034
+ return endpoint === request.endpoint && method === request.method;
3035
+ }
3036
+ }
3037
+ HttpWaitService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: HttpWaitService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
3038
+ HttpWaitService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: HttpWaitService, providedIn: 'root' });
3039
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: HttpWaitService, decorators: [{
3040
+ type: Injectable,
3041
+ args: [{
3042
+ providedIn: 'root',
3043
+ }]
3044
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
3045
+
3338
3046
  class ResourceWaitService {
3339
3047
  constructor() {
3340
3048
  this.store = new InternalStore({ resources: new Set() });
@@ -3563,19 +3271,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
3563
3271
  }]
3564
3272
  }] });
3565
3273
 
3566
- class TimeoutLimitedOAuthService extends OAuthService {
3567
- calcTimeout(storedAt, expiration) {
3568
- const result = super.calcTimeout(storedAt, expiration);
3569
- const MAX_TIMEOUT_DURATION = 2147483647;
3570
- return result < MAX_TIMEOUT_DURATION ? result : MAX_TIMEOUT_DURATION - 1;
3571
- }
3572
- }
3573
- TimeoutLimitedOAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: TimeoutLimitedOAuthService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
3574
- TimeoutLimitedOAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: TimeoutLimitedOAuthService });
3575
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: TimeoutLimitedOAuthService, decorators: [{
3576
- type: Injectable
3577
- }] });
3578
-
3579
3274
  class ShortDateTimePipe extends DatePipe {
3580
3275
  constructor(configStateService, locale, defaultTimezone) {
3581
3276
  super(locale, defaultTimezone);
@@ -3671,9 +3366,6 @@ const IncludeLocalizationResourcesProvider = {
3671
3366
  useValue: false,
3672
3367
  };
3673
3368
 
3674
- function storageFactory() {
3675
- return oAuthStorage;
3676
- }
3677
3369
  /**
3678
3370
  * BaseCoreModule is the module that holds
3679
3371
  * all imports, declarations, exports, and entryComponents
@@ -3699,8 +3391,7 @@ BaseCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version:
3699
3391
  ToInjectorPipe,
3700
3392
  ShortDateTimePipe,
3701
3393
  ShortTimePipe,
3702
- ShortDatePipe], imports: [OAuthModule,
3703
- CommonModule,
3394
+ ShortDatePipe], imports: [CommonModule,
3704
3395
  HttpClientModule,
3705
3396
  FormsModule,
3706
3397
  ReactiveFormsModule,
@@ -3728,8 +3419,7 @@ BaseCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version:
3728
3419
  ShortDateTimePipe,
3729
3420
  ShortTimePipe,
3730
3421
  ShortDatePipe] });
3731
- BaseCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: BaseCoreModule, providers: [LocalizationPipe], imports: [OAuthModule,
3732
- CommonModule,
3422
+ BaseCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: BaseCoreModule, providers: [LocalizationPipe], imports: [CommonModule,
3733
3423
  HttpClientModule,
3734
3424
  FormsModule,
3735
3425
  ReactiveFormsModule,
@@ -3769,7 +3459,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
3769
3459
  ShortDatePipe,
3770
3460
  ],
3771
3461
  imports: [
3772
- OAuthModule,
3773
3462
  CommonModule,
3774
3463
  HttpClientModule,
3775
3464
  FormsModule,
@@ -3806,11 +3495,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
3806
3495
  class RootCoreModule {
3807
3496
  }
3808
3497
  RootCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RootCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3809
- RootCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: RootCoreModule, imports: [BaseCoreModule, LocalizationModule,
3810
- OAuthModule, i1.HttpClientXsrfModule], exports: [BaseCoreModule, LocalizationModule] });
3498
+ RootCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: RootCoreModule, imports: [BaseCoreModule, LocalizationModule, i1.HttpClientXsrfModule], exports: [BaseCoreModule, LocalizationModule] });
3811
3499
  RootCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RootCoreModule, imports: [BaseCoreModule,
3812
3500
  LocalizationModule,
3813
- OAuthModule,
3814
3501
  HttpClientXsrfModule.withOptions({
3815
3502
  cookieName: 'XSRF-TOKEN',
3816
3503
  headerName: 'RequestVerificationToken',
@@ -3822,7 +3509,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
3822
3509
  imports: [
3823
3510
  BaseCoreModule,
3824
3511
  LocalizationModule,
3825
- OAuthModule,
3826
3512
  HttpClientXsrfModule.withOptions({
3827
3513
  cookieName: 'XSRF-TOKEN',
3828
3514
  headerName: 'RequestVerificationToken',
@@ -3838,7 +3524,6 @@ class CoreModule {
3838
3524
  return {
3839
3525
  ngModule: RootCoreModule,
3840
3526
  providers: [
3841
- OAuthModule.forRoot().providers,
3842
3527
  LocaleProvider,
3843
3528
  CookieLanguageProvider,
3844
3529
  {
@@ -3850,17 +3535,6 @@ class CoreModule {
3850
3535
  useFactory: coreOptionsFactory,
3851
3536
  deps: ['CORE_OPTIONS'],
3852
3537
  },
3853
- {
3854
- provide: HTTP_INTERCEPTORS,
3855
- useExisting: ApiInterceptor,
3856
- multi: true,
3857
- },
3858
- {
3859
- provide: APP_INITIALIZER,
3860
- multi: true,
3861
- deps: [OAuthConfigurationHandler],
3862
- useFactory: noop,
3863
- },
3864
3538
  {
3865
3539
  provide: APP_INITIALIZER,
3866
3540
  multi: true,
@@ -3885,8 +3559,6 @@ class CoreModule {
3885
3559
  deps: [RoutesHandler],
3886
3560
  useFactory: noop,
3887
3561
  },
3888
- { provide: OAuthStorage, useFactory: storageFactory },
3889
- { provide: OAuthService, useClass: TimeoutLimitedOAuthService },
3890
3562
  { provide: TENANT_KEY, useValue: options.tenantKey || '__tenant' },
3891
3563
  {
3892
3564
  provide: LOCALIZATIONS,
@@ -3894,7 +3566,7 @@ class CoreModule {
3894
3566
  useValue: localizationContributor(options.localizations),
3895
3567
  deps: [LocalizationService],
3896
3568
  },
3897
- IncludeLocalizationResourcesProvider
3569
+ IncludeLocalizationResourcesProvider,
3898
3570
  ],
3899
3571
  };
3900
3572
  }
@@ -3923,29 +3595,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
3923
3595
  }]
3924
3596
  }] });
3925
3597
 
3926
- class AuthGuard {
3927
- constructor(oauthService, authService) {
3928
- this.oauthService = oauthService;
3929
- this.authService = authService;
3930
- }
3931
- canActivate() {
3932
- const hasValidAccessToken = this.oauthService.hasValidAccessToken();
3933
- if (hasValidAccessToken) {
3934
- return true;
3935
- }
3936
- this.authService.navigateToLogin();
3937
- return false;
3938
- }
3939
- }
3940
- AuthGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthGuard, deps: [{ token: i1$3.OAuthService }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
3941
- AuthGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthGuard, providedIn: 'root' });
3942
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AuthGuard, decorators: [{
3943
- type: Injectable,
3944
- args: [{
3945
- providedIn: 'root',
3946
- }]
3947
- }], ctorParameters: function () { return [{ type: i1$3.OAuthService }, { type: AuthService }]; } });
3948
-
3949
3598
  class PermissionGuard {
3950
3599
  constructor(router, routesService, permissionService, httpErrorReporter) {
3951
3600
  this.router = router;
@@ -4398,15 +4047,11 @@ const PROJECTION_STRATEGY = {
4398
4047
  },
4399
4048
  };
4400
4049
 
4401
- const NAVIGATE_TO_MANAGE_PROFILE = new InjectionToken('NAVIGATE_TO_MANAGE_PROFILE', {
4402
- providedIn: 'root',
4403
- factory: () => {
4404
- const environment = inject(EnvironmentService);
4405
- return () => {
4406
- window.open(`${environment.getEnvironment().oAuthConfig.issuer}/Account/Manage?returnUrl=${window.location.href}`, '_self');
4407
- };
4408
- },
4409
- });
4050
+ const NAVIGATE_TO_MANAGE_PROFILE = new InjectionToken('NAVIGATE_TO_MANAGE_PROFILE');
4051
+
4052
+ const PIPE_TO_LOGIN_FN_KEY = new InjectionToken('PIPE_TO_LOGIN_FN_KEY');
4053
+
4054
+ const SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY = new InjectionToken('SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY');
4410
4055
 
4411
4056
  function validateMinAge({ age = 18 } = {}) {
4412
4057
  return (control) => {
@@ -4528,11 +4173,32 @@ const AbpValidators = {
4528
4173
  username: validateUsername,
4529
4174
  };
4530
4175
 
4176
+ class ApiInterceptor {
4177
+ constructor(httpWaitService) {
4178
+ this.httpWaitService = httpWaitService;
4179
+ }
4180
+ getAdditionalHeaders(existingHeaders) {
4181
+ return existingHeaders;
4182
+ }
4183
+ intercept(request, next) {
4184
+ this.httpWaitService.addRequest(request);
4185
+ return next.handle(request).pipe(finalize(() => this.httpWaitService.deleteRequest(request)));
4186
+ }
4187
+ }
4188
+ ApiInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ApiInterceptor, deps: [{ token: HttpWaitService }], target: i0.ɵɵFactoryTarget.Injectable });
4189
+ ApiInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ApiInterceptor, providedIn: 'root' });
4190
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ApiInterceptor, decorators: [{
4191
+ type: Injectable,
4192
+ args: [{
4193
+ providedIn: 'root',
4194
+ }]
4195
+ }], ctorParameters: function () { return [{ type: HttpWaitService }]; } });
4196
+
4531
4197
  // export * from './lib/handlers';
4532
4198
 
4533
4199
  /**
4534
4200
  * Generated bundle index. Do not edit.
4535
4201
  */
4536
4202
 
4537
- export { APP_INIT_ERROR_HANDLERS, AbpApiDefinitionService, AbpApplicationConfigurationService, AbpApplicationLocalizationService, AbpTenantService, AbpValidators, AbstractNavTreeService, AbstractNgModelComponent, AbstractTreeService, ApiInterceptor, AuditedEntityDto, AuditedEntityWithUserDto, AuthGuard, AuthService, AutofocusDirective, BaseCoreModule, BaseTreeNode, CONTAINER_STRATEGY, CONTENT_SECURITY_STRATEGY, CONTENT_STRATEGY, CONTEXT_STRATEGY, COOKIE_LANGUAGE_KEY, CORE_OPTIONS, CROSS_ORIGIN_STRATEGY, ClearContainerStrategy, ComponentContextStrategy, ComponentProjectionStrategy, ConfigStateService, ContainerStrategy, ContentProjectionService, ContentSecurityStrategy, ContentStrategy, ContextStrategy, CoreModule, CreationAuditedEntityDto, CreationAuditedEntityWithUserDto, CrossOriginStrategy, DOM_STRATEGY, DomInsertionService, DomStrategy, DynamicLayoutComponent, EntityDto, EnvironmentService, ExtensibleAuditedEntityDto, ExtensibleAuditedEntityWithUserDto, ExtensibleCreationAuditedEntityDto, ExtensibleCreationAuditedEntityWithUserDto, ExtensibleEntityDto, ExtensibleFullAuditedEntityDto, ExtensibleFullAuditedEntityWithUserDto, ExtensibleObject, ForDirective, FormSubmitDirective, FullAuditedEntityDto, FullAuditedEntityWithUserDto, HttpErrorReporterService, HttpWaitService, INCUDE_LOCALIZATION_RESOURCES_TOKEN, INJECTOR_PIPE_DATA_TOKEN, InitDirective, InputEventDebounceDirective, InsertIntoContainerStrategy, InternalStore, LIST_QUERY_DEBOUNCE_TIME, LOADER_DELAY, LOADING_STRATEGY, LOCALIZATIONS, LazyLoadService, LazyModuleFactory, LimitedResultRequestDto, ListResultDto, ListService, LoadingStrategy, LocalizationModule, LocalizationPipe, LocalizationService, LooseContentSecurityStrategy, MultiTenancyService, NAVIGATE_TO_MANAGE_PROFILE, NavigationEvent, NoContentSecurityStrategy, NoContextStrategy, NoCrossOriginStrategy, index as ObjectExtending, PROJECTION_STRATEGY, PagedAndSortedResultRequestDto, PagedResultDto, PagedResultRequestDto, PermissionDirective, PermissionGuard, PermissionService, ProjectionStrategy, ReplaceableComponentsService, ReplaceableRouteContainerComponent, ReplaceableTemplateDirective, ResourceWaitService, RestService, RootComponentProjectionStrategy, RootCoreModule, RouterEvents, RouterOutletComponent, RouterWaitService, RoutesService, ScriptContentStrategy, ScriptLoadingStrategy, SessionStateService, ShortDatePipe, ShortDateTimePipe, ShortTimePipe, SortPipe, StopPropagationDirective, StyleContentStrategy, StyleLoadingStrategy, SubscriptionService, TENANT_KEY, TemplateContextStrategy, TemplateProjectionStrategy, TimeoutLimitedOAuthService, ToInjectorPipe, TrackByService, WebHttpUrlEncodingCodec, checkAccessToken, coreOptionsFactory, createLocalizationPipeKeyGenerator, createLocalizer, createLocalizerWithFallback, createMapFromList, createTokenParser, createTreeFromList, createTreeNodeFilterCreator, deepMerge, differentLocales, downloadBlob, escapeHtmlChars, exists, featuresFactory, findRoute, fromLazyLoad, generateHash, generatePassword, getInitialData, getLocaleDirection, getPathName, getRemoteEnv, getRoutePath, getShortDateFormat, getShortDateShortTimeFormat, getShortTimeFormat, interpolate, isArray, isNode, isNullOrEmpty, isNullOrUndefined, isNumber, isObject, isObjectAndNotArray, isObjectAndNotArrayNotNode, isUndefinedOrEmptyString, localeInitializer, localizationContributor, localizations$, mapEnumToOptions, noop, parseTenantFromUrl, pipeToLogin, pushValueTo, reloadRoute, removeRememberMe, setRememberMe, setTokenResponseToStorage, storageFactory, trackBy, trackByDeep, uuid, validateCreditCard, validateMinAge, validateRange, validateRequired, validateStringLength, validateUrl };
4203
+ export { APP_INIT_ERROR_HANDLERS, AbpApiDefinitionService, AbpApplicationConfigurationService, AbpApplicationLocalizationService, AbpTenantService, AbpValidators, AbstractNavTreeService, AbstractNgModelComponent, AbstractTreeService, ApiInterceptor, AuditedEntityDto, AuditedEntityWithUserDto, AuthGuard, AuthService, AutofocusDirective, BaseCoreModule, BaseTreeNode, CHECK_AUTHENTICATION_STATE_FN_KEY, CONTAINER_STRATEGY, CONTENT_SECURITY_STRATEGY, CONTENT_STRATEGY, CONTEXT_STRATEGY, COOKIE_LANGUAGE_KEY, CORE_OPTIONS, CROSS_ORIGIN_STRATEGY, ClearContainerStrategy, ComponentContextStrategy, ComponentProjectionStrategy, ConfigStateService, ContainerStrategy, ContentProjectionService, ContentSecurityStrategy, ContentStrategy, ContextStrategy, CoreModule, CreationAuditedEntityDto, CreationAuditedEntityWithUserDto, CrossOriginStrategy, DOM_STRATEGY, DomInsertionService, DomStrategy, DynamicLayoutComponent, EntityDto, EnvironmentService, ExtensibleAuditedEntityDto, ExtensibleAuditedEntityWithUserDto, ExtensibleCreationAuditedEntityDto, ExtensibleCreationAuditedEntityWithUserDto, ExtensibleEntityDto, ExtensibleFullAuditedEntityDto, ExtensibleFullAuditedEntityWithUserDto, ExtensibleObject, ForDirective, FormSubmitDirective, FullAuditedEntityDto, FullAuditedEntityWithUserDto, HttpErrorReporterService, HttpWaitService, INCUDE_LOCALIZATION_RESOURCES_TOKEN, INJECTOR_PIPE_DATA_TOKEN, InitDirective, InputEventDebounceDirective, InsertIntoContainerStrategy, InternalStore, LIST_QUERY_DEBOUNCE_TIME, LOADER_DELAY, LOADING_STRATEGY, LOCALIZATIONS, LazyLoadService, LazyModuleFactory, LimitedResultRequestDto, ListResultDto, ListService, LoadingStrategy, LocalizationModule, LocalizationPipe, LocalizationService, LooseContentSecurityStrategy, MultiTenancyService, NAVIGATE_TO_MANAGE_PROFILE, NavigationEvent, NoContentSecurityStrategy, NoContextStrategy, NoCrossOriginStrategy, index as ObjectExtending, PIPE_TO_LOGIN_FN_KEY, PROJECTION_STRATEGY, PagedAndSortedResultRequestDto, PagedResultDto, PagedResultRequestDto, PermissionDirective, PermissionGuard, PermissionService, ProjectionStrategy, ReplaceableComponentsService, ReplaceableRouteContainerComponent, ReplaceableTemplateDirective, ResourceWaitService, RestService, RootComponentProjectionStrategy, RootCoreModule, RouterEvents, RouterOutletComponent, RouterWaitService, RoutesService, SET_TOKEN_RESPONSE_TO_STORAGE_FN_KEY, ScriptContentStrategy, ScriptLoadingStrategy, SessionStateService, ShortDatePipe, ShortDateTimePipe, ShortTimePipe, SortPipe, StopPropagationDirective, StyleContentStrategy, StyleLoadingStrategy, SubscriptionService, TENANT_KEY, TemplateContextStrategy, TemplateProjectionStrategy, ToInjectorPipe, TrackByService, WebHttpUrlEncodingCodec, coreOptionsFactory, createLocalizationPipeKeyGenerator, createLocalizer, createLocalizerWithFallback, createMapFromList, createTokenParser, createTreeFromList, createTreeNodeFilterCreator, deepMerge, differentLocales, downloadBlob, escapeHtmlChars, exists, featuresFactory, findRoute, fromLazyLoad, generateHash, generatePassword, getInitialData, getLocaleDirection, getPathName, getRemoteEnv, getRoutePath, getShortDateFormat, getShortDateShortTimeFormat, getShortTimeFormat, interpolate, isArray, isNode, isNullOrEmpty, isNullOrUndefined, isNumber, isObject, isObjectAndNotArray, isObjectAndNotArrayNotNode, isUndefinedOrEmptyString, localeInitializer, localizationContributor, localizations$, mapEnumToOptions, noop, parseTenantFromUrl, pushValueTo, reloadRoute, trackBy, trackByDeep, uuid, validateCreditCard, validateMinAge, validateRange, validateRequired, validateStringLength, validateUrl };
4538
4204
  //# sourceMappingURL=abp-ng.core.mjs.map