Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

555 B
Raw Blame
import { useQuery } from '@tanstack/react-query';
import { useTRPC } from '@/integrations/trpc/react';
import type { RouterInputs } from '@/trpc/client';

export function useEventProperties(
  params: RouterInputs['chart']['properties'],
  options?: {
    enabled: boolean;
  }
) {
  const trpc = useTRPC();
  const query = useQuery(
    trpc.chart.properties.queryOptions(params, {
      enabled:
        !!params.projectId && typeof options?.enabled !== 'undefined'
          ? options.enabled
          : true,
    })
  );
  return query.data ?? [];
}