valtech-components 2.0.798 → 2.0.800

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.
@@ -60,6 +60,15 @@ export declare class MessagingService {
60
60
  private readonly debugPersistence;
61
61
  /** Key para localStorage de mensajes FCM (debugging) */
62
62
  private readonly DEBUG_STORAGE_KEY;
63
+ /**
64
+ * Key de localStorage donde se persiste el token FCM.
65
+ *
66
+ * El token vive en un `BehaviorSubject` en memoria y se pierde en cada
67
+ * recarga / suspensión de la PWA (iOS reinicia PWAs con frecuencia). Persistir
68
+ * el token permite hidratar el estado en cold start y que la UI no parpadee.
69
+ * Es un *optimistic hint* — la verdad la confirma el siguiente `getToken()`.
70
+ */
71
+ private readonly TOKEN_STORAGE_KEY;
63
72
  constructor(injector: Injector, config: ValtechFirebaseConfig, platformId: Object, ngZone: NgZone);
64
73
  /**
65
74
  * Obtiene la instancia de Messaging via Firebase SDK directo (NO AngularFire DI).
@@ -124,6 +133,23 @@ export declare class MessagingService {
124
133
  * ```
125
134
  */
126
135
  getToken(): Promise<string | null>;
136
+ /**
137
+ * Resuelve el `ServiceWorkerRegistration` del SW de FCM.
138
+ *
139
+ * El SW `/firebase-messaging-sw.js` ya se registra una vez en el bootstrap de
140
+ * la app (`config.ts`). Reutilizamos ese registro en lugar de re-registrarlo
141
+ * en cada `getToken()` — re-registrar repetidamente dispara revalidaciones del
142
+ * SW en iOS PWA. Solo registramos como fallback si todavía no existe.
143
+ */
144
+ private resolveServiceWorkerRegistration;
145
+ /**
146
+ * Persiste el token FCM en localStorage (o lo limpia si es null/empty).
147
+ */
148
+ private persistToken;
149
+ /**
150
+ * Hidrata el estado del token desde localStorage en el arranque del servicio.
151
+ */
152
+ private hydrateTokenFromStorage;
127
153
  /**
128
154
  * Elimina el token FCM actual (unsubscribe de notificaciones).
129
155
  *
@@ -38,6 +38,16 @@ export declare class PreferencesService {
38
38
  readonly synced: import("@angular/core").Signal<boolean>;
39
39
  private subscription?;
40
40
  private currentUserId?;
41
+ /**
42
+ * `true` mientras un `update()` está en vuelo (PUT al backend).
43
+ *
44
+ * El listener Firestore (`bindToUser`) es real-time y puede emitir un snapshot
45
+ * *stale* — anterior al sync del backend — que pisaría el valor optimista de
46
+ * `_notificationsMaster` y revertiría el toggle. Mientras este flag esté `true`
47
+ * el listener ignora las emisiones; el `update()` ya alinea las señales con la
48
+ * respuesta del backend al terminar.
49
+ */
50
+ private _updateInFlight;
41
51
  constructor(config: ValtechAuthConfig, firestore: FirestoreService, auth: AuthService, http: HttpClient, themeService: ThemeService | null, i18n: I18nService | null);
42
52
  /** Actualiza preferencias via backend. Optimistic UI: aplica local, revierte si falla. */
43
53
  update(partial: PreferencesUpdate): Promise<PreferencesUpdateResponse>;
package/lib/version.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Current version of valtech-components.
3
3
  * This is automatically updated during the publish process.
4
4
  */
5
- export declare const VERSION = "2.0.798";
5
+ export declare const VERSION = "2.0.800";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.798",
3
+ "version": "2.0.800",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"