valtech-components 2.0.497 → 2.0.498
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/esm2022/lib/components/molecules/language-selector/language-selector.component.mjs +23 -14
- package/esm2022/lib/components/molecules/language-selector/types.mjs +1 -1
- package/esm2022/lib/services/auth/auth.service.mjs +16 -3
- package/esm2022/lib/services/auth/types.mjs +1 -1
- package/esm2022/lib/services/firebase/analytics-types.mjs +7 -0
- package/esm2022/lib/services/firebase/types.mjs +1 -1
- package/fesm2022/valtech-components.mjs +412 -391
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/molecules/language-selector/language-selector.component.d.ts +1 -4
- package/lib/components/molecules/language-selector/types.d.ts +7 -0
- package/lib/services/auth/auth.service.d.ts +4 -2
- package/lib/services/auth/types.d.ts +4 -0
- package/lib/services/firebase/analytics-types.d.ts +219 -0
- package/lib/services/firebase/types.d.ts +11 -0
- package/package.json +1 -1
|
@@ -10,18 +10,15 @@ export declare class LanguageSelectorComponent implements OnInit {
|
|
|
10
10
|
/**
|
|
11
11
|
* Event emitted when the language selection changes.
|
|
12
12
|
* Emits the selected language code.
|
|
13
|
-
* Note: Page will reload after this event.
|
|
14
13
|
*/
|
|
15
14
|
languageChange: EventEmitter<string>;
|
|
16
15
|
/** Popover selector configuration */
|
|
17
16
|
popoverProps: PopoverSelectorMetadata;
|
|
18
|
-
private
|
|
17
|
+
private i18n;
|
|
19
18
|
/** Default language display names */
|
|
20
19
|
private readonly defaultLanguageNames;
|
|
21
20
|
/** Default flag icons for languages */
|
|
22
21
|
private readonly defaultLanguageFlags;
|
|
23
|
-
/** Available languages */
|
|
24
|
-
private readonly availableLanguages;
|
|
25
22
|
constructor();
|
|
26
23
|
ngOnInit(): void;
|
|
27
24
|
private initializePopoverProps;
|
|
@@ -49,4 +49,11 @@ export interface LanguageSelectorMetadata {
|
|
|
49
49
|
disabled?: boolean;
|
|
50
50
|
/** Custom display names for languages */
|
|
51
51
|
customLanguageNames?: Record<string, string>;
|
|
52
|
+
/**
|
|
53
|
+
* Force page reload on language change.
|
|
54
|
+
* By default (false), language changes are reactive without reload.
|
|
55
|
+
* Set to true for legacy behavior or if reactive updates don't work.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
forceReload?: boolean;
|
|
52
59
|
}
|
|
@@ -8,6 +8,7 @@ import { AuthStorageService } from './storage.service';
|
|
|
8
8
|
import { AuthSyncService } from './sync.service';
|
|
9
9
|
import { SigninRequest, SigninResponse, SignupRequest, SignupResponse, VerifyEmailRequest, VerifyEmailResponse, ResendCodeRequest, ResendCodeResponse, MFAVerifyResponse, RefreshResponse, GetPermissionsResponse, GetProfileResponse, UpdateProfileRequest, UpdateProfileResponse, MFASetupResponse, MFAConfirmResponse, MFADisableResponse, ForgotPasswordRequest, ForgotPasswordResponse, ResetPasswordRequest, ResetPasswordResponse, SwitchOrgResponse, MFAMethod, AuthError, ValtechAuthConfig, EnableNotificationsResult, NotificationPermissionState, RegisterDeviceResult, TOTPSetupResponse, TOTPVerifySetupResponse, TOTPDisableResponse, RegenerateBackupCodesResponse, BackupCodesCountResponse } from './types';
|
|
10
10
|
import { FirebaseService, MessagingService } from '../firebase';
|
|
11
|
+
import { I18nService } from '../i18n';
|
|
11
12
|
import * as i0 from "@angular/core";
|
|
12
13
|
/**
|
|
13
14
|
* Servicio principal de autenticación.
|
|
@@ -41,9 +42,10 @@ export declare class AuthService implements OnDestroy {
|
|
|
41
42
|
private syncService;
|
|
42
43
|
private firebaseService;
|
|
43
44
|
private messagingService;
|
|
45
|
+
private i18nService;
|
|
44
46
|
private refreshTimerId;
|
|
45
47
|
private syncSubscription;
|
|
46
|
-
constructor(config: ValtechAuthConfig, http: HttpClient, router: Router, stateService: AuthStateService, tokenService: TokenService, storageService: AuthStorageService, syncService: AuthSyncService, firebaseService: FirebaseService, messagingService: MessagingService | null);
|
|
48
|
+
constructor(config: ValtechAuthConfig, http: HttpClient, router: Router, stateService: AuthStateService, tokenService: TokenService, storageService: AuthStorageService, syncService: AuthSyncService, firebaseService: FirebaseService, messagingService: MessagingService | null, i18nService: I18nService | null);
|
|
47
49
|
/** Estado completo de autenticación */
|
|
48
50
|
readonly state: import("@angular/core").Signal<import("./types").AuthState>;
|
|
49
51
|
/** Usuario está autenticado */
|
|
@@ -275,6 +277,6 @@ export declare class AuthService implements OnDestroy {
|
|
|
275
277
|
* Detecta información de la plataforma del dispositivo.
|
|
276
278
|
*/
|
|
277
279
|
private detectPlatformInfo;
|
|
278
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, [null, null, null, null, null, null, null, null, { optional: true; }]>;
|
|
280
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, [null, null, null, null, null, null, null, null, { optional: true; }, { optional: true; }]>;
|
|
279
281
|
static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
|
|
280
282
|
}
|
|
@@ -249,6 +249,8 @@ export interface SigninResponse {
|
|
|
249
249
|
isNewDevice?: boolean;
|
|
250
250
|
/** ID del dispositivo usado para el login */
|
|
251
251
|
deviceId?: string;
|
|
252
|
+
/** Idioma preferido del usuario (para sincronizar con i18n) */
|
|
253
|
+
language?: string;
|
|
252
254
|
}
|
|
253
255
|
/**
|
|
254
256
|
* Request para verificar MFA.
|
|
@@ -269,6 +271,8 @@ export interface MFAVerifyResponse {
|
|
|
269
271
|
tokenType: string;
|
|
270
272
|
roles?: string[];
|
|
271
273
|
permissions?: string[];
|
|
274
|
+
/** Idioma preferido del usuario (para sincronizar con i18n) */
|
|
275
|
+
language?: string;
|
|
272
276
|
}
|
|
273
277
|
/**
|
|
274
278
|
* Request para refrescar token.
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics Types
|
|
3
|
+
*
|
|
4
|
+
* Tipos e interfaces para el servicio de Firebase Analytics (GA4).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Configuración de Analytics para ValtechFirebaseConfig
|
|
8
|
+
*/
|
|
9
|
+
export interface AnalyticsConfig {
|
|
10
|
+
/** Habilitar tracking automático de page views via Router (default: true) */
|
|
11
|
+
enablePageViewTracking?: boolean;
|
|
12
|
+
/** Habilitar tracking automático de errores via ErrorHandler (default: false) */
|
|
13
|
+
enableErrorTracking?: boolean;
|
|
14
|
+
/** Habilitar integración con auth para userId y userProperties (default: true) */
|
|
15
|
+
enableAuthIntegration?: boolean;
|
|
16
|
+
/** Modo debug: no envía a Firebase, logea a consola (default: false en prod) */
|
|
17
|
+
debugMode?: boolean;
|
|
18
|
+
/** Rutas a excluir del page view tracking (regex patterns) */
|
|
19
|
+
excludeRoutes?: string[];
|
|
20
|
+
/** Consent mode inicial (GDPR) */
|
|
21
|
+
defaultConsent?: ConsentSettings;
|
|
22
|
+
/** Clave de localStorage para persistir consent (default: 'analytics_consent') */
|
|
23
|
+
consentStorageKey?: string;
|
|
24
|
+
/** Propiedades de usuario por defecto */
|
|
25
|
+
defaultUserProperties?: Record<string, string>;
|
|
26
|
+
/** Prefijo para eventos custom (ej: 'myapp_') */
|
|
27
|
+
eventPrefix?: string;
|
|
28
|
+
/** Sampling rate (0.0 - 1.0) para reducir volumen (default: 1.0) */
|
|
29
|
+
samplingRate?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Settings de consentimiento GDPR
|
|
33
|
+
*/
|
|
34
|
+
export interface ConsentSettings {
|
|
35
|
+
/** Permite recolección de analytics */
|
|
36
|
+
analytics?: boolean;
|
|
37
|
+
/** Permite personalización de ads */
|
|
38
|
+
advertising?: boolean;
|
|
39
|
+
/** Permite funcionalidad */
|
|
40
|
+
functionality?: boolean;
|
|
41
|
+
/** Permite seguridad */
|
|
42
|
+
security?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Estado completo de consentimiento
|
|
46
|
+
*/
|
|
47
|
+
export interface ConsentState {
|
|
48
|
+
/** Settings actuales */
|
|
49
|
+
settings: ConsentSettings;
|
|
50
|
+
/** Timestamp de la última actualización */
|
|
51
|
+
updatedAt: Date | null;
|
|
52
|
+
/** Si el usuario ha tomado una decisión explícita */
|
|
53
|
+
hasDecided: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Nombres de eventos GA4 recomendados + customs
|
|
57
|
+
*/
|
|
58
|
+
export type AnalyticsEventName = 'add_payment_info' | 'add_shipping_info' | 'add_to_cart' | 'add_to_wishlist' | 'begin_checkout' | 'purchase' | 'refund' | 'remove_from_cart' | 'view_cart' | 'view_item' | 'view_item_list' | 'generate_lead' | 'login' | 'page_view' | 'screen_view' | 'search' | 'select_content' | 'select_item' | 'select_promotion' | 'share' | 'sign_up' | 'view_promotion' | 'feature_used' | 'preference_changed' | 'onboarding_step' | 'error_occurred' | 'performance_metric' | string;
|
|
59
|
+
/**
|
|
60
|
+
* Parámetros tipados por evento
|
|
61
|
+
*/
|
|
62
|
+
export interface AnalyticsEventParams {
|
|
63
|
+
add_to_cart: {
|
|
64
|
+
item_id: string;
|
|
65
|
+
item_name?: string;
|
|
66
|
+
value?: number;
|
|
67
|
+
currency?: string;
|
|
68
|
+
quantity?: number;
|
|
69
|
+
};
|
|
70
|
+
purchase: {
|
|
71
|
+
transaction_id: string;
|
|
72
|
+
value: number;
|
|
73
|
+
currency?: string;
|
|
74
|
+
items?: AnalyticsItem[];
|
|
75
|
+
tax?: number;
|
|
76
|
+
shipping?: number;
|
|
77
|
+
};
|
|
78
|
+
begin_checkout: {
|
|
79
|
+
value?: number;
|
|
80
|
+
currency?: string;
|
|
81
|
+
items?: AnalyticsItem[];
|
|
82
|
+
};
|
|
83
|
+
view_item: {
|
|
84
|
+
item_id: string;
|
|
85
|
+
item_name?: string;
|
|
86
|
+
value?: number;
|
|
87
|
+
currency?: string;
|
|
88
|
+
};
|
|
89
|
+
remove_from_cart: {
|
|
90
|
+
item_id: string;
|
|
91
|
+
item_name?: string;
|
|
92
|
+
value?: number;
|
|
93
|
+
};
|
|
94
|
+
login: {
|
|
95
|
+
method?: string;
|
|
96
|
+
};
|
|
97
|
+
sign_up: {
|
|
98
|
+
method?: string;
|
|
99
|
+
};
|
|
100
|
+
search: {
|
|
101
|
+
search_term: string;
|
|
102
|
+
};
|
|
103
|
+
share: {
|
|
104
|
+
content_type?: string;
|
|
105
|
+
item_id?: string;
|
|
106
|
+
method?: string;
|
|
107
|
+
};
|
|
108
|
+
select_content: {
|
|
109
|
+
content_type: string;
|
|
110
|
+
item_id?: string;
|
|
111
|
+
};
|
|
112
|
+
page_view: {
|
|
113
|
+
page_path?: string;
|
|
114
|
+
page_title?: string;
|
|
115
|
+
page_location?: string;
|
|
116
|
+
};
|
|
117
|
+
screen_view: {
|
|
118
|
+
screen_name: string;
|
|
119
|
+
screen_class?: string;
|
|
120
|
+
};
|
|
121
|
+
feature_used: {
|
|
122
|
+
feature_name: string;
|
|
123
|
+
feature_category?: string;
|
|
124
|
+
};
|
|
125
|
+
preference_changed: {
|
|
126
|
+
preference_name: string;
|
|
127
|
+
old_value?: string;
|
|
128
|
+
new_value?: string;
|
|
129
|
+
};
|
|
130
|
+
onboarding_step: {
|
|
131
|
+
step_number: number;
|
|
132
|
+
step_name?: string;
|
|
133
|
+
};
|
|
134
|
+
error_occurred: {
|
|
135
|
+
error_type: string;
|
|
136
|
+
error_message?: string;
|
|
137
|
+
error_stack?: string;
|
|
138
|
+
context?: string;
|
|
139
|
+
};
|
|
140
|
+
performance_metric: {
|
|
141
|
+
metric_name: string;
|
|
142
|
+
value: number;
|
|
143
|
+
unit?: string;
|
|
144
|
+
};
|
|
145
|
+
[key: string]: Record<string, unknown> | undefined;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Item para eventos de ecommerce
|
|
149
|
+
*/
|
|
150
|
+
export interface AnalyticsItem {
|
|
151
|
+
/** ID único del item */
|
|
152
|
+
item_id: string;
|
|
153
|
+
/** Nombre del item */
|
|
154
|
+
item_name: string;
|
|
155
|
+
/** Categoría principal */
|
|
156
|
+
item_category?: string;
|
|
157
|
+
/** Subcategorías */
|
|
158
|
+
item_category2?: string;
|
|
159
|
+
item_category3?: string;
|
|
160
|
+
/** Marca */
|
|
161
|
+
item_brand?: string;
|
|
162
|
+
/** Variante (ej: color, talla) */
|
|
163
|
+
item_variant?: string;
|
|
164
|
+
/** Precio unitario */
|
|
165
|
+
price?: number;
|
|
166
|
+
/** Cantidad */
|
|
167
|
+
quantity?: number;
|
|
168
|
+
/** Moneda ISO 4217 */
|
|
169
|
+
currency?: string;
|
|
170
|
+
/** Posición en lista */
|
|
171
|
+
index?: number;
|
|
172
|
+
/** Cupón aplicado */
|
|
173
|
+
coupon?: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Tipo de evento de debug
|
|
177
|
+
*/
|
|
178
|
+
export type DebugEventType = 'event' | 'page_view' | 'screen_view' | 'user_property' | 'error' | 'consent' | 'timing';
|
|
179
|
+
/**
|
|
180
|
+
* Evento de debug (solo en debug mode)
|
|
181
|
+
*/
|
|
182
|
+
export interface AnalyticsDebugEvent {
|
|
183
|
+
/** Timestamp del evento */
|
|
184
|
+
timestamp: Date;
|
|
185
|
+
/** Tipo de evento */
|
|
186
|
+
type: DebugEventType;
|
|
187
|
+
/** Nombre del evento */
|
|
188
|
+
name: string;
|
|
189
|
+
/** Parámetros del evento */
|
|
190
|
+
params?: Record<string, unknown>;
|
|
191
|
+
/** Si fue enviado a Firebase (false en debug mode) */
|
|
192
|
+
sent: boolean;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Métrica de timing/performance
|
|
196
|
+
*/
|
|
197
|
+
export interface TimingMetric {
|
|
198
|
+
/** Nombre de la métrica */
|
|
199
|
+
name: string;
|
|
200
|
+
/** Valor en milisegundos */
|
|
201
|
+
valueMs: number;
|
|
202
|
+
/** Categoría (ej: 'api', 'render', 'load') */
|
|
203
|
+
category?: string;
|
|
204
|
+
/** Parámetros adicionales */
|
|
205
|
+
params?: Record<string, string>;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Propiedades de usuario para segmentación
|
|
209
|
+
*/
|
|
210
|
+
export interface UserProperties {
|
|
211
|
+
/** Idioma preferido */
|
|
212
|
+
preferred_language?: string;
|
|
213
|
+
/** Nivel de suscripción */
|
|
214
|
+
subscription_tier?: string;
|
|
215
|
+
/** Organización activa (multi-tenant) */
|
|
216
|
+
active_organization?: string;
|
|
217
|
+
/** Propiedades custom */
|
|
218
|
+
[key: string]: string | number | boolean | undefined;
|
|
219
|
+
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Tipos e interfaces para la integración de Firebase en valtech-components.
|
|
5
5
|
* Todos los modelos de Firestore deben extender FirestoreDocument.
|
|
6
6
|
*/
|
|
7
|
+
import type { AnalyticsConfig } from './analytics-types';
|
|
7
8
|
/**
|
|
8
9
|
* Configuración de Firebase (valores de firebaseConfig)
|
|
9
10
|
*/
|
|
@@ -72,6 +73,16 @@ export interface ValtechFirebaseConfig {
|
|
|
72
73
|
* Default: false
|
|
73
74
|
*/
|
|
74
75
|
debugMessagePersistence?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Habilitar Firebase Analytics / GA4 (default: false).
|
|
78
|
+
* Requiere measurementId en firebase config.
|
|
79
|
+
*/
|
|
80
|
+
enableAnalytics?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Configuración detallada de Analytics.
|
|
83
|
+
* Solo aplica si enableAnalytics es true.
|
|
84
|
+
*/
|
|
85
|
+
analyticsConfig?: AnalyticsConfig;
|
|
75
86
|
}
|
|
76
87
|
/**
|
|
77
88
|
* Interface base para todos los documentos de Firestore.
|