ng-easycommerce-v18 0.3.18-beta.1 → 0.3.18-beta.2

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.
@@ -8,11 +8,18 @@ export declare class RuntimeConfigService {
8
8
  private configSubject;
9
9
  config$: Observable<RuntimeConfig | null>;
10
10
  private _config;
11
+ private _loadPromise;
12
+ private _isLoaded;
11
13
  constructor(platformId: Object, http: HttpClient);
12
14
  /**
13
- * Carga la configuración en runtime
15
+ * Inicialización única - llamada por APP_INITIALIZER
16
+ * Garantiza que la configuración se carga solo una vez al inicio
17
+ */
18
+ initialize(): Promise<RuntimeConfig>;
19
+ /**
20
+ * Carga la configuración en runtime (optimizada para una sola carga)
14
21
  * - En SSR: Lee desde el objeto window inyectado por el servidor
15
- * - En Browser: Hace petición HTTP a /runtime-config.json
22
+ * - En Browser: Hace petición HTTP a /runtime-config.json (solo si no está en window)
16
23
  */
17
24
  loadConfig(): Observable<RuntimeConfig>;
18
25
  /**
@@ -1 +1,2 @@
1
1
  export * from './auth.interceptor';
2
+ export * from './runtime-config.interceptor';
@@ -0,0 +1,7 @@
1
+ import { HttpInterceptorFn } from '@angular/common/http';
2
+ /**
3
+ * Interceptor que garantiza que las peticiones HTTP no se hagan hasta que
4
+ * el runtime config esté completamente cargado
5
+ * Evita que se hagan peticiones con URLs incorrectas
6
+ */
7
+ export declare const runtimeConfigInterceptor: HttpInterceptorFn;
@@ -1,8 +1,9 @@
1
1
  import { EnvironmentProviders } from '@angular/core';
2
2
  import { RuntimeConfigService } from '../ec-services/runtime-config.service';
3
3
  /**
4
- * Factory function para APP_INITIALIZER
5
- * Carga la configuración runtime antes de que Angular bootstrap la aplicación
4
+ * Factory function para APP_INITIALIZER (OPTIMIZADA)
5
+ * Carga la configuración runtime UNA SOLA VEZ antes de que Angular bootstrap la aplicación
6
+ * Evita múltiples cargas y mejora el rendimiento
6
7
  */
7
8
  export declare function initializeRuntimeConfig(runtimeConfigService: RuntimeConfigService): () => Promise<any>;
8
9
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-easycommerce-v18",
3
- "version": "0.3.18-beta.1",
3
+ "version": "0.3.18-beta.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^18.2.0",
6
6
  "@angular/core": "^18.2.0"