ng-easycommerce-v18 0.3.13 → 0.3.14-beta.10

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 (41) hide show
  1. package/README.md +21 -0
  2. package/esm2022/lib/classes/filters/filter.mjs +27 -2
  3. package/esm2022/lib/constants/api.constants.service.mjs +42 -44
  4. package/esm2022/lib/constants/core.constants.service.mjs +2 -2
  5. package/esm2022/lib/ec-components/abstractions-components/menu-ec.component.mjs +17 -1
  6. package/esm2022/lib/ec-components/auth-ec/login-form-ec/login-form-ec.component.mjs +15 -12
  7. package/esm2022/lib/ec-components/auth-ec/password-reset-ec/password-reset-ec.component.mjs +7 -2
  8. package/esm2022/lib/ec-components/blocks-ec/block-products-ec/block-products-ec.component.mjs +5 -3
  9. package/esm2022/lib/ec-components/checkout-ec/payment-ec/payment-methods/mp-redirect-ec/mp-redirect-ec.component.mjs +141 -75
  10. package/esm2022/lib/ec-components/filters-ec/filters-ec.component.mjs +30 -5
  11. package/esm2022/lib/ec-components/header-ec/header-ec.component.mjs +32 -23
  12. package/esm2022/lib/ec-components/product-detail-ec/product-detail-ec.component.mjs +11 -10
  13. package/esm2022/lib/ec-components/related-products-ec/related-products-ec.component.mjs +6 -4
  14. package/esm2022/lib/ec-components/stores-ec/stores-ec.component.mjs +21 -6
  15. package/esm2022/lib/ec-components/widgets-ec/decidir-ec/decidir-ec.component.mjs +5 -3
  16. package/esm2022/lib/ec-components/widgets-ec/magnizoom-ec/magnizoom-ec.component.mjs +4 -2
  17. package/esm2022/lib/ec-components/widgets-ec/redsys-catch-ec/redsys-catch-ec.component.mjs +135 -80
  18. package/esm2022/lib/ec-services/analytics/facebook-pixel.service.mjs +4 -2
  19. package/esm2022/lib/ec-services/analytics/google-analytics.service.mjs +7 -3
  20. package/esm2022/lib/ec-services/analytics/gtm.service.mjs +6 -3
  21. package/esm2022/lib/ec-services/analytics/metricool-pixel.service.mjs +4 -2
  22. package/esm2022/lib/ec-services/local-storage.service.mjs +21 -7
  23. package/esm2022/lib/ec-services/ngx-local-storage.service.mjs +24 -7
  24. package/esm2022/lib/ec-services/options.service.mjs +27 -3
  25. package/esm2022/lib/interfaces/filter.mjs +1 -1
  26. package/esm2022/lib/interfaces/options.mjs +1 -1
  27. package/fesm2022/ng-easycommerce-v18.mjs +603 -316
  28. package/fesm2022/ng-easycommerce-v18.mjs.map +1 -1
  29. package/lib/constants/api.constants.service.d.ts +13 -24
  30. package/lib/ec-components/abstractions-components/menu-ec.component.d.ts +12 -0
  31. package/lib/ec-components/checkout-ec/payment-ec/payment-methods/mp-redirect-ec/mp-redirect-ec.component.d.ts +38 -16
  32. package/lib/ec-components/filters-ec/filters-ec.component.d.ts +12 -4
  33. package/lib/ec-components/header-ec/header-ec.component.d.ts +1 -1
  34. package/lib/ec-components/stores-ec/stores-ec.component.d.ts +2 -1
  35. package/lib/ec-components/widgets-ec/redsys-catch-ec/redsys-catch-ec.component.d.ts +26 -5
  36. package/lib/ec-services/local-storage.service.d.ts +4 -2
  37. package/lib/ec-services/ngx-local-storage.service.d.ts +4 -2
  38. package/lib/ec-services/options.service.d.ts +4 -0
  39. package/lib/interfaces/filter.d.ts +1 -0
  40. package/lib/interfaces/options.d.ts +2 -0
  41. package/package.json +1 -1
