Pure logic for CRM integration settings in WhatsApp SaaS. Handles blocking, controls, and API bodies for HighLevel and HubSpot.
// Source: https://github.com/Carlos-Dominguez-faber/whatsapp-saas | License: MIT | Copyright 2026 Carlos Domínguez
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Lógica pura de las secciones de CRM de Configuración → Integraciones. Vive fuera del
* componente para poder probarla con node:test (sin jsdom). La regla de verdad es la del servidor
* (índice uq_integrations_one_active_crm + 409 del PUT); esto evita ofrecer un botón que va a
* fallar y no reenviar un token que no cambió.
*/
export type CrmName = "highlevel" | "hubspot";
const LABEL: Record<CrmName, string> = { highlevel: "HighLevel", hubspot: "HubSpot" };
export function crmBlockedBy(
integrations: Array<{ provider: string; enabled: boolean }>,
self: CrmName,
): string | null {
const other:
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key