hunk.code_window: // const prismaWithClientExtensions = prismaWithoutClientExtensions;
   export const prisma = (globalThis.prisma as typeof prismaWithClientExtensions) || prismaWithClientExtensions;
   if (process.env.NODE_ENV !== "production") {
  
hunk.labels: keep keep keep replace keep keep
hunk.after_edit: export const prisma =
     ((globalThis as any).prisma as typeof prismaWithClientExtensions) || prismaWithClientExtensions;
  
hunk.file_path: packages/prisma/index.ts
hunk.type: replace
file: import { Title } from "@tremor/react";
  
  import { useLocale } from "@calcom/lib/hooks/useLocale";
  import { trpc } from "@calcom/trpc";
  
  import { useFilterContext } from "../context/provider";
  import { valueFormatter } from "../lib/valueFormatter";
  import { CardInsights } from "./Card";
  import { LineChart } from "./LineChart";
  import { LoadingInsight } from "./LoadingInsights";
  
  export const BookingStatusLineChart = () => {
    const { t } = useLocale();
    const { filter } = useFilterContext();
    const {
      selectedTeamId,
      selectedUserId,
      selectedTimeView = "week",
      dateRange,
      selectedEventTypeId,
      isAll,
      initialConfig,
    } = filter;
    const initialConfigIsReady = !!(initialConfig?.teamId || initialConfig?.userId || initialConfig?.isAll);
    const [startDate, endDate] = dateRange;
  
    if (!startDate || !endDate) return null;
  
    const {
      data: eventsTimeLine,
      isSuccess,
      isLoading,
    } = trpc.viewer.insights.eventsTimeline.useQuery(
      {
        timeView: selectedTimeView,
        startDate: startDate.toISOString(),
        endDate: endDate.toISOString(),
        teamId: selectedTeamId ?? undefined,
        eventTypeId: selectedEventTypeId ?? undefined,
        userId: selectedUserId ?? undefined,
        isAll,
      },
      {
        staleTime: 30000,
        trpc: {
          context: { skipBatch: true },
        },
        enabled: initialConfigIsReady,
      }
    );
  
    if (isLoading) return <LoadingInsight />;
  
    if (!isSuccess) return null;
  
    return (
      <CardInsights>
        <Title className="text-emphasis">{t("event_trends")}</Title>
        <LineChart
          className="linechart mt-4 h-80"
          data={eventsTimeLine ?? []}
          categories={["Created", "Completed", "Rescheduled", "Cancelled"]}
          index="Month"
          colors={["purple", "green", "blue", "red"]}
          valueFormatter={valueFormatter}
        />
      </CardInsights>
    );
  };
  