Skip to main content

Servicios

Todos son providedIn: 'root'. Se dividen en core/services/api (clientes HTTP) y core/services/ui (estado de UI, sesión, sockets). Las rutas HTTP se construyen con environment.apiUrl más una ruta base de API_URLS (core/helpers/global/global.constant.ts) y los sufijos de API_ENDPOINTS (/get-all, /create, /update, /remove, /toggle-active).

Las respuestas siguen el envoltorio ApiResponse<T> (interfaces/api/api-response.interface.ts): data.results + data.meta para listas paginadas.

Servicios de API (core/services/api)​

ServicioRuta baseNotas
AuthService/authlogin, frameLogin (ambos con header skip), logout, isLoggedIn, getExpiration (lee exp del JWT)
UserService/usersget-me, me/signature, me/avatar
CrmUserService/usersCRUD de usuarios del CRM
TicketService/ticketsget-all, get-one, resolve, resolve-no-farewell, return, unassign, transfer, postpone, cancel-postpone, lock, unlock, force-unlock, mark-unread, status, remove, filter-agents, contact-reason
MessageService/messagesget-all, mensajes por contacto, unread-count, recent-unread, remove, notas
ContactService/contactsCRUD + assign-labels
ConnectionService/connections y /meta/oauth/instagramVer Conexiones Meta
DepartmentService/departmentsCRUD
LabelService/labelsCRUD
QuickResponseService/quick-responsesCRUD
SettingsService/settingsget-all, general, attention/schedule, attention/auto-resolution, attention/csat
ScheduledMessageService/scheduled-messagescreate, mine, by-ticket, update, cancel
StarredMessageService/starred-messagestoggle, ids, by-contact, by-internal-conversation, listado y ventana de contexto
InternalChatService/internal-conversationsConversaciones directas/grupales, mensajes, miembros, leave, read
FileApiService/files/uploadSubida de archivos
CrmRoleService, PermissionService, CrmRolePermissionService, SystemModuleService/roles, /permissions, /role-permissions, /modulesAdministración de RBAC (catálogo, no confundir con MyPermissionsService)
LanguageService (api)/languageget-all paginado de idiomas

Servicios con rutas de un backoffice anterior y poco o ningún uso en el CRM: RoleService (/role, sin consumidores fuera de su archivo), ReportService (/report, /tickets-mts), PageManagerService (/page-manager).

Servicios de UI (core/services/ui)​

GrupoServicios
Sesión y permisosStorageService (almacenamiento cifrado), GlobalService (perfil actual en un ReplaySubject), MyPermissionsService, EncryptionService, DeviceTokenService
Tiempo realChatSocketService, InternalChatSocketService, AudioNotificationService, NotificationCenterService, InternalChatNotificationService
IframeIframeDetectionService, FrameBridgeService
ChatChatMessageBuilderService, ChatStateManagerService, ChatScrollManagerService, ChatDateFormatterService, ChatUserHelperService, MediaDownloadService, ImageCompressionService, ImageLoadService
PresentaciónLayoutService, NavService, LanguageService (ui), ToastrNotificationService, ConfirmDialogService, BootstrapModalService, SanitizationService, ClipboardService, UserAvatarsService
Tablas y filtrosNgxDatatableService, NgxDatatableMobileService, ColumnStorageService, TableColumnStorageService, FilterService, SearchNgSelectService, TabChangeService
OtrosDateUtilsService, RouteHelperService, ValidationService, UserLocationService, ReportDownloadService, PageManagementFormSelectorService

StorageService​

Envuelve SecureWebStorage sobre localStorage: las claves se hashean con SHA-256 y los valores se cifran con AES (crypto-js). La clave de cifrado es una constante definida en storage.service.ts (hardcodeada en el bundle, por lo que el cifrado solo ofusca; no es un secreto real frente a quien tenga acceso al navegador). La sesión se guarda bajo USER_SESSION. Expone parseJwt para leer el payload del token.

EncryptionService​

Descarga la clave pública RSA de GET <apiUrl>/auth/public-key, valida su huella SHA-256 contra environment.PUBLIC_KEY_FINGERPRINT, y la cachea en localStorage (aes-gcm-encryption-pub-key) hasta 24 h. Cifra con RSA-OAEP la clave AES del envoltorio (ENVELOPE_VERSION = '1.0') y usa environment.AES_GCM_AAD como AAD cuando está definido. Solo lo importa ReportService (heredado). Ver Entornos.

GlobalService​

Se suscribe a selectUser y reemite el usuario en profile. Lo consumen el layout (para conectar sockets), AdminGuard y MyPermissionsService.

Servicios de chat​

ChatMessageBuilderService (buildMessagePayload), ChatStateManagerService (estado de carga/paginación de la conversación: startLoading, canLoadMore, shouldScrollToBottom), ChatScrollManagerService, ChatDateFormatterService y ChatUserHelperService se inyectan en ChatConversationComponent (y algunos en el chat interno); ver Chat.