@@ -1,48 +1,37 @@
1
1
  import * as i0 from "@angular/core";
2
2
  /**
3
- * Servicio que provee de datos que estan relacionado con las peticiones a la API
4
- * @export
5
- * @class ApiConstantsService
3
+ * Servicio que provee de datos relacionados con las peticiones a la API
6
4
  */
7
5
  export declare class ApiConstantsService {
6
+ private ssrApiUrl;
8
7
  private _localStorage;
9
8
  private _translate;
10
- /**
11
- * Contiene los datos provisto por el frontend en el archivo environment.ts
12
- */
13
9
  private environment;
14
- /**
15
- * Canal actual del frontend
16
- */
17
- get CHANNEL(): string;
18
- set CHANNEL(value: string);
10
+ private platformId;
19
11
  private _channel;
20
- /**
21
- * Locale actual del frontend
22
- */
23
12
  LOCALE: string;
24
- /**
25
- * URL para las peticiones a shop-api
26
- */
27
13
  readonly SHOP_API_URL: string;
14
+ readonly CMS_URL: string;
15
+ constructor(ssrApiUrl: string);
28
16
  /**
29
- * URL para las peticiones a cms
17
+ * Canal actual del frontend
30
18
  */
31
- readonly CMS_URL: string;
32
- constructor();
19
+ get CHANNEL(): string;
20
+ set CHANNEL(value: string);
33
21
  /**
34
22
  * URL del backend para realizar las peticiones
35
23
  */
36
24
  get API_URL(): string;
37
25
  /**
38
- * Retorna la url base
39
- * @returns {string}
26
+ * URL base completa para shop-api con channel y locale
27
+ */
28
+ getShopApiBase(): string;
29
+ /**
30
+ * Retorna la url base general (sin shop-api)
40
31
  */
41
32
  getUrlBase(): string;
42
33
  /**
43
34
  * Cambia el canal actual
44
- * @param code
45
- * @returns
46
35
  */
47
36
  setChannel(code: string): void;
48
37
  setLocale(locale: string): void;
@@ -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
  }
@@ -1,30 +1,52 @@
1
- import { EventEmitter, OnInit } from '@angular/core';
1
+ import { EventEmitter, OnInit, OnDestroy } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
- export declare class MpRedirectEcComponent implements OnInit {
3
+ type Phase = 'idle' | 'paying' | 'finalizing';
4
+ export declare class MpRedirectEcComponent implements OnInit, OnDestroy {
4
5
  private _paymentService;
5
6
  private _toastService;
7
+ private platformId;
8
+ private finished;
6
9
  method: null;
7
10
  total_amount: number;
8
11
  allData: any;
9
- ready: EventEmitter<any>;
12
+ ready: EventEmitter<boolean>;
10
13
  protected preference: any;
11
- loading: boolean;
12
- url: any;
13
- closeModal: string;
14
- ventana: any;
15
- window?: Window;
16
- localStorage?: Storage;
17
- private platformId;
18
- constructor();
14
+ url?: string;
15
+ phase: Phase;
16
+ get isIdle(): boolean;
17
+ get isPaying(): boolean;
18
+ get isFinalizing(): boolean;
19
+ private ventana;
20
+ private windowRef?;
21
+ private sid;
22
+ private bc?;
23
+ private pollTimer?;
24
+ private pollStartedAt;
19
25
  ngOnInit(): void;
26
+ ngOnDestroy(): void;
27
+ /** Cancela manualmente el pago y finaliza el flujo con estado "cancel". */
20
28
  clickClose: () => void;
29
+ /**
30
+ * Inicia el pago abriendo `init_point` en una ventana/pestaña nueva.
31
+ * Genera un SID y lo persiste para casar la respuesta del catch.
32
+ * Si el popup es bloqueado, hace fallback navegando en la misma pestaña.
33
+ */
21
34
  iniciar: () => void;
22
- callState: () => void;
23
- processError: (err: any) => void;
35
+ private onWindowMessage;
36
+ private onStorage;
37
+ private onMpMessage;
38
+ private checkLocalStorageOnce;
39
+ /** Cierra el flujo de pago con el estado final y notifica al padre. */
40
+ private finishWithState;
41
+ private genSid;
42
+ private processError;
43
+ /** Limpia posibles residuos de estado en storages. */
24
44
  clearStorageState: () => void;
25
- getPreference: () => Promise<void>;
26
- setError: (message: any) => void;
27
- renderMP: (preference: any) => void;
45
+ /** Obtiene la preferencia e inicializa `url` (init_point). */
46
+ private getPreference;
47
+ private setError;
48
+ private renderMP;
28
49
  static ɵfac: i0.ɵɵFactoryDeclaration<MpRedirectEcComponent, never>;
29
50
  static ɵcmp: i0.ɵɵComponentDeclaration<MpRedirectEcComponent, "app-mp-redirect-ec", never, { "method": { "alias": "method"; "required": false; }; "total_amount": { "alias": "total_amount"; "required": false; }; "allData": { "alias": "allData"; "required": false; }; }, { "ready": "ready"; }, never, never, true, never>;
30
51
  }
52
+ export {};
@@ -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
  }
