@osovitny/anatoly 3.21.27 → 3.21.29

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.
@@ -3,14 +3,14 @@ import { inject, Injectable, Inject, EventEmitter, Output, Pipe, NgModule, Input
3
3
  import { BehaviorSubject, forkJoin, Subject, filter, takeUntil, map as map$1, catchError, of, merge, timer, fromEvent, firstValueFrom } from 'rxjs';
4
4
  import { map, tap, mergeMap, finalize } from 'rxjs/operators';
5
5
  import * as i1 from '@angular/common/http';
6
- import { HttpClient, HttpBackend, HTTP_INTERCEPTORS, provideHttpClient } from '@angular/common/http';
6
+ import { HttpClient, HttpBackend, provideHttpClient } from '@angular/common/http';
7
7
  import { format, formatDistance, formatDistanceToNow } from 'date-fns';
8
8
  import js_beautify from 'js-beautify';
9
9
  import * as i1$1 from '@angular/router';
10
10
  import { NavigationEnd, NavigationStart, NavigationCancel, NavigationError, RouterModule } from '@angular/router';
11
11
  import { v4 } from 'uuid';
12
12
  import * as i4 from '@azure/msal-angular';
13
- import { MSAL_GUARD_CONFIG, MsalGuard, MsalService, MsalBroadcastService, MsalInterceptor, MSAL_INSTANCE, MSAL_INTERCEPTOR_CONFIG, MsalModule } from '@azure/msal-angular';
13
+ import { MSAL_GUARD_CONFIG, MsalGuard, MsalService, MsalBroadcastService, MSAL_INSTANCE, MsalModule } from '@azure/msal-angular';
14
14
  import { BrowserUtils, EventType, InteractionStatus, InteractionType, InteractionRequiredAuthError, PromptValue, PublicClientApplication, LogLevel } from '@azure/msal-browser';
15
15
  import * as i1$2 from '@angular/common';
16
16
  import { DOCUMENT, CommonModule } from '@angular/common';
@@ -2568,7 +2568,7 @@ class AnatolyHttpInterceptor {
2568
2568
  }
2569
2569
  //2. Check is site External?
2570
2570
  for (const i of this.externalSiteUrls) {
2571
- if (url.indexOf(this.externalSiteUrls[i]) >= 0) {
2571
+ if (url.indexOf(i.toLowerCase()) >= 0) {
2572
2572
  isExternalSite = true;
2573
2573
  break;
2574
2574
  }
@@ -2595,7 +2595,7 @@ class AnatolyHttpInterceptor {
2595
2595
  //5. Check should we add CDN SAS tokens
2596
2596
  if (isCDNEnabled) {
2597
2597
  for (const i of this.autoCDNSASTokenUrls) {
2598
- if (url.indexOf(this.autoCDNSASTokenUrls[i]) >= 0) {
2598
+ if (url.indexOf(i.toLowerCase()) >= 0) {
2599
2599
  newUrl = newUrl + cdnSasToken;
2600
2600
  break;
2601
2601
  }
@@ -2616,21 +2616,28 @@ class AnatolyHttpInterceptor {
2616
2616
  req = req.clone({ headers: req.headers.set('Accept', 'application/json') });
2617
2617
  req = req.clone({ headers: req.headers.set('Accept', 'application/text') });
2618
2618
  try {
2619
- this.onRequestStart(loadingRequired);
2620
2619
  let request$;
2620
+ let requestStarted = false;
2621
+ let handleRequest = () => {
2622
+ requestStarted = true;
2623
+ this.onRequestStart(loadingRequired);
2624
+ return this.handleHttpRequest(req, next);
2625
+ };
2621
2626
  if (authorizationTokenRequired) {
2622
2627
  request$ = this.authService.getAccessToken().pipe(mergeMap((token) => {
2623
2628
  if (token) {
2624
2629
  req = req.clone({ headers: req.headers.set('Authorization', 'Bearer ' + token) });
2625
2630
  }
2626
- return this.handleHttpRequest(req, next);
2631
+ return handleRequest();
2627
2632
  }));
2628
2633
  }
2629
2634
  else {
2630
- request$ = this.handleHttpRequest(req, next);
2635
+ request$ = handleRequest();
2631
2636
  }
2632
2637
  return request$.pipe(finalize(() => {
2633
- this.onRequestEnd(loadingRequired);
2638
+ if (requestStarted) {
2639
+ this.onRequestEnd(loadingRequired);
2640
+ }
2634
2641
  }));
2635
2642
  }
2636
2643
  catch (err) {
@@ -9262,11 +9269,6 @@ function loggerCallback(logLevel, message, containsPii) {
9262
9269
  const MSALProviders = [
9263
9270
  MsalService,
9264
9271
  MsalBroadcastService,
9265
- {
9266
- provide: HTTP_INTERCEPTORS,
9267
- useClass: MsalInterceptor,
9268
- multi: true
9269
- },
9270
9272
  {
9271
9273
  provide: MSAL_INSTANCE,
9272
9274
  useFactory: MSALInstanceFactory
@@ -9275,10 +9277,6 @@ const MSALProviders = [
9275
9277
  provide: MSAL_GUARD_CONFIG,
9276
9278
  useFactory: MSALGuardConfigFactory
9277
9279
  },
9278
- {
9279
- provide: MSAL_INTERCEPTOR_CONFIG,
9280
- useFactory: MSALInterceptorConfigFactory
9281
- },
9282
9280
  //App
9283
9281
  AuthService,
9284
9282
  AuthenticationGuard,