Skip to main content

Documentation Index

Fetch the complete documentation index at: https://grantmaster.dev/llms.txt

Use this file to discover all available pages before exploring further.

Engineering reference: For service contracts, EventBus events, and data-layer details see src/features/partnerships/partnerships.md.

Partnerships

Overview

The partnerships feature manages the platform’s reseller / partner organization program. Partner organizations are entities (agencies, resellers, NGO networks) that refer member organizations to GrantMaster and earn revenue share. This feature handles partner registration, invitation management, financial tracking, and analytics. This is distinct from relations (CRM contacts) and grantors (funders). Partners here are distribution partners with commercial relationships to the platform, not beneficiaries or funders.

Data Model

Firestore Collections

CollectionDocument typeDescription
partnerOrganizationsPartnerOrganizationRegistered reseller/partner orgs
partnerInvitationsPartnerInvitationInvitations sent to potential member orgs by partners
PartnerOrganization and related types are defined in the partnerships feature contracts and managed by shared/partnerships/PartnerService.

Key TypeScript Types

interface PartnerOrganization {
  id: string;
  name: string;
  contactEmail: string;
  partnerCode: string;            // Unique referral code
  status: 'active' | 'inactive' | 'pending' | 'suspended';
  memberCount: number;            // Referred member organizations
  totalRevenue: number;           // Cumulative revenue attributed
  contractEndDate?: string;
  // ...additional commercial fields
}

interface PartnerSummaryStats {
  totalPartners: number;
  activePartners: number;
  totalMembers: number;
  totalActiveSubscriptions: number;
  totalRevenue: number;
  averageConversionRate: number;
}

interface FilterCriteria {
  status?: PartnerOrganization['status'];
  minMembers?: number;
  minRevenue?: number;
  hasActiveContract?: boolean;
}

Key Behaviors

Dashboard Overview

PartnershipsDashboard is the main page with two views: a partner list and an analytics panel (PartnerAnalyticsDashboard). usePartnershipsDashboardState loads summary stats and the full partner list in parallel via PartnerService.getPartnerSummaryStats() and PartnerService.listPartnerOrgs().

Partner Search and Filtering

Partners can be filtered in real time by status, minimum member count, minimum revenue, and active contract presence. Search matches against name, contact email, and partner code.

Partner CRUD

  • Create: CreatePartnerDialog registers a new partner organization
  • Edit: EditPartnerDialog updates partner details
  • View: PartnerDetailsView shows full partner profile, member list (MemberOrganizationsList), and metrics (PartnerMetricsCard, PartnerFinancialDashboard)

Invitation Management

InvitationManagementPanel lists outbound invitations sent by a partner to prospective member organizations. BulkInviteDialog allows partners to invite multiple organizations at once. ReminderManagementPanel manages follow-up reminders for pending invitations. InvitationAnalyticsWidget tracks invitation conversion rates.

Partner Portal

PartnerPortal is a simplified view exposed to partner users (not platform admins) showing their own referral stats, earnings, and member organizations.

Service Contract

No service files within the feature directory. Data access is via shared services.
HookOwnsKey interface
usePartnershipsDashboardStateDashboard state, search, filterpartners, filteredPartners, stats, handleSearch, handleFilterChange, handlePartnerCreated
Shared serviceLocationKey methods
PartnerServicesrc/shared/partnerships/listPartnerOrgs(), getPartnerSummaryStats(), createPartner(), updatePartner()
ReferralCreditServicesrc/shared/partnerships/Credit and referral transaction management

Events

Emitted

None. Partner operations are direct Firestore writes via PartnerService.

Consumed

None.

Dependencies

Depends on:
  • shared/partnerships/PartnerService — all partner CRUD and stats
  • shared/partnerships/ReferralCreditService — credit ledger
  • features/billing — subscription and revenue data
Depended on by:
  • features/missionReferralCreditService is also used by mission for credit history

File Structure

partnerships/
├── components/
│   └── pages/
│       ├── BulkInviteDialog.tsx              # Multi-org invitation dialog
│       ├── CreatePartnerDialog.tsx           # New partner registration
│       ├── EditPartnerDialog.tsx             # Partner profile editing
│       ├── InvitationAnalyticsWidget.tsx     # Conversion rate widget
│       ├── InvitationManagementPanel.tsx     # Outbound invitations list
│       ├── MemberOrganizationsList.tsx       # Referred member orgs
│       ├── PartnerAnalyticsDashboard.tsx     # Revenue and conversion analytics
│       ├── PartnerDetailsView.tsx            # Full partner profile
│       ├── PartnerFinancialDashboard.tsx     # Revenue breakdown
│       ├── PartnerList.tsx                   # Searchable partner list
│       ├── PartnerMetricsCard.tsx            # Key metrics card
│       ├── PartnerPortal.tsx                 # Partner-facing self-service view
│       ├── PartnerSearchFilter.tsx           # Filter controls
│       ├── PartnershipsDashboard.tsx         # Main page
│       └── ReminderManagementPanel.tsx       # Invitation follow-up reminders
├── hooks/
│   └── usePartnershipsDashboardState.ts     # Dashboard state and filter logic
└── index.ts