sass-template-common 0.10.10 → 0.10.12

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,6 +51,13 @@ export declare type Analytics = {
51
51
  comscore: string | undefined;
52
52
  };
53
53
 
54
+ /**
55
+ * Red de seguridad runtime para consumidores JS (sin type-check). El tipo
56
+ * marca la forma en build; esto valida presencia de cada slot y que matchee
57
+ * el formato exacto en runtime — enforcement doble, decisión del owner (§3).
58
+ */
59
+ export declare function assertImageSizesContract(x: unknown): asserts x is ImageSizesContract;
60
+
54
61
  export declare const assetsImagesPrefixer: (imagePath: string, assetsClient?: string) => string;
55
62
 
56
63
  export declare const AssetsPreconnect: () => false | "" | JSX.Element | undefined;
@@ -309,6 +316,9 @@ declare interface CarruselCardProps extends Omit<CarrouselProps, 'slot_id'> {
309
316
 
310
317
  export declare const CarruselOpinion: FC<SectionCardCarouselProps>;
311
318
 
319
+ /** Corre `resolveImageSizes` y reduce el resultado a pass/fail para CI. */
320
+ export declare function checkImageSizes(input: ImageSizesContractInput | undefined): ImageSizesCheckReport;
321
+
312
322
  /**
313
323
  * Recorre recursivamente un schema (objeto o array) y elimina toda entry
314
324
  * que quede sin valor. Si una propiedad de un objeto queda sin valor, la
@@ -512,6 +522,11 @@ export declare class CommonServices {
512
522
  protected props?: ICommonServices | undefined;
513
523
  configVersion: string;
514
524
  exclude: string;
525
+ /**
526
+ * Contrato de tamaños resuelto UNA vez en el punto de entrada (§3). El resto
527
+ * de los métodos consume `this.contract.<slot>` — cero literales sueltos.
528
+ */
529
+ readonly contract: ImageSizesContract;
515
530
  constructor(props?: ICommonServices | undefined);
516
531
  generateTokenOffline: (browserId: string) => Promise<any>;
517
532
  getEntitySection: (params: Params) => Promise<AxiosResponse<{
@@ -1289,9 +1304,7 @@ export declare function getConfigOriginAuditReport(comparison?: ConfigOriginComp
1289
1304
 
1290
1305
  export declare const getDynamicSlots: (axiosApi: AxiosInstance, config: Config, imgSizes: {
1291
1306
  [key: string]: any;
1292
- }, imgSizesVideo: {
1293
- [key: string]: any;
1294
- }, DYNAMIC_SLOT_TOTAL: number, DYNAMIC_SLOT_SUBINDEXES: number, exclude?: string) => Promise<{
1307
+ }, imageSizes: ImageSizesContractInput | undefined, DYNAMIC_SLOT_TOTAL: number, DYNAMIC_SLOT_SUBINDEXES: number, exclude?: string) => Promise<{
1295
1308
  [key: string]: any;
1296
1309
  }>;
1297
1310
 
@@ -1327,7 +1340,7 @@ export declare const getPreloadImages: (list: NewListResponseData[], PRELOADED_I
1327
1340
 
1328
1341
  export declare const getPrevMeta: (config: Config, paths: Array<string>, page: number) => string;
1329
1342
 
1330
- export declare const getRelatedNewsCarrousel: (currentNew: NewListResponseData, internalPath: string, commonServices: CommonServices, imgSizes: any) => Promise<NewListResponseData[] | undefined>;
1343
+ export declare const getRelatedNewsCarrousel: (currentNew: NewListResponseData, internalPath: string, commonServices: CommonServices) => Promise<NewListResponseData[] | undefined>;
1331
1344
 
1332
1345
  export declare function getReportReasonLabel(reasonKey: ReportReasonKey): string;
1333
1346
 
@@ -1475,8 +1488,12 @@ export declare function homeCardImagenToHTMLString(item: NewListResponseData, in
1475
1488
 
1476
1489
  declare interface ICommonServices {
1477
1490
  config?: Config;
1491
+ /** @deprecated Ya no se lee acá; los tamaños salen de `contract` (§3). Se acepta por retrocompat hasta Fase 3. */
1478
1492
  imgSizes?: any;
1493
+ /** @deprecated No se lee en CommonServices; se acepta por retrocompat hasta Fase 3. */
1479
1494
  imgSizesVideo?: any;
1495
+ /** Nuevo contrato de tamaños (REFACTOR_IMGSIZES_PLAN.md §3). Ausente → `resolveImageSizes` cae a los defaults congelados (§4) → output idéntico. */
1496
+ imageSizes?: ImageSizesContractInput;
1480
1497
  axiosApi: AxiosInstance;
1481
1498
  exclude?: string;
1482
1499
  }
@@ -1561,6 +1578,60 @@ declare interface ImageProps_4 {
1561
1578
  figCaption?: string;
1562
1579
  }
1563
1580
 
1581
+ export declare interface ImageSizesCheckReport {
1582
+ /** `true` si el contrato no necesitó ningún default congelado. */
1583
+ ok: boolean;
1584
+ legacyFieldsUsed: string[];
1585
+ }
1586
+
1587
+ export declare interface ImageSizesContract {
1588
+ note: {
1589
+ detailMain: SizeString;
1590
+ detailSecondary: SizeString;
1591
+ itemsListPrimary: SizeString;
1592
+ relatedPrimary: SizeString;
1593
+ relatedThumb: SizeString;
1594
+ listStandard: SizeString;
1595
+ cardTall: SizeString;
1596
+ square: SizeString;
1597
+ gallery: SizeString;
1598
+ featuredSuperSecondary: SizeString;
1599
+ featuredVerticalPrimary: SizeString;
1600
+ featuredVerticalSecondary: SizeString;
1601
+ featuredHorizontalPrimary: SizeString;
1602
+ featuredHorizontalSecondary: SizeString;
1603
+ featuredDiarioImageThumb: SizeString;
1604
+ };
1605
+ author: {
1606
+ avatar: SizeString;
1607
+ multiCrop: SizeString;
1608
+ };
1609
+ video: {
1610
+ xl: SizeString;
1611
+ lg: SizeString;
1612
+ md: SizeString;
1613
+ };
1614
+ og: {
1615
+ social: SizeString;
1616
+ };
1617
+ }
1618
+
1619
+ /**
1620
+ * Partial real (por slot, no solo por grupo): `Partial<ImageSizesContract>` es
1621
+ * shallow y obligaría a mandar cada grupo completo o nada. Un app puede mandar
1622
+ * solo algunos slots de `note` y dejar el resto en manos del default congelado.
1623
+ */
1624
+ export declare type ImageSizesContractInput = {
1625
+ [G in keyof ImageSizesContract]?: Partial<ImageSizesContract[G]>;
1626
+ };
1627
+
1628
+ export declare interface ImageSizesResolution {
1629
+ /** Siempre completo — nunca undefined para el resto del paquete. */
1630
+ contract: ImageSizesContract;
1631
+ /** Slots resueltos por el default congelado, no provistos por el app. */
1632
+ legacyFieldsUsed: string[];
1633
+ }
1634
+
1564
1635
  export declare interface Info {
1565
1636
  type?: string;
1566
1637
  section?: {
@@ -1887,11 +1958,19 @@ export declare interface MainBlock1Props extends SectionCardProps, NewDescriptio
1887
1958
  export declare class MainComponentServices {
1888
1959
  exclude: string;
1889
1960
  config: any;
1961
+ /**
1962
+ * @deprecated Ya no se lee: los tamaños salen de `this.contract` (§3). Bigfish
1963
+ * pasa `imgSizesVideo` acá (quirk documentado en el snapshot de Fase 0), por eso
1964
+ * `this.imgSizes.lg` valía `video.lg`; ahora eso se expresa como `contract.video.lg`.
1965
+ * Se mantiene el parámetro posicional por retrocompat hasta Fase 3.
1966
+ */
1890
1967
  imgSizes: any;
1891
1968
  configVersion: string;
1892
1969
  axiosApi: AxiosInstance | undefined;
1893
1970
  customMainImagesSize: string | undefined;
1894
- constructor(config: Config, imgSizes: any, axiosApi: AxiosInstance, exclude?: string, customMainImagesSizes?: string);
1971
+ /** Contrato de tamaños resuelto UNA vez (§3); el resto consume `this.contract.<slot>`. */
1972
+ readonly contract: ImageSizesContract;
1973
+ constructor(config: Config, imgSizes: any, axiosApi: AxiosInstance, exclude?: string, customMainImagesSizes?: string, imageSizes?: ImageSizesContractInput);
1895
1974
  getNewsListZone(params: Params): Promise<AxiosResponse<NewListResponse, any, {}> | undefined>;
1896
1975
  getOutstandingBlock(params: Params): Promise<AxiosResponse< {
1897
1976
  data: Array<Outstanding>;
@@ -2575,7 +2654,10 @@ export declare interface Preview {
2575
2654
  photographer?: string | false;
2576
2655
  }
2577
2656
 
2578
- export declare const processExtractedRelatedNews: (relatedNews: string[][], getNews: (params: any) => any) => Promise<any[]>;
2657
+ /** Única función que imprime: nada de `console.warn` en el runtime de la app (§3.1). */
2658
+ export declare function printImageSizesReport(report: ImageSizesCheckReport, label?: string): void;
2659
+
2660
+ export declare const processExtractedRelatedNews: (relatedNews: string[][], getNews: (params: any) => any, imagesizes?: string) => Promise<any[]>;
2579
2661
 
2580
2662
  export declare type PromiseArray = {
2581
2663
  [key: string]: {
@@ -3207,6 +3289,18 @@ export declare function resolveBucketMenuSubtype(path?: string): string;
3207
3289
 
3208
3290
  export declare function resolveBucketOriginUrl(bucket: BucketOriginConfig, servicePrefix: string | undefined, type: 'menu' | 'banners', subtype: string): string;
3209
3291
 
3292
+ /**
3293
+ * Recibe lo que el app mande hoy (contrato completo, parcial, o nada) y
3294
+ * devuelve SIEMPRE un contrato completo. Los constructores públicos del
3295
+ * paquete llaman esto una sola vez, en su punto de entrada, y de ahí en
3296
+ * adelante consumen `contract.<slot>` sin condicionales ni valores propios.
3297
+ *
3298
+ * Puede tirar (vía `assertImageSizesContract`) si un slot provisto por el
3299
+ * app no matchea el formato esperado — enforcement doble (§3): tipos en
3300
+ * build, assert en runtime.
3301
+ */
3302
+ export declare function resolveImageSizes(input: ImageSizesContractInput | undefined): ImageSizesResolution;
3303
+
3210
3304
  export declare interface RoutePathConfig {
3211
3305
  autor: string | 'autor';
3212
3306
  tema: string | 'tema';
@@ -3386,6 +3480,9 @@ export declare interface SizeImage {
3386
3480
  scale?: string;
3387
3481
  }
3388
3482
 
3483
+ /** Formato: `"w:{n},h:{n},t:{n}[,c:{hex}];"` (uno o más, cada uno separado y terminado en `;`). */
3484
+ export declare type SizeString = string;
3485
+
3389
3486
  declare interface Social {
3390
3487
  title: boolean;
3391
3488
  description: boolean;