sass-cms-template-common 0.0.14 → 0.0.16
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/index.d.ts +84 -7
- package/dist/index.js +962 -910
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +62 -0
- package/dist/server.js +2 -2
- package/dist/{services-DB5GX5UJ.js → services-BQ1IbdWe.js} +112 -75
- package/dist/services-BQ1IbdWe.js.map +1 -0
- package/package.json +1 -1
- package/dist/services-DB5GX5UJ.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1381,6 +1381,44 @@ export declare type CmsMultiSelectFieldProps = {
|
|
|
1381
1381
|
testId?: string;
|
|
1382
1382
|
};
|
|
1383
1383
|
|
|
1384
|
+
/**
|
|
1385
|
+
* Singleton que conecta el interceptor de axios con el provider de red. El
|
|
1386
|
+
* provider llama `register` al montar y `unregister` al desmontar; el
|
|
1387
|
+
* interceptor usa los métodos (con fallback seguro si no hay provider).
|
|
1388
|
+
*/
|
|
1389
|
+
export declare const cmsNetworkBridge: {
|
|
1390
|
+
register(next: CmsNetworkBridgeHandlers): void;
|
|
1391
|
+
unregister(): void;
|
|
1392
|
+
/** `true` si hay un `CmsNetworkProvider` montado escuchando. */
|
|
1393
|
+
readonly isRegistered: boolean;
|
|
1394
|
+
reportOffline(): void;
|
|
1395
|
+
waitForOnline(): Promise<void>;
|
|
1396
|
+
verifyConnectivity(): Promise<boolean>;
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* Puente entre el interceptor de axios (un módulo, sin React) y el
|
|
1401
|
+
* `CmsNetworkProvider` (React). Replica el rol del `NetworkService` que se
|
|
1402
|
+
* inyecta en el `NetworkInterceptor` del Angular legacy: el interceptor no
|
|
1403
|
+
* puede usar hooks, así que el provider registra aquí sus funciones y el
|
|
1404
|
+
* interceptor las consume.
|
|
1405
|
+
*
|
|
1406
|
+
* Módulo **server-safe** (sin React, sin `'use client'`): así lo puede importar
|
|
1407
|
+
* el `lib/http/axios.ts` del gestor —que corre tanto en cliente como en
|
|
1408
|
+
* servidor— sin arrastrar componentes cliente. En el servidor el bridge queda
|
|
1409
|
+
* sin registrar (no hay provider) y `resumeAxiosOnNetworkError` re-lanza el
|
|
1410
|
+
* error para que lo maneje el server action (`toCmsError`).
|
|
1411
|
+
*/
|
|
1412
|
+
/** Funciones que el `CmsNetworkProvider` registra para el interceptor. */
|
|
1413
|
+
export declare interface CmsNetworkBridgeHandlers {
|
|
1414
|
+
/** Marca la conexión como offline de inmediato (dispara el toast). */
|
|
1415
|
+
reportOffline: () => void;
|
|
1416
|
+
/** Resuelve cuando la conexión vuelve (confirmada por el ping/eventos). */
|
|
1417
|
+
waitForOnline: () => Promise<void>;
|
|
1418
|
+
/** Confirma por ping si hay internet real. `true` = online. */
|
|
1419
|
+
verifyConnectivity: () => Promise<boolean>;
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1384
1422
|
export declare const CmsNetworkContext: Context<CmsNetworkContextValue | null>;
|
|
1385
1423
|
|
|
1386
1424
|
export declare interface CmsNetworkContextValue {
|
|
@@ -1396,9 +1434,17 @@ export declare interface CmsNetworkContextValue {
|
|
|
1396
1434
|
waitForOnline: () => Promise<void>;
|
|
1397
1435
|
/**
|
|
1398
1436
|
* Fuerza una verificación por ping (útil cuando una petición falló por red
|
|
1399
|
-
* pero `navigator.onLine` todavía dice `true`).
|
|
1437
|
+
* pero `navigator.onLine` todavía dice `true`). Resuelve a `true` si confirma
|
|
1438
|
+
* conexión real, `false` si confirma que no hay internet.
|
|
1439
|
+
*/
|
|
1440
|
+
verifyConnectivity: () => Promise<boolean>;
|
|
1441
|
+
/**
|
|
1442
|
+
* Marca la conexión como `offline` de inmediato (dispara el toast de "sin
|
|
1443
|
+
* conexión" sin esperar al ping). Lo usa el reintento cuando el navegador ya
|
|
1444
|
+
* reporta que no hay internet, para que el error se vea al perder la conexión
|
|
1445
|
+
* y no recién al recuperarla.
|
|
1400
1446
|
*/
|
|
1401
|
-
|
|
1447
|
+
reportOffline: () => void;
|
|
1402
1448
|
}
|
|
1403
1449
|
|
|
1404
1450
|
/**
|
|
@@ -1412,7 +1458,7 @@ export declare interface CmsNetworkContextValue {
|
|
|
1412
1458
|
* El mecanismo vive en la lib; el **disparo** de toasts lo hace
|
|
1413
1459
|
* `CmsNetworkToaster` (globales) y `useResilientAction` (por petición).
|
|
1414
1460
|
*/
|
|
1415
|
-
export declare function CmsNetworkProvider({ children, pingUrl, pingIntervalMs, }: CmsNetworkProviderProps): JSX.Element;
|
|
1461
|
+
export declare function CmsNetworkProvider({ children, pingUrl, pingIntervalMs, pingTimeoutMs, }: CmsNetworkProviderProps): JSX.Element;
|
|
1416
1462
|
|
|
1417
1463
|
export declare interface CmsNetworkProviderProps {
|
|
1418
1464
|
children: ReactNode;
|
|
@@ -1425,6 +1471,12 @@ export declare interface CmsNetworkProviderProps {
|
|
|
1425
1471
|
pingUrl?: string | null;
|
|
1426
1472
|
/** Intervalo del polling de ping mientras siga offline (ms). Default 5000. */
|
|
1427
1473
|
pingIntervalMs?: number;
|
|
1474
|
+
/**
|
|
1475
|
+
* Timeout del ping antes de darlo por fallido (ms). Sin él, un `fetch` a un
|
|
1476
|
+
* host externo sin internet puede colgarse hasta que la red vuelva, y el
|
|
1477
|
+
* offline se detectaría tarde. Default 5000.
|
|
1478
|
+
*/
|
|
1479
|
+
pingTimeoutMs?: number;
|
|
1428
1480
|
}
|
|
1429
1481
|
|
|
1430
1482
|
/** Estado de conectividad del navegador. */
|
|
@@ -6540,6 +6592,30 @@ export declare function resolveCmsOrigin(cmsOrigin?: string): string;
|
|
|
6540
6592
|
/** Devuelve la severidad de toast para un código de error (`warning`/`error`). */
|
|
6541
6593
|
export declare function resolveErrorSeverity(errorCode: string | number | Array<string | number> | null | undefined): CmsErrorSeverity;
|
|
6542
6594
|
|
|
6595
|
+
/**
|
|
6596
|
+
* Da resiliencia de red a una petición de axios, replicando el
|
|
6597
|
+
* `NetworkInterceptor` del Angular legacy. Pensado para el `onRejected` del
|
|
6598
|
+
* interceptor de respuesta de axios del gestor:
|
|
6599
|
+
*
|
|
6600
|
+
* ```ts
|
|
6601
|
+
* api.interceptors.response.use(
|
|
6602
|
+
* (r) => r,
|
|
6603
|
+
* (error) => resumeAxiosOnNetworkError(error, (config) => api.request(config)),
|
|
6604
|
+
* );
|
|
6605
|
+
* ```
|
|
6606
|
+
*
|
|
6607
|
+
* - **En el servidor, o no es error de red, o no hay provider montado** →
|
|
6608
|
+
* re-lanza el error (lo maneja el caller / `toCmsError`).
|
|
6609
|
+
* - **Sin internet** (el navegador reporta offline, o el ping confirma que no
|
|
6610
|
+
* hay salida real, p. ej. `ERR_NAME_NOT_RESOLVED`): muestra "sin conexión"
|
|
6611
|
+
* (vía el provider), arranca el ping y, al volver la conexión, **reintenta**
|
|
6612
|
+
* la petición (retoma el servicio).
|
|
6613
|
+
* - **Con internet** (el caído era el backend: 5xx/timeout): re-lanza sin
|
|
6614
|
+
* reintentar, para no repetir a ciegas un POST. Ese caso lo cubre
|
|
6615
|
+
* `useResilientAction`/`toCmsError` en las mutaciones envueltas.
|
|
6616
|
+
*/
|
|
6617
|
+
export declare function resumeAxiosOnNetworkError<T = unknown>(error: unknown, reAttempt: (config: unknown) => Promise<T>): Promise<T>;
|
|
6618
|
+
|
|
6543
6619
|
/** Sección de una publicación del CMS (forma devuelta por get/exist). */
|
|
6544
6620
|
export declare interface Section {
|
|
6545
6621
|
id?: number;
|
|
@@ -6679,8 +6755,8 @@ export declare type SelectOption = {
|
|
|
6679
6755
|
* - Trigger por defecto: borde `m3.outlineVariant` (#C4C6CF), texto `controlText`
|
|
6680
6756
|
* (#000) en negrita, fondo transparente; hover → `neutralHover` (state layer
|
|
6681
6757
|
* M3 `onSurface` al 8%, #191C20).
|
|
6682
|
-
* - Trigger
|
|
6683
|
-
* (#D8E2FF), sin borde.
|
|
6758
|
+
* - Trigger resaltado (valor activo, `highlighted`): fondo `secondary`
|
|
6759
|
+
* (#D8E2FF), sin borde. Abrir el menú NO lo colorea: queda outlined.
|
|
6684
6760
|
* - Opción del menú: hover → `neutralHover` (state layer M3 `onSurface` al 8%,
|
|
6685
6761
|
* #191C20); seleccionada → fondo `secondary` (#D8E2FF). El menú es full-bleed
|
|
6686
6762
|
* (sin padding lateral ni radio en los ítems): el resaltado llega de borde a
|
|
@@ -6688,8 +6764,9 @@ export declare type SelectOption = {
|
|
|
6688
6764
|
*/
|
|
6689
6765
|
export declare const SelectStyles: {
|
|
6690
6766
|
/**
|
|
6691
|
-
* Disparador outlined con label + chevron. Se rellena con `secondary`
|
|
6692
|
-
* está
|
|
6767
|
+
* Disparador outlined con label + chevron. Se rellena con `secondary` solo
|
|
6768
|
+
* cuando está resaltado (`highlighted`, valor activo); abrir el menú (`open`)
|
|
6769
|
+
* NO lo colorea.
|
|
6693
6770
|
*/
|
|
6694
6771
|
sxTrigger: (highlighted: boolean, open: boolean) => SxProps<Theme>;
|
|
6695
6772
|
/** Paper sin padding lateral: los ítems llegan de borde a borde. */
|