import { Flex, Spinner, useColorModeValue, useDisclosure, } from '@chakra-ui/react' import { useTypebot } from '@/features/editor/providers/TypebotProvider' import { Stats } from '@typebot.io/schemas' import React from 'react' import { StatsCards } from './StatsCards' import { ChangePlanModal } from '@/features/billing/components/ChangePlanModal' import { Graph } from '@/features/graph/components/Graph' import { GraphProvider } from '@/features/graph/providers/GraphProvider' import { useTranslate } from '@tolgee/react' import { trpc } from '@/lib/trpc' import { isDefined } from '@typebot.io/lib' import { EventsCoordinatesProvider } from '@/features/graph/providers/EventsCoordinateProvider' export const AnalyticsGraphContainer = ({ stats }: { stats?: Stats }) => { const { t } = useTranslate() const { isOpen, onOpen, onClose } = useDisclosure() const { typebot, publishedTypebot } = useTypebot() const { data } = trpc.analytics.getTotalAnswers.useQuery( { typebotId: typebot?.id as string, }, { enabled: isDefined(publishedTypebot) } ) const { data: edgesData } = trpc.analytics.getTotalVisitedEdges.useQuery( { typebotId: typebot?.id as string, }, { enabled: isDefined(publishedTypebot) } ) return ( {publishedTypebot && stats ? ( ) : ( )} ) }