valtech-components 2.0.503 → 2.0.505

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,7 +1,7 @@
1
1
  /**
2
2
  * Ad Slot Component
3
3
  *
4
- * Componente standalone para mostrar ads de Google Ad Manager.
4
+ * Componente standalone para mostrar ads de Google AdSense.
5
5
  * Se integra automaticamente con el servicio de Ads y respeta consent + premium.
6
6
  *
7
7
  * @example
@@ -9,52 +9,41 @@
9
9
  * <!-- Banner basico -->
10
10
  * <val-ad-slot
11
11
  * slotId="homepage-top"
12
- * adUnitPath="/homepage/top"
13
- * size="leaderboard"
12
+ * format="horizontal"
13
+ * [fullWidth]="true"
14
14
  * />
15
15
  *
16
- * <!-- Con responsivo -->
16
+ * <!-- Rectangle ad -->
17
17
  * <val-ad-slot
18
18
  * slotId="sidebar-ad"
19
- * adUnitPath="/sidebar"
20
- * [size]="['medium-rectangle', 'half-page']"
21
- * [sizeMapping]="[
22
- * { viewportWidth: 1024, sizes: [[300, 600]] },
23
- * { viewportWidth: 768, sizes: [[300, 250]] },
24
- * { viewportWidth: 0, sizes: [[320, 50]] }
25
- * ]"
19
+ * adSlot="1234567890"
20
+ * format="rectangle"
26
21
  * />
27
22
  *
28
- * <!-- Native ad -->
23
+ * <!-- Auto format (Google decides) -->
29
24
  * <val-ad-slot
30
- * slotId="article-native"
31
- * adUnitPath="/article/native"
32
- * size="native"
33
- * [isNative]="true"
25
+ * slotId="article-ad"
26
+ * format="auto"
27
+ * [fullWidth]="true"
34
28
  * />
35
29
  * ```
36
30
  */
37
- import { OnInit, OnDestroy } from '@angular/core';
31
+ import { OnInit, OnDestroy, AfterViewInit } from '@angular/core';
38
32
  import { AdsService } from '../../../services/ads/ads.service';
39
- import { AdSlotSize, AdSlotState, SizeMapping } from '../../../services/ads/types';
33
+ import { AdFormat, AdSlotState } from '../../../services/ads/types';
40
34
  import * as i0 from "@angular/core";