@@ -16,7 +16,7 @@ export declare class HeaderEcComponent extends MenuEcComponent {
16
16
  private _channelService;
17
17
  private changeDetector;
18
18
  private appRouter;
19
- private platformId;
19
+ protected platformId: Object;
20
20
  logged$: Observable<boolean>;
21
21
  isAuthenticated$: boolean;
22
22
  constructor();
@@ -9,6 +9,7 @@ export declare class StoresEcComponent extends ComponentHelper {
9
9
  storesService: StoresService;
10
10
  consts: CoreConstantsService;
11
11
  protected sanitizer: DomSanitizer;
12
+ protected platformId: Object;
12
13
  stores: BehaviorSubject<Store[]>;
13
14
  filterStores: Store[] | null;
14
15
  storesAll: Store[] | null;
@@ -21,7 +22,7 @@ export declare class StoresEcComponent extends ComponentHelper {
21
22
  private markers;
22
23
  private locations;
23
24
  ultimoElementoSeleccionado: any;
24
- constructor(storesService: StoresService, consts: CoreConstantsService, sanitizer: DomSanitizer);
25
+ constructor(storesService: StoresService, consts: CoreConstantsService, sanitizer: DomSanitizer, platformId: Object);
25
26
  ngOnInit(): void;
26
27
  updateMap(url: string): void;
27
28
  /**
@@ -3,6 +3,12 @@ import { ActivatedRoute, Router } from '@angular/router';
3
3
  import { ComponentHelper } from '../../../classes/component-helper';
4
4
  import { CheckoutService } from '../../../ec-services';
5
5
  import * as i0 from "@angular/core";
6
+ /**
7
+ * Catch genérico para redirecciones de pagos.
8
+ * - Normaliza el estado recibido por params/query.
9
+ * - Informa el resultado al opener (postMessage), BroadcastChannel y localStorage.
10
+ * - Intenta cerrarse; si el cierre falla, redirige según el estado.
11
+ */
6
12
  export declare class RedsysCatchEcComponent extends ComponentHelper implements OnInit, OnDestroy {
7
13
  activedRoute: ActivatedRoute;
8
14
  router: Router;
@@ -10,17 +16,32 @@ export declare class RedsysCatchEcComponent extends ComponentHelper implements O
10
16
  private renderer;
11
17
  private elementRef;
12
18
  private document;
19
+ private platformId;
13
20
  message: string;
14
21
  private subscription;
15
- constructor(activedRoute: ActivatedRoute, router: Router, checkoutService: CheckoutService, renderer: Renderer2, elementRef: ElementRef, document: Document);
22
+ private sid;
23
+ private bc?;
24
+ constructor(activedRoute: ActivatedRoute, router: Router, checkoutService: CheckoutService, renderer: Renderer2, elementRef: ElementRef, document: Document, platformId: any);
16
25
  ngOnInit(): void;
17
26
  ngOnDestroy(): void;
18
- private hideHeaderFooter;
19
- private showHeaderFooter;
20
- private handlePaymentState;
27
+ /** Guarda total_amount si viene desde el PSP. */
21
28
  private storeTotalAmount;
29
+ /** Setea mensaje y estado en storages. */
22
30
  private setStateInLocal;
23
- private setStateInSesion;
31
+ /** Normaliza estados heterogéneos de distintos gateways. */
32
+ private normalizeState;
33
+ /**
34
+ * Informa el resultado: postMessage al opener, BroadcastChannel y localStorage
35
+ * (este último permite polling en la pestaña madre).
36
+ */
37
+ private signalState;
38
+ /** Intenta cerrar la pestaña actual; si falla, ejecuta el callback de fallback. */
39
+ private tryCloseSelf;
40
+ /** Oculta header/footer para esta pantalla mínima. */
41
+ private hideHeaderFooter;
42
+ /** Restaura header/footer al salir. */
43
+ private showHeaderFooter;
44
+ private setStateInSession;
24
45
  static ɵfac: i0.ɵɵFactoryDeclaration<RedsysCatchEcComponent, never>;
25
46
  static ɵcmp: i0.ɵɵComponentDeclaration<RedsysCatchEcComponent, "app-redsys-catch-ec", never, {}, {}, never, never, true, never>;
26
47
  }
@@ -1,3 +1,4 @@
1
+ import { CookieService } from 'ngx-cookie-service';
1
2
  import { Storage } from '../interfaces';
2
3
  import * as i0 from "@angular/core";
3
4
  /**
@@ -10,7 +11,8 @@ export declare class LocalStorageService implements Storage {
10
11
  * Servicio usado para guardar los datos en las cookies
11
12
  */
12
13
  private _cookieService;
13
- constructor();
14
+ private platformId;
15
+ constructor(cookieService: CookieService);
14
16
  /**
15
17
  * Obtiene el item del Storage
16
18
  * @param key Clave para acceder al valor
@@ -35,6 +37,6 @@ export declare class LocalStorageService implements Storage {
35
37
  */
36
38
  clear(): void;
37
39
  key(index: number): string | null;
38
- static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageService, never>;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageService, [{ optional: true; }]>;
39
41
  static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageService>;
40
42
  }
@@ -1,4 +1,5 @@
1
1
  import { Storage } from '../interfaces';
2
+ import { StorageMap } from '@ngx-pwa/local-storage';
2
3
  import { Observable } from 'rxjs';
3
4
  import * as i0 from "@angular/core";
4
5
  /**
@@ -11,7 +12,8 @@ export declare class NgxLocalStorageService implements Storage {
11
12
  * Servicio usado para guardar los datos en el localstorage.
12
13
  */
13
14
  private _storage;
14
- constructor();
15
+ private platformId;
16
+ constructor(storage: StorageMap);
15
17
  private getItemPromise;
16
18
  /**
17
19
  * Obtiene el item del Storage
@@ -37,6 +39,6 @@ export declare class NgxLocalStorageService implements Storage {
37
39
  */
38
40
  clear(): void;
39
41
  key(index: number): string | null;
40
- static ɵfac: i0.ɵɵFactoryDeclaration<NgxLocalStorageService, never>;
42
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxLocalStorageService, [{ optional: true; }]>;
41
43
  static ɵprov: i0.ɵɵInjectableDeclaration<NgxLocalStorageService>;
42
44
  }
@@ -11,6 +11,10 @@ export declare class OptionsService {
11
11
  * Maneja las peticiones a la API
12
12
  */
13
13
  private connection;
14
+ /**
15
+ * Platform ID para verificar si estamos en el navegador
16
+ */
17
+ private platformId;
14
18
  /**
15
19
  * Constantes del core
16
20
  */
@@ -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;
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-easycommerce-v18",
3
- "version": "0.3.13",
3
+ "version": "0.3.14-beta.10",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^18.2.0",
6
6
  "@angular/core": "^18.2.0"