template-common 1.2.0 → 1.2.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/dist/sass-template-common.d.ts +84 -3
- package/dist/sass-template-common.js +3390 -3319
- package/dist/sass-template-common.umd.cjs +48 -48
- package/package.json +83 -82
|
@@ -272,6 +272,41 @@ export declare const AssetsPreconnect: () => false | "" | JSX.Element | undefine
|
|
|
272
272
|
|
|
273
273
|
export declare function auditConfigOrigin(entry: ConfigOriginAuditEntry): void;
|
|
274
274
|
|
|
275
|
+
/**
|
|
276
|
+
* `[<prefijo actual><base>, <viejo 1><base>, ...]`. El primero es el único que
|
|
277
|
+
* se escribe; el resto solo se lee.
|
|
278
|
+
*/
|
|
279
|
+
export declare const authCookieNames: (cfg: AuthCookiePrefixConfig, base: string, prefix?: string) => string[];
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Nombres de las cookies del login propio del sitio (`<prefix>IS_AUTH`,
|
|
283
|
+
* `<prefix>userInfo`, ...) y su lectura con prefijos viejos de respaldo.
|
|
284
|
+
*
|
|
285
|
+
* Módulo puro, sin imports: lo cargan `coreAuth.ts`, el LoginForm y los tests
|
|
286
|
+
* de `scripts/test-auth-cookie-names.mjs` desde node.
|
|
287
|
+
*
|
|
288
|
+
* Renombrar el prefijo sin cortar sesiones: el sitio pasa el prefijo nuevo en
|
|
289
|
+
* `COGNITO_AUTH_PREFIX` y los anteriores en `COGNITO_AUTH_LEGACY_PREFIXES`.
|
|
290
|
+
* Se lee primero el nombre nuevo y, si falta o está vacío, cada nombre viejo en
|
|
291
|
+
* orden. Los viejos son SOLO de lectura: la librería no escribe cookies de
|
|
292
|
+
* sesión; renombrarlas (escribir la nueva y borrar la vieja) es trabajo de las
|
|
293
|
+
* rutas `/api/auth/*` del sitio, que son las que conocen sus atributos.
|
|
294
|
+
*
|
|
295
|
+
* Sin `COGNITO_AUTH_LEGACY_PREFIXES` (todos los sitios salvo el que lo active)
|
|
296
|
+
* la lista de nombres tiene un solo elemento y el comportamiento es idéntico al
|
|
297
|
+
* anterior.
|
|
298
|
+
*/
|
|
299
|
+
/** Las claves de config que este módulo necesita. */
|
|
300
|
+
export declare type AuthCookiePrefixConfig = {
|
|
301
|
+
/** `''` o `null` = sin prefijo. `undefined` = `'ASTRO_'` histórico. */
|
|
302
|
+
COGNITO_AUTH_PREFIX?: string | null;
|
|
303
|
+
/**
|
|
304
|
+
* Prefijos anteriores que se aceptan SOLO para leer, en orden de prioridad
|
|
305
|
+
* (`''` = sin prefijo). Opt-in: sin la clave no hay respaldo.
|
|
306
|
+
*/
|
|
307
|
+
COGNITO_AUTH_LEGACY_PREFIXES?: readonly (string | null)[] | null;
|
|
308
|
+
};
|
|
309
|
+
|
|
275
310
|
export declare interface Author {
|
|
276
311
|
firstname: string;
|
|
277
312
|
lastname: string;
|
|
@@ -1397,7 +1432,7 @@ export declare const contractWarn: (component: string, field: string, extra?: un
|
|
|
1397
1432
|
export declare const CORE_AUTH_CHANGED_EVENT = "core-auth:changed";
|
|
1398
1433
|
|
|
1399
1434
|
/** Claves de config que usa el login del header y la página de cuenta. */
|
|
1400
|
-
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"];
|
|
1435
|
+
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", "COGNITO_AUTH_LEGACY_PREFIXES", "PUBLIC_ENV", "PUBLIC_LNG", "PUBLIC_SERVICE_PREFIX", "PUBLIC_IS_SUB_PUBLICATION", "FORCE_SUB_PUBLICATION_PREFIX"];
|
|
1401
1436
|
|
|
1402
1437
|
/** Largo máximo de nombre y apellido (mismo límite que `/api/auth/update-profile`). */
|
|
1403
1438
|
export declare const CORE_AUTH_NAME_MAX_LENGTH = 60;
|
|
@@ -2317,7 +2352,10 @@ export declare interface Hascontent {
|
|
|
2317
2352
|
hasembeddedbrid: boolean;
|
|
2318
2353
|
}
|
|
2319
2354
|
|
|
2320
|
-
/**
|
|
2355
|
+
/**
|
|
2356
|
+
* `<prefix>IS_AUTH=true`: la setea el login (password o Google) y la borra el logout.
|
|
2357
|
+
* Con `COGNITO_AUTH_LEGACY_PREFIXES` también vale el nombre viejo (gana el nuevo).
|
|
2358
|
+
*/
|
|
2321
2359
|
export declare const hasSessionCookie: (cfg?: CoreAuthConfig) => boolean;
|
|
2322
2360
|
|
|
2323
2361
|
export declare type headConfig = {
|
|
@@ -3130,6 +3168,13 @@ export declare type LibraryConfig = {
|
|
|
3130
3168
|
ANALYTICS_comscore?: string | undefined;
|
|
3131
3169
|
/** `''` o `null` = cookies de login sin prefijo (ver `authPrefix` en `coreAuth.ts`). */
|
|
3132
3170
|
COGNITO_AUTH_PREFIX?: string | null;
|
|
3171
|
+
/**
|
|
3172
|
+
* Prefijos anteriores de las cookies de login, SOLO para leer mientras dura un
|
|
3173
|
+
* renombre (`''` = sin prefijo). Primero se lee `COGNITO_AUTH_PREFIX` y, si
|
|
3174
|
+
* falta, cada uno de estos en orden. Sin definir: sin respaldo (como antes).
|
|
3175
|
+
* Ver `helpers/auth/authCookieNames.ts`.
|
|
3176
|
+
*/
|
|
3177
|
+
COGNITO_AUTH_LEGACY_PREFIXES?: readonly (string | null)[] | null;
|
|
3133
3178
|
COGNITO_CLIENT_ID?: string;
|
|
3134
3179
|
COGNITO_DOMAIN?: string;
|
|
3135
3180
|
COGNITO_REDIRECT_URI?: string;
|
|
@@ -4394,6 +4439,8 @@ declare type Props_15 = {
|
|
|
4394
4439
|
API_ENV: {
|
|
4395
4440
|
/** `''` o `null` = cookies de login sin prefijo. */
|
|
4396
4441
|
COGNITO_AUTH_PREFIX: string | null;
|
|
4442
|
+
/** Prefijos viejos, solo lectura (ver `COGNITO_AUTH_LEGACY_PREFIXES` en config). */
|
|
4443
|
+
COGNITO_AUTH_LEGACY_PREFIXES?: readonly (string | null)[] | null;
|
|
4397
4444
|
PUBLIC_ENV: string;
|
|
4398
4445
|
CAPTCHA_KEY: string;
|
|
4399
4446
|
/** Kill switch de reCAPTCHA. Sin definir: captcha activo (como hoy). */
|
|
@@ -5020,6 +5067,13 @@ declare type Props_9 = {
|
|
|
5020
5067
|
};
|
|
5021
5068
|
};
|
|
5022
5069
|
|
|
5070
|
+
/**
|
|
5071
|
+
* Valor crudo de la cookie `name` en un string tipo `document.cookie`, por
|
|
5072
|
+
* nombre EXACTO (sin prefijo, `IS_AUTH` no matchea `bs_IS_AUTH`). `null` si no
|
|
5073
|
+
* está. Sin decodificar.
|
|
5074
|
+
*/
|
|
5075
|
+
export declare const readCookieFromString: (cookieString: string | null | undefined, name: string) => string | null;
|
|
5076
|
+
|
|
5023
5077
|
/**
|
|
5024
5078
|
* Lectura SINCRÓNICA, sin red: mock de dev, la cookie `<prefix>userInfo`, o
|
|
5025
5079
|
* el usuario cacheado en esta pestaña. Sin cookie de sesión => deslogueado.
|
|
@@ -5028,6 +5082,15 @@ export declare const readCoreAuthUser: (cfg?: CoreAuthConfig) => CoreAuthUser |
|
|
|
5028
5082
|
|
|
5029
5083
|
export declare const Readest: FC<Props_30>;
|
|
5030
5084
|
|
|
5085
|
+
/**
|
|
5086
|
+
* Primer nombre de `names` con valor no vacío. Si están el nuevo y el viejo,
|
|
5087
|
+
* gana el nuevo (es el primero de la lista). `null` si no hay ninguno con valor.
|
|
5088
|
+
*/
|
|
5089
|
+
export declare const readFirstCookie: (cookieString: string | null | undefined, names: readonly string[]) => {
|
|
5090
|
+
name: string;
|
|
5091
|
+
value: string;
|
|
5092
|
+
} | null;
|
|
5093
|
+
|
|
5031
5094
|
/**
|
|
5032
5095
|
* Token que devuelve `getCaptchaToken` cuando reCAPTCHA está desactivado por
|
|
5033
5096
|
* `CONFIG_blockRecaptcha`. Es un placeholder no vacío a propósito: los call
|
|
@@ -5333,6 +5396,13 @@ export declare interface ResilientFetchOptions {
|
|
|
5333
5396
|
/** Ignora `undefined` del override: un `texts.comentarios` parcial no pisa defaults. */
|
|
5334
5397
|
export declare const resolveAccountProfileTexts: (lng?: string, overrides?: Partial<Record<keyof AccountProfileTexts, unknown>>) => AccountProfileTexts;
|
|
5335
5398
|
|
|
5399
|
+
/**
|
|
5400
|
+
* `''` o `null` son validos y significan "sin prefijo": las cookies ya quedan atadas al
|
|
5401
|
+
* dominio del sitio, el prefijo no las hace mas unicas y solo complica la CDN. Solo
|
|
5402
|
+
* `undefined` (sin configurar) cae al `'ASTRO_'` historico.
|
|
5403
|
+
*/
|
|
5404
|
+
export declare const resolveAuthPrefix: (cfg: AuthCookiePrefixConfig) => string;
|
|
5405
|
+
|
|
5336
5406
|
export declare function resolveBucketMenuSubtype(path?: string): string;
|
|
5337
5407
|
|
|
5338
5408
|
/**
|
|
@@ -5403,6 +5473,13 @@ export declare const resolveHeaderAuthTexts: (lng?: string, overrides?: Partial<
|
|
|
5403
5473
|
*/
|
|
5404
5474
|
export declare function resolveImageSizes(input: ImageSizesContractInput | undefined): ImageSizesResolution;
|
|
5405
5475
|
|
|
5476
|
+
/**
|
|
5477
|
+
* Prefijos viejos válidos, sin repetidos y sin el actual. `null` cuenta como
|
|
5478
|
+
* `''` (sin prefijo), igual que en `COGNITO_AUTH_PREFIX`. Cualquier otra cosa
|
|
5479
|
+
* que no sea string se ignora.
|
|
5480
|
+
*/
|
|
5481
|
+
export declare const resolveLegacyAuthPrefixes: (cfg: AuthCookiePrefixConfig, current?: string) => string[];
|
|
5482
|
+
|
|
5406
5483
|
/**
|
|
5407
5484
|
* El toggle del boton "Ver mas" con los defaults aplicados, o `null` si el
|
|
5408
5485
|
* sitio no lo prendio. Fuente UNICA de la resolucion: la consumen el componente,
|
|
@@ -6038,10 +6115,14 @@ export declare function usePlayIcon(): ComponentType<SVGProps<SVGSVGElement>>;
|
|
|
6038
6115
|
/**
|
|
6039
6116
|
* Cookie NO httpOnly con los datos visibles del usuario (JSON, URL-encoded por
|
|
6040
6117
|
* `cookies.set` de Astro). Forma: {@link CoreAuthUser}. Señal visual, igual que
|
|
6041
|
-
* `IS_AUTH`: no es prueba de sesión.
|
|
6118
|
+
* `IS_AUTH`: no es prueba de sesión. Es el nombre que el sitio ESCRIBE; para
|
|
6119
|
+
* leer con respaldo ver {@link userInfoCookieNames}.
|
|
6042
6120
|
*/
|
|
6043
6121
|
export declare const userInfoCookieName: (cfg: CoreAuthConfig) => string;
|
|
6044
6122
|
|
|
6123
|
+
/** `userInfoCookieName` + los nombres viejos, en orden de lectura. */
|
|
6124
|
+
export declare const userInfoCookieNames: (cfg: CoreAuthConfig) => string[];
|
|
6125
|
+
|
|
6045
6126
|
export declare interface UserType {
|
|
6046
6127
|
username: string;
|
|
6047
6128
|
firstname: string;
|