template-common 1.1.0 → 1.1.1

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, 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,24 @@ 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
+ /** Tarjetas en "Sugerencias para vos". Default 6. */
45
+ preferenceSuggestionsLimit?: number;
46
+ /** Opciones de "Newsletters". Default: lista genérica de la lib. */
47
+ newsletterItems?: AccountProfileNewsletterItem[];
48
+ /**
49
+ * Panel debug de "Newsletters". Default: visible fuera de prod, o con
50
+ * `?debug` en la URL.
51
+ */
52
+ debug?: boolean;
35
53
  };
36
54
 
37
55
  export declare type AccountProfileNavItem = {
@@ -43,6 +61,41 @@ export declare type AccountProfileNavItem = {
43
61
  disabled?: boolean;
44
62
  };
45
63
 
64
+ export declare type AccountProfileNewsletterItem = {
65
+ id: string;
66
+ name: string;
67
+ description: string;
68
+ /** Texto libre: "Diario", "Semanal"... */
69
+ frequency?: string;
70
+ };
71
+
72
+ export declare type AccountProfilePreferenceItem = {
73
+ id: string;
74
+ label: string;
75
+ kind: AccountProfilePreferenceKind;
76
+ /** Afinidad para recomendar: seguir un ítem sube a los del mismo grupo. */
77
+ group?: string;
78
+ /** Foto (autores). Sin imagen: iniciales. */
79
+ image?: string;
80
+ /** Marca "Nuevo" en la sugerencia. */
81
+ isNew?: boolean;
82
+ };
83
+
84
+ /**
85
+ * Tipos y listas por defecto de "Mis preferencias" y "Newsletters". El sitio
86
+ * pasa las suyas por prop (`preferenceItems`, `newsletterItems`).
87
+ */
88
+ export declare type AccountProfilePreferenceKind = 'section' | 'tag' | 'author';
89
+
90
+ /** Secciones de la página de cuenta. Cada una es su propia ruta en el sitio. */
91
+ export declare type AccountProfileSection = 'config' | 'preferences' | 'newsletters';
92
+
93
+ /** Toggles de las secciones opcionales. "Configuración" siempre está. */
94
+ export declare type AccountProfileSectionToggles = {
95
+ CONFIG_profilePreferences?: boolean;
96
+ CONFIG_profileNewsletters?: boolean;
97
+ };
98
+
46
99
  export declare type AccountProfileTexts = {
47
100
  title: string;
48
101
  logout: string;
@@ -63,6 +116,37 @@ export declare type AccountProfileTexts = {
63
116
  gnewsLink: string;
64
117
  gnewsHintPrefix: string;
65
118
  gnewsHintSuffix: string;
119
+ prefsTitle: string;
120
+ prefsDesc: string;
121
+ prefsFollowingTitle: string;
122
+ prefsFollowingEmpty: string;
123
+ prefsSuggestionsTitle: string;
124
+ prefsSuggestionsEmpty: string;
125
+ prefsResetSuggestions: string;
126
+ prefsExploreTitle: string;
127
+ prefsFilterAll: string;
128
+ prefsKindSection: string;
129
+ prefsKindTag: string;
130
+ prefsKindAuthor: string;
131
+ prefsFollow: string;
132
+ prefsFollowing: string;
133
+ prefsDismiss: string;
134
+ prefsUnfollow: string;
135
+ /** `{{label}}` se reemplaza por el tema seguido relacionado. */
136
+ prefsReasonRelated: string;
137
+ prefsReasonNew: string;
138
+ prefsReasonPopular: string;
139
+ prefsNewBadge: string;
140
+ newslettersTitle: string;
141
+ newslettersDesc: string;
142
+ newslettersFootnote: string;
143
+ newslettersSaved: string;
144
+ newslettersSelectAll: string;
145
+ newslettersClearAll: string;
146
+ debugTitle: string;
147
+ debugStorageKey: string;
148
+ debugUpdatedAt: string;
149
+ debugNever: string;
66
150
  changePasswordButton: string;
67
151
  /** `{{email}}` se reemplaza por el email enmascarado. */
68
152
  changePasswordMessage: string;
@@ -436,6 +520,9 @@ export declare type BucketOriginConfig = {
436
520
  cacheTtlMs?: number;
437
521
  };
438
522
 
523
+ /** Menú lateral: solo las secciones prendidas, con la actual marcada. */
524
+ export declare const buildAccountProfileNav: (lng: string | undefined, cfg: AccountProfileSectionToggles, current: AccountProfileSection) => AccountProfileNavItem[];
525
+
439
526
  export declare const buildAccountUrl: (cfg?: CoreAuthConfig) => string;
440
527
 
441
528
  declare type BuildArgs = {
@@ -1088,8 +1175,8 @@ export declare const contractWarn: (component: string, field: string, extra?: un
1088
1175
 
1089
1176
  export declare const CORE_AUTH_CHANGED_EVENT = "core-auth:changed";
1090
1177
 
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"];
1178
+ /** Claves de config que usa el login del header y la página de cuenta. */
1179
+ 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
1180
 
1094
1181
  export declare type CoreAuthConfig = Pick<LibraryConfig, (typeof CORE_AUTH_CONFIG_KEYS)[number]>;
1095
1182
 
@@ -1834,6 +1921,10 @@ export declare const getCoreAuthDisplayName: (user: CoreAuthUser) => string;
1834
1921
  */
1835
1922
  export declare const getCoreAuthInitials: (user: CoreAuthUser) => string;
1836
1923
 
1924
+ export declare const getDefaultNewsletterItems: (lng?: string) => AccountProfileNewsletterItem[];
1925
+
1926
+ export declare const getDefaultPreferenceItems: (lng?: string) => AccountProfilePreferenceItem[];
1927
+
1837
1928
  export declare const getDynamicSlots: (axiosApi: AxiosInstance, config: Config, imgSizes: {
1838
1929
  [key: string]: any;
1839
1930
  }, imageSizes: ImageSizesContractInput | undefined, DYNAMIC_SLOT_TOTAL: number, DYNAMIC_SLOT_SUBINDEXES: number, exclude?: string) => Promise<{
@@ -2305,6 +2396,9 @@ export declare const initRelativeTime: (opts?: RelativeTimeOptions) => () => voi
2305
2396
  */
2306
2397
  export declare function insertCkAudioPlayers(html: string): string;
2307
2398
 
2399
+ /** `true` si la sección está prendida en config. */
2400
+ export declare const isAccountProfileSectionEnabled: (section: AccountProfileSection, cfg: AccountProfileSectionToggles) => boolean;
2401
+
2308
2402
  export declare function isConfigOriginAuditEnabled(): boolean;
2309
2403
 
2310
2404
  /**
@@ -2521,6 +2615,18 @@ export declare type LibraryConfig = {
2521
2615
  * `PUBLIC_ENV === 'prod'`.
2522
2616
  */
2523
2617
  CONFIG_authMockUser?: string;
2618
+ /**
2619
+ * Sección "Mis preferencias" de la página de cuenta
2620
+ * (`/account/profile/preferences`): entra al menú lateral y la ruta renderiza.
2621
+ * Hoy es un modelo visual: lo elegido se guarda en `localStorage`.
2622
+ */
2623
+ CONFIG_profilePreferences?: boolean;
2624
+ /**
2625
+ * Sección "Newsletters" de la página de cuenta
2626
+ * (`/account/profile/newsletters`): checklist de newsletters. Hoy es un modelo
2627
+ * visual: lo marcado se guarda en `localStorage`.
2628
+ */
2629
+ CONFIG_profileNewsletters?: boolean;
2524
2630
  CONFIG_blockDefaultTwitterHydrator?: boolean;
2525
2631
  CONFIG_hasSlugRoute?: boolean;
2526
2632
  CONFIG_slugAsSection?: boolean;