sass-template-common 0.10.0 → 0.10.10

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.
@@ -51,8 +51,12 @@ export declare type Analytics = {
51
51
  comscore: string | undefined;
52
52
  };
53
53
 
54
+ export declare const assetsImagesPrefixer: (imagePath: string, assetsClient?: string) => string;
55
+
54
56
  export declare const AssetsPreconnect: () => false | "" | JSX.Element | undefined;
55
57
 
58
+ export declare function auditConfigOrigin(entry: ConfigOriginAuditEntry): void;
59
+
56
60
  export declare interface Author {
57
61
  firstname: string;
58
62
  lastname: string;
@@ -177,15 +181,14 @@ export declare const bannersReplace: (bannerLineAd: string, replaces?: {
177
181
  }) => string;
178
182
 
179
183
  /**
180
- * Splits a single large news-list fetch into `batchCount` parallel requests
181
- * of `batchSize` items each, then combines results in order.
182
- *
183
- * Page mapping (batchCount=3, newsListLimit=45 batchSize=15):
184
- * userPage=1 API pages 1, 2, 3 (items 1–45)
185
- * userPage=2 → API pages 4, 5, 6 (items 46–90)
184
+ * Variante metadata: mismo split que `createBatchedFetch` pero devuelve
185
+ * `hasNextPage` (último batch lleno) y el primer response crudo, para derivar
186
+ * next/prev y el título de sección. Lee el conteo de batches del MISMO
187
+ * `CONFIG_batchedFetch` que el render (vía `resolveBatchCount`), de modo que la
188
+ * paginación de metadata y la lista visible nunca discrepan.
186
189
  *
187
- * hasNextPage is true when the last batch came back full (length === batchSize),
188
- * which is equivalent to the original `data.length === newsListLimit` check.
190
+ * `ceil` (antes `floor`) alinea la matemática con `createBatchedFetch`; para los
191
+ * totales usados en prod (45, 15) ambos coinciden por ser divisibles.
189
192
  */
190
193
  export declare function batchedNewsFetch({ fetchFn, baseParams, userPage, newsListLimit, batchCount, }: BatchFetchParams): Promise<BatchFetchResult>;
191
194
 
@@ -227,6 +230,11 @@ export declare interface BlockSaasResponseData {
227
230
  export declare type BucketOriginConfig = {
228
231
  /** Base URL pública del bucket (sin slash final). Ej: `https://debate-site-configs.s3.us-west-2.amazonaws.com` */
229
232
  url: string;
233
+ /**
234
+ * Base URL alternativa (CloudFront u otro proxy cacheado). Si está definida,
235
+ * reemplaza `url` al armar las rutas de menú/banners en bucket.
236
+ */
237
+ proxyUrl?: string;
230
238
  /** Prefijo raíz del cliente dentro del bucket (ej. `'debate'`). */
231
239
  clientName: string;
232
240
  /** Sirve el menú (sidebar/menu/footer/freeZone/cintillo + equipos/sites) desde el bucket. */
@@ -246,8 +254,15 @@ export declare type BucketOriginConfig = {
246
254
  * (ej. `debate/debate/menu/...` en vez de `debate//menu/...`).
247
255
  */
248
256
  forceSite?: string;
257
+ /**
258
+ * TTL (ms) del cache in-memory SSR para menú/banners (bucket o API). Default 45000.
259
+ * `0` desactiva. Prioridad sobre `CONFIG_configCacheTtlMs`.
260
+ */
261
+ cacheTtlMs?: number;
249
262
  };
250
263
 
264
+ export declare function buildConfigMenuApiPath(servicePrefix: string, configVersion: string, fileName: string): string;
265
+
251
266
  export declare const buildTagUrl: (tag: Tag, paths: RoutePathConfig) => string;
252
267
 
253
268
  declare interface ButtonCSS {
@@ -302,6 +317,13 @@ export declare const CarruselOpinion: FC<SectionCardCarouselProps>;
302
317
  */
303
318
  export declare const cleanSchema: <T>(value: T) => T;
304
319
 
320
+ export declare function clearConfigOriginAudit(): void;
321
+
322
+ /** Limpia el cache (útil en tests o tras invalidación manual). */
323
+ export declare function clearConfigOriginCache(cacheKey?: string): void;
324
+
325
+ export declare function clearConfigOriginComparisonCache(): void;
326
+
305
327
  export declare const coloringByStrokeSVGs: string[];
306
328
 
307
329
  /** Textos del popup anónimo (AnonimusPopUp.tsx) */
@@ -501,7 +523,7 @@ export declare class CommonServices {
501
523
  data: {
502
524
  data: Array<MenuResponse>;
503
525
  };
504
- } | undefined> | undefined;
526
+ }>;
505
527
  getNewsListZone: (params: Params) => Promise<AxiosResponse<NewListResponse, any, {}>> | undefined;
506
528
  getNewsListZoneSection: (params: Params) => Promise<AxiosResponse<NewListResponse, any, {}>> | undefined;
507
529
  getNewsList: (params: Params) => Promise<AxiosResponse<NewListResponse, any, {}>> | undefined;
@@ -531,7 +553,7 @@ export declare class CommonServices {
531
553
  data: {
532
554
  data: Array<BannerResponse>;
533
555
  };
534
- } | undefined>;
556
+ }>;
535
557
  getPages: (params: Params) => Promise<AxiosResponse<{
536
558
  data: Array<FreeZoneResponse>;
537
559
  }, any, {}>> | undefined;
@@ -697,6 +719,60 @@ export declare type ConfigMain = {
697
719
  };
698
720
  };
699
721
 
722
+ export declare type ConfigOriginAuditEntry = {
723
+ kind: 'menu' | 'banners';
724
+ origin: 'api' | 'bucket';
725
+ outcome: ConfigOriginOutcome;
726
+ target: string;
727
+ durationMs: number;
728
+ ok?: boolean;
729
+ };
730
+
731
+ export declare type ConfigOriginAuditReport = {
732
+ entries: ConfigOriginAuditEntry[];
733
+ totals: {
734
+ network: number;
735
+ cacheHit: number;
736
+ dedup: number;
737
+ api: number;
738
+ bucket: number;
739
+ networkMs: number;
740
+ };
741
+ comparison?: ConfigOriginComparisonReport | null;
742
+ };
743
+
744
+ export declare type ConfigOriginComparisonReport = {
745
+ runs: number;
746
+ rows: ConfigOriginComparisonRow[];
747
+ homeParallel: {
748
+ api: number;
749
+ bucket: number;
750
+ };
751
+ generatedAt: string;
752
+ cached: boolean;
753
+ };
754
+
755
+ export declare type ConfigOriginComparisonRow = {
756
+ name: string;
757
+ api: ConfigOriginTimingStats;
758
+ bucket: ConfigOriginTimingStats;
759
+ winner: 'api' | 'bucket';
760
+ advantagePct: number;
761
+ deltaMs: number;
762
+ };
763
+
764
+ export declare type ConfigOriginOutcome = 'network' | 'cache-hit' | 'dedup';
765
+
766
+ export declare type ConfigOriginTimingStats = {
767
+ ok: boolean;
768
+ status: number;
769
+ size: number;
770
+ avg: number;
771
+ p50: number;
772
+ min: number;
773
+ max: number;
774
+ };
775
+
700
776
  export declare const ContactInfoServer: FC<Props_9>;
701
777
 
702
778
  export declare const ContactInput: FC<Props_40>;
@@ -733,6 +809,25 @@ declare interface CreateAssessmentParams {
733
809
  userIpAddress?: string;
734
810
  }
735
811
 
812
+ /**
813
+ * Divide un fetch de lista en `batches` requests paralelos de `ceil(totalSize/
814
+ * batches)` ítems cada uno (páginas contiguas del upstream) y concatena los
815
+ * resultados en orden, devolviendo el MISMO envelope que un fetch único
816
+ * (`{ data: { data: [] } }`) para que caiga directo en un `PromiseArray` con
817
+ * `custom_extractData: getResponse`.
818
+ *
819
+ * Mapeo de páginas (batches=5, totalSize=45 → batchSize=9):
820
+ * userPage=1 → API pages 1..5 (ítems 1–45)
821
+ * userPage=2 → API pages 6..10 (ítems 46–90)
822
+ *
823
+ * `fetchFn` recibe `(size, page)` y devuelve la respuesta del CMS o `undefined`.
824
+ */
825
+ export declare function createBatchedFetch(fetchFn: (size: number, page: number) => Promise<any> | undefined, totalSize: number, userPage: number, batches?: number): Promise<{
826
+ data: {
827
+ data: any[];
828
+ };
829
+ }>;
830
+
736
831
  export declare const cutString: (text: string, length?: number) => string;
737
832
 
738
833
  export declare interface DataNews {
@@ -824,6 +919,8 @@ export declare function decodeApiEnv<T = any>(encoded: Record<string, any>): T;
824
919
  */
825
920
  export declare const DEFAULT_HEAD_CONFIG: headConfig;
826
921
 
922
+ export declare const DEFAULT_S3_REFERER = "https://goamg.amplifyapp.com/vndomv";
923
+
827
924
  declare type DestacadoDiario = {
828
925
  customSectionCardStyles: SectionCardCSS;
829
926
  customNewsDescriptionStyles: NewsDescriptionBlockCSS;
@@ -979,6 +1076,24 @@ export declare type FetchConfig = {
979
1076
  newsType: string;
980
1077
  };
981
1078
 
1079
+ /**
1080
+ * Envuelve `fetchFn` con batch SI la ruta está activada en config; si no, hace
1081
+ * el fetch único (comportamiento de master). Behavior-preserving cuando el batch
1082
+ * está off, así que es seguro envolver todas las rutas de lista de una — solo
1083
+ * las que estén en `CONFIG_batchedFetch.routes` cambian de comportamiento.
1084
+ */
1085
+ export declare function fetchMaybeBatched(route: string, fetchFn: (size: number, page: number) => Promise<any> | undefined, totalSize: number, userPage: number): Promise<{
1086
+ data: {
1087
+ data: any[];
1088
+ };
1089
+ }>;
1090
+
1091
+ /**
1092
+ * Cache in-memory + deduplicación de requests en vuelo (misma clave → misma promesa).
1093
+ * TTL corto pensado para SSR: evita 4–5 GETs repetidos de menú/banners por instancia.
1094
+ */
1095
+ export declare function fetchWithConfigCache<T>(cacheKey: string, fetchFn: () => Promise<T>, ttlMs?: number): Promise<T>;
1096
+
982
1097
  export declare const Font: ({ config }: {
983
1098
  config: Config;
984
1099
  }) => JSX.Element | null;
@@ -987,6 +1102,8 @@ export declare const Footer: FC<Props_33>;
987
1102
 
988
1103
  export declare const FormatAfterScripts: (props: ScriptProps) => JSX.Element | null;
989
1104
 
1105
+ export declare function formatConfigOriginComparisonTable(report: ConfigOriginComparisonReport): string;
1106
+
990
1107
  export declare const formatDate: (date: number, DATE_CONFIG?: {
991
1108
  PUBLIC_LNG: string;
992
1109
  DATE_TIMEZONE: string;
@@ -1135,7 +1252,10 @@ export declare const generalGetData: (promiseArray: PromiseArray) => Promise<{
1135
1252
 
1136
1253
  export declare const GenerateBody: ({ children, defaultRouteName, banners, pathname, slug, config, internalPath, currentNew, tagsParsed, scriptReplaces, body_custom_elements, }: Props_5) => JSX.Element;
1137
1254
 
1138
- export declare function GenerateHead({ axiosApi, headConfig: headConfigInput, meta, imgSizes, defaultMetadataName, pathname, slug, texts, query, autor, listAutor, currentNew, banners, schemasImages, internalPath, meta_info, config, socials, speculationType, preloadImageUrl, custom_Speculation, custom_metadata, custom_scriptReplaces, head_custom_elements, schemasCustomEndpoints, }: Props_4): Promise<ReactNode>;
1255
+ export declare function GenerateHead({ axiosApi, headConfig: headConfigInput, meta, imgSizes, defaultMetadataName, pathname, slug, texts, query, autor, listAutor, currentNew, banners, schemasImages, internalPath, meta_info, config, socials, speculationType, preloadImageUrl, custom_Speculation, custom_metadata, custom_scriptReplaces, head_custom_elements, schemasCustomEndpoints, configOriginAuditReport, }: Props_4): Promise<ReactNode>;
1256
+
1257
+ /** Cliente axios compartido por origen de bucket (keep-alive en Node SSR). */
1258
+ export declare function getBucketHttpClient(baseUrl: string, referer: string): AxiosInstance;
1139
1259
 
1140
1260
  /**
1141
1261
  * Helper para conseguir el recaptcha token usando grecaptcha.enterprise
@@ -1163,6 +1283,10 @@ export declare interface GetCommentsParams {
1163
1283
 
1164
1284
  export declare function getConfig(): LibraryConfig;
1165
1285
 
1286
+ export declare function getConfigCacheTtlMs(): number;
1287
+
1288
+ export declare function getConfigOriginAuditReport(comparison?: ConfigOriginComparisonReport | null): ConfigOriginAuditReport;
1289
+
1166
1290
  export declare const getDynamicSlots: (axiosApi: AxiosInstance, config: Config, imgSizes: {
1167
1291
  [key: string]: any;
1168
1292
  }, imgSizesVideo: {
@@ -1339,6 +1463,16 @@ export declare const HeaderSectionComponent: FC<Props_12>;
1339
1463
 
1340
1464
  export declare function HomeCard(props: SectionCardProps_3): JSX.Element;
1341
1465
 
1466
+ /**
1467
+ * Genera el string HTML de una HomeCard de tipo "imagen" sin pasar por React.
1468
+ * Reemplaza a <HomeCard> para el tipo imagen en LandingTemplate.
1469
+ *
1470
+ * - `priorityHigh` (lo decide el caller) → fetchpriority="high" / loading="eager".
1471
+ * Por default false → low/lazy.
1472
+ * - Sin espacio extra en la clase homeCardImage cuando no hay preRenderClass.
1473
+ */
1474
+ export declare function homeCardImagenToHTMLString(item: NewListResponseData, index: number, paths: RoutePathConfig, share?: Omit<NoteShare, 'googleProfile'>, priorityHigh?: boolean): string;
1475
+
1342
1476
  declare interface ICommonServices {
1343
1477
  config?: Config;
1344
1478
  imgSizes?: any;
@@ -1451,6 +1585,8 @@ export declare interface Info {
1451
1585
 
1452
1586
  export declare function initLibrary(userConfig?: LibraryConfig): void;
1453
1587
 
1588
+ export declare function isConfigOriginAuditEnabled(): boolean;
1589
+
1454
1590
  export declare interface ISection {
1455
1591
  name: string;
1456
1592
  slug: string;
@@ -1465,6 +1601,14 @@ export declare const isHomePath: (pathname?: string) => boolean;
1465
1601
 
1466
1602
  export declare const isPhotoGallery: (news: NewListResponseData) => boolean | undefined;
1467
1603
 
1604
+ /**
1605
+ * ¿La ruta tiene batch activo? Precedencia:
1606
+ * 1. `CONFIG_batchedFetch.routes[route]` explícito (true/false) gana.
1607
+ * 2. Retro-compat: el legacy `CONFIG_sectionBatchedFetch` solo cubría `seccion`.
1608
+ * 3. Off por default.
1609
+ */
1610
+ export declare function isRouteBatched(route: string): boolean;
1611
+
1468
1612
  export declare class IssuuServices {
1469
1613
  private issuuApi;
1470
1614
  private api;
@@ -1572,17 +1716,56 @@ export declare type LibraryConfig = {
1572
1716
  */
1573
1717
  CONFIG_sectionMetaInfo?: boolean;
1574
1718
  /**
1575
- * [renderizado] Cuando es `true`, la lista de sección se obtiene con
1576
- * `batchedNewsFetch` (N fetches paralelos en lugar de uno). Hoy implementado
1577
- * en el sitio soyfutbol; se formaliza acá como opt-in. Default `false`
1578
- * un único fetch (comportamiento de master).
1719
+ * @deprecated Reemplazado por `CONFIG_batchedFetch.routes.seccion`. Se mantiene
1720
+ * como shim de retro-compatibilidad: si `CONFIG_batchedFetch` no está seteado y
1721
+ * este flag es `true`, el batch de sección (solo metadata next/prev) sigue
1722
+ * funcionando con el conteo default. Cuando ambos están, `CONFIG_batchedFetch`
1723
+ * gana. Remover cuando todos los sitios migren a `CONFIG_batchedFetch`.
1579
1724
  */
1580
1725
  CONFIG_sectionBatchedFetch?: boolean;
1726
+ /**
1727
+ * [renderizado] Formaliza el fetch de listas de noticias por batches: divide un
1728
+ * único fetch de `config.newsListLimit` ítems en `batches` fetches paralelos
1729
+ * (páginas contiguas del upstream) y los concatena, devolviendo el MISMO
1730
+ * envelope que un fetch único. Es la versión canónica del sistema que vivía
1731
+ * suelto en soyfutbol (`newsListBatches` + `batchFetchRoutes`).
1732
+ *
1733
+ * - `batches`: número de fetches paralelos por lista. Sin la key (o 1) → un
1734
+ * único fetch = comportamiento de master (aditivo, cero cambio por default).
1735
+ * - `routes`: opt-in por ruta (`home`/`seccion`/`tema`/`ultimas-noticias`/
1736
+ * `autor`/...). Solo las rutas en `true` se batchean; el resto hace fetch único.
1737
+ *
1738
+ * Unifica render y metadata: cuando una ruta está activa acá, tanto la lista
1739
+ * visible como la derivación next/prev usan el MISMO `batches`, evitando el
1740
+ * desajuste "next dice que hay más pero la página muestra un solo fetch".
1741
+ * Reemplaza al legacy `CONFIG_sectionBatchedFetch`.
1742
+ */
1743
+ CONFIG_batchedFetch?: {
1744
+ /** N fetches paralelos por lista. Default efectivo 3 si algo lo activa sin fijarlo. */
1745
+ batches?: number;
1746
+ /** Opt-in por ruta. Claves = route keys de `MetadataDefaultsKeys`. */
1747
+ routes?: Record<string, boolean>;
1748
+ };
1749
+ /**
1750
+ * [render] Cuando es `true`, `LandingTemplate` renderiza las cards de tipo
1751
+ * `imagen` con el fast-render HTML-string (`homeCardImagenToHTMLString`) en
1752
+ * lugar del componente React `<HomeCard>`, ahorrando reconciliación/hidratación.
1753
+ * El fast-render se saltea online cuando la URL de preview no es absoluta y
1754
+ * SIEMPRE cae a `<HomeCard>` en offline (el path HTML-string no pasa por el
1755
+ * hidratador de imágenes offline). Default `false` → usa `<HomeCard>` React.
1756
+ */
1757
+ CONFIG_landingFastRender?: boolean;
1581
1758
  CONFIG_deferBanners?: {
1582
1759
  common?: boolean;
1583
1760
  middle?: boolean;
1584
1761
  innote?: boolean;
1585
1762
  };
1763
+ /**
1764
+ * TTL (ms) del cache in-memory SSR para `getMainMenu` / `getBanners` vía API CMS.
1765
+ * Default 45000. `0` desactiva el cache. También configurable en
1766
+ * `BUCKET_ORIGIN.cacheTtlMs` (tiene prioridad si está definido).
1767
+ */
1768
+ CONFIG_configCacheTtlMs?: number;
1586
1769
  PAGE_SWIPER?: {
1587
1770
  home: boolean;
1588
1771
  autor: boolean;
@@ -2335,6 +2518,12 @@ export declare type Params = {
2335
2518
  related?: number;
2336
2519
  };
2337
2520
 
2521
+ export declare function parseConfigOriginCacheKey(cacheKey: string): {
2522
+ kind: 'menu' | 'banners';
2523
+ origin: 'api' | 'bucket';
2524
+ target: string;
2525
+ };
2526
+
2338
2527
  export declare const parseTags: (keywords: any) => string;
2339
2528
 
2340
2529
  export declare const pathnameSplit: (pathname: string) => {
@@ -2745,6 +2934,8 @@ declare type Props_4 = {
2745
2934
  headConfig?: Partial<headConfig>;
2746
2935
  head_custom_elements?: any;
2747
2936
  schemasCustomEndpoints?: string[];
2937
+ /** Reporte SSR de menú/banners (cache/dedup/network). Solo con HTML_AUDIT. */
2938
+ configOriginAuditReport?: ConfigOriginAuditReport | null;
2748
2939
  };
2749
2940
 
2750
2941
  declare type Props_40 = {
@@ -3005,6 +3196,17 @@ export declare interface ResilientFetchOptions {
3005
3196
  baseDelayMs?: number;
3006
3197
  }
3007
3198
 
3199
+ /**
3200
+ * Conteo de batches efectivo leído de `getConfig().CONFIG_batchedFetch.batches`.
3201
+ * Default `3` cuando algo activa el batch sin fijar el número (preserva el
3202
+ * comportamiento histórico del path de metadata, cuyo default era 3).
3203
+ */
3204
+ export declare function resolveBatchCount(): number;
3205
+
3206
+ export declare function resolveBucketMenuSubtype(path?: string): string;
3207
+
3208
+ export declare function resolveBucketOriginUrl(bucket: BucketOriginConfig, servicePrefix: string | undefined, type: 'menu' | 'banners', subtype: string): string;
3209
+
3008
3210
  export declare interface RoutePathConfig {
3009
3211
  autor: string | 'autor';
3010
3212
  tema: string | 'tema';
@@ -3015,6 +3217,13 @@ export declare interface RoutePathConfig {
3015
3217
  'ultimas-noticias': string | 'ultimas-noticias';
3016
3218
  }
3017
3219
 
3220
+ export declare function runConfigOriginComparison(params: {
3221
+ axiosApi: AxiosInstance;
3222
+ servicePrefix: string;
3223
+ configVersion: string;
3224
+ runs?: number;
3225
+ }): Promise<ConfigOriginComparisonReport | null>;
3226
+
3018
3227
  export declare function ScriptHydrator({ containerId, containerId2 }: Props_17): null;
3019
3228
 
3020
3229
  declare type ScriptProps = {
@@ -3309,6 +3518,9 @@ declare interface TagSectionProps {
3309
3518
  paths: RoutePathConfig;
3310
3519
  }
3311
3520
 
3521
+ /** Loguea el resumen en consola, limpia el buffer y devuelve el reporte (SSR). */
3522
+ export declare function takeConfigOriginAuditReport(comparison?: ConfigOriginComparisonReport | null): ConfigOriginAuditReport | null;
3523
+
3312
3524
  /** Cabecera / edición (barra superior) */
3313
3525
  export declare type TextsHeader = {
3314
3526
  menuText: string;