41
- export declare class AdSlotComponent implements OnInit, OnDestroy {
35
+ export declare class AdSlotComponent implements OnInit, OnDestroy, AfterViewInit {
42
36
  readonly adsService: AdsService;
43
37
  private readonly platformId;
44
- /** ID unico del slot */
38
+ private readonly elementRef;
39
+ /** ID unico del slot (para tracking interno) */
45
40
  slotId: string;
46
- /** Ad unit path (sin el network ID) */
47
- adUnitPath: string;
48
- /** Tamano del ad */
49
- size: AdSlotSize | AdSlotSize[] | [number, number] | [number, number][];
50
- /** Mapping responsivo */
51
- sizeMapping?: SizeMapping[];
52
- /** Targeting especifico */
53
- targeting?: Record<string, string | string[]>;
54
- /** Colapsar si vacio */
55
- collapseEmpty: boolean;
56
- /** Es native ad */
57
- isNative: boolean;
41
+ /** Ad Slot ID de AdSense (opcional, para unidades manuales) */
42
+ adSlot?: string;
43
+ /** Formato del ad */
44
+ format: AdFormat;
45
+ /** Full width responsive */
46
+ fullWidth: boolean;
58
47
  /** CSS class adicional */
59
48
  cssClass: string;
60
49
  /** Altura minima */
@@ -63,16 +52,13 @@ export declare class AdSlotComponent implements OnInit, OnDestroy {
63
52
  showSkeleton: boolean;
64
53
  private readonly _state;
65
54
  readonly state: import("@angular/core").Signal<AdSlotState>;
55
+ private adInitialized;
66
56
  /** Indica si el componente debe renderizarse */
67
57
  readonly shouldRender: import("@angular/core").Signal<boolean>;
68
- /** Ancho del skeleton */
69
- readonly skeletonWidth: import("@angular/core").Signal<string>;
70
- /** Altura del skeleton */
71
- readonly skeletonHeight: import("@angular/core").Signal<string>;
72
58
  ngOnInit(): Promise<void>;
59
+ ngAfterViewInit(): Promise<void>;
73
60
  ngOnDestroy(): void;
74
- private initializeSlot;
75
- private getFirstSize;
61
+ private initializeAd;
76
62
  static ɵfac: i0.ɵɵFactoryDeclaration<AdSlotComponent, never>;
77
- static ɵcmp: i0.ɵɵComponentDeclaration<AdSlotComponent, "val-ad-slot", never, { "slotId": { "alias": "slotId"; "required": true; }; "adUnitPath": { "alias": "adUnitPath"; "required": true; }; "size": { "alias": "size"; "required": false; }; "sizeMapping": { "alias": "sizeMapping"; "required": false; }; "targeting": { "alias": "targeting"; "required": false; }; "collapseEmpty": { "alias": "collapseEmpty"; "required": false; }; "isNative": { "alias": "isNative"; "required": false; }; "cssClass": { "alias": "cssClass"; "required": false; }; "minHeight": { "alias": "minHeight"; "required": false; }; "showSkeleton": { "alias": "showSkeleton"; "required": false; }; }, {}, never, never, true, never>;
63
+ static ɵcmp: i0.ɵɵComponentDeclaration<AdSlotComponent, "val-ad-slot", never, { "slotId": { "alias": "slotId"; "required": true; }; "adSlot": { "alias": "adSlot"; "required": false; }; "format": { "alias": "format"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; "cssClass": { "alias": "cssClass"; "required": false; }; "minHeight": { "alias": "minHeight"; "required": false; }; "showSkeleton": { "alias": "showSkeleton"; "required": false; }; }, {}, never, never, true, never>;
78
64
  }
@@ -45,7 +45,7 @@ export declare class ArticleComponent implements OnInit {
45
45
  getVideoElement(element: ArticleElement): ArticleVideoElement;
46
46
  getCustomElement(element: ArticleElement): ArticleCustomElement;
47
47
  getQuoteTextProps(element: ArticleElement): {
48
- size: "medium" | "small" | "large" | "xlarge";
48
+ size: "small" | "medium" | "large" | "xlarge";
49
49
  color: import("@ionic/core").Color;
50
50
  content?: string;
51
51
  bold: boolean;
@@ -61,7 +61,7 @@ export declare class ArticleComponent implements OnInit {
61
61
  showQuoteMark?: boolean;
62
62
  };
63
63
  getHighlightTextProps(element: ArticleElement): {
64
- size: "medium" | "small" | "large" | "xlarge";
64
+ size: "small" | "medium" | "large" | "xlarge";
65
65
  color: import("@ionic/core").Color;
66
66
  content?: string;
67
67
  bold: boolean;
@@ -90,7 +90,7 @@ export declare class ArticleComponent implements OnInit {
90
90
  contentInterpolation?: Record<string, string | number>;
91
91
  icon?: import("valtech-components").IconMetada;
92
92
  shape?: "round";
93
- size?: "default" | "small" | "large";
93
+ size?: "small" | "large" | "default";
94
94
  fill?: "default" | "clear" | "outline" | "solid";
95
95
  type: "button" | "submit" | "reset";
96
96
  token?: string;
@@ -1,8 +1,7 @@
1
- import { ValtechAdsConfig, GPTNamespace } from './types';
2
- import { AdsConsentService } from './ads-consent.service';
1
+ import { ValtechAdsConfig } from './types';
3
2
  import * as i0 from "@angular/core";
4
3
  /**
5
- * Servicio para cargar el script de Google Publisher Tags.
4
+ * Servicio para cargar el script de Google AdSense.
6
5
  *
7
6
  * Implementa lazy loading: el script solo se carga cuando
8
7
  * se solicita renderizar el primer ad slot.
@@ -10,7 +9,6 @@ import * as i0 from "@angular/core";
10
9
  export declare class AdsLoaderService {
11
10
  private config;
12
11
  private platformId;
13
- private consentService;
14
12
  private readonly _isLoading;
15
13
  private readonly _isLoaded;
16
14
  private readonly _error;
@@ -21,26 +19,23 @@ export declare class AdsLoaderService {
21
19
  /** Error de carga (si existe) */
22
20
  readonly error: import("@angular/core").Signal<Error>;
23
21
  private loadPromise;
24
- constructor(config: ValtechAdsConfig, platformId: Object, consentService: AdsConsentService);
22
+ constructor(config: ValtechAdsConfig, platformId: Object);
25
23
  /**
26
- * Carga el script GPT de forma lazy.
27
- * Retorna la instancia de googletag o null si falla.
24
+ * Carga el script AdSense de forma lazy.
25
+ * Retorna true si se cargo correctamente, false si fallo.
28
26
  *
29
- * @returns Promise con googletag o null
27
+ * @returns Promise<boolean>
30
28
  */
31
- loadGPT(): Promise<GPTNamespace | null>;
29
+ loadAdSense(): Promise<boolean>;
32
30
  /**
33
- * Configura GPT con las opciones de la aplicacion.
31
+ * Verifica si el script AdSense esta disponible.
34
32
  */
35
- private configureGPT;
33
+ isAdSenseAvailable(): boolean;
36
34
  /**
37
- * Verifica si el script GPT esta disponible.
35
+ * Ejecuta un comando AdSense (push a la queue).
36
+ * Usado internamente para activar ad slots.
38
37
  */
39
- isGPTAvailable(): boolean;
40
- /**
41
- * Obtiene la instancia de googletag si esta cargada.
42
- */
43
- getGPT(): GPTNamespace | null;
38
+ pushAdCommand(): void;
44
39
  static ɵfac: i0.ɵɵFactoryDeclaration<AdsLoaderService, never>;
45
40
  static ɵprov: i0.ɵɵInjectableDeclaration<AdsLoaderService>;
46
41
  }
@@ -1,20 +1,20 @@
1
1
  /**
2
2
  * Ads Service
3
3
  *
4
- * Servicio principal para Google Ad Manager (GPT).
5
- * Integra con el sistema de consent existente y respeta usuarios premium.
4
+ * Servicio principal para Google AdSense.
5
+ * Integra con el sistema de auth para detectar usuarios premium.
6
6
  */
7
- import { Injector, OnDestroy } from '@angular/core';
7
+ import { OnDestroy } from '@angular/core';
8
8
  import { Router } from '@angular/router';
9
9
  import { AdsLoaderService } from './ads-loader.service';
10
- import { AdsConsentService } from './ads-consent.service';
11
- import { ValtechAdsConfig, AdSlotConfig, AdSlotState, AdEvent, GPTNamespace } from './types';
10
+ import { AuthStateService } from '../auth/auth-state.service';
11
+ import { ValtechAdsConfig, AdSlotState, AdEvent } from './types';
12
12
  import * as i0 from "@angular/core";
13
13
  /**
14
- * Servicio principal de Google Ad Manager.
14
+ * Servicio principal de Google AdSense.
15
15
  *
16
- * Maneja la creacion, destruccion y refresh de ad slots.
17
- * Integra automaticamente con consent mode y detecta usuarios premium.
16
+ * Maneja la carga del script y el estado de ads.
17
+ * Detecta automaticamente usuarios premium para ocultar ads.
18
18
  *
19
19
  * @example
20
20
  * ```typescript
@@ -31,66 +31,57 @@ import * as i0 from "@angular/core";
31
31
  * ```
32
32
  */
33
33
  export declare class AdsService implements OnDestroy {
34
- private injector;
35
34
  private config;
36
35
  private platformId;
37
36
  private router;
38
37
  private loaderService;
39
- private consentService;
40
- private readonly authStateService;
38
+ private authStateService;
41
39
  private readonly _isInitialized;
42
40
  private readonly _isEnabled;
43
41
  private readonly _isDebugMode;
44
- private readonly _slots;
45
42
  private readonly _slotStates;
46
43
  private readonly _events;
44
+ private readonly _adClient;
47
45
  /** Indica si el servicio esta inicializado */
48
46
  readonly isInitialized: import("@angular/core").Signal<boolean>;
49
- /** Indica si los ads estan habilitados (consent + no premium) */
47
+ /** Indica si los ads estan habilitados (no premium + inicializado) */
50
48
  readonly isEnabled: import("@angular/core").Signal<boolean>;
51
- /** Indica si el usuario es premium (no ve ads) - lee de AuthStateService */
49
+ /** Indica si el usuario es premium (no ve ads) */
52
50
  readonly isPremiumUser: import("@angular/core").Signal<boolean>;
53
51
  /** Indica si esta en modo debug */
54
52
  readonly isDebugMode: import("@angular/core").Signal<boolean>;
55
- /** Estado de consent para ads */
56
- readonly consentState: import("@angular/core").Signal<import("./types").AdsConsentState>;
53
+ /** Publisher ID de AdSense */
54
+ readonly adClient: import("@angular/core").Signal<string>;
57
55
  /** Eventos de ads (historial) */
58
56
  readonly events: import("@angular/core").Signal<AdEvent[]>;
59
- private activeSlots;
57
+ private activeSlotIds;
60
58
  private routerSubscription;
61
- private refreshTimerId;
62
- constructor(injector: Injector, config: ValtechAdsConfig, platformId: Object, router: Router, loaderService: AdsLoaderService, consentService: AdsConsentService);
59
+ constructor(config: ValtechAdsConfig, platformId: Object, router: Router, loaderService: AdsLoaderService, authStateService: AuthStateService);
63
60
  /**
64
61
  * Inicializa el servicio de ads.
65
62
  * Llamado automaticamente por APP_INITIALIZER.
66
- * NO carga el script GPT hasta que se necesite el primer ad.
63
+ * NO carga el script AdSense hasta que se necesite el primer ad.
67
64
  */
68
65
  initialize(): Promise<void>;
69
66
  /**
70
- * Carga el script GPT de forma lazy.
67
+ * Carga el script AdSense de forma lazy.
71
68
  * Llamado automaticamente cuando se renderiza el primer ad slot.
72
69
  */
73
- ensureGPTLoaded(): Promise<GPTNamespace | null>;
70
+ ensureAdSenseLoaded(): Promise<boolean>;
74
71
  /**
75
- * Define y muestra un ad slot.
72
+ * Registra un ad slot.
76
73
  * Llamado internamente por el componente AdSlot.
77
74
  *
78
- * @param config - Configuracion del slot
79
- * @returns ID del slot o null si no se puede mostrar
75
+ * @param slotId - ID unico del slot
76
+ * @returns true si el slot se puede mostrar
80
77
  */
81
- defineSlot(config: AdSlotConfig): Promise<string | null>;
78
+ registerSlot(slotId: string): Promise<boolean>;
82
79
  /**
83
- * Destruye un slot y libera recursos.
80
+ * Desregistra un slot.
84
81
  *
85
- * @param slotId - ID del slot a destruir
82
+ * @param slotId - ID del slot a desregistrar
86
83
  */
87
- destroySlot(slotId: string): void;
88
- /**
89
- * Refresca un slot especifico o todos los slots activos.
90
- *
91
- * @param slotIds - IDs de slots a refrescar (undefined = todos)
92
- */
93
- refreshSlots(slotIds?: string[]): void;
84
+ unregisterSlot(slotId: string): void;
94
85
  /**
95
86
  * Obtiene el estado de un slot.
96
87
  *
@@ -98,18 +89,9 @@ export declare class AdsService implements OnDestroy {
98
89
  * @returns Estado actual del slot
99
90
  */
100
91
  getSlotState(slotId: string): AdSlotState;
101
- /**
102
- * Destruye todos los slots activos.
103
- * Llamar cuando el usuario se vuelve premium o cambia de página.
104
- */
105
- destroyAllSlots(): void;
106
- private resolveSizes;
107
- private buildSizeMapping;
108
- private applyTargeting;
109
92
  private updateSlotState;
110
93
  private emitEvent;
111
94
  private setupRouteListener;
112
- private setupAutoRefresh;
113
95
  private isRouteExcluded;
114
96
  ngOnDestroy(): void;
115
97
  static ɵfac: i0.ɵɵFactoryDeclaration<AdsService, never>;
@@ -1,20 +1,16 @@
1
1
  /**
2
2
  * Ads Configuration
3
3
  *
4
- * Configuracion e inicializacion de Google Ad Manager para Angular.
4
+ * Configuracion e inicializacion de Google AdSense para Angular.
5
5
  * Usa provideValtechAds() en el bootstrap de tu aplicacion.
6
6
  */
7
7
  import { EnvironmentProviders, InjectionToken } from '@angular/core';
8
- import { ValtechAdsConfig, LazyLoadConfig } from './types';
8
+ import { ValtechAdsConfig } from './types';
9
9
  /**
10
10
  * Token de inyeccion para la configuracion de Ads.
11
11
  * Usado internamente por los servicios de ads.
12
12
  */
13
13
  export declare const VALTECH_ADS_CONFIG: InjectionToken<ValtechAdsConfig>;
14
- /**
15
- * Configuracion por defecto de lazy loading.
16
- */
17
- export declare const DEFAULT_LAZY_LOAD_CONFIG: LazyLoadConfig;
18
14
  /**
19
15
  * Configuracion por defecto del servicio de ads.
20
16
  */
@@ -22,42 +18,30 @@ export declare const DEFAULT_ADS_CONFIG: Partial<ValtechAdsConfig>;
22
18
  /**
23
19
  * Provee el servicio de Ads a la aplicacion Angular.
24
20
  *
25
- * @param config - Configuracion de Google Ad Manager
21
+ * @param config - Configuracion de Google AdSense
26
22
  * @returns EnvironmentProviders para usar en bootstrapApplication
27
23
  *
28
24
  * @example
29
25
  * ```typescript
30
26
  * // main.ts
31
27
  * import { bootstrapApplication } from '@angular/platform-browser';
32
- * import { provideValtechAds, provideValtechFirebase } from 'valtech-components';
33
- * import { environment } from './environments/environment';
28
+ * import { provideValtechAds } from 'valtech-components';
34
29
  *
35
30
  * bootstrapApplication(AppComponent, {
36
31
  * providers: [
37
- * // Firebase primero (para consent mode)
38
- * provideValtechFirebase({
39
- * firebase: environment.firebase,
40
- * enableAnalytics: true,
41
- * }),
42
- *
43
- * // Luego Ads
44
32
  * provideValtechAds({
45
- * networkId: '/12345678',
46
- * debugMode: !environment.production,
47
- * isPremiumUser: () => inject(AuthService).hasRole('premium'),
33
+ * adClient: 'ca-pub-XXXXXXXXXXXXXXXX',
34
+ * testMode: true, // Usa ads de prueba en desarrollo
35
+ * debugMode: true,
48
36
  * }),
49
37
  * ],
50
38
  * });
51
39
  * ```
52
40
  *
53
- * @example Con targeting global y rutas excluidas
41
+ * @example Con rutas excluidas
54
42
  * ```typescript
55
43
  * provideValtechAds({
56
- * networkId: '/12345678',
57
- * globalTargeting: {
58
- * site: 'myvaltech',
59
- * section: 'app',
60
- * },
44
+ * adClient: 'ca-pub-XXXXXXXXXXXXXXXX',
61
45
  * excludeRoutes: [
62
46
  * '^/checkout',
63
47
  * '^/payment',
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * Ads Module
3
3
  *
4
- * Exports publicos para el servicio de Google Ad Manager.
4
+ * Exports publicos para el servicio de Google AdSense.
5
5
  */
6
- export { provideValtechAds, VALTECH_ADS_CONFIG, DEFAULT_ADS_CONFIG, DEFAULT_LAZY_LOAD_CONFIG } from './config';
6
+ export { provideValtechAds, VALTECH_ADS_CONFIG, DEFAULT_ADS_CONFIG } from './config';
7
7
  export { AdsService } from './ads.service';
8
- export { AdsConsentService } from './ads-consent.service';
9
8
  export { AdsLoaderService } from './ads-loader.service';
10
- export { ValtechAdsConfig, LazyLoadConfig, AdSlotConfig, AdSlotSize, AD_SIZE_MAP, SizeMapping, AdSlotState, AdEvent, AdsConsentState, GPTSlot, GPTNamespace, GPTPubadsService, GPTSizeMappingBuilder, GPTEvent, } from './types';
9
+ export { ValtechAdsConfig, AdSlotConfig, AdFormat, AdSlotState, AdEvent, AdsConsentState, AdSlotSize, AD_SIZE_MAP, SizeMapping, } from './types';
@@ -1,78 +1,45 @@
1
1
  /**
2
2
  * Ads Types
3
3
  *
4
- * Tipos e interfaces para el servicio de Google Ad Manager.
5
- * Usa Google Publisher Tags (GPT) para renderizar ads.
4
+ * Tipos e interfaces para el servicio de Google AdSense.
5
+ * Simplificado para usar AdSense en lugar de GPT (Ad Manager).
6
6
  */
7
7
  /**
8
8
  * Configuracion del servicio de Ads.
9
9
  * Pasada a provideValtechAds() en el bootstrap de la aplicacion.
10
10
  */
11
11
  export interface ValtechAdsConfig {
12
- /** Network ID de Google Ad Manager (ej: '/12345678') */
13
- networkId: string;
12
+ /** Publisher ID de AdSense (formato: ca-pub-XXXXXXXXXXXXXXXX) */
13
+ adClient: string;
14
14
  /** Habilitar modo debug (muestra info de ads en consola) */
15
15
  debugMode?: boolean;
16
- /** Activar lazy loading de ads (viewport intersection) */
17
- lazyLoad?: boolean;
18
- /** Configuracion de lazy loading */
19
- lazyLoadConfig?: LazyLoadConfig;
20
- /** Configuracion por defecto para ad slots */
21
- defaultSlotConfig?: Partial<AdSlotConfig>;
22
- /** Targeting global (aplica a todos los slots) */
23
- globalTargeting?: Record<string, string | string[]>;
24
- /** Habilitar personalizacion de ads (requiere consent) */
25
- enablePersonalization?: boolean;
26
- /** Mostrar ads de fallback si no hay consent */
27
- showNonPersonalizedAds?: boolean;
16
+ /** Test mode - usa ads de prueba durante desarrollo */
17
+ testMode?: boolean;
18
+ /** Habilitar Auto Ads (Google decide ubicacion automaticamente) */
19
+ autoAds?: boolean;
28
20
  /** Callback cuando se carga un ad */
29
21
  onAdLoaded?: (slotId: string, isEmpty: boolean) => void;
30
22
  /** Callback cuando falla un ad */
31
23
  onAdError?: (slotId: string, error: Error) => void;
32
- /** Refresh automatico de ads (en segundos, 0 = deshabilitado) */
33
- autoRefreshInterval?: number;
34
24
  /** Rutas donde NO mostrar ads (regex patterns) */
35
25
  excludeRoutes?: string[];
36
26
  }
37
27
  /**
38
- * Configuracion de lazy loading para GPT.
28
+ * Formato de ad para AdSense.
39
29
  */
40
- export interface LazyLoadConfig {
41
- /** Margen del viewport para cargar (ej: '200px') */
42
- rootMargin?: string;
43
- /** Threshold de interseccion (0-1) */
44
- threshold?: number;
45
- /** Fetch margin para GPT (pixels antes del viewport) */
46
- fetchMarginPercent?: number;
47
- /** Render margin para GPT */
48
- renderMarginPercent?: number;
49
- }
50
- /**
51
- * Tamanos de ad predefinidos (IAB standard).
52
- */
53
- export type AdSlotSize = 'leaderboard' | 'billboard' | 'medium-rectangle' | 'large-rectangle' | 'half-page' | 'skyscraper' | 'mobile-banner' | 'mobile-leaderboard' | 'fluid' | 'native' | 'custom';
54
- /**
55
- * Mapeo de tamanos predefinidos a dimensiones.
56
- */
57
- export declare const AD_SIZE_MAP: Record<AdSlotSize, [number, number] | 'fluid'>;
30
+ export type AdFormat = 'auto' | 'fluid' | 'rectangle' | 'horizontal' | 'vertical';
58
31
  /**
59
32
  * Configuracion de un ad slot individual.
60
33
  */
61
34
  export interface AdSlotConfig {
62
35
  /** ID unico del slot (usado para el div container) */
63
36
  slotId: string;
64
- /** Ad unit path (ej: '/homepage/top') - se concatena con networkId */
65
- adUnitPath: string;
66
- /** Tamano del ad o tamanos responsivos */
67
- size: AdSlotSize | AdSlotSize[] | [number, number] | [number, number][];
68
- /** Mapping responsivo: [viewport-width, sizes] */
69
- sizeMapping?: SizeMapping[];
70
- /** Targeting especifico para este slot */
71
- targeting?: Record<string, string | string[]>;
72
- /** Colapsar slot si esta vacio */
73
- collapseEmpty?: boolean;
74
- /** Es un native ad */
75
- isNative?: boolean;
37
+ /** Ad Slot ID de AdSense (numero de unidad de anuncio) */
38
+ adSlot?: string;
39
+ /** Formato del ad */
40
+ format?: AdFormat;
41
+ /** Responsive - ocupa todo el ancho disponible */
42
+ fullWidth?: boolean;
76
43
  /** CSS class adicional */
77
44
  cssClass?: string;
78
45
  /** Altura minima mientras carga */
@@ -80,16 +47,6 @@ export interface AdSlotConfig {
80
47
  /** Mostrar skeleton mientras carga */
81
48
  showSkeleton?: boolean;
82
49
  }
83
- /**
84
- * Mapping de tamanos responsivos.
85
- * Define que tamanos de ad mostrar segun el viewport.
86
- */
87
- export interface SizeMapping {
88
- /** Ancho minimo del viewport */
89
- viewportWidth: number;
90
- /** Tamanos de ad para este viewport */
91
- sizes: ([number, number] | 'fluid')[];
92
- }
93
50
  /**
94
51
  * Estado de un ad slot.
95
52
  */
@@ -115,47 +72,25 @@ export interface AdsConsentState {
115
72
  /** Permite datos de usuario para ads */
116
73
  adUserData: boolean;
117
74
  }
118
- /** GPT Slot reference */
119
- export interface GPTSlot {
120
- getSlotElementId(): string;
121
- getAdUnitPath(): string;
122
- addService(service: unknown): GPTSlot;
123
- defineSizeMapping(mapping: unknown): GPTSlot;
124
- setTargeting(key: string, value: string | string[]): GPTSlot;
125
- setCollapseEmptyDiv(collapse: boolean, collapseBeforeAdFetch?: boolean): GPTSlot;
126
- }
127
- /** GPT global namespace (window.googletag) */
128
- export interface GPTNamespace {
129
- cmd: Array<() => void>;
130
- defineSlot(adUnitPath: string, size: unknown, divId: string): GPTSlot | null;
131
- pubads(): GPTPubadsService;
132
- enableServices(): void;
133
- display(divId: string): void;
134
- destroySlots(slots?: GPTSlot[]): boolean;
135
- sizeMapping(): GPTSizeMappingBuilder;
136
- }
137
- /** GPT Pubads Service */
138
- export interface GPTPubadsService {
139
- enableSingleRequest(): void;
140
- enableLazyLoad(config?: object): void;
141
- setTargeting(key: string, value: string | string[]): void;
142
- setRequestNonPersonalizedAds(value: 0 | 1): void;
143
- addEventListener(event: string, callback: (event: GPTEvent) => void): void;
144
- refresh(slots?: GPTSlot[]): void;
145
- collapseEmptyDivs(collapseBeforeAdFetch?: boolean): void;
146
- }
147
- /** GPT Size Mapping Builder */
148
- export interface GPTSizeMappingBuilder {
149
- addSize(viewport: [number, number], sizes: unknown): GPTSizeMappingBuilder;
150
- build(): unknown;
151
- }
152
- /** GPT Event */
153
- export interface GPTEvent {
154
- slot: GPTSlot;
155
- isEmpty?: boolean;
156
- }
75
+ /** AdSense global array */
76
+ export type AdSenseCommand = Record<string, unknown>;
157
77
  declare global {
158
78
  interface Window {
159
- googletag?: GPTNamespace;
79
+ adsbygoogle?: AdSenseCommand[];
160
80
  }
161
81
  }
82
+ /**
83
+ * @deprecated Use AdFormat instead
84
+ */
85
+ export type AdSlotSize = 'leaderboard' | 'billboard' | 'medium-rectangle' | 'large-rectangle' | 'half-page' | 'skyscraper' | 'mobile-banner' | 'mobile-leaderboard' | 'fluid' | 'native' | 'custom';
86
+ /**
87
+ * @deprecated AdSense handles sizes automatically
88
+ */
89
+ export declare const AD_SIZE_MAP: Record<AdSlotSize, [number, number] | 'fluid'>;
90
+ /**
91
+ * @deprecated Not used with AdSense
92
+ */
93
+ export interface SizeMapping {
94
+ viewportWidth: number;
95
+ sizes: ([number, number] | 'fluid')[];
96
+ }
@@ -6,6 +6,7 @@
6
6
  * deben definirse en cada app consumidora.
7
7
  */
8
8
  import { AppId, EmulatorConfig, FirebaseConfig, ValtechFirebaseConfig } from './types';
9
+ import type { AnalyticsConfig } from './analytics-types';
9
10
  export type { AppId } from './types';
10
11
  /**
11
12
  * Genera paths de Storage con namespace por app.
@@ -74,6 +75,16 @@ export interface CreateFirebaseConfigOptions {
74
75
  * Cuando se configura, FirestoreService y StorageService prefijan automáticamente los paths.
75
76
  */
76
77
  appId?: string;
78
+ /**
79
+ * Habilitar Firebase Analytics / GA4.
80
+ * Requiere measurementId en firebase config.
81
+ */
82
+ enableAnalytics?: boolean;
83
+ /**
84
+ * Configuración detallada de Analytics.
85
+ * Solo aplica si enableAnalytics es true.
86
+ */
87
+ analyticsConfig?: AnalyticsConfig;
77
88
  }
78
89
  /**
79
90
  * Crea la configuración completa de Firebase desde variables de entorno.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.503",
3
+ "version": "2.0.505",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"