sass-cms-template-common 0.0.10 → 0.0.11

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/server.d.ts CHANGED
@@ -566,6 +566,25 @@ export declare class CmsContributionsServices {
566
566
  getPaymentGateways: (filters?: PaymentGatewaysGetFilters) => Promise<PaymentGatewaysGetResponse>;
567
567
  }
568
568
 
569
+ /**
570
+ * Servicios HTTP del módulo `copilot` del CMS (gateway hacia el microservicio
571
+ * Copilot/Kundera). Errores propios en la serie `030.x` (ver `commonErrors`).
572
+ *
573
+ * Se construye igual que `CmsCommonServices`, con `{ axiosApi, authentication }`.
574
+ */
575
+ export declare class CmsCopilotServices {
576
+ protected props: ICopilotServices;
577
+ protected authentication: Authentication;
578
+ constructor(props: ICopilotServices);
579
+ /** POST /copilot/opportunities — feed de oportunidades (permiso COPILOT_VIEW). */
580
+ getOpportunities: (filters?: CopilotOpportunitiesFilters) => Promise<CopilotOpportunitiesResponse>;
581
+ /**
582
+ * POST /copilot/actions — ejecuta una acción del editor sobre una
583
+ * oportunidad: `save` | `like` | `dislike` | `assign` (permiso COPILOT_ACTION).
584
+ */
585
+ executeAction: (input: CopilotActionInput) => Promise<CopilotActionResponse>;
586
+ }
587
+
569
588
  /**
570
589
  * Servicios HTTP del módulo `dashboard` del CMS.
571
590
  *
@@ -1737,6 +1756,90 @@ export declare interface ContributionsInsertCrmResponse extends CmsResponse {
1737
1756
  [key: string]: unknown;
1738
1757
  }
1739
1758
 
1759
+ /** Acción del editor sobre una oportunidad (POST /copilot/actions). */
1760
+ export declare type CopilotAction = 'save' | 'like' | 'dislike' | 'assign';
1761
+
1762
+ /** Datos según la acción ejecutada (el backend lo omite si está vacío). */
1763
+ export declare interface CopilotActionData {
1764
+ /** Acción `save` (bookmark, toggle). */
1765
+ is_followed?: boolean;
1766
+ /** Acciones `like` / `dislike`. */
1767
+ interest_signal?: string;
1768
+ /** Acción `assign`. */
1769
+ assigned_to?: string;
1770
+ }
1771
+
1772
+ /** Entrada de POST /copilot/actions. */
1773
+ export declare interface CopilotActionInput {
1774
+ action: CopilotAction;
1775
+ /** ID de la oportunidad sobre la que se acciona. */
1776
+ opportunityId: string;
1777
+ /**
1778
+ * ID opaco y estable del redactor a asignar (NO el username).
1779
+ * Obligatorio solo para `action = "assign"` (error 030.005 si falta).
1780
+ */
1781
+ userExternalId?: string;
1782
+ }
1783
+
1784
+ /** Cuerpo de la respuesta de POST /copilot/actions. */
1785
+ export declare interface CopilotActionResponse extends CmsResponse {
1786
+ copilotEnabled?: boolean;
1787
+ action?: CopilotAction;
1788
+ opportunity_id?: string;
1789
+ /** Código de resultado devuelto por el microservicio (omitido si es nulo). */
1790
+ code?: string;
1791
+ data?: CopilotActionData;
1792
+ }
1793
+
1794
+ /** Filtros opcionales de POST /copilot/opportunities (passthrough al micro). */
1795
+ export declare interface CopilotOpportunitiesFilters {
1796
+ /** Filtro de estado de las oportunidades (p. ej. "open"). */
1797
+ status?: CopilotOpportunityStatus;
1798
+ /** Cantidad máxima de oportunidades a devolver. */
1799
+ limit?: number;
1800
+ }
1801
+
1802
+ /**
1803
+ * Cuerpo de la respuesta de POST /copilot/opportunities.
1804
+ *
1805
+ * Si la publicación no tiene `KUNDERA_SITE_UUID` (Copilot desactivado) el CMS
1806
+ * responde `status:"ok"` con `copilotEnabled:false` y lista vacía: NO es un
1807
+ * error, el gestor decide qué mostrar.
1808
+ */
1809
+ export declare interface CopilotOpportunitiesResponse extends CmsResponse {
1810
+ copilotEnabled?: boolean;
1811
+ /** UUID del sitio en Kundera (solo si `copilotEnabled = true`). */
1812
+ site_uuid?: string;
1813
+ count?: number;
1814
+ opportunities?: CopilotOpportunity[];
1815
+ }
1816
+
1817
+ /**
1818
+ * Oportunidad editorial del feed de Copilot.
1819
+ *
1820
+ * La doc del gateway lista `id`, `topic` y `created_at`, pero el microservicio
1821
+ * (observado en dev) puede omitirlos: solo `title`, `status` y `score` están
1822
+ * garantizados. El consumidor debe tolerar los faltantes.
1823
+ */
1824
+ export declare interface CopilotOpportunity {
1825
+ id?: string;
1826
+ title: string;
1827
+ /** Tema/categoría. */
1828
+ topic?: string;
1829
+ status: CopilotOpportunityStatus;
1830
+ /** Puntaje (el backend lo omite si es nulo). */
1831
+ score?: number;
1832
+ /** Fecha de creación (ISO 8601, p. ej. "2026-06-26T10:15:00Z"). */
1833
+ created_at?: string;
1834
+ }
1835
+
1836
+ /**
1837
+ * Estado de una oportunidad tal como lo entrega el microservicio (passthrough).
1838
+ * El único valor documentado hoy es `"open"`; se deja abierto para no romper
1839
+ * cuando el microservicio agregue estados nuevos.
1840
+ */
1841
+ export declare type CopilotOpportunityStatus = 'open' | (string & {});
1842
+
1740
1843
  /** POST /dashboard/countNotificatio */
