ng-easycommerce-v18 0.3.18-beta.2 → 0.3.19-beta.1
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.
- package/README.md +2 -5
- package/assets/ec-i18n/en.json +1 -0
- package/assets/ec-i18n/es.json +1 -0
- package/esm2022/lib/constants/api.constants.service.mjs +15 -19
- package/esm2022/lib/ec-components/blocks-ec/block-products-ec/block-products-ec.component.mjs +2 -4
- package/esm2022/lib/ec-components/cart-ec/cart-item-ec/cart-item-ec.component.mjs +37 -9
- package/esm2022/lib/ec-components/header-ec/header-ec.component.mjs +21 -31
- package/esm2022/lib/ec-components/product-ec/product-ec.component.mjs +54 -6
- package/esm2022/lib/ec-services/analytics/google-analytics.service.mjs +2 -2
- package/esm2022/lib/ec-services/cart.service.mjs +22 -4
- package/esm2022/lib/ec-services/checkout.service.mjs +2 -4
- package/esm2022/lib/ec-services/index.mjs +1 -3
- package/esm2022/lib/ec-services/product-detail.service.mjs +11 -1
- package/esm2022/lib/interceptors/index.mjs +1 -2
- package/esm2022/lib/interfaces/environment.mjs +1 -1
- package/esm2022/lib/interfaces/index.mjs +1 -2
- package/esm2022/lib/interfaces/product.mjs +1 -1
- package/esm2022/lib/providers/index.mjs +1 -2
- package/fesm2022/ng-easycommerce-v18.mjs +223 -541
- package/fesm2022/ng-easycommerce-v18.mjs.map +1 -1
- package/lib/constants/api.constants.service.d.ts +0 -1
- package/lib/ec-components/cart-ec/cart-item-ec/cart-item-ec.component.d.ts +1 -1
- package/lib/ec-components/product-ec/product-ec.component.d.ts +4 -0
- package/lib/ec-services/cart.service.d.ts +1 -1
- package/lib/ec-services/index.d.ts +0 -2
- package/lib/interceptors/index.d.ts +0 -1
- package/lib/interfaces/environment.d.ts +0 -1
- package/lib/interfaces/index.d.ts +0 -1
- package/lib/interfaces/product.d.ts +6 -0
- package/lib/providers/index.d.ts +0 -1
- package/package.json +1 -1
- package/esm2022/lib/ec-services/base-api.service.mjs +0 -148
- package/esm2022/lib/ec-services/runtime-config.service.mjs +0 -190
- package/esm2022/lib/interceptors/runtime-config.interceptor.mjs +0 -41
- package/esm2022/lib/interfaces/runtime-config.mjs +0 -2
- package/esm2022/lib/providers/provideRuntimeConfig.mjs +0 -42
- package/lib/ec-services/base-api.service.d.ts +0 -64
- package/lib/ec-services/runtime-config.service.d.ts +0 -63
- package/lib/interceptors/runtime-config.interceptor.d.ts +0 -7
- package/lib/interfaces/runtime-config.d.ts +0 -22
- package/lib/providers/provideRuntimeConfig.d.ts +0 -13
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
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,22 +0,0 @@
|
|
|
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,13 +0,0 @@
|
|
|
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;
|