template-common 1.1.0 → 1.1.2

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.
@@ -14,11 +14,13 @@ import { RefAttributes } from 'react';
14
14
  import { SVGProps } from 'react';
15
15
  import { TextareaHTMLAttributes } from 'react';
16
16
 
17
- export declare const ACCOUNT_PROFILE_NAV_ITEMS: Record<'es' | 'en', AccountProfileNavItem[]>;
17
+ export declare const ACCOUNT_PROFILE_NAV_ITEMS: Record<'es' | 'en', (AccountProfileNavItem & {
18
+ id: AccountProfileSection;
19
+ })[]>;
18
20
 
19
21
  export declare const ACCOUNT_PROFILE_TEXTS: Record<'es' | 'en', AccountProfileTexts>;
20
22
 
21
- export declare function AccountProfileConfig({ API_ENV, socials, texts, navItems, }: AccountProfileConfigProps): JSX.Element | null;
23
+ export declare function AccountProfileConfig({ API_ENV, socials, texts, navItems, section: requestedSection, preferenceItems, preferenceSuggestionsLimit, preferenceCollapseAt, newsletterItems, debug, }: AccountProfileConfigProps): JSX.Element | null;
22
24
 
23
25
  export declare type AccountProfileConfigProps = {
24
26
  /** Subconjunto de config (`pickCoreAuthConfig`). Default: `getConfig()`. */
@@ -30,8 +32,26 @@ export declare type AccountProfileConfigProps = {
30
32
  * claves de contraseña coinciden).
31
33
  */
32
34
  texts?: Partial<Record<keyof AccountProfileTexts, unknown>>;
33
- /** Menú lateral. Default: solo "Configuración" activo, el resto deshabilitado. */
35
+ /**
36
+ * Menú lateral. Default: las secciones prendidas por config
37
+ * (`CONFIG_profilePreferences`, `CONFIG_profileNewsletters`) + "Configuración".
38
+ */
34
39
  navItems?: AccountProfileNavItem[];
40
+ /** Sección a mostrar. Default `config`. */
41
+ section?: AccountProfileSection;
42
+ /** Temas de "Mis preferencias". Default: lista genérica de la lib. */
43
+ preferenceItems?: AccountProfilePreferenceItem[];
44
+ /** Chips sugeridos (+) en "Lo que querés ver más". Default 3. */
45
+ preferenceSuggestionsLimit?: number;
46
+ /** Chips visibles por lista antes de "Mostrar más N". Default 8. */
47
+ preferenceCollapseAt?: number;
48
+ /** Opciones de "Newsletters". Default: lista genérica de la lib. */
49
+ newsletterItems?: AccountProfileNewsletterItem[];
50
+ /**
51
+ * Panel debug de "Mis preferencias" y "Newsletters". Default: visible fuera
52
+ * de prod, o con `?debug` en la URL.
53
+ */
54
+ debug?: boolean;
35
55
  };
36
56
 
