Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

998 B
Raw Blame
import type { BoardEntityType } from './boards';

export const BOARD_COMPONENT_COMPATIBILITY_MATRIX = {
  EventsMetricsBar: ['website'],
  EventsChart: ['website'],
  Funnel: ['website'],
  Goal: ['website'],
  RealtimeActiveUsers: ['website'],
  RealtimeHeader: ['website'],
  RealtimeChart: ['website'],
  RevenueMetricsBar: ['website'],
  RevenueChart: ['website'],
  RevenueMetricsTable: ['website'],
  UTM: ['website'],
  WeeklyTraffic: ['website'],
} as const satisfies Partial<Record<string, readonly BoardEntityType[]>>;

export function getSupportedBoardComponentEntityTypes(componentType: string) {
  return BOARD_COMPONENT_COMPATIBILITY_MATRIX[componentType];
}

export function isBoardComponentSupportedByEntityType(
  componentType: string,
  entityType?: BoardEntityType,
) {
  const supportedEntityTypes = getSupportedBoardComponentEntityTypes(componentType);

  if (!entityType || !supportedEntityTypes) {
    return true;
  }

  return supportedEntityTypes.includes(entityType);
}