@osovitny/anatoly 3.20.4 → 3.20.6

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 i0 from '@angular/core';
2
2
  import { Injectable, EventEmitter, Component, Output, Input, Inject, Pipe, provideAppInitializer, inject, NgModule, Directive, ChangeDetectionStrategy, ViewChild, ViewEncapsulation, HostListener, HostBinding, APP_INITIALIZER } from '@angular/core';
3
- import { BehaviorSubject, forkJoin, Subject, filter, takeUntil, map as map$1, catchError, of, merge, timer, fromEvent, firstValueFrom } from 'rxjs';
3
+ import { BehaviorSubject, forkJoin, Subject, filter, takeUntil, map as map$1, catchError, of, merge, timer, fromEvent, firstValueFrom, lastValueFrom } from 'rxjs';
4
4
  import { map, tap, mergeMap } from 'rxjs/operators';
5
5
  import * as i1 from '@angular/common/http';
6
- import { HttpResponse, HttpClient, HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
6
+ import { HttpResponse, HttpClient, provideHttpClient, HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
7
7
  import * as i1$1 from '@angular/common';
8
8
  import { DOCUMENT, CommonModule } from '@angular/common';
9
9
  import { format, formatDistance, formatDistanceToNow } from 'date-fns';
@@ -357,7 +357,7 @@ class AppContextService extends ApiServiceBase {
357
357
  //standardJsonFilesLoaded
358
358
  this._standardJsonFilesLoaded = new BehaviorSubject(null);
359
359
  this.standardJsonFilesLoaded$ = this._standardJsonFilesLoaded.asObservable();
360
- this.baseUrl = `${ApiUrl}/appContext`;
360
+ this.baseUrl = `${ApiUrl}/app`;
361
361
  }
362
362
  //fires
363
363
  fireUpdated(data) {
@@ -2560,7 +2560,8 @@ class AnatolyHttpInterceptor {
2560
2560
  ];
2561
2561
  this.authorizationTokenExceptions = [
2562
2562
  'assets',
2563
- 'dist'
2563
+ 'dist',
2564
+ 'loadAppInitializerSettings'
2564
2565
  ];
2565
2566
  this.autoCDNSASTokenUrls = [
2566
2567
  'chunks',
@@ -2626,8 +2627,8 @@ class AnatolyHttpInterceptor {
2626
2627
  }
2627
2628
  }
2628
2629
  }
2629
- //4. appContext
2630
- if (url.indexOf('/appcontext/') > -1) {
2630
+ //4. getCurrentContext
2631
+ if (url.indexOf('getCurrentContext') > -1) {
2631
2632
  authorizationTokenRequired = this.authService.isUserAuthenticated();
2632
2633
  }
2633
2634
  // Change Url if need it -------------------------------------------->
@@ -2648,7 +2649,9 @@ class AnatolyHttpInterceptor {
2648
2649
  }
2649
2650
  //7. set ca
2650
2651
  let app = getCurrentApp();
2651
- newUrl = this.setQS(newUrl, 'ca=' + app.type);
2652
+ if (app) {
2653
+ newUrl = this.setQS(newUrl, 'ca=' + app.type);
2654
+ }
2652
2655
  //8. set new url
2653
2656
  req = req.clone({ url: newUrl });
2654
2657
  req = req.clone({ headers: req.headers.set('Accept', 'application/json') });
@@ -2729,8 +2732,8 @@ class StarterService extends ApiServiceBase {
2729
2732
  //Logging
2730
2733
  let stopwatch = new Stopwatch("@osovitny/anatoly. StarterService: getting AppContext from API");
2731
2734
  stopwatch.start();
2732
- this.baseUrl = `${ApiUrl}/appContext`;
2733
- return this.get('applicationStarting').pipe(map(data => {
2735
+ this.baseUrl = `${ApiUrl}/app`;
2736
+ return this.get('appStarting').pipe(map(data => {
2734
2737
  //Logging
2735
2738
  stopwatch.stop();
2736
2739
  stopwatch.printElapsedAsMilliseconds();
@@ -10251,6 +10254,34 @@ class SafeHtmlPipe {
10251
10254
  </file>
10252
10255
  */
10253
10256
 
10257
+ class AppService extends ApiServiceBase {
10258
+ constructor(http) {
10259
+ super(http);
10260
+ this.http = http;
10261
+ this.baseUrl = `${ApiUrl}/app`;
10262
+ }
10263
+ loadAppInitializerSettings() {
10264
+ //Logging
10265
+ let stopwatch = new Stopwatch("@osovitny/anatoly. AppService: loadAppInitializerSettings");
10266
+ stopwatch.start();
10267
+ return this.get('loadAppInitializerSettings').pipe(map$1(data => {
10268
+ //Logging
10269
+ stopwatch.stop();
10270
+ stopwatch.printElapsedAsMilliseconds();
10271
+ console.log('loadAppInitializerSettings');
10272
+ console.log(data);
10273
+ }));
10274
+ }
10275
+ static { this.ɵfac = function AppService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AppService)(i0.ɵɵinject(i1.HttpClient)); }; }
10276
+ static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AppService, factory: AppService.ɵfac, providedIn: 'root' }); }
10277
+ }
10278
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AppService, [{
10279
+ type: Injectable,
10280
+ args: [{
10281
+ providedIn: 'root'
10282
+ }]
10283
+ }], () => [{ type: i1.HttpClient }], null); })();
10284
+
10254
10285
  /*
10255
10286
  <file>
10256
10287
  Project:
@@ -10276,9 +10307,15 @@ class AnatolyCoreModule {
10276
10307
  static { this.ɵfac = function AnatolyCoreModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AnatolyCoreModule)(i0.ɵɵinject(i0.Injector)); }; }
10277
10308
  static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AnatolyCoreModule }); }
10278
10309
  static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [
10310
+ provideHttpClient(),
10311
+ provideAppInitializer(() => {
10312
+ const appService = inject(AppService);
10313
+ return lastValueFrom(appService.loadAppInitializerSettings());
10314
+ }),
10279
10315
  //Guards
10280
10316
  StarterGuard,
10281
10317
  //Services
10318
+ AppService,
10282
10319
  BrowserService,
10283
10320
  DigitalMarketingService,
10284
10321
  GoogleAnalyticsService,
@@ -10315,9 +10352,15 @@ class AnatolyCoreModule {
10315
10352
  LocalizationModule
10316
10353
  ],
10317
10354
  providers: [
10355
+ provideHttpClient(),
10356
+ provideAppInitializer(() => {
10357
+ const appService = inject(AppService);
10358
+ return lastValueFrom(appService.loadAppInitializerSettings());
10359
+ }),
10318
10360
  //Guards
10319
10361
  StarterGuard,
10320
10362
  //Services
10363
+ AppService,
10321
10364
  BrowserService,
10322
10365
  DigitalMarketingService,
10323
10366
  GoogleAnalyticsService,