ng-easycommerce-v18 0.3.19-beta.1 → 0.3.19-beta.3

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/README.md +15 -0
  2. package/esm2022/lib/constants/api.constants.service.mjs +19 -15
  3. package/esm2022/lib/constants/core.constants.service.mjs +12 -6
  4. package/esm2022/lib/ec-components/abstractions-components/menu-ec.component.mjs +17 -1
  5. package/esm2022/lib/ec-components/auth-ec/login-form-ec/login-form-ec.component.mjs +26 -16
  6. package/esm2022/lib/ec-components/auth-ec/password-reset-ec/password-reset-ec.component.mjs +25 -21
  7. package/esm2022/lib/ec-components/blocks-ec/block-products-ec/block-products-ec.component.mjs +7 -16
  8. package/esm2022/lib/ec-components/filters-ec/filters-ec.component.mjs +36 -7
  9. package/esm2022/lib/ec-components/header-ec/header-ec.component.mjs +41 -25
  10. package/esm2022/lib/ec-components/product-detail-ec/product-detail-ec.component.mjs +12 -7
  11. package/esm2022/lib/ec-components/stores-ec/stores-ec.component.mjs +18 -9
  12. package/esm2022/lib/ec-components/widgets-ec/decidir-ec/decidir-ec.component.mjs +12 -6
  13. package/esm2022/lib/ec-components/widgets-ec/magnizoom-ec/magnizoom-ec.component.mjs +6 -4
  14. package/esm2022/lib/ec-services/analytics/google-analytics.service.mjs +4 -4
  15. package/esm2022/lib/ec-services/analytics/gtm.service.mjs +10 -6
  16. package/esm2022/lib/ec-services/analytics/metricool-pixel.service.mjs +17 -18
  17. package/esm2022/lib/ec-services/base-api.service.mjs +148 -0
  18. package/esm2022/lib/ec-services/checkout.service.mjs +4 -2
  19. package/esm2022/lib/ec-services/index.mjs +3 -1
  20. package/esm2022/lib/ec-services/runtime-config.service.mjs +181 -0
  21. package/esm2022/lib/interceptors/index.mjs +2 -1
  22. package/esm2022/lib/interceptors/runtime-config.interceptor.mjs +41 -0
  23. package/esm2022/lib/interfaces/environment.mjs +1 -1
  24. package/esm2022/lib/interfaces/filter.mjs +1 -1
  25. package/esm2022/lib/interfaces/index.mjs +2 -1
  26. package/esm2022/lib/interfaces/options.mjs +1 -1
  27. package/esm2022/lib/interfaces/runtime-config.mjs +2 -0
  28. package/esm2022/lib/providers/index.mjs +2 -1
  29. package/esm2022/lib/providers/provideRuntimeConfig.mjs +42 -0
  30. package/fesm2022/ng-easycommerce-v18.mjs +709 -211
  31. package/fesm2022/ng-easycommerce-v18.mjs.map +1 -1
  32. package/lib/constants/api.constants.service.d.ts +1 -0
  33. package/lib/constants/core.constants.service.d.ts +5 -1
  34. package/lib/ec-components/abstractions-components/menu-ec.component.d.ts +12 -0
  35. package/lib/ec-components/auth-ec/login-form-ec/login-form-ec.component.d.ts +2 -0
  36. package/lib/ec-components/filters-ec/filters-ec.component.d.ts +12 -4
  37. package/lib/ec-services/analytics/gtm.service.d.ts +1 -1
  38. package/lib/ec-services/base-api.service.d.ts +64 -0
  39. package/lib/ec-services/index.d.ts +2 -0
  40. package/lib/ec-services/runtime-config.service.d.ts +63 -0
  41. package/lib/interceptors/index.d.ts +1 -0
  42. package/lib/interceptors/runtime-config.interceptor.d.ts +7 -0
  43. package/lib/interfaces/environment.d.ts +1 -0
  44. package/lib/interfaces/filter.d.ts +1 -0
  45. package/lib/interfaces/index.d.ts +1 -0
  46. package/lib/interfaces/options.d.ts +2 -0
  47. package/lib/interfaces/runtime-config.d.ts +22 -0
  48. package/lib/providers/index.d.ts +1 -0
  49. package/lib/providers/provideRuntimeConfig.d.ts +13 -0
  50. package/package.json +1 -1
