valtech-components 2.0.972 → 2.0.975
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/organisms/profile-view/profile-view.component.mjs +59 -2
- package/esm2022/lib/components/organisms/profile-view/profile-view.i18n.mjs +7 -1
- package/esm2022/lib/components/organisms/profile-view/types.mjs +1 -1
- package/esm2022/lib/components/organisms/settings-hub/settings-hub.component.mjs +152 -0
- package/esm2022/lib/components/organisms/settings-hub/settings-hub.i18n.mjs +57 -0
- package/esm2022/lib/components/organisms/settings-hub/settings-sections.mjs +137 -0
- package/esm2022/lib/components/organisms/settings-hub/settings.routes.mjs +59 -0
- package/esm2022/lib/components/organisms/settings-hub/types.mjs +2 -0
- package/esm2022/lib/components/organisms/share-profile-modal/share-profile-modal.component.mjs +13 -5
- package/esm2022/lib/components/organisms/share-profile-modal/types.mjs +1 -1
- package/esm2022/lib/version.mjs +2 -2
- package/esm2022/public-api.mjs +5 -1
- package/fesm2022/valtech-components.mjs +467 -7
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/organisms/profile-view/profile-view.component.d.ts +6 -1
- package/lib/components/organisms/profile-view/types.d.ts +12 -0
- package/lib/components/organisms/settings-hub/settings-hub.component.d.ts +43 -0
- package/lib/components/organisms/settings-hub/settings-hub.i18n.d.ts +13 -0
- package/lib/components/organisms/settings-hub/settings-sections.d.ts +62 -0
- package/lib/components/organisms/settings-hub/settings.routes.d.ts +59 -0
- package/lib/components/organisms/settings-hub/types.d.ts +37 -0
- package/lib/components/organisms/share-profile-modal/types.d.ts +2 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +4 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AvatarUploadError, AvatarUploadMetadata, AvatarUploadResult } from '../avatar-upload/types';
|
|
2
|
+
import { ShareProfileModalMetadata } from '../share-profile-modal/types';
|
|
3
|
+
import { CtaCardMetadata } from '../../molecules/cta-card/types';
|
|
2
4
|
import { EmptyStateMetadata } from '../../molecules/empty-state/types';
|
|
3
5
|
import { FormMetadata, FormSubmit } from '../../types';
|
|
4
6
|
import { GetProfileResponse } from '../../../services/auth/types';
|
|
@@ -45,7 +47,7 @@ export declare class ProfileViewComponent {
|
|
|
45
47
|
*/
|
|
46
48
|
config?: ProfileViewConfig;
|
|
47
49
|
/** Config mergeada con defaults. @Input gana sobre route data. */
|
|
48
|
-
readonly resolvedConfig: import("@angular/core").Signal<Required<Omit<ProfileViewConfig, "onSaved" | "onAvatarUploaded">> & Pick<ProfileViewConfig, "onSaved" | "onAvatarUploaded">>;
|
|
50
|
+
readonly resolvedConfig: import("@angular/core").Signal<Required<Omit<ProfileViewConfig, "onSaved" | "onAvatarUploaded" | "profileBaseUrl">> & Pick<ProfileViewConfig, "onSaved" | "onAvatarUploaded" | "profileBaseUrl">>;
|
|
49
51
|
/** Namespace i18n resuelto (capturado una vez para llamadas no-reactivas). */
|
|
50
52
|
private get ns();
|
|
51
53
|
/**
|
|
@@ -58,6 +60,9 @@ export declare class ProfileViewComponent {
|
|
|
58
60
|
readonly loading: import("@angular/core").WritableSignal<boolean>;
|
|
59
61
|
readonly saving: import("@angular/core").WritableSignal<boolean>;
|
|
60
62
|
readonly loadError: import("@angular/core").WritableSignal<unknown>;
|
|
63
|
+
readonly shareOpen: import("@angular/core").WritableSignal<boolean>;
|
|
64
|
+
readonly shareCta: import("@angular/core").Signal<CtaCardMetadata>;
|
|
65
|
+
readonly shareModal: import("@angular/core").Signal<ShareProfileModalMetadata>;
|
|
61
66
|
private readonly _userId;
|
|
62
67
|
readonly errorState: import("@angular/core").Signal<EmptyStateMetadata>;
|
|
63
68
|
readonly avatarProps: import("@angular/core").Signal<AvatarUploadMetadata>;
|
|
@@ -25,6 +25,18 @@ export interface ProfileViewConfig {
|
|
|
25
25
|
* Default `'Settings.Profile'`.
|
|
26
26
|
*/
|
|
27
27
|
i18nNamespace?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Muestra la CTA de compartir perfil (QR modal). Requiere que el user tenga
|
|
30
|
+
* handle configurado — si no, la sección no aparece aunque esté en `true`.
|
|
31
|
+
* Default `true`.
|
|
32
|
+
*/
|
|
33
|
+
showShareCta?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* URL base de la app para construir el enlace del perfil público.
|
|
36
|
+
* El enlace final es `${profileBaseUrl}/u/${handle}`.
|
|
37
|
+
* Ej: `'https://app.myvaltech.com'`.
|
|
38
|
+
*/
|
|
39
|
+
profileBaseUrl?: string;
|
|
28
40
|
/** Callback tras un guardado de perfil exitoso. */
|
|
29
41
|
onSaved?: (profile: GetProfileResponse) => void;
|
|
30
42
|
/** Callback tras subir/actualizar el avatar exitosamente. */
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ActionCardMetadata } from '../../molecules/action-card/types';
|
|
2
|
+
import { SettingsHubConfig } from './types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* `val-settings-hub` — portada de la sección Settings (organism). Renderiza un
|
|
6
|
+
* header (título + descripción) + un grid de `val-action-card` que navega a las
|
|
7
|
+
* sub-vistas. Promovido desde `showcase` (`pages/settings/pages/preferences`)
|
|
8
|
+
* bajo el proceso de ADR-021.
|
|
9
|
+
*
|
|
10
|
+
* Las cards salen de `buildSettingsCards` sobre el catálogo default
|
|
11
|
+
* (`SETTINGS_SECTIONS_CATALOG`), filtrado/extendido/reordenado por la config.
|
|
12
|
+
*
|
|
13
|
+
* Navegación: cards con `routerLink` navegan vía `Router`; la card de logout
|
|
14
|
+
* (sin ruta) invoca `config.onLogout`. Cada click emite `config.onSectionClick`.
|
|
15
|
+
*
|
|
16
|
+
* NO renderiza ion-content — vive dentro de val-page-wrapper.
|
|
17
|
+
*
|
|
18
|
+
* Auto-registra sus dos sets de defaults i18n (labels + header) en sus
|
|
19
|
+
* respectivos namespaces si el consumer no los proveyó.
|
|
20
|
+
*/
|
|
21
|
+
export declare class SettingsHubComponent {
|
|
22
|
+
private nav;
|
|
23
|
+
private i18n;
|
|
24
|
+
private router;
|
|
25
|
+
private route;
|
|
26
|
+
/**
|
|
27
|
+
* Config vía @Input (object-first). Si no se pasa, cae al route data
|
|
28
|
+
* `settingsHubConfig` (poblado por `provideValtechSettingsRoutes`).
|
|
29
|
+
* `resolvedConfig` mergea con defaults — @Input gana sobre route data.
|
|
30
|
+
*/
|
|
31
|
+
config?: SettingsHubConfig;
|
|
32
|
+
readonly resolvedConfig: import("@angular/core").Signal<Required<Pick<SettingsHubConfig, "i18nNamespace" | "pageI18nNamespace">> & SettingsHubConfig>;
|
|
33
|
+
private get labelsNs();
|
|
34
|
+
private get pageNs();
|
|
35
|
+
readonly pageTitle: import("@angular/core").Signal<string>;
|
|
36
|
+
readonly pageDescription: import("@angular/core").Signal<string>;
|
|
37
|
+
/** Cards del HUB, resueltas desde la config. */
|
|
38
|
+
readonly actionCards: import("@angular/core").Signal<ActionCardMetadata[]>;
|
|
39
|
+
constructor();
|
|
40
|
+
onActionClick(action: ActionCardMetadata): void;
|
|
41
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SettingsHubComponent, never>;
|
|
42
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SettingsHubComponent, "val-settings-hub", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LanguagesContent } from '../../../services/i18n/types';
|
|
2
|
+
/**
|
|
3
|
+
* Defaults i18n embebidos en `val-settings-hub`. Dos sets, uno por namespace
|
|
4
|
+
* (ver `SettingsHubConfig.i18nNamespace` / `.pageI18nNamespace`). Auto-registrados
|
|
5
|
+
* en el constructor SOLO si el namespace no existe (respeta override del consumer).
|
|
6
|
+
*
|
|
7
|
+
* `SETTINGS_HUB_LABELS_I18N` — labels de cada sección (namespace `Dashboard` por
|
|
8
|
+
* default). Mismo set que showcase mantiene en `src/i18n/index.ts` (queda como
|
|
9
|
+
* override). `SETTINGS_HUB_PAGE_I18N` — header del HUB (namespace
|
|
10
|
+
* `Settings.Preferences` por default), tomado de la page Preferencias original.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SETTINGS_HUB_LABELS_I18N: LanguagesContent;
|
|
13
|
+
export declare const SETTINGS_HUB_PAGE_I18N: LanguagesContent;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ActionCardMetadata } from '../../molecules/action-card/types';
|
|
2
|
+
/**
|
|
3
|
+
* Modelo de una sección del HUB de settings. Cada sección se proyecta a un
|
|
4
|
+
* `val-action-card` (vía `buildSettingsCards`). El catálogo default
|
|
5
|
+
* (`SETTINGS_SECTIONS_CATALOG`) cubre las secciones estándar del factory;
|
|
6
|
+
* el consumer puede filtrar (`exclude`), reordenar (`order`), reescribir las
|
|
7
|
+
* rutas base (`basePath`) o sumar las suyas (`include`).
|
|
8
|
+
*/
|
|
9
|
+
export interface SettingsSection {
|
|
10
|
+
/** Identificador estable de la sección (dispatch de click + filtrado). */
|
|
11
|
+
token: string;
|
|
12
|
+
/** i18n key del título de la card (resuelto contra el namespace de labels). */
|
|
13
|
+
titleKey: string;
|
|
14
|
+
/** i18n key de la descripción (opcional — logout no la tiene). */
|
|
15
|
+
descKey?: string;
|
|
16
|
+
/** Ionicon de la card. */
|
|
17
|
+
ionicon: string;
|
|
18
|
+
/**
|
|
19
|
+
* Ruta de navegación. Las secciones bajo `/app/settings` se reescriben si el
|
|
20
|
+
* consumer pasa `basePath`. `action-logout` no tiene ruta (callback).
|
|
21
|
+
*/
|
|
22
|
+
routerLink?: string;
|
|
23
|
+
/** Muestra el chevron a la derecha. Default `true`. */
|
|
24
|
+
showChevron?: boolean;
|
|
25
|
+
/** Card con sombra. Default `true`. */
|
|
26
|
+
shadowed?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Catálogo default de secciones del HUB de settings (8 entradas). `logout` va
|
|
30
|
+
* incluida pero sin `routerLink` (la maneja un callback). Mismo set, mismos
|
|
31
|
+
* tokens/iconos/rutas que el builder original de showcase
|
|
32
|
+
* (`shared/settings-action-cards.ts`) que esta promoción reemplaza.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SETTINGS_SECTIONS_CATALOG: SettingsSection[];
|
|
35
|
+
/** Opciones del builder `buildSettingsCards`. */
|
|
36
|
+
export interface SettingsCardsOptions {
|
|
37
|
+
/** Oculta secciones por token (típicamente la entrada de la página actual). */
|
|
38
|
+
exclude?: string[];
|
|
39
|
+
/** Secciones extra a sumar al catálogo (las de la app aún no promovidas). */
|
|
40
|
+
include?: SettingsSection[];
|
|
41
|
+
/** Orden explícito por token. Las no listadas quedan al final, en su orden. */
|
|
42
|
+
order?: string[];
|
|
43
|
+
/** Incluye la card de logout (sin ruta). Default `false`. */
|
|
44
|
+
includeLogout?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Reescribe el prefijo `/app/settings` de las rutas del catálogo. Ej.
|
|
47
|
+
* `basePath: '/app/config'` → `/app/config/general`. Si se omite, las rutas
|
|
48
|
+
* quedan tal cual el catálogo.
|
|
49
|
+
*/
|
|
50
|
+
basePath?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Construye el grid de cards de navegación del HUB de settings (versión
|
|
54
|
+
* promovida del `buildSettingsActionCards` de showcase). Usa el catálogo
|
|
55
|
+
* default + las `include` del consumer, filtra `exclude`, gatea logout por
|
|
56
|
+
* `includeLogout`, reordena por `order` y reescribe las rutas por `basePath`.
|
|
57
|
+
*
|
|
58
|
+
* El `t` resuelve los `titleKey`/`descKey` contra el namespace de labels
|
|
59
|
+
* (default del componente: `Dashboard`). `logout` NO tiene `routerLink` — el
|
|
60
|
+
* consumer maneja el flujo de cierre de sesión por token / callback.
|
|
61
|
+
*/
|
|
62
|
+
export declare function buildSettingsCards(t: (key: string) => string, options?: SettingsCardsOptions): ActionCardMetadata[];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Routes } from '@angular/router';
|
|
2
|
+
import { ProfileViewConfig } from '../profile-view/types';
|
|
3
|
+
import { PreferencesViewConfig } from '../preferences-view/types';
|
|
4
|
+
import { SettingsHubConfig } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Opciones de `provideValtechSettingsRoutes`. Agrupa el HUB (`val-settings-hub`)
|
|
7
|
+
* con las vistas ya promovidas (Perfil + Preferencias) bajo un único `path`
|
|
8
|
+
* base, y deja `extraRoutes` para las secciones de la app aún no promovidas
|
|
9
|
+
* (security, account, notifications, organization, …).
|
|
10
|
+
*/
|
|
11
|
+
export interface ValtechSettingsRoutesOptions {
|
|
12
|
+
/** Path base del bloque de settings. Default `'settings'`. */
|
|
13
|
+
basePath?: string;
|
|
14
|
+
/** Config del HUB (pasada por route data `settingsHubConfig`). */
|
|
15
|
+
hubConfig?: SettingsHubConfig;
|
|
16
|
+
/** Config de la vista Perfil (pass-through a `provideValtechProfileRoutes`). */
|
|
17
|
+
profileConfig?: ProfileViewConfig;
|
|
18
|
+
/** Config de la vista Preferencias (pass-through a `provideValtechPreferencesRoutes`). */
|
|
19
|
+
preferencesConfig?: PreferencesViewConfig;
|
|
20
|
+
/** Monta la ruta `profile`. Default `true`. */
|
|
21
|
+
includeProfile?: boolean;
|
|
22
|
+
/** Monta la ruta de preferencias. Default `true`. */
|
|
23
|
+
includePreferences?: boolean;
|
|
24
|
+
/** Path de la vista Preferencias. Default `'preferences'`. */
|
|
25
|
+
preferencesPath?: string;
|
|
26
|
+
/** Rutas extra a sumar como hijas (secciones de la app no promovidas). */
|
|
27
|
+
extraRoutes?: Routes;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Helper para montar el bloque completo de Settings en una app del factory: el
|
|
31
|
+
* HUB de navegación (`val-settings-hub`) en el index + las vistas promovidas
|
|
32
|
+
* (Perfil, Preferencias) + las rutas propias de la app (`extraRoutes`).
|
|
33
|
+
*
|
|
34
|
+
* Pensado para apps nuevas (greenfield) que adoptan el set entero. showcase NO
|
|
35
|
+
* lo usa hoy (preserva su `settings.routes.ts` por la semántica de sus muchas
|
|
36
|
+
* secciones no promovidas — ver guía de promoción), pero el provider debe
|
|
37
|
+
* existir y compilar para el resto de apps.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* // app.routes.ts
|
|
42
|
+
* import { provideValtechSettingsRoutes } from 'valtech-components';
|
|
43
|
+
*
|
|
44
|
+
* export const routes: Routes = [
|
|
45
|
+
* {
|
|
46
|
+
* path: 'app',
|
|
47
|
+
* children: [
|
|
48
|
+
* ...provideValtechSettingsRoutes({
|
|
49
|
+
* hubConfig: { onLogout: () => auth.logoutWithConfirmation() },
|
|
50
|
+
* extraRoutes: [
|
|
51
|
+
* { path: 'security', loadComponent: () => ... },
|
|
52
|
+
* ],
|
|
53
|
+
* }),
|
|
54
|
+
* ],
|
|
55
|
+
* },
|
|
56
|
+
* ];
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function provideValtechSettingsRoutes(opts?: ValtechSettingsRoutesOptions): Routes;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SettingsSection } from './settings-sections';
|
|
2
|
+
/**
|
|
3
|
+
* Configuración acotada de `val-settings-hub` (object-first). El HUB es la
|
|
4
|
+
* portada de la sección Settings: un header (título + descripción) + un grid de
|
|
5
|
+
* `val-action-card` que navega a las sub-vistas.
|
|
6
|
+
*
|
|
7
|
+
* Doble namespace i18n:
|
|
8
|
+
* - `i18nNamespace` (default `'Dashboard'`) — labels de cada sección
|
|
9
|
+
* (`general`, `account`, …). Es el set que comparten dashboard / hub.
|
|
10
|
+
* - `pageI18nNamespace` (default `'Settings.Preferences'`) — `pageTitle` /
|
|
11
|
+
* `pageDescription` del header del HUB.
|
|
12
|
+
*
|
|
13
|
+
* El catálogo de secciones es el default (`SETTINGS_SECTIONS_CATALOG`); se
|
|
14
|
+
* filtra (`exclude`), reordena (`order`), extiende (`include`) o reescribe sus
|
|
15
|
+
* rutas (`basePath`). `includeLogout` agrega la card de cierre de sesión (sin
|
|
16
|
+
* ruta) — su click se delega a `onLogout`.
|
|
17
|
+
*/
|
|
18
|
+
export interface SettingsHubConfig {
|
|
19
|
+
/** Oculta secciones por token (ej. la propia entrada del HUB). */
|
|
20
|
+
exclude?: string[];
|
|
21
|
+
/** Secciones extra a sumar al catálogo (las de la app aún no promovidas). */
|
|
22
|
+
include?: SettingsSection[];
|
|
23
|
+
/** Orden explícito por token. Las no listadas quedan al final. */
|
|
24
|
+
order?: string[];
|
|
25
|
+
/** Incluye la card de logout (sin ruta). Default `false`. */
|
|
26
|
+
includeLogout?: boolean;
|
|
27
|
+
/** Reescribe el prefijo `/app/settings` de las rutas del catálogo. */
|
|
28
|
+
basePath?: string;
|
|
29
|
+
/** Namespace i18n de los labels de sección. Default `'Dashboard'`. */
|
|
30
|
+
i18nNamespace?: string;
|
|
31
|
+
/** Namespace i18n del header (pageTitle/pageDescription). Default `'Settings.Preferences'`. */
|
|
32
|
+
pageI18nNamespace?: string;
|
|
33
|
+
/** Callback al click de la card de logout (sin ruta). */
|
|
34
|
+
onLogout?: () => void;
|
|
35
|
+
/** Callback al click de cualquier card, con su token. */
|
|
36
|
+
onSectionClick?: (token: string) => void;
|
|
37
|
+
}
|
|
@@ -20,6 +20,8 @@ export interface ShareProfileModalMetadata {
|
|
|
20
20
|
avatarUrl?: string;
|
|
21
21
|
/** Email — used for the avatar initials/color when no avatarUrl */
|
|
22
22
|
email?: string;
|
|
23
|
+
/** Handle shown as @handle below the name */
|
|
24
|
+
handle?: string;
|
|
23
25
|
/** Modal title (val-display). Default: `name` */
|
|
24
26
|
title?: string;
|
|
25
27
|
/** Caption under the QR. Default: i18n `ShareProfileModal.caption` */
|
package/lib/version.d.ts
CHANGED
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -268,6 +268,10 @@ export * from './lib/components/organisms/profile-view/profile.routes';
|
|
|
268
268
|
export * from './lib/components/organisms/preferences-view/preferences-view.component';
|
|
269
269
|
export * from './lib/components/organisms/preferences-view/types';
|
|
270
270
|
export * from './lib/components/organisms/preferences-view/preferences.routes';
|
|
271
|
+
export * from './lib/components/organisms/settings-hub/settings-hub.component';
|
|
272
|
+
export * from './lib/components/organisms/settings-hub/types';
|
|
273
|
+
export * from './lib/components/organisms/settings-hub/settings-sections';
|
|
274
|
+
export * from './lib/components/organisms/settings-hub/settings.routes';
|
|
271
275
|
export * from './lib/components/organisms/skeleton-layout/skeleton-layout.component';
|
|
272
276
|
export * from './lib/components/organisms/skeleton-layout/types';
|
|
273
277
|
export * from './lib/components/organisms/faq/faq.component';
|