valtech-components 2.0.621 → 2.0.623

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 (31) hide show
  1. package/esm2022/lib/components/molecules/docs-code-example/docs-code-example.component.mjs +3 -3
  2. package/esm2022/lib/components/molecules/footer-links/footer-links.component.mjs +5 -5
  3. package/esm2022/lib/components/molecules/update-banner/update-banner.component.mjs +112 -0
  4. package/esm2022/lib/components/organisms/menu/menu.component.mjs +3 -3
  5. package/esm2022/lib/components/templates/maintenance-page/maintenance-page.component.mjs +153 -0
  6. package/esm2022/lib/components/templates/maintenance-page/types.mjs +2 -0
  7. package/esm2022/lib/components/templates/page-content/page-content.component.mjs +21 -5
  8. package/esm2022/lib/components/templates/page-content/types.mjs +1 -1
  9. package/esm2022/lib/services/app-config/app-config.service.mjs +209 -0
  10. package/esm2022/lib/services/app-config/config.mjs +47 -0
  11. package/esm2022/lib/services/app-config/index.mjs +39 -0
  12. package/esm2022/lib/services/app-config/types.mjs +13 -0
  13. package/esm2022/lib/services/i18n/default-content.mjs +21 -1
  14. package/esm2022/public-api.mjs +8 -1
  15. package/fesm2022/valtech-components.mjs +8180 -7595
  16. package/fesm2022/valtech-components.mjs.map +1 -1
  17. package/lib/components/atoms/rights-footer/rights-footer.component.d.ts +1 -1
  18. package/lib/components/molecules/features-list/features-list.component.d.ts +2 -2
  19. package/lib/components/molecules/update-banner/update-banner.component.d.ts +42 -0
  20. package/lib/components/organisms/article/article.component.d.ts +2 -2
  21. package/lib/components/organisms/toolbar/toolbar.component.d.ts +1 -1
  22. package/lib/components/templates/maintenance-page/maintenance-page.component.d.ts +57 -0
  23. package/lib/components/templates/maintenance-page/types.d.ts +12 -0
  24. package/lib/components/templates/page-content/page-content.component.d.ts +6 -0
  25. package/lib/components/templates/page-content/types.d.ts +6 -0
  26. package/lib/services/app-config/app-config.service.d.ts +115 -0
  27. package/lib/services/app-config/config.d.ts +31 -0
  28. package/lib/services/app-config/index.d.ts +38 -0
  29. package/lib/services/app-config/types.d.ts +54 -0
  30. package/package.json +1 -1
  31. package/public-api.d.ts +4 -0