@@ -7,6 +7,7 @@ import * as i0 from "@angular/core";
7
7
  export declare class ApiConstantsService {
8
8
  private _localStorage;
9
9
  private _translate;
10
+ private _runtimeConfig;
10
11
  /**
11
12
  * Contiene los datos provisto por el frontend en el archivo environment.ts
12
13
  */
@@ -18,7 +18,7 @@ export declare class CoreConstantsService {
18
18
  /**
19
19
  * Document token para acceso SSR-compatible al documento
20
20
  */
21
- private document;
21
+ private _document;
22
22
  /**
23
23
  * Contiene los datos provisto por el frontend en el archivo environment.ts
24
24
  */
@@ -27,6 +27,10 @@ export declare class CoreConstantsService {
27
27
  * Guarda la variable window del web browser.
28
28
  */
29
29
  private window?;
30
+ /**
31
+ * Getter seguro para document que verifica la plataforma
32
+ */
33
+ private get document();
30
34
  constructor();
31
35
  /**
32
36
  * Path usado en las colecciones de productos.
@@ -75,6 +75,18 @@ export declare class MenuEcComponent {
75
75
  * @returns true si la categoría es visible, false en caso contrario
76
76
  */
77
77
  hasVisibleProperty(category: Category): boolean;
78
+ private filterVisibleTree;
79
+ categoriesVisible$: Observable<Category[]>;
80
+ sectionsVisible$: Observable<Section[]>;
81
+ attributesVisible$: Observable<Attribute[]>;
82
+ getVisibleChildren<T extends {
83
+ isVisible?: boolean;
84
+ children?: T[];
85
+ }>(node?: T): T[];
86
+ hasVisibleChildren<T extends {
87
+ isVisible?: boolean;
88
+ children?: T[];
89
+ }>(node?: T): boolean;
78
90
  static ɵfac: i0.ɵɵFactoryDeclaration<MenuEcComponent, never>;
79
91
  static ɵcmp: i0.ɵɵComponentDeclaration<MenuEcComponent, "lib-footer-ec", never, {}, {}, never, never, true, never>;
80
92
  }
@@ -2,10 +2,12 @@ import { EventEmitter } from '@angular/core';
2
2
  import { UserRoleType } from '../../../interfaces';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class LoginFormEcComponent {
5
+ private platformId;
5
6
  private _authService;
6
7
  private _formBuilder;
7
8
  private _toastService;
8
9
  private _router;
10
+ constructor(platformId: Object);
9
11
  showPassword: boolean;
10
12
  /**
11
13
  * Parametro para indicar si tras loguear
@@ -31,11 +31,19 @@ export declare class FiltersEcComponent {
31
31
  scrollUp: () => boolean;
32
32
  hasAppliedFilters(): boolean;
33
33
  /**
34
- * Verifica si una categoría tiene la propiedad isVisible y está marcada como visible
35
- * @param category - La categoría a verificar
36
- * @returns true si la categoría es visible, false en caso contrario
37
- */
34
+ * Verifica si una categoría tiene la propiedad isVisible y está marcada como visible
35
+ * @param category - La categoría a verificar
36
+ * @returns true si la categoría es visible, false en caso contrario
37
+ */
38
38
  hasVisibleProperty(category: FilterElement): boolean;
39
+ /** Lista visible (filtra recursivo por isVisible) */
40
+ getVisibleData(filter: Filter | null): FilterElement[];
41
+ /** Children visibles de un nodo */
42
+ getVisibleChildren(node?: FilterElement): FilterElement[];
43
+ /** Tiene hijos visibles? */
44
+ hasVisibleChildren(node?: FilterElement): boolean;
45
+ /** Utilidad recursiva */
46
+ private filterVisibleTree;
39
47
  static ɵfac: i0.ɵɵFactoryDeclaration<FiltersEcComponent, never>;
40
48
  static ɵcmp: i0.ɵɵComponentDeclaration<FiltersEcComponent, "lib-filters-ec", never, { "setSelect": { "alias": "setSelect"; "required": false; }; }, {}, never, never, true, never>;
41
49
  }
@@ -23,6 +23,7 @@ export declare class GTMService {
23
23
  private window?;
24
24
  private rendererFactory;
25
25
  private document;
26
+ private platformId;
26
27
  /**
27
28
  * Servicio de ruteo de angular.
28
29
  */
@@ -31,7 +32,6 @@ export declare class GTMService {
31
32
  * Configuración de Google Tag Manager.
32
33
  */
33
34
  private config;
34
- private platformId;
35
35
  constructor();
36
36
  /**
37
37
  * Obtiene el dataLayer del objecto window
@@ -0,0 +1,64 @@
1
+ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { RuntimeConfigService } from './runtime-config.service';
4
+ import * as i0 from "@angular/core";
5
+ export interface ApiRequestOptions {
6
+ headers?: HttpHeaders | {
7
+ [header: string]: string | string[];
8
+ };
9
+ params?: HttpParams | {
10
+ [param: string]: string | string[];
11
+ };
12
+ withCredentials?: boolean;
13
+ }
14
+ /**
15
+ * Servicio base para realizar peticiones HTTP usando configuración dinámica
16
+ * Todos los servicios de la aplicación deben extender este servicio o usar sus métodos
17
+ */
18
+ export declare class BaseApiService {
19
+ protected http: HttpClient;
20
+ protected runtimeConfigService: RuntimeConfigService;
21
+ constructor(http: HttpClient, runtimeConfigService: RuntimeConfigService);
22
+ /**
23
+ * Construye una URL completa usando la API_URL del runtime
24
+ */
25
+ protected buildApiUrl(endpoint: string): string;
26
+ /**
27
+ * Obtiene headers comunes que incluyen información del runtime
28
+ */
29
+ protected getCommonHeaders(): HttpHeaders;
30
+ /**
31
+ * Método GET genérico
32
+ */
33
+ get<T>(endpoint: string, options?: ApiRequestOptions): Observable<T>;
34
+ /**
35
+ * Método POST genérico
36
+ */
37
+ post<T>(endpoint: string, data: any, options?: ApiRequestOptions): Observable<T>;
38
+ /**
39
+ * Método PUT genérico
40
+ */
41
+ put<T>(endpoint: string, data: any, options?: ApiRequestOptions): Observable<T>;
42
+ /**
43
+ * Método PATCH genérico
44
+ */
45
+ patch<T>(endpoint: string, data: any, options?: ApiRequestOptions): Observable<T>;
46
+ /**
47
+ * Método DELETE genérico
48
+ */
49
+ delete<T>(endpoint: string, options?: ApiRequestOptions): Observable<T>;
50
+ /**
51
+ * Método para peticiones que necesitan esperar a que la config esté cargada
52
+ */
53
+ getWithConfig<T>(endpoint: string, options?: ApiRequestOptions): Observable<T>;
54
+ /**
55
+ * Método para POST que necesitan esperar a que la config esté cargada
56
+ */
57
+ postWithConfig<T>(endpoint: string, data: any, options?: ApiRequestOptions): Observable<T>;
58
+ /**
59
+ * Combina headers personalizados con los headers comunes
60
+ */
61
+ private mergeHeaders;
62
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaseApiService, never>;
63
+ static ɵprov: i0.ɵɵInjectableDeclaration<BaseApiService>;
64
+ }
@@ -24,3 +24,5 @@ export * from './order-utility.service';
24
24
  export * from './payment.service';
25
25
  export * from './test.service';
26
26
  export * from './orders.service';
27
+ export * from './runtime-config.service';
28
+ export * from './base-api.service';
@@ -0,0 +1,63 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { RuntimeConfig } from '../interfaces/runtime-config';
4
+ import * as i0 from "@angular/core";
5
+ export declare class RuntimeConfigService {
6
+ private platformId;
7
+ private http;
8
+ private configSubject;
9
+ config$: Observable<RuntimeConfig | null>;
10
+ private _config;
11
+ private _loadPromise;
12
+ private _isLoaded;
13
+ constructor(platformId: Object, http: HttpClient);
14
+ /**
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)
21
+ * - En SSR: Lee desde el objeto window inyectado por el servidor
22
+ * - En Browser: Hace petición HTTP a /runtime-config.json (solo si no está en window)
23
+ */
24
+ loadConfig(): Observable<RuntimeConfig>;
25
+ /**
26
+ * Obtiene la configuración actual (síncrono)
27
+ */
28
+ getConfig(): RuntimeConfig | null;
29
+ /**
30
+ * Obtiene la API URL actual
31
+ */
32
+ getApiUrl(): string;
33
+ /**
34
+ * Obtiene la Frontend URL actual
35
+ */
36
+ getFrontendUrl(): string | undefined;
37
+ /**
38
+ * Obtiene el entorno actual
39
+ */
40
+ getAppEnv(): string;
41
+ /**
42
+ * Verifica si estamos en producción
43
+ */
44
+ isProduction(): boolean;
45
+ /**
46
+ * Obtiene el locale actual
47
+ */
48
+ getLocale(): string;
49
+ /**
50
+ * Obtiene el canal actual
51
+ */
52
+ getChannel(): string;
53
+ /**
54
+ * Método helper para construir URLs de API
55
+ */
56
+ buildApiUrl(endpoint: string): string;
57
+ /**
58
+ * Método helper para construir URLs del frontend
59
+ */
60
+ buildFrontendUrl(path: string): string;
61
+ static ɵfac: i0.ɵɵFactoryDeclaration<RuntimeConfigService, never>;
62
+ static ɵprov: i0.ɵɵInjectableDeclaration<RuntimeConfigService>;
63
+ }
@@ -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;
@@ -4,4 +4,5 @@ export interface Environment {
4
4
  frontendUrl?: string;
5
5
  locale: string;
6
6
  channel: string;
7
+ appEnv?: string;
7
8
  }
@@ -20,6 +20,7 @@ export interface FilterElement {
20
20
  title: string;
21
21
  type: ElementType;
22
22
  code: string;
23
+ isVisible?: boolean;
23
24
  multi?: boolean;
24
25
  children?: FilterElement[];
25
26
  shape?: FilterShape;
@@ -16,3 +16,4 @@ export * from './coupon';
16
16
  export * from './step';
17
17
  export * from './checkout';
18
18
  export * from './faqs';
19
+ export * from './runtime-config';
@@ -4,6 +4,7 @@ export interface Category {
4
4
  slug: string;
5
5
  position: number;
6
6
  path: string;
7
+ isVisible?: boolean;
7
8
  children?: Category[];
8
9
  images?: any[];
9
10
  }
@@ -23,4 +24,5 @@ export interface Attribute {
23
24
  slug: string;
24
25
  useToFilter: boolean;
25
26
  styles?: any[];
27
+ isVisible?: boolean;
26
28
  }
@@ -0,0 +1,22 @@
1
+ export interface RuntimeConfig {
2
+ apiUrl: string;
3
+ frontendUrl?: string;
4
+ /** Ambiente de la aplicación. Valores válidos: 'prod', 'preprod', 'test' */
5
+ appEnv: 'prod' | 'preprod' | 'test';
6
+ production: boolean;
7
+ locale: string;
8
+ channel: string;
9
+ port?: number;
10
+ host?: string;
11
+ }
12
+ export interface ServerEnvironmentVariables {
13
+ API_URL?: string;
14
+ FRONTEND_URL?: string;
15
+ /** Ambiente de la aplicación. Valores válidos: 'prod', 'preprod', 'test' */
16
+ APP_ENV?: 'prod' | 'preprod' | 'test';
17
+ PORT?: string;
18
+ HOST?: string;
19
+ NODE_ENV?: 'development' | 'production';
20
+ LOCALE?: string;
21
+ CHANNEL?: string;
22
+ }
@@ -1 +1,2 @@
1
1
  export * from './provideEnvironment';
2
+ export * from './provideRuntimeConfig';
@@ -0,0 +1,13 @@
1
+ import { EnvironmentProviders } from '@angular/core';
2
+ import { RuntimeConfigService } from '../ec-services/runtime-config.service';
3
+ /**
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
7
+ */
8
+ export declare function initializeRuntimeConfig(runtimeConfigService: RuntimeConfigService): () => Promise<any>;
9
+ /**
10
+ * Función que configura el RuntimeConfigService y su inicialización
11
+ * Debe ser usado en app.config.ts junto con provideEnvironment
12
+ */
13
+ export declare function provideRuntimeConfig(): EnvironmentProviders;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-easycommerce-v18",
3
- "version": "0.3.19-beta.1",
3
+ "version": "0.3.19-beta.3",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^18.2.0",
6
6
  "@angular/core": "^18.2.0"