Embed Mode Contract
Last Updated: December 2025Status: Phase 3.x Implementation Complete
Overview
Embed mode allows the dashboard to be embedded in external CRM systems (Salesforce, HubSpot, etc.) via Canvas/iframe without showing the global sidebar and top navigation. Use Case: Salesforce/HubSpot Canvas-type integrations where we need a minimal UI that fits within the CRM’s layout.Activation
Embed mode is activated via query parameter:https://dashboard.example.com/agent/robin-bundy?mode=embeddedhttps://dashboard.example.com/ceo?mode=embedded&period_label=2025-12-01
Behavior
When mode=embedded:
✅ Preserved:
- Authentication (JWT tokens, auth checks)
- Routing (Next.js routing works normally)
- Theme support (theme colors/styles still apply)
- All page functionality (charts, tables, interactions)
- Sidebar navigation (left sidebar)
- Top header/navigation bar
- Logo and branding elements
Layout Changes
Normal Mode:Implementation
Frontend Hook
Layout Component
TheDashboardLayout component automatically detects embed mode and conditionally renders sidebar/header:
Security Considerations
Authentication: Embed mode does NOT bypass authentication. All auth checks remain in place. Authorization: Role-based access control (RBAC) still applies. Users can only access pages they have permission for. CSP/Frame Options: For production, consider configuring Content Security Policy (CSP) and X-Frame-Options headers to control which domains can embed the dashboard.Testing
Manual Testing
-
Normal Mode: Navigate to any page (e.g.,
/agent/robin-bundy)- ✅ Sidebar visible
- ✅ Header visible
- ✅ Content renders normally
-
Embed Mode: Add
?mode=embedded(e.g.,/agent/robin-bundy?mode=embedded)- ✅ Sidebar hidden
- ✅ Header hidden
- ✅ Content renders full-width
- ✅ Auth still works
- ✅ Routing still works
Automated Testing
Integration Examples
Salesforce Canvas
HubSpot Custom App
Future Enhancements (Phase 4)
- Custom CSS: Allow CRM-specific styling via query params
- PostMessage API: Bi-directional communication with parent CRM frame
- Responsive Breakpoints: Optimize layout for different CRM frame sizes
- Loading States: Show CRM-branded loading indicators
See Also:
dashboard/src/hooks/useEmbedMode.ts- Embed mode detection hookdashboard/src/components/layout/DashboardLayout.tsx- Layout component with embed supportdocs/INTEGRATION_READINESS.md- CRM integration readiness guide