1741
1844
  export declare interface CountNotificationsResponse {
1742
1845
  status: string;
@@ -1923,6 +2026,23 @@ export declare interface FileExplorerGetFoldersResponse extends CmsResponse {
1923
2026
  folders: ExplorerFolder[];
1924
2027
  }
1925
2028
 
2029
+ /**
2030
+ * Filtra los módulos de POST /auth/modulesAvailable dejando solo los que el
2031
+ * usuario puede ver, replicando el cruce que hace `parseModuleIntoMenu` de
2032
+ * cmsmedios: un admin ve todo; el resto solo ve un módulo si tiene la operación
2033
+ * `${module}_VIEW` en POST /auth/permissions. La comparación es case-insensitive.
2034
+ *
2035
+ * Degrada con seguridad: si `permissions` es null/undefined (p. ej. porque
2036
+ * /auth/permissions falló), NO filtra y devuelve los módulos tal cual (misma
2037
+ * visibilidad que hoy). El acceso real lo sigue gobernando el guard de ruta
2038
+ * (`hasModulePermission`), así que el menú puede degradar sin exponer nada.
2039
+ *
2040
+ * @param modules módulos crudos de POST /auth/modulesAvailable
2041
+ * @param permissions respuesta de POST /auth/permissions (`isAdmin` + `operations`)
2042
+ * @returns los módulos visibles para el usuario (preserva `isnew`)
2043
+ */
2044
+ export declare function filterModulesByPermissions(modules: NavItemPermissions[], permissions: Pick<AuthPermissionsResponse, 'isAdmin' | 'operations'> | null | undefined): NavItemPermissions[];
2045
+
1926
2046
  export declare function findPublicationBySlug(sites: SiteSection[], slug: string): Publication | undefined;
1927
2047
 
1928
2048
  export declare function findPublicationLabel(sites: SiteSection[], publicationId: string): string;
@@ -1961,6 +2081,19 @@ export declare function getDefaultPublicationSlug(sites: SiteSection[]): string;
1961
2081
  */
1962
2082
  export declare function getSiteNow(gmtRedaction: string | null | undefined, localeTag: string, options?: Intl.DateTimeFormatOptions): string;
1963
2083
 
2084
+ /**
2085
+ * Decide si el usuario puede acceder a un módulo, replicando el
2086
+ * `AccessPermissionsGuard` de cmsmedios: un admin siempre pasa, el comodín
2087
+ * `All_VIEWS` siempre pasa, y en el resto el usuario debe tener una operación
2088
+ * cuyo `name` coincida con el permiso requerido. La comparación es
2089
+ * case-insensitive (cmsmedios pasa el permiso de la ruta a mayúsculas).
2090
+ *
2091
+ * @param permissions respuesta de POST /auth/permissions (`isAdmin` + `operations`)
2092
+ * @param requiredPermission permiso que exige la ruta (p. ej. `'NEWS_VIEW'`)
2093
+ * @returns `true` si tiene acceso; `false` si debería redirigirse a `/not-allowed`
2094
+ */
2095
+ export declare function hasModulePermission(permissions: Pick<AuthPermissionsResponse, 'isAdmin' | 'operations'> | null | undefined, requiredPermission: string): boolean;
2096
+
1964
2097
  declare interface IAudiosServices {
1965
2098
  axiosApi: AxiosInstance;
1966
2099
  authentication: Authentication;
@@ -2000,6 +2133,11 @@ declare interface IContributionsServices {
2000
2133
  authentication: Authentication;
2001
2134
  }
2002
2135
 
2136
+ declare interface ICopilotServices {
2137
+ axiosApi: AxiosInstance;
2138
+ authentication: Authentication;
2139
+ }
2140
+
2003
2141
  declare interface IDashboardServices {
2004
2142
  axiosApi: AxiosInstance;
2005
2143
  authentication: Authentication;
package/dist/server.js CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as e, A as t, C as n, D as r, E as i, F as a, G as o, I as s, J as c, K as l, L as u, M as d, N as f, O as p, P as m, Q as h, R as g, S as _, T as v, U as y, W as b, X as x, Y as S, Z as C, _ as w, a as T, b as E, c as D, d as O, f as k, g as A, h as j, i as M, j as N, k as P, l as F, m as I, n as L, o as R, p as z, q as B, r as V, s as H, t as U, u as W, v as G, w as K, x as q, y as J } from "./services-Zx1IiHhX.js";
2
- export { i as CmsAudiosServices, P as CmsAuthLoginServices, m as CmsAuthServices, v as CmsCategoriesServices, K as CmsCkeditorServices, n as CmsCommentsServices, U as CmsCommonServices, _ as CmsContributionsServices, f as CmsDashboardServices, J as CmsEventsServices, G as CmsFileExplorerServices, w as CmsGeneralServices, A as CmsImagesServices, j as CmsNewsServices, I as CmsNotificationServices, z as CmsPeopleServices, k as CmsPlanningServices, O as CmsPollsServices, r as CmsPreviewServices, E as CmsProductivityPlanServices, d as CmsProfileServices, N as CmsPublicationsServices, W as CmsRecipesServices, q as CmsSectionsServices, t as CmsSitesServices, L as CmsTagsServices, V as CmsTranscribeServices, M as CmsTriviasServices, p as CmsUploadServices, F as CmsUsersServices, T as CmsVideosServices, R as CmsVodsServices, H as CmsWorkpaperServices, D as CmsZonesServices, e as commonErrorsEn, h as commonErrorsEs, C as commonErrorsPt, y as findPublicationBySlug, b as findPublicationLabel, a as formatSiteDateTime, o as getAllPublications, c as getCommonError, l as getDefaultPublicationSlug, s as getSiteNow, S as normalizeErrorCode, u as parseGmtOffsetMinutes, B as parsePublicationSlug, x as resolveErrorSeverity, g as toSiteWallClock };
1
+ import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, I as s, J as c, K as l, L as u, M as d, N as f, O as p, P as m, Q as h, R as g, S as _, T as v, V as y, X as b, Y as x, Z as S, _ as C, a as w, b as T, c as E, d as D, et as O, f as k, g as A, h as j, i as M, j as N, k as P, l as F, m as I, n as L, nt as R, o as z, p as B, q as V, r as H, s as U, t as W, tt as G, u as K, v as q, w as J, x as Y, y as X, z as Z } from "./services-BLy9bEvH.js";
2
+ export { i as CmsAudiosServices, t as CmsAuthLoginServices, o as CmsAuthServices, a as CmsCategoriesServices, v as CmsCkeditorServices, r as CmsCommentsServices, W as CmsCommonServices, _ as CmsContributionsServices, J as CmsCopilotServices, m as CmsDashboardServices, X as CmsEventsServices, q as CmsFileExplorerServices, C as CmsGeneralServices, A as CmsImagesServices, j as CmsNewsServices, I as CmsNotificationServices, B as CmsPeopleServices, k as CmsPlanningServices, D as CmsPollsServices, p as CmsPreviewServices, T as CmsProductivityPlanServices, f as CmsProfileServices, d as CmsPublicationsServices, K as CmsRecipesServices, Y as CmsSectionsServices, N as CmsSitesServices, L as CmsTagsServices, H as CmsTranscribeServices, M as CmsTriviasServices, P as CmsUploadServices, F as CmsUsersServices, w as CmsVideosServices, z as CmsVodsServices, U as CmsWorkpaperServices, E as CmsZonesServices, R as commonErrorsEn, G as commonErrorsEs, O as commonErrorsPt, s as filterModulesByPermissions, l as findPublicationBySlug, V as findPublicationLabel, g as formatSiteDateTime, c as getAllPublications, S as getCommonError, x as getDefaultPublicationSlug, Z as getSiteNow, u as hasModulePermission, h as normalizeErrorCode, n as parseGmtOffsetMinutes, b as parsePublicationSlug, e as resolveErrorSeverity, y as toSiteWallClock };