37
57
  export declare type AccountProfileNavItem = {
@@ -43,6 +63,42 @@ export declare type AccountProfileNavItem = {
43
63
  disabled?: boolean;
44
64
  };
45
65
 
66
+ export declare type AccountProfileNewsletterItem = {
67
+ id: string;
68
+ name: string;
69
+ description: string;
70
+ /** Texto libre: "Diario", "Semanal"... */
71
+ frequency?: string;
72
+ };
73
+
74
+ export declare type AccountProfilePreferenceItem = {
75
+ id: string;
76
+ label: string;
77
+ kind: AccountProfilePreferenceKind;
78
+ /** Afinidad: lo que comparte grupo con lo que te interesa se sugiere primero. */
79
+ group?: string;
80
+ /**
81
+ * Interés detectado por actividad, de -1 a 1 (hoy es mock: lo trae la lista).
82
+ * > 0: aparece en "ver más" sin ícono (inferido). < 0: en "ver menos".
83
+ */
84
+ activity?: number;
85
+ };
86
+
87
+ /**
88
+ * Tipos y listas por defecto de "Mis preferencias" y "Newsletters". El sitio
89
+ * pasa las suyas por prop (`preferenceItems`, `newsletterItems`).
90
+ */
91
+ export declare type AccountProfilePreferenceKind = 'section' | 'tag' | 'author';
92
+
93
+ /** Secciones de la página de cuenta. Cada una es su propia ruta en el sitio. */
94
+ export declare type AccountProfileSection = 'config' | 'preferences' | 'newsletters';
95
+
96
+ /** Toggles de las secciones opcionales. "Configuración" siempre está. */
97
+ export declare type AccountProfileSectionToggles = {
98
+ CONFIG_profilePreferences?: boolean;
99
+ CONFIG_profileNewsletters?: boolean;
100
+ };
101
+
46
102
  export declare type AccountProfileTexts = {
47
103
  title: string;
48
104
  logout: string;
@@ -63,6 +119,37 @@ export declare type AccountProfileTexts = {
63
119
  gnewsLink: string;
64
120
  gnewsHintPrefix: string;
65
121
  gnewsHintSuffix: string;
122
+ prefsTitle: string;
123
+ /** `{{topics}}` se reemplaza por la lista de temas ("A, B y C"). */
124
+ prefsSummary: string;
125
+ prefsSummaryEmpty: string;
126
+ prefsMoreTitle: string;
127
+ prefsMoreHint: string;
128
+ prefsLessTitle: string;
129
+ prefsLessHint: string;
130
+ prefsExpand: string;
131
+ prefsCollapse: string;
132
+ prefsAdd: string;
133
+ prefsAddPlaceholder: string;
134
+ prefsSuggestedAria: string;
135
+ prefsEditAria: string;
136
+ prefsSourceAdded: string;
137
+ prefsSourceActivity: string;
138
+ prefsMoveToLess: string;
139
+ prefsMoveToMore: string;
140
+ prefsRemove: string;
141
+ prefsCancel: string;
142
+ newslettersTitle: string;
143
+ newslettersDesc: string;
144
+ newslettersFootnote: string;
145
+ newslettersSaved: string;
146
+ newslettersSelectAll: string;
147
+ newslettersClearAll: string;
148
+ debugTitle: string;
149
+ debugStorageKey: string;
150
+ debugUpdatedAt: string;
151
+ debugNever: string;
152
+ debugReset: string;
66
153
  changePasswordButton: string;
67
154
  /** `{{email}}` se reemplaza por el email enmascarado. */
68
155
  changePasswordMessage: string;
@@ -436,6 +523,9 @@ export declare type BucketOriginConfig = {
436
523
  cacheTtlMs?: number;
437
524
  };
438
525
 
526
+ /** Menú lateral: solo las secciones prendidas, con la actual marcada. */
527
+ export declare const buildAccountProfileNav: (lng: string | undefined, cfg: AccountProfileSectionToggles, current: AccountProfileSection) => AccountProfileNavItem[];
528
+
439
529
  export declare const buildAccountUrl: (cfg?: CoreAuthConfig) => string;
440
530
 
441
531
  declare type BuildArgs = {
@@ -1088,8 +1178,8 @@ export declare const contractWarn: (component: string, field: string, extra?: un
1088
1178
 
1089
1179
  export declare const CORE_AUTH_CHANGED_EVENT = "core-auth:changed";
1090
1180
 
1091
- /** Claves de config que usa el login del header y del perfil. */
1092
- export declare const CORE_AUTH_CONFIG_KEYS: readonly ["CONFIG_headerAuth", "CONFIG_authUserImage", "CONFIG_accountPath", "CONFIG_authAvatarBase", "CONFIG_authMockUser", "COGNITO_AUTH_PREFIX", "PUBLIC_ENV", "PUBLIC_LNG", "PUBLIC_SERVICE_PREFIX", "PUBLIC_IS_SUB_PUBLICATION", "FORCE_SUB_PUBLICATION_PREFIX"];
1181
+ /** Claves de config que usa el login del header y la página de cuenta. */
1182
+ export declare const CORE_AUTH_CONFIG_KEYS: readonly ["CONFIG_headerAuth", "CONFIG_authUserImage", "CONFIG_accountPath", "CONFIG_authAvatarBase", "CONFIG_authMockUser", "CONFIG_profilePreferences", "CONFIG_profileNewsletters", "COGNITO_AUTH_PREFIX", "PUBLIC_ENV", "PUBLIC_LNG", "PUBLIC_SERVICE_PREFIX", "PUBLIC_IS_SUB_PUBLICATION", "FORCE_SUB_PUBLICATION_PREFIX"];
1093
1183
 
1094
1184
  export declare type CoreAuthConfig = Pick<LibraryConfig, (typeof CORE_AUTH_CONFIG_KEYS)[number]>;
1095
1185
 
@@ -1834,6 +1924,10 @@ export declare const getCoreAuthDisplayName: (user: CoreAuthUser) => string;
1834
1924
  */
1835
1925
  export declare const getCoreAuthInitials: (user: CoreAuthUser) => string;
1836
1926
 
1927
+ export declare const getDefaultNewsletterItems: (lng?: string) => AccountProfileNewsletterItem[];
1928
+
1929
+ export declare const getDefaultPreferenceItems: (lng?: string) => AccountProfilePreferenceItem[];
1930
+
1837
1931
  export declare const getDynamicSlots: (axiosApi: AxiosInstance, config: Config, imgSizes: {
1838
1932
  [key: string]: any;
1839
1933
  }, imageSizes: ImageSizesContractInput | undefined, DYNAMIC_SLOT_TOTAL: number, DYNAMIC_SLOT_SUBINDEXES: number, exclude?: string) => Promise<{
@@ -2305,6 +2399,9 @@ export declare const initRelativeTime: (opts?: RelativeTimeOptions) => () => voi
2305
2399
  */
2306
2400
  export declare function insertCkAudioPlayers(html: string): string;
2307
2401
 
2402
+ /** `true` si la sección está prendida en config. */
2403
+ export declare const isAccountProfileSectionEnabled: (section: AccountProfileSection, cfg: AccountProfileSectionToggles) => boolean;
2404
+
2308
2405
  export declare function isConfigOriginAuditEnabled(): boolean;
2309
2406
 
2310
2407
  /**
@@ -2521,6 +2618,18 @@ export declare type LibraryConfig = {
2521
2618
  * `PUBLIC_ENV === 'prod'`.
2522
2619
  */
2523
2620
  CONFIG_authMockUser?: string;
2621
+ /**
2622
+ * Sección "Mis preferencias" de la página de cuenta
2623
+ * (`/account/profile/preferences`): entra al menú lateral y la ruta renderiza.
2624
+ * Hoy es un modelo visual: lo elegido se guarda en `localStorage`.
2625
+ */
2626
+ CONFIG_profilePreferences?: boolean;
2627
+ /**
2628
+ * Sección "Newsletters" de la página de cuenta
2629
+ * (`/account/profile/newsletters`): checklist de newsletters. Hoy es un modelo
2630
+ * visual: lo marcado se guarda en `localStorage`.
2631
+ */
2632
+ CONFIG_profileNewsletters?: boolean;
2524
2633
  CONFIG_blockDefaultTwitterHydrator?: boolean;
2525
2634
  CONFIG_hasSlugRoute?: boolean;
2526
2635
  CONFIG_slugAsSection?: boolean;