@@ -39,7 +39,7 @@ export declare class RightsFooterComponent {
39
39
  /**
40
40
  * Computed helper for align prop in template.
41
41
  */
42
- propsAlign: import("@angular/core").Signal<"center" | "left" | "right">;
42
+ propsAlign: import("@angular/core").Signal<"left" | "center" | "right">;
43
43
  /**
44
44
  * Computed helper for color prop in template.
45
45
  */
@@ -47,9 +47,9 @@ export declare class FeaturesListComponent {
47
47
  i18nNamespace?: string;
48
48
  iconColor: string;
49
49
  iconSize: number;
50
- mode: "vertical" | "horizontal";
50
+ mode: "horizontal" | "vertical";
51
51
  gap: "small" | "medium" | "large";
52
- alignment: "start" | "center";
52
+ alignment: "center" | "start";
53
53
  }>;
54
54
  /** Resolved icon color (handles Ionic colors and CSS colors) */
55
55
  iconColorStyle: import("@angular/core").Signal<string>;
@@ -0,0 +1,42 @@
1
+ import { BannerMetadata } from '../../organisms/banner/types';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * val-update-banner
5
+ *
6
+ * Banner de actualización que aparece cuando hay una nueva versión disponible.
7
+ * Se cierra automáticamente cuando el usuario hace clic en "Actualizar" o en cerrar.
8
+ *
9
+ * @example
10
+ * ```html
11
+ * <!-- Uso básico -->
12
+ * <val-update-banner />
13
+ *
14
+ * <!-- El banner solo aparece si hay actualización disponible -->
15
+ * ```
16
+ */
17
+ export declare class UpdateBannerComponent {
18
+ private appConfig;
19
+ private i18n;
20
+ /**
21
+ * Signal para controlar si el banner fue descartado por el usuario.
22
+ */
23
+ private dismissed;
24
+ /**
25
+ * Indica si el banner debe mostrarse.
26
+ */
27
+ readonly show: import("@angular/core").Signal<boolean>;
28
+ /**
29
+ * Props del banner calculadas reactivamente.
30
+ */
31
+ readonly bannerProps: import("@angular/core").Signal<BannerMetadata>;
32
+ /**
33
+ * Maneja el clic en acciones del banner.
34
+ */
35
+ onAction(token: string): void;
36
+ /**
37
+ * Descarta el banner temporalmente (hasta que se recargue la página).
38
+ */
39
+ dismiss(): void;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<UpdateBannerComponent, never>;
41
+ static ɵcmp: i0.ɵɵComponentDeclaration<UpdateBannerComponent, "val-update-banner", never, {}, {}, never, never, true, never>;
42
+ }
@@ -57,7 +57,7 @@ export declare class ArticleComponent implements OnInit {
57
57
  linkConfig?: import("valtech-components").LinkProcessorConfig;
58
58
  allowPartialBold?: boolean;
59
59
  authorColor?: import("@ionic/core").Color;
60
- alignment?: "center" | "left" | "right";
60
+ alignment?: "left" | "center" | "right";
61
61
  showQuoteMark?: boolean;
62
62
  };
63
63
  getHighlightTextProps(element: ArticleElement): {
@@ -91,7 +91,7 @@ export declare class ArticleComponent implements OnInit {
91
91
  icon?: import("valtech-components").IconMetada;
92
92
  shape?: "round";
93
93
  size?: "small" | "large" | "default";
94
- fill?: "default" | "clear" | "outline" | "solid";
94
+ fill?: "default" | "outline" | "clear" | "solid";
95
95
  type: "button" | "submit" | "reset";
96
96
  token?: string;
97
97
  ref?: any;
@@ -73,7 +73,7 @@ export declare class ToolbarComponent implements OnInit {
73
73
  showFlags?: boolean;
74
74
  color: import("@ionic/core").Color;
75
75
  size?: "small" | "large" | "default";
76
- fill?: "default" | "clear" | "outline" | "solid";
76
+ fill?: "default" | "outline" | "clear" | "solid";
77
77
  shape?: "round";
78
78
  expand?: "full" | "block";
79
79
  disabled?: boolean;
@@ -0,0 +1,57 @@
1
+ import { MaintenancePageMetadata } from './types';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * val-maintenance-page
5
+ *
6
+ * Página completa de mantenimiento con imagen, título y mensaje personalizables.
7
+ * Se integra con i18n para textos por defecto en múltiples idiomas.
8
+ *
9
+ * @example
10
+ * ```html
11
+ * <!-- Uso básico (usa textos por defecto) -->
12
+ * <val-maintenance-page />
13
+ *
14
+ * <!-- Personalizado -->
15
+ * <val-maintenance-page
16
+ * [props]="{
17
+ * title: 'En mantenimiento',
18
+ * message: 'Volvemos pronto',
19
+ * image: 'assets/maintenance.svg'
20
+ * }"
21
+ * />
22
+ * ```
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * // En app.component.ts
27
+ * @Component({
28
+ * template: \`
29
+ * @if (appConfig.isMaintenanceMode()) {
30
+ * <val-maintenance-page />
31
+ * } @else {
32
+ * <ion-router-outlet />
33
+ * }
34
+ * \`
35
+ * })
36
+ * export class AppComponent {
37
+ * appConfig = inject(AppConfigService);
38
+ * }
39
+ * ```
40
+ */
41
+ export declare class MaintenancePageComponent {
42
+ /**
43
+ * Configuración de la página de mantenimiento.
44
+ */
45
+ props: MaintenancePageMetadata;
46
+ private i18n;
47
+ /**
48
+ * Título de la página (reactivo a cambios de idioma).
49
+ */
50
+ title: import("@angular/core").Signal<string>;
51
+ /**
52
+ * Mensaje de la página (reactivo a cambios de idioma).
53
+ */
54
+ message: import("@angular/core").Signal<string>;
55
+ static ɵfac: i0.ɵɵFactoryDeclaration<MaintenancePageComponent, never>;
56
+ static ɵcmp: i0.ɵɵComponentDeclaration<MaintenancePageComponent, "val-maintenance-page", never, { "props": { "alias": "props"; "required": false; }; }, {}, never, never, true, never>;
57
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Props para val-maintenance-page component.
3
+ *
4
+ * @property title - Título personalizado (opcional, usa i18n por defecto)
5
+ * @property message - Mensaje personalizado (opcional, usa i18n por defecto)
6
+ * @property image - Ruta a imagen personalizada (opcional)
7
+ */
8
+ export type MaintenancePageMetadata = {
9
+ title?: string;
10
+ message?: string;
11
+ image?: string;
12
+ };
@@ -36,7 +36,13 @@ export declare class PageContentComponent {
36
36
  * Page content configuration.
37
37
  */
38
38
  props: PageContentMetadata;
39
+ private appConfigEnabled;
39
40
  constructor(theme: ThemeService, nav: NavigationService);
41
+ /**
42
+ * Whether to show the update banner.
43
+ * Only shows if AppConfigService is configured and not disabled via props.
44
+ */
45
+ get showUpdateBanner(): boolean;
40
46
  /**
41
47
  * Emits when a header action is clicked.
42
48
  */
@@ -18,4 +18,10 @@ export interface PageContentMetadata {
18
18
  * Uses 'icon' mode by default for compact display.
19
19
  */
20
20
  languageSelector?: LanguageSelectorMetadata;
21
+ /**
22
+ * Whether to show the update banner when a new version is available.
23
+ * Requires AppConfigService to be configured with provideValtechAppConfig().
24
+ * @default true
25
+ */
26
+ showUpdateBanner?: boolean;
21
27
  }
@@ -0,0 +1,115 @@
1
+ import { AppConfig } from './types';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Servicio de configuración remota de la aplicación.
5
+ *
6
+ * Lee la configuración desde Firestore (apps/{appId}/config/app) y provee:
7
+ * - Feature flags reactivos
8
+ * - Variables dinámicas de configuración
9
+ * - Detección de nuevas versiones
10
+ * - Modo mantenimiento
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * @Component({...})
15
+ * export class MyComponent {
16
+ * private appConfig = inject(AppConfigService);
17
+ *
18
+ * // Verificar feature flag
19
+ * showNewFeature = computed(() =>
20
+ * this.appConfig.isFeatureEnabled('newDashboard')
21
+ * );
22
+ *
23
+ * // Obtener variable
24
+ * maxSize = this.appConfig.getVariable('maxUploadSize', 5242880);
25
+ * }
26
+ * ```
27
+ */
28
+ export declare class AppConfigService {
29
+ private firestore;
30
+ private serviceConfig;
31
+ private subscription;
32
+ /**
33
+ * Configuración actual de la aplicación.
34
+ * null si no se ha cargado o no está configurado.
35
+ */
36
+ readonly appConfig: import("@angular/core").WritableSignal<AppConfig>;
37
+ /**
38
+ * Indica si la configuración está cargando.
39
+ */
40
+ readonly loading: import("@angular/core").WritableSignal<boolean>;
41
+ /**
42
+ * Error de carga, si existe.
43
+ */
44
+ readonly error: import("@angular/core").WritableSignal<string>;
45
+ /**
46
+ * Indica si hay una nueva versión disponible.
47
+ */
48
+ readonly hasUpdate: import("@angular/core").Signal<boolean>;
49
+ /**
50
+ * Indica si la aplicación está en modo mantenimiento.
51
+ */
52
+ readonly isMaintenanceMode: import("@angular/core").Signal<boolean>;
53
+ /**
54
+ * Versión remota de la aplicación.
55
+ */
56
+ readonly remoteVersion: import("@angular/core").Signal<string>;
57
+ /**
58
+ * Versión actual de la aplicación (local).
59
+ */
60
+ readonly currentVersion: import("@angular/core").Signal<string>;
61
+ /**
62
+ * Inicializa el servicio y comienza a escuchar cambios en la configuración.
63
+ * Se llama automáticamente via APP_INITIALIZER si se usa provideValtechAppConfig().
64
+ */
65
+ initialize(): Promise<void>;
66
+ /**
67
+ * Verifica si un feature flag está habilitado.
68
+ *
69
+ * @param feature - Nombre del feature flag
70
+ * @param defaultValue - Valor por defecto si no existe (default: false)
71
+ * @returns true si el feature está habilitado
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * if (appConfig.isFeatureEnabled('darkMode')) {
76
+ * // Mostrar toggle de dark mode
77
+ * }
78
+ * ```
79
+ */
80
+ isFeatureEnabled(feature: string, defaultValue?: boolean): boolean;
81
+ /**
82
+ * Obtiene una variable de configuración.
83
+ *
84
+ * @param key - Clave de la variable
85
+ * @param defaultValue - Valor por defecto si no existe
86
+ * @returns Valor de la variable o el valor por defecto
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * const maxSize = appConfig.getVariable('maxUploadSize', 5242880);
91
+ * const supportEmail = appConfig.getVariable('supportEmail', 'support@example.com');
92
+ * ```
93
+ */
94
+ getVariable<T>(key: string, defaultValue: T): T;
95
+ /**
96
+ * Recarga la configuración manualmente (one-time read).
97
+ * Útil si necesitas forzar una actualización.
98
+ */
99
+ refresh(): Promise<void>;
100
+ /**
101
+ * Desuscribe del listener de Firestore.
102
+ * Se llama automáticamente cuando el servicio se destruye.
103
+ */
104
+ destroy(): void;
105
+ /**
106
+ * Compara dos versiones semver y retorna true si remote > current.
107
+ *
108
+ * @param remote - Versión remota (ej: "1.2.3")
109
+ * @param current - Versión actual (ej: "1.2.0")
110
+ * @returns true si remote es mayor que current
111
+ */
112
+ private isNewerVersion;
113
+ static ɵfac: i0.ɵɵFactoryDeclaration<AppConfigService, never>;
114
+ static ɵprov: i0.ɵɵInjectableDeclaration<AppConfigService>;
115
+ }
@@ -0,0 +1,31 @@
1
+ import { EnvironmentProviders, InjectionToken } from '@angular/core';
2
+ import { AppConfigServiceConfig } from './types';
3
+ /**
4
+ * Token de inyección para la configuración de AppConfig.
5
+ */
6
+ export declare const VALTECH_APP_CONFIG: InjectionToken<AppConfigServiceConfig>;
7
+ /**
8
+ * Provee el servicio de configuración remota a la aplicación Angular.
9
+ *
10
+ * @param config - Configuración del servicio
11
+ * @returns EnvironmentProviders para usar en bootstrapApplication
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * // main.ts
16
+ * import { bootstrapApplication } from '@angular/platform-browser';
17
+ * import { provideValtechAppConfig } from 'valtech-components';
18
+ * import { version } from '../package.json';
19
+ *
20
+ * bootstrapApplication(AppComponent, {
21
+ * providers: [
22
+ * provideValtechFirebase(environment.valtechFirebase),
23
+ * provideValtechAppConfig({
24
+ * currentVersion: version,
25
+ * showUpdateBanner: true,
26
+ * }),
27
+ * ],
28
+ * });
29
+ * ```
30
+ */
31
+ export declare function provideValtechAppConfig(config: AppConfigServiceConfig): EnvironmentProviders;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * AppConfig Service Module
3
+ *
4
+ * Servicio de configuración remota para aplicaciones Angular.
5
+ * Lee configuración desde Firestore y provee feature flags, variables dinámicas,
6
+ * y detección de actualizaciones.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // main.ts
11
+ * import { provideValtechAppConfig } from 'valtech-components';
12
+ *
13
+ * bootstrapApplication(AppComponent, {
14
+ * providers: [
15
+ * provideValtechFirebase(environment.valtechFirebase),
16
+ * provideValtechAppConfig({
17
+ * currentVersion: '1.0.0',
18
+ * showUpdateBanner: true,
19
+ * }),
20
+ * ],
21
+ * });
22
+ *
23
+ * // component.ts
24
+ * import { AppConfigService } from 'valtech-components';
25
+ *
26
+ * @Component({...})
27
+ * export class MyComponent {
28
+ * private appConfig = inject(AppConfigService);
29
+ *
30
+ * showFeature = computed(() =>
31
+ * this.appConfig.isFeatureEnabled('newDashboard')
32
+ * );
33
+ * }
34
+ * ```
35
+ */
36
+ export * from './types';
37
+ export { VALTECH_APP_CONFIG, provideValtechAppConfig } from './config';
38
+ export { AppConfigService } from './app-config.service';
@@ -0,0 +1,54 @@
1
+ /**
2
+ * AppConfig Types
3
+ *
4
+ * Tipos para el servicio de configuración remota de la aplicación.
5
+ */
6
+ import { FirestoreDocument } from '../firebase/types';
7
+ /**
8
+ * Configuración de la aplicación almacenada en Firestore.
9
+ *
10
+ * @property version - Versión más reciente de la app
11
+ * @property minVersion - Versión mínima soportada (opcional)
12
+ * @property maintenance - Modo mantenimiento global
13
+ * @property features - Feature flags (key-value boolean)
14
+ * @property variables - Variables dinámicas de configuración
15
+ * @property announcements - Anuncios opcionales para mostrar
16
+ */
17
+ export interface AppConfig extends FirestoreDocument {
18
+ version: string;
19
+ minVersion?: string;
20
+ maintenance?: boolean;
21
+ features: Record<string, boolean>;
22
+ variables: Record<string, unknown>;
23
+ announcements?: Announcement[];
24
+ }
25
+ /**
26
+ * Anuncio para mostrar en la aplicación.
27
+ *
28
+ * @property id - Identificador único del anuncio
29
+ * @property type - Tipo de anuncio (info, warning, promo)
30
+ * @property message - Mensaje en múltiples idiomas
31
+ * @property active - Si el anuncio está activo
32
+ * @property link - URL opcional para redirección
33
+ */
34
+ export interface Announcement {
35
+ id: string;
36
+ type: 'info' | 'warning' | 'promo';
37
+ message: Record<string, string>;
38
+ active: boolean;
39
+ link?: string;
40
+ }
41
+ /**
42
+ * Configuración para el proveedor de AppConfigService.
43
+ *
44
+ * @property currentVersion - Versión actual de la aplicación
45
+ * @property showUpdateBanner - Mostrar banner de actualización automáticamente
46
+ */
47
+ export interface AppConfigServiceConfig {
48
+ currentVersion: string;
49
+ showUpdateBanner?: boolean;
50
+ }
51
+ /**
52
+ * Configuración por defecto del servicio.
53
+ */
54
+ export declare const DEFAULT_APP_CONFIG_SERVICE_CONFIG: AppConfigServiceConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.621",
3
+ "version": "2.0.623",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"
package/public-api.d.ts CHANGED
@@ -161,6 +161,7 @@ export * from './lib/components/molecules/links-accordion/links-accordion.compon
161
161
  export * from './lib/components/molecules/links-accordion/types';
162
162
  export * from './lib/components/molecules/refresher/refresher.component';
163
163
  export * from './lib/components/molecules/refresher/types';
164
+ export * from './lib/components/molecules/update-banner/update-banner.component';
164
165
  export * from './lib/components/organisms/article/article.component';
165
166
  export * from './lib/components/organisms/article/types';
166
167
  export * from './lib/components/organisms/banner/banner.component';
@@ -213,6 +214,8 @@ export * from './lib/components/templates/page-content/page-content.component';
213
214
  export * from './lib/components/templates/page-content/types';
214
215
  export * from './lib/components/templates/page-wrapper/page-wrapper.component';
215
216
  export * from './lib/components/templates/page-wrapper/types';
217
+ export * from './lib/components/templates/maintenance-page/maintenance-page.component';
218
+ export * from './lib/components/templates/maintenance-page/types';
216
219
  export * from './lib/services/download.service';
217
220
  export * from './lib/services/icons.service';
218
221
  export * from './lib/services/in-app-browser.service';
@@ -232,6 +235,7 @@ export * from './lib/services/modal/types';
232
235
  export * from './lib/services/firebase';
233
236
  export * from './lib/services/auth';
234
237
  export * from './lib/services/i18n';
238
+ export * from './lib/services/app-config';
235
239
  export * from './lib/services/presets';
236
240
  export * from './lib/services/skeleton';
237
241
  export * from './lib/services/pagination';