Skip to main content

Log Activities

This package provides a centralized event registration system for logging various activities—such as meetings, calls, and notes—across the entire Rhapsody platform. It handles the orchestration and event management for activity logging, while the actual UI components are provided by the Component Package Collection (CPC).


Installation

pnpm add @shared/log-activities

Usage

This package provides event registration and orchestration for activity logging. The actual UI components are sourced from the Component Package Collection (CPC).

Event Registration

The package automatically registers event listeners for activity logging when imported:

import '@shared/log-activities' // Registers event listeners automatically

Logging a Meeting

Import handleLogMeeting and call it with the relevant options. This will trigger events that open a dedicated meeting pane (UI provided by CPC).

import { handleLogMeeting } from '@shared/log-activities'

// In your component or wherever you need to log a meeting
const handleLogMeetingClick = () => {
handleLogMeeting({
personId: person?.id,
companyId: company?.id,
entityType: 'person', // Can be 'person' or 'company'
source: 'activity_header', // e.g., 'activity_header', 'dashboard'
tabState: 'activities', // e.g., 'activities', 'meetings'
})
}

handleLogMeeting(options)

This function initiates the meeting logging process by publishing events that trigger the CPC meeting pane components.

ParameterTypeDescription
options.personIdnumber | stringID of the person associated with the meeting.
options.companyIdnumber | stringID of the company/account for the meeting.
options.entityType'person' | 'company'The type of entity this meeting is primarily for.
options.sourcestringThe origin of the action (e.g., 'activity_header', 'quick_add_button'). This helps track where the logging was initiated from.
options.tabStatestringThe current tab context from which the meeting pane is being opened (e.g., 'activities', 'meetings').

Returns: string - The unique ID of the created meeting pane.


Event Management

This package manages the following events for activity logging:

Published Events

  • ADD_MEETING_PANE - Triggers when a new meeting pane should be opened
  • REMOVE_MEETING_PANE - Triggers when a meeting pane should be closed
  • MEETING_PANE_OPENED - Analytics event when a meeting pane is opened
  • MEETING_PANE_CLOSED - Analytics event when a meeting pane is closed

Event Listeners

  • Automatically registers listeners for activity-related events
  • Handles pane orchestration and state management
  • Manages analytics tracking for user interactions

Architecture

┌─────────────────────┐    Events    ┌──────────────────────┐
│ @shared/ │◄────────────►│ Component Package │
│ log-activities │ │ Collection (CPC) │
│ │ │ │
│ • Event Registration│ │ • LogMeetingPane │
│ • handleLogMeeting()│ │ • ActivityPane │
│ • Event Orchestrator│ │ • UI Components │
└─────────────────────┘ └──────────────────────┘

Responsibilities

@shared/log-activities:

  • Event registration and management
  • Activity logging orchestration
  • Analytics tracking
  • API for triggering activity logs

Component Package Collection (CPC):

  • UI components (LogMeetingPane, ActivityPane, etc.)
  • Form handling and validation
  • Visual presentation and interactions
  • Design system compliance