sass-template-common 0.10.0 → 0.10.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.
package/README.md CHANGED
@@ -1,36 +1,36 @@
1
- # sass-template-common
2
-
3
- Librería web, maqueta de configuración y componentes para proyectos sass.
4
-
5
- ## Publicar nueva versión
6
-
7
- Para que los cambios se reflejen al publicar:
8
-
9
- 1. **Subir versión** (obligatorio; si no, npm rechaza o se usa la misma versión):
10
- ```bash
11
- pnpm version:patch # 0.3.21 → 0.3.22
12
- # o
13
- pnpm version:minor # 0.3.21 → 0.4.0
14
- pnpm version:major # 0.3.21 → 1.0.0
15
- ```
16
-
17
- 2. **Build limpio + publicar**:
18
- ```bash
19
- pnpm run clean && pnpm run build && pnpm publish
20
- ```
21
- O en un solo paso (patch):
22
- ```bash
23
- pnpm release:patch
24
- ```
25
-
26
- 3. **`prepublishOnly`**: Antes de cada `pnpm publish` se ejecuta `clean` + `build`, así siempre se publica un build nuevo.
27
-
28
- 4. **En proyectos que consumen la lib**: Actualizar la dependencia y reinstalar:
29
- ```bash
30
- pnpm update sass-template-common
31
- # o cambiar la versión en package.json y luego
32
- pnpm install
33
- ```
34
- Si usan versión fija (`"0.3.21"`), hay que actualizarla a la nueva (p. ej. `"0.3.22"`).
35
-
36
- **Si no ves los cambios:** comprueba que subiste la versión (`version:patch` o similar), que hiciste `clean` + `build` antes de publicar, y que el proyecto consumidor tiene actualizada la dependencia (o `^0.3.21` y ha ejecutado `pnpm update`).
1
+ # sass-template-common
2
+
3
+ Librería web, maqueta de configuración y componentes para proyectos sass.
4
+
5
+ ## Publicar nueva versión
6
+
7
+ Para que los cambios se reflejen al publicar:
8
+
9
+ 1. **Subir versión** (obligatorio; si no, npm rechaza o se usa la misma versión):
10
+ ```bash
11
+ pnpm version:patch # 0.3.21 → 0.3.22
12
+ # o
13
+ pnpm version:minor # 0.3.21 → 0.4.0
14
+ pnpm version:major # 0.3.21 → 1.0.0
15
+ ```
16
+
17
+ 2. **Build limpio + publicar**:
18
+ ```bash
19
+ pnpm run clean && pnpm run build && pnpm publish
20
+ ```
21
+ O en un solo paso (patch):
22
+ ```bash
23
+ pnpm release:patch
24
+ ```
25
+
26
+ 3. **`prepublishOnly`**: Antes de cada `pnpm publish` se ejecuta `clean` + `build`, así siempre se publica un build nuevo.
27
+
28
+ 4. **En proyectos que consumen la lib**: Actualizar la dependencia y reinstalar:
29
+ ```bash
30
+ pnpm update sass-template-common
31
+ # o cambiar la versión en package.json y luego
32
+ pnpm install
33
+ ```
34
+ Si usan versión fija (`"0.3.21"`), hay que actualizarla a la nueva (p. ej. `"0.3.22"`).
35
+
36
+ **Si no ves los cambios:** comprueba que subiste la versión (`version:patch` o similar), que hiciste `clean` + `build` antes de publicar, y que el proyecto consumidor tiene actualizada la dependencia (o `^0.3.21` y ha ejecutado `pnpm update`).
@@ -53,6 +53,8 @@ export declare type Analytics = {
53
53
 
54
54
  export declare const AssetsPreconnect: () => false | "" | JSX.Element | undefined;
55
55
 
56
+ export declare function auditConfigOrigin(entry: ConfigOriginAuditEntry): void;
57
+
56
58
  export declare interface Author {
57
59
  firstname: string;
58
60
  lastname: string;
@@ -227,6 +229,11 @@ export declare interface BlockSaasResponseData {
227
229
  export declare type BucketOriginConfig = {
228
230
  /** Base URL pública del bucket (sin slash final). Ej: `https://debate-site-configs.s3.us-west-2.amazonaws.com` */
229
231
  url: string;
232
+ /**
233
+ * Base URL alternativa (CloudFront u otro proxy cacheado). Si está definida,
234
+ * reemplaza `url` al armar las rutas de menú/banners en bucket.
235
+ */
236
+ proxyUrl?: string;
230
237
  /** Prefijo raíz del cliente dentro del bucket (ej. `'debate'`). */
231
238
  clientName: string;
232
239
  /** Sirve el menú (sidebar/menu/footer/freeZone/cintillo + equipos/sites) desde el bucket. */
@@ -246,8 +253,15 @@ export declare type BucketOriginConfig = {
246
253
  * (ej. `debate/debate/menu/...` en vez de `debate//menu/...`).
247
254
  */
248
255
  forceSite?: string;
256
+ /**
257
+ * TTL (ms) del cache in-memory SSR para menú/banners (bucket o API). Default 45000.
258
+ * `0` desactiva. Prioridad sobre `CONFIG_configCacheTtlMs`.
259
+ */
260
+ cacheTtlMs?: number;
249
261
  };
250
262
 
263
+ export declare function buildConfigMenuApiPath(servicePrefix: string, configVersion: string, fileName: string): string;
264
+
251
265
  export declare const buildTagUrl: (tag: Tag, paths: RoutePathConfig) => string;
252
266
 
253
267
  declare interface ButtonCSS {
@@ -302,6 +316,13 @@ export declare const CarruselOpinion: FC<SectionCardCarouselProps>;
302
316
  */
303
317
  export declare const cleanSchema: <T>(value: T) => T;
304
318
 
319
+ export declare function clearConfigOriginAudit(): void;
320
+
321
+ /** Limpia el cache (útil en tests o tras invalidación manual). */
322
+ export declare function clearConfigOriginCache(cacheKey?: string): void;
323
+
324
+ export declare function clearConfigOriginComparisonCache(): void;
325
+
305
326
  export declare const coloringByStrokeSVGs: string[];
306
327
 
307
328
  /** Textos del popup anónimo (AnonimusPopUp.tsx) */
@@ -501,7 +522,7 @@ export declare class CommonServices {
501
522
  data: {
502
523
  data: Array<MenuResponse>;
503
524
  };
504
- } | undefined> | undefined;
525
+ }>;
505
526
  getNewsListZone: (params: Params) => Promise<AxiosResponse<NewListResponse, any, {}>> | undefined;
506
527
  getNewsListZoneSection: (params: Params) => Promise<AxiosResponse<NewListResponse, any, {}>> | undefined;
507
528
  getNewsList: (params: Params) => Promise<AxiosResponse<NewListResponse, any, {}>> | undefined;
@@ -531,7 +552,7 @@ export declare class CommonServices {
531
552
  data: {
532
553
  data: Array<BannerResponse>;
533
554
  };
534
- } | undefined>;
555
+ }>;
535
556
  getPages: (params: Params) => Promise<AxiosResponse<{
536
557
  data: Array<FreeZoneResponse>;
537
558
  }, any, {}>> | undefined;
@@ -697,6 +718,60 @@ export declare type ConfigMain = {
697
718
  };
698
719
  };
699
720
 
721
+ export declare type ConfigOriginAuditEntry = {
722
+ kind: 'menu' | 'banners';
723
+ origin: 'api' | 'bucket';
724
+ outcome: ConfigOriginOutcome;
725
+ target: string;
726
+ durationMs: number;
727
+ ok?: boolean;
728
+ };
729
+
730
+ export declare type ConfigOriginAuditReport = {
731
+ entries: ConfigOriginAuditEntry[];
732
+ totals: {
733
+ network: number;
734
+ cacheHit: number;
735
+ dedup: number;
736
+ api: number;
737
+ bucket: number;
738
+ networkMs: number;
739
+ };
740
+ comparison?: ConfigOriginComparisonReport | null;
741
+ };
742
+
743
+ export declare type ConfigOriginComparisonReport = {
744
+ runs: number;
745
+ rows: ConfigOriginComparisonRow[];
746
+ homeParallel: {
747
+ api: number;
748
+ bucket: number;
749
+ };
750
+ generatedAt: string;
751
+ cached: boolean;
752
+ };
753
+
754
+ export declare type ConfigOriginComparisonRow = {
755
+ name: string;
756
+ api: ConfigOriginTimingStats;
757
+ bucket: ConfigOriginTimingStats;
758
+ winner: 'api' | 'bucket';
759
+ advantagePct: number;
760
+ deltaMs: number;
761
+ };
762
+
763
+ export declare type ConfigOriginOutcome = 'network' | 'cache-hit' | 'dedup';
764
+
765
+ export declare type ConfigOriginTimingStats = {
766
+ ok: boolean;
767
+ status: number;
768
+ size: number;
769
+ avg: number;
770
+ p50: number;
771
+ min: number;
772
+ max: number;
773
+ };
774
+
700
775
  export declare const ContactInfoServer: FC<Props_9>;
701
776
 
702
777
  export declare const ContactInput: FC<Props_40>;
@@ -824,6 +899,8 @@ export declare function decodeApiEnv<T = any>(encoded: Record<string, any>): T;
824
899
  */
825
900
  export declare const DEFAULT_HEAD_CONFIG: headConfig;
826
901
 
902
+ export declare const DEFAULT_S3_REFERER = "https://goamg.amplifyapp.com/vndomv";
903
+
827
904
  declare type DestacadoDiario = {
828
905
  customSectionCardStyles: SectionCardCSS;
829
906
  customNewsDescriptionStyles: NewsDescriptionBlockCSS;
@@ -979,6 +1056,12 @@ export declare type FetchConfig = {
979
1056
  newsType: string;
980
1057
  };
981
1058
 
1059
+ /**
1060
+ * Cache in-memory + deduplicación de requests en vuelo (misma clave → misma promesa).
1061
+ * TTL corto pensado para SSR: evita 4–5 GETs repetidos de menú/banners por instancia.
1062
+ */
1063
+ export declare function fetchWithConfigCache<T>(cacheKey: string, fetchFn: () => Promise<T>, ttlMs?: number): Promise<T>;
1064
+
982
1065
  export declare const Font: ({ config }: {
983
1066
  config: Config;
984
1067
  }) => JSX.Element | null;
@@ -987,6 +1070,8 @@ export declare const Footer: FC<Props_33>;
987
1070
 
988
1071
  export declare const FormatAfterScripts: (props: ScriptProps) => JSX.Element | null;
989
1072
 
1073
+ export declare function formatConfigOriginComparisonTable(report: ConfigOriginComparisonReport): string;
1074
+
990
1075
  export declare const formatDate: (date: number, DATE_CONFIG?: {
991
1076
  PUBLIC_LNG: string;
992
1077
  DATE_TIMEZONE: string;
@@ -1135,7 +1220,10 @@ export declare const generalGetData: (promiseArray: PromiseArray) => Promise<{
1135
1220
 
1136
1221
  export declare const GenerateBody: ({ children, defaultRouteName, banners, pathname, slug, config, internalPath, currentNew, tagsParsed, scriptReplaces, body_custom_elements, }: Props_5) => JSX.Element;
1137
1222
 
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>;
1223
+ 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>;
1224
+
1225
+ /** Cliente axios compartido por origen de bucket (keep-alive en Node SSR). */
1226
+ export declare function getBucketHttpClient(baseUrl: string, referer: string): AxiosInstance;
1139
1227
 
1140
1228
  /**
1141
1229
  * Helper para conseguir el recaptcha token usando grecaptcha.enterprise
@@ -1163,6 +1251,10 @@ export declare interface GetCommentsParams {
1163
1251
 
1164
1252
  export declare function getConfig(): LibraryConfig;
1165
1253
 
1254
+ export declare function getConfigCacheTtlMs(): number;
1255
+
1256
+ export declare function getConfigOriginAuditReport(comparison?: ConfigOriginComparisonReport | null): ConfigOriginAuditReport;
1257
+
1166
1258
  export declare const getDynamicSlots: (axiosApi: AxiosInstance, config: Config, imgSizes: {
1167
1259
  [key: string]: any;
1168
1260
  }, imgSizesVideo: {
@@ -1451,6 +1543,8 @@ export declare interface Info {
1451
1543
 
1452
1544
  export declare function initLibrary(userConfig?: LibraryConfig): void;
1453
1545
 
1546
+ export declare function isConfigOriginAuditEnabled(): boolean;
1547
+
1454
1548
  export declare interface ISection {
1455
1549
  name: string;
1456
1550
  slug: string;
@@ -1583,6 +1677,12 @@ export declare type LibraryConfig = {
1583
1677
  middle?: boolean;
1584
1678
  innote?: boolean;
1585
1679
  };
1680
+ /**
1681
+ * TTL (ms) del cache in-memory SSR para `getMainMenu` / `getBanners` vía API CMS.
1682
+ * Default 45000. `0` desactiva el cache. También configurable en
1683
+ * `BUCKET_ORIGIN.cacheTtlMs` (tiene prioridad si está definido).
1684
+ */
1685
+ CONFIG_configCacheTtlMs?: number;
1586
1686
  PAGE_SWIPER?: {
1587
1687
  home: boolean;
1588
1688
  autor: boolean;
@@ -2335,6 +2435,12 @@ export declare type Params = {
2335
2435
  related?: number;
2336
2436
  };
2337
2437
 
2438
+ export declare function parseConfigOriginCacheKey(cacheKey: string): {
2439
+ kind: 'menu' | 'banners';
2440
+ origin: 'api' | 'bucket';
2441
+ target: string;
2442
+ };
2443
+
2338
2444
  export declare const parseTags: (keywords: any) => string;
2339
2445
 
2340
2446
  export declare const pathnameSplit: (pathname: string) => {
@@ -2745,6 +2851,8 @@ declare type Props_4 = {
2745
2851
  headConfig?: Partial<headConfig>;
2746
2852
  head_custom_elements?: any;
2747
2853
  schemasCustomEndpoints?: string[];
2854
+ /** Reporte SSR de menú/banners (cache/dedup/network). Solo con HTML_AUDIT. */
2855
+ configOriginAuditReport?: ConfigOriginAuditReport | null;
2748
2856
  };
2749
2857
 
2750
2858
  declare type Props_40 = {
@@ -3005,6 +3113,10 @@ export declare interface ResilientFetchOptions {
3005
3113
  baseDelayMs?: number;
3006
3114
  }
3007
3115
 
3116
+ export declare function resolveBucketMenuSubtype(path?: string): string;
3117
+
3118
+ export declare function resolveBucketOriginUrl(bucket: BucketOriginConfig, servicePrefix: string | undefined, type: 'menu' | 'banners', subtype: string): string;
3119
+
3008
3120
  export declare interface RoutePathConfig {
3009
3121
  autor: string | 'autor';
3010
3122
  tema: string | 'tema';
@@ -3015,6 +3127,13 @@ export declare interface RoutePathConfig {
3015
3127
  'ultimas-noticias': string | 'ultimas-noticias';
3016
3128
  }
3017
3129
 
3130
+ export declare function runConfigOriginComparison(params: {
3131
+ axiosApi: AxiosInstance;
3132
+ servicePrefix: string;
3133
+ configVersion: string;
3134
+ runs?: number;
3135
+ }): Promise<ConfigOriginComparisonReport | null>;
3136
+
3018
3137
  export declare function ScriptHydrator({ containerId, containerId2 }: Props_17): null;
3019
3138
 
3020
3139
  declare type ScriptProps = {
@@ -3309,6 +3428,9 @@ declare interface TagSectionProps {
3309
3428
  paths: RoutePathConfig;
3310
3429
  }
3311
3430
 
3431
+ /** Loguea el resumen en consola, limpia el buffer y devuelve el reporte (SSR). */
3432
+ export declare function takeConfigOriginAuditReport(comparison?: ConfigOriginComparisonReport | null): ConfigOriginAuditReport | null;
3433
+
3312
3434
  /** Cabecera / edición (barra superior) */
3313
3435
  export declare type TextsHeader = {
3314
3436
  menuText: string;