sass-cms-template-common 0.0.29 → 0.0.31
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 +53 -2
- package/dist/index.js +1671 -1644
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4620,6 +4620,13 @@ declare interface ISectionsServices {
|
|
|
4620
4620
|
authentication: Authentication;
|
|
4621
4621
|
}
|
|
4622
4622
|
|
|
4623
|
+
/**
|
|
4624
|
+
* `true` si la excepción es una señal interna de control de flujo de Next
|
|
4625
|
+
* (`redirect()`, `notFound()`, `forbidden()`), no un fallo real. Estas NUNCA
|
|
4626
|
+
* deben atraparse: si se tragan, la navegación no ocurre.
|
|
4627
|
+
*/
|
|
4628
|
+
export declare function isFrameworkControlFlowError(error: unknown): boolean;
|
|
4629
|
+
|
|
4623
4630
|
declare interface ISitesServices {
|
|
4624
4631
|
axiosApi: AxiosInstance;
|
|
4625
4632
|
authentication: Authentication;
|
|
@@ -6885,6 +6892,16 @@ export declare interface RecipesPublishCheckResponse extends CmsResponse {
|
|
|
6885
6892
|
/** Estilo del texto relativo (`Intl.RelativeTimeFormat`). */
|
|
6886
6893
|
export declare type RelativeTimeStyle = 'long' | 'short' | 'narrow';
|
|
6887
6894
|
|
|
6895
|
+
export declare interface ResilientFormActionOptions<S> extends ResilientRunOptions {
|
|
6896
|
+
/**
|
|
6897
|
+
* Estado a devolver cuando la llamada no pudo completarse (se agotaron los
|
|
6898
|
+
* reintentos, o la excepción no era de red). Recibe el error crudo y su
|
|
6899
|
+
* clasificación (`null` si no es un fallo de red) para poder distinguir
|
|
6900
|
+
* "servicio caído" de "error inesperado".
|
|
6901
|
+
*/
|
|
6902
|
+
onError: (error: unknown, classified: ClassifiedNetworkError | null) => S;
|
|
6903
|
+
}
|
|
6904
|
+
|
|
6888
6905
|
export declare type ResilientRunner = <T>(fn: () => Promise<T>, options?: ResilientRunOptions) => Promise<T>;
|
|
6889
6906
|
|
|
6890
6907
|
export declare interface ResilientRunOptions {
|
|
@@ -7274,13 +7291,15 @@ export declare const stateColors: Record<"active" | "generating" | "assigned" |
|
|
|
7274
7291
|
}>;
|
|
7275
7292
|
|
|
7276
7293
|
/**
|
|
7277
|
-
* Arma y envía el formulario POST que abre una ruta del admin viejo
|
|
7278
|
-
*
|
|
7294
|
+
* Arma y envía el formulario POST que abre una ruta del admin viejo pasando la
|
|
7295
|
+
* sesión del usuario (igual que cmsmedios).
|
|
7279
7296
|
*
|
|
7280
7297
|
* @param params.cmsBaseUrl - Origen del CMS (p. ej. `https://dev.cms-medios.com`).
|
|
7281
7298
|
* @param params.path - Ruta destino dentro del CMS (campo `r`).
|
|
7282
7299
|
* @param params.session - Datos de sesión a enviar (token, sitio, etc.).
|
|
7283
7300
|
* @param params.device - Opcional: protocolo/queryString del preview.
|
|
7301
|
+
* @param params.target - Destino del form: `_blank` (default, pestaña nueva) o
|
|
7302
|
+
* `_self` para navegar en la misma pestaña (lo que usa el menú lateral).
|
|
7284
7303
|
* @returns void
|
|
7285
7304
|
*/
|
|
7286
7305
|
export declare function submitLegacyAdminPage(params: {
|
|
@@ -7288,6 +7307,7 @@ export declare function submitLegacyAdminPage(params: {
|
|
|
7288
7307
|
path: string;
|
|
7289
7308
|
session: LegacyAdminSession;
|
|
7290
7309
|
device?: LegacyAdminDevice;
|
|
7310
|
+
target?: '_blank' | '_self';
|
|
7291
7311
|
}): void;
|
|
7292
7312
|
|
|
7293
7313
|
/** Filtros de POST /contributions/getSuscriptions. */
|
|
@@ -8028,6 +8048,37 @@ export declare type UserAvatarProps = {
|
|
|
8028
8048
|
*/
|
|
8029
8049
|
export declare function useResilientAction(): ResilientRunner;
|
|
8030
8050
|
|
|
8051
|
+
/**
|
|
8052
|
+
* Envuelve el server action de un formulario (`useActionState`) para hacerlo
|
|
8053
|
+
* **resiliente a la red** y, sobre todo, para que **jamás propague la excepción**.
|
|
8054
|
+
*
|
|
8055
|
+
* Por qué existe: al invocar un server action desde el navegador, Next hace un
|
|
8056
|
+
* `fetch` interno. Sin internet ese fetch lanza `TypeError: Failed to fetch`
|
|
8057
|
+
* dentro del render de React; como `useActionState` no atrapa nada, el error
|
|
8058
|
+
* sube al error boundary y **tumba la pantalla** ("recargá la página"). Es
|
|
8059
|
+
* inaceptable en pantallas sin shell —el login—, donde no hay nada que degradar:
|
|
8060
|
+
* se cae todo.
|
|
8061
|
+
*
|
|
8062
|
+
* Qué hace, apoyado en `useResilientAction`:
|
|
8063
|
+
* - **Sin internet:** no pierde el envío. Muestra el toast de "sin conexión"
|
|
8064
|
+
* (vía `CmsNetworkProvider` + `CmsNetworkToaster`), espera la reconexión y
|
|
8065
|
+
* **retoma el llamado** solo (avisando "reintentando…").
|
|
8066
|
+
* - **Backend caído / 5xx / timeout:** reintenta con backoff exponencial.
|
|
8067
|
+
* - **Agotado o error inesperado:** devuelve el estado de `onError` — la pantalla
|
|
8068
|
+
* sigue viva y pinta el mensaje en su lugar.
|
|
8069
|
+
*
|
|
8070
|
+
* Requiere estar dentro de `<CmsNetworkProvider>` y `<CmsToastProvider>`.
|
|
8071
|
+
*
|
|
8072
|
+
* ```ts
|
|
8073
|
+
* const resilientLogin = useResilientFormAction(loginAction, {
|
|
8074
|
+
* service: '/auth/loginValid',
|
|
8075
|
+
* onError: () => ({ error: 'service', field: 'general' }),
|
|
8076
|
+
* });
|
|
8077
|
+
* const [state, formAction, isPending] = useActionState(resilientLogin, {});
|
|
8078
|
+
* ```
|
|
8079
|
+
*/
|
|
8080
|
+
export declare function useResilientFormAction<S>(action: (prevState: S, formData: FormData) => Promise<S>, options: ResilientFormActionOptions<S>): (prevState: S, formData: FormData) => Promise<S>;
|
|
8081
|
+
|
|
8031
8082
|
/** Grupo del sistema devuelto por POST /users/groups/get. */
|
|
8032
8083
|
export declare interface UserGroup {
|
|
8033
8084
|
id: string;
|