valtech-components 2.0.863 → 2.0.865

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 (40) hide show
  1. package/esm2022/lib/components/molecules/pin-input/pin-input.component.mjs +4 -2
  2. package/esm2022/lib/services/auth/storage.service.mjs +28 -4
  3. package/esm2022/lib/services/auth/sync.service.mjs +13 -7
  4. package/esm2022/lib/services/firebase/analytics.service.mjs +6 -3
  5. package/esm2022/lib/services/firebase/config.mjs +15 -10
  6. package/esm2022/lib/services/i18n/config.mjs +11 -4
  7. package/esm2022/lib/services/i18n/i18n.service.mjs +20 -8
  8. package/esm2022/lib/services/local-storage.service.mjs +16 -6
  9. package/esm2022/lib/services/locale.service.mjs +15 -6
  10. package/esm2022/lib/services/splash-screen/config.mjs +34 -0
  11. package/esm2022/lib/services/splash-screen/index.mjs +25 -0
  12. package/esm2022/lib/services/splash-screen/splash-screen.service.mjs +20 -0
  13. package/esm2022/lib/services/splash-screen/types.mjs +4 -0
  14. package/esm2022/lib/services/theme.service.mjs +22 -11
  15. package/esm2022/lib/version.mjs +2 -2
  16. package/esm2022/public-api.mjs +4 -1
  17. package/fesm2022/valtech-components.mjs +207 -49
  18. package/fesm2022/valtech-components.mjs.map +1 -1
  19. package/lib/components/atoms/glow/glow.component.d.ts +1 -1
  20. package/lib/components/atoms/rights-footer/rights-footer.component.d.ts +1 -1
  21. package/lib/components/atoms/text/text.component.d.ts +1 -1
  22. package/lib/components/atoms/user-avatar/user-avatar.component.d.ts +1 -1
  23. package/lib/components/molecules/features-list/features-list.component.d.ts +3 -3
  24. package/lib/components/organisms/article/article.component.d.ts +5 -5
  25. package/lib/components/organisms/bottom-nav/bottom-nav.component.d.ts +1 -1
  26. package/lib/components/organisms/toolbar/toolbar.component.d.ts +2 -2
  27. package/lib/services/auth/storage.service.d.ts +2 -1
  28. package/lib/services/auth/sync.service.d.ts +3 -1
  29. package/lib/services/i18n/i18n.service.d.ts +2 -1
  30. package/lib/services/local-storage.service.d.ts +5 -5
  31. package/lib/services/locale.service.d.ts +3 -1
  32. package/lib/services/splash-screen/config.d.ts +21 -0
  33. package/lib/services/splash-screen/index.d.ts +24 -0
  34. package/lib/services/splash-screen/splash-screen.service.d.ts +6 -0
  35. package/lib/services/splash-screen/types.d.ts +4 -0
  36. package/lib/services/theme.service.d.ts +2 -1
  37. package/lib/version.d.ts +1 -1
  38. package/package.json +6 -2
  39. package/public-api.d.ts +1 -0
  40. package/src/lib/services/firebase/firebase-messaging-sw.js +145 -0
@@ -30,7 +30,7 @@ export declare class GlowComponent {
30
30
  protected intensity: import("@angular/core").Signal<GlowIntensity>;
31
31
  protected shape: import("@angular/core").Signal<GlowShape>;
32
32
  protected animated: import("@angular/core").Signal<boolean>;
33
- protected blendMode: import("@angular/core").Signal<"normal" | "multiply" | "screen" | "overlay" | "soft-light" | "hard-light" | "color-dodge">;
33
+ protected blendMode: import("@angular/core").Signal<"overlay" | "normal" | "multiply" | "screen" | "soft-light" | "hard-light" | "color-dodge">;
34
34
  protected colorRgbVar: import("@angular/core").Signal<string>;
35
35
  protected secondaryColorRgbVar: import("@angular/core").Signal<string>;
36
36
  protected positionCss: import("@angular/core").Signal<string>;
@@ -43,7 +43,7 @@ export declare class RightsFooterComponent {
43
43
  /**
44
44
  * Computed helper for color prop in template.
45
45
  */
46
- propsColor: import("@angular/core").Signal<"medium" | "primary" | "secondary" | "tertiary" | "success" | "warning" | "danger" | "light" | "dark">;
46
+ propsColor: import("@angular/core").Signal<"light" | "dark" | "primary" | "secondary" | "tertiary" | "success" | "warning" | "danger" | "medium">;
47
47
  /**
48
48
  * Computed helper for withMargin prop in template.
49
49
  */
@@ -11,7 +11,7 @@ export declare class TextComponent {
11
11
  */
12
12
  displayContent: import("@angular/core").Signal<string>;
13
13
  propsColor: import("@angular/core").Signal<import("@ionic/core").Color>;
14
- propsSize: import("@angular/core").Signal<"small" | "medium" | "large" | "xlarge">;
14
+ propsSize: import("@angular/core").Signal<"medium" | "small" | "large" | "xlarge">;
15
15
  propsBold: import("@angular/core").Signal<boolean>;
16
16
  propsProcessLinks: import("@angular/core").Signal<boolean>;
17
17
  propsAllowPartialBold: import("@angular/core").Signal<boolean>;
@@ -38,7 +38,7 @@ export declare class UserAvatarComponent {
38
38
  readonly imageUrl: import("@angular/core").Signal<string>;
39
39
  /** Iniciales — 1-2 chars derivados de name (preferred) o email prefix. */
40
40
  readonly initials: import("@angular/core").Signal<string>;
41
- readonly sizeClass: import("@angular/core").Signal<"small" | "medium" | "large" | "xlarge" | "xsmall">;
41
+ readonly sizeClass: import("@angular/core").Signal<"medium" | "small" | "large" | "xlarge" | "xsmall">;
42
42
  readonly shapeClass: import("@angular/core").Signal<"circle" | "square">;
43
43
  /** Background — explicito o derivado deterministicamente del user. */
44
44
  readonly bgColor: import("@angular/core").Signal<string>;
@@ -47,9 +47,9 @@ export declare class FeaturesListComponent {
47
47
  i18nNamespace?: string;
48
48
  iconColor: string;
49
49
  iconSize: number;
50
- mode: "horizontal" | "vertical";
51
- gap: "small" | "medium" | "large";
52
- alignment: "center" | "start";
50
+ mode: "vertical" | "horizontal";
51
+ gap: "medium" | "small" | "large";
52
+ alignment: "start" | "center";
53
53
  }>;
54
54
  /** Resolved icon color (handles Ionic colors and CSS colors) */
55
55
  iconColorStyle: import("@angular/core").Signal<string>;
@@ -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: "small" | "medium" | "large" | "xlarge";
48
+ size: "medium" | "small" | "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: "small" | "medium" | "large" | "xlarge";
64
+ size: "medium" | "small" | "large" | "xlarge";
65
65
  color: import("@ionic/core").Color;
66
66
  content?: string;
67
67
  bold: boolean;
@@ -76,7 +76,7 @@ export declare class ArticleComponent implements OnInit {
76
76
  getHighlightColor(element: ArticleElement): string;
77
77
  getButtonProps(element: ArticleElement): {
78
78
  actionType?: import("valtech-components").ActionType;
79
- expand?: "full" | "block";
79
+ expand?: "block" | "full";
80
80
  link?: string;
81
81
  href?: string;
82
82
  target?: "_blank" | "_self" | "_parent" | "_top";
@@ -90,9 +90,9 @@ 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?: "small" | "large" | "default";
93
+ size?: "small" | "default" | "large";
94
94
  fill?: "default" | "clear" | "outline" | "solid";
95
- type: "button" | "submit" | "reset";
95
+ type: "submit" | "button" | "reset";
96
96
  token?: string;
97
97
  ref?: any;
98
98
  handler?: (value: any) => any;
@@ -63,7 +63,7 @@ export declare class BottomNavComponent implements OnInit, OnDestroy {
63
63
  i18nNamespace?: string;
64
64
  hideLabels: boolean;
65
65
  safeArea: boolean;
66
- animation: "none" | "slide" | "fade" | "scale";
66
+ animation: "fade" | "scale" | "slide" | "none";
67
67
  maxWidth: string;
68
68
  }>;
69
69
  /** Computed tabs with FAB inserted if present */
@@ -72,10 +72,10 @@ export declare class ToolbarComponent implements OnInit {
72
72
  };
73
73
  showFlags?: boolean;
74
74
  color: import("@ionic/core").Color;
75
- size?: "small" | "large" | "default";
75
+ size?: "small" | "default" | "large";
76
76
  fill?: "default" | "clear" | "outline" | "solid";
77
77
  shape?: "round";
78
- expand?: "full" | "block";
78
+ expand?: "block" | "full";
79
79
  disabled?: boolean;
80
80
  customLanguageNames?: Record<string, string>;
81
81
  forceReload?: boolean;
@@ -6,7 +6,8 @@ import * as i0 from "@angular/core";
6
6
  export declare class AuthStorageService {
7
7
  private config;
8
8
  private keys;
9
- constructor(config: ValtechAuthConfig);
9
+ private readonly isBrowser;
10
+ constructor(config: ValtechAuthConfig, platformId: Object);
10
11
  /**
11
12
  * Guarda el estado completo de autenticación.
12
13
  */
@@ -14,9 +14,11 @@ export declare class AuthSyncService implements OnDestroy {
14
14
  private storageListener;
15
15
  /** Observable de eventos de sincronización */
16
16
  readonly onEvent$: Observable<AuthSyncEvent>;
17
- constructor(config: ValtechAuthConfig);
17
+ private readonly isBrowser;
18
+ constructor(config: ValtechAuthConfig, platformId: Object);
18
19
  /**
19
20
  * Inicia la sincronización entre pestañas.
21
+ * SSR-noop — sync de pestañas solo aplica en browser.
20
22
  */
21
23
  start(): void;
22
24
  /**
@@ -30,7 +30,8 @@ export declare class I18nService {
30
30
  readonly supportedLanguages: import("@angular/core").Signal<I18nLang[]>;
31
31
  readonly isSpanish: import("@angular/core").Signal<boolean>;
32
32
  readonly isEnglish: import("@angular/core").Signal<boolean>;
33
- constructor();
33
+ private readonly isBrowser;
34
+ constructor(platformId: Object);
34
35
  /**
35
36
  * Obtiene texto traducido (alias corto de getText)
36
37
  *
@@ -1,23 +1,23 @@
1
1
  /**
2
2
  * Utility service for interacting with browser localStorage in a type-safe way.
3
3
  * Provides static methods for setting, getting, removing, and clearing items.
4
+ *
5
+ * SSR-safe: en Node (prerender) `localStorage` no existe — los métodos son no-ops
6
+ * en server. `get` retorna `null` casteado a `T`, igual que cuando la key no
7
+ * existe en browser.
4
8
  */
5
9
  export declare class LocalStorageService {
10
+ private static get available();
6
11
  /**
7
12
  * Stores a value in localStorage under the given reference key.
8
- * @param reference The key to store the value under
9
- * @param value The value to store
10
13
  */
11
14
  static set<T>(reference: string, value: T): void;
12
15
  /**
13
16
  * Retrieves a value from localStorage by key.
14
- * @param reference The key to retrieve
15
- * @returns The parsed value
16
17
  */
17
18
  static get<T>(reference: string): T;
18
19
  /**
19
20
  * Removes an item from localStorage by key.
20
- * @param reference The key to remove
21
21
  */
22
22
  static remove(reference: string): void;
23
23
  /**
@@ -26,7 +26,8 @@ export declare class LocaleService {
26
26
  * Se lee una vez al iniciar desde localStorage.
27
27
  */
28
28
  readonly lang: SupportedLang;
29
- constructor();
29
+ private readonly isBrowser;
30
+ constructor(platformId: Object);
30
31
  /**
31
32
  * Cambia el idioma de la aplicación.
32
33
  * Guarda en localStorage y recarga la página para aplicar el cambio.
@@ -37,6 +38,7 @@ export declare class LocaleService {
37
38
  /**
38
39
  * Obtiene el idioma almacenado en localStorage.
39
40
  * Si no existe o no es válido, retorna el idioma por defecto.
41
+ * En SSR (sin localStorage) retorna el default.
40
42
  */
41
43
  private getStoredLang;
42
44
  /**
@@ -0,0 +1,21 @@
1
+ import { EnvironmentProviders, InjectionToken } from '@angular/core';
2
+ import { SplashScreenConfig } from './types';
3
+ export declare const VALTECH_SPLASH_SCREEN: InjectionToken<Required<SplashScreenConfig>>;
4
+ /**
5
+ * Oculta el splash screen nativo (Capacitor) al completar el bootstrap de Angular.
6
+ * En web/PWA es no-op — el skeleton HTML en index.html se elimina cuando Angular
7
+ * reemplaza <app-root>.
8
+ *
9
+ * Requiere @capacitor/splash-screen instalado en la app consumer y
10
+ * launchAutoHide: false en capacitor.config.ts.
11
+ *
12
+ * @example
13
+ * // main.ts
14
+ * bootstrapApplication(AppComponent, {
15
+ * providers: [provideSplashScreen()],
16
+ * });
17
+ *
18
+ * // capacitor.config.ts
19
+ * plugins: { SplashScreen: { launchAutoHide: false } }
20
+ */
21
+ export declare function provideSplashScreen(config?: SplashScreenConfig): EnvironmentProviders;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * SplashScreen Service
3
+ *
4
+ * Gestiona el splash screen nativo (Capacitor) y el skeleton PWA.
5
+ *
6
+ * - Nativo: oculta el splash screen de Capacitor con fade al completar bootstrap.
7
+ * - PWA/web: no-op (el skeleton en index.html se elimina cuando Angular reemplaza <app-root>).
8
+ *
9
+ * Setup:
10
+ * 1. Agregar el skeleton HTML/CSS en index.html (ver docs/splash-screen.md o CLAUDE.md).
11
+ * 2. Instalar @capacitor/splash-screen en la app consumer.
12
+ * 3. Configurar capacitor.config.ts con launchAutoHide: false.
13
+ * 4. Agregar provideSplashScreen() en main.ts.
14
+ *
15
+ * @example
16
+ * // main.ts
17
+ * import { provideSplashScreen } from 'valtech-components';
18
+ * bootstrapApplication(AppComponent, {
19
+ * providers: [provideSplashScreen()],
20
+ * });
21
+ */
22
+ export * from './types';
23
+ export { VALTECH_SPLASH_SCREEN, provideSplashScreen } from './config';
24
+ export { SplashScreenService } from './splash-screen.service';
@@ -0,0 +1,6 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class SplashScreenService {
3
+ hide(fadeOutDuration?: number): Promise<void>;
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<SplashScreenService, never>;
5
+ static ɵprov: i0.ɵɵInjectableDeclaration<SplashScreenService>;
6
+ }
@@ -0,0 +1,4 @@
1
+ export interface SplashScreenConfig {
2
+ fadeOutDuration?: number;
3
+ }
4
+ export declare const DEFAULT_SPLASH_SCREEN_CONFIG: Required<SplashScreenConfig>;
@@ -38,7 +38,8 @@ export declare class ThemeService {
38
38
  * Observable for the current theme.
39
39
  */
40
40
  theme: BehaviorSubject<ThemeOption>;
41
- constructor();
41
+ private readonly isBrowser;
42
+ constructor(platformId: Object);
42
43
  private handleAutoConfiguration;
43
44
  private handleDarkPreference;
44
45
  private handleLightPreference;
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.863";
5
+ export declare const VERSION = "2.0.865";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.863",
3
+ "version": "2.0.865",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"
@@ -20,12 +20,16 @@
20
20
  "@ionic/angular": "^8.0.0",
21
21
  "firebase": "^10.0.0",
22
22
  "ionicons": "^7.2.1",
23
- "rxjs": "~7.8.0"
23
+ "rxjs": "~7.8.0",
24
+ "@capacitor/splash-screen": ">=6.0.0"
24
25
  },
25
26
  "peerDependenciesMeta": {
26
27
  "@capacitor/app": {
27
28
  "optional": true
28
29
  },
30
+ "@capacitor/splash-screen": {
31
+ "optional": true
32
+ },
29
33
  "@angular/service-worker": {
30
34
  "optional": true
31
35
  }
package/public-api.d.ts CHANGED
@@ -294,6 +294,7 @@ export * from './lib/components/molecules/feedback-form/feedback-form.component'
294
294
  export * from './lib/components/molecules/feedback-form/types';
295
295
  export * from './lib/components/molecules/content-reaction/content-reaction.component';
296
296
  export * from './lib/components/molecules/content-reaction/types';
297
+ export * from './lib/services/splash-screen';
297
298
  export * from './lib/components/templates/docs-layout/docs-layout.component';
298
299
  export * from './lib/components/templates/docs-layout/types';
299
300
  export * from './lib/components/organisms/docs-sidebar/docs-sidebar.component';
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Firebase Messaging Service Worker
3
+ *
4
+ * Service Worker estático para Firebase Cloud Messaging.
5
+ * Carga la configuración dinámicamente desde /firebase-config.js.
6
+ *
7
+ * CONFIGURACIÓN:
8
+ * 1. Crea firebase.config.json con tu configuración de Firebase
9
+ * 2. Ejecuta: npm run generate:firebase-config
10
+ * Esto genera /firebase-config.js con: self.FIREBASE_CONFIG = {...}
11
+ * 3. Agrega este SW y firebase-config.js a los assets de angular.json
12
+ *
13
+ * Ver README.md para documentación completa.
14
+ */
15
+
16
+ // Importar Firebase scripts
17
+ importScripts('https://www.gstatic.com/firebasejs/10.7.0/firebase-app-compat.js');
18
+ importScripts('https://www.gstatic.com/firebasejs/10.7.0/firebase-messaging-compat.js');
19
+
20
+ // Importar configuración desde archivo externo (generado en build)
21
+ // Este archivo define: self.FIREBASE_CONFIG = { ... }
22
+ try {
23
+ importScripts('/firebase-config.js');
24
+ } catch (e) {
25
+ console.error('[SW] No se pudo cargar firebase-config.js:', e);
26
+ }
27
+
28
+ // Verificar que la configuración existe
29
+ if (!self.FIREBASE_CONFIG) {
30
+ console.error('[SW] FIREBASE_CONFIG no está definido.');
31
+ console.error('[SW] Ejecuta: npm run generate:firebase-config');
32
+ } else {
33
+ // Inicializar Firebase
34
+ firebase.initializeApp(self.FIREBASE_CONFIG);
35
+
36
+ // Obtener instancia de messaging
37
+ const messaging = firebase.messaging();
38
+
39
+ /**
40
+ * Handler para mensajes en background.
41
+ */
42
+ messaging.onBackgroundMessage((payload) => {
43
+ console.log('[SW] Mensaje recibido en background:', payload);
44
+
45
+ // Web push usa mensajes data-only (sin bloque `notification`) para que el
46
+ // navegador NO auto-muestre una notificación duplicada — el SW es el único
47
+ // que la pinta. Title/body/icon llegan dentro de `data`. Se mantiene el
48
+ // fallback a `payload.notification` por compatibilidad con mensajes
49
+ // legacy o nativos que sí traen el bloque.
50
+ const data = payload.data || {};
51
+ const notificationTitle =
52
+ payload.notification?.title || data.title || 'Nueva notificación';
53
+ const notificationBody = payload.notification?.body || data.body || '';
54
+ const notificationIcon =
55
+ payload.notification?.icon || data.icon || '/assets/icon/favicon.ico';
56
+
57
+ const notificationOptions = {
58
+ body: notificationBody,
59
+ icon: notificationIcon,
60
+ image: payload.notification?.image,
61
+ badge: '/assets/icon/badge.png',
62
+ tag: payload.messageId || data.messageId || 'default',
63
+ data: {
64
+ ...data,
65
+ messageId: payload.messageId || data.messageId,
66
+ title: notificationTitle,
67
+ body: notificationBody,
68
+ },
69
+ vibrate: [200, 100, 200],
70
+ requireInteraction: data.require_interaction === 'true',
71
+ };
72
+
73
+ return self.registration.showNotification(notificationTitle, notificationOptions);
74
+ });
75
+
76
+ /**
77
+ * Handler para clicks en notificaciones.
78
+ */
79
+ self.addEventListener('notificationclick', (event) => {
80
+ console.log('[SW] Click en notificación:', event);
81
+ event.notification.close();
82
+
83
+ const data = event.notification.data || {};
84
+ let targetUrl = '/';
85
+
86
+ if (data.route) {
87
+ targetUrl = data.route;
88
+ } else if (data.url) {
89
+ targetUrl = data.url;
90
+ }
91
+
92
+ if (data.query_params) {
93
+ const separator = targetUrl.includes('?') ? '&' : '?';
94
+ targetUrl += separator + data.query_params;
95
+ }
96
+
97
+ const notificationPayload = {
98
+ type: 'NOTIFICATION_CLICK',
99
+ notification: {
100
+ title: data.title,
101
+ body: data.body,
102
+ data: data,
103
+ messageId: data.messageId,
104
+ },
105
+ };
106
+
107
+ event.waitUntil(
108
+ clients
109
+ .matchAll({ type: 'window', includeUncontrolled: true })
110
+ .then((clientList) => {
111
+ // Siempre enviar postMessage para que la app pueda reaccionar
112
+ for (const client of clientList) {
113
+ client.postMessage(notificationPayload);
114
+ }
115
+
116
+ // Navegar si hay route o url
117
+ if (targetUrl !== '/') {
118
+ for (const client of clientList) {
119
+ if ('navigate' in client) {
120
+ return client.navigate(targetUrl).then((c) => c?.focus());
121
+ }
122
+ }
123
+ // Si no hay cliente abierto, abrir nueva ventana
124
+ if (clients.openWindow) {
125
+ return clients.openWindow(targetUrl);
126
+ }
127
+ }
128
+
129
+ // Solo hacer focus si no hay navegación
130
+ for (const client of clientList) {
131
+ if ('focus' in client) {
132
+ return client.focus();
133
+ }
134
+ }
135
+ if (clients.openWindow) {
136
+ return clients.openWindow('/');
137
+ }
138
+ })
139
+ );
140
+ });
141
+
142
+ self.addEventListener('notificationclose', (event) => {
143
+ console.log('[SW] Notificación cerrada:', event.notification.tag);
144
+ });
145
+ }