import { Flex, Spinner, useColorModeValue, useDisclosure, } from '@chakra-ui/react' import { useToast } from '@/hooks/useToast' import { useTypebot } from '@/features/editor' import { Stats } from '@typebot.io/schemas' import React from 'react' import { useAnswersCount } from '../hooks/useAnswersCount' import { Graph, GraphProvider, GroupsCoordinatesProvider, } from '@/features/graph' import { ChangePlanModal, LimitReached } from '@/features/billing' import { StatsCards } from './StatsCards' export const AnalyticsGraphContainer = ({ stats }: { stats?: Stats }) => { const { isOpen, onOpen, onClose } = useDisclosure() const { typebot, publishedTypebot } = useTypebot() const { showToast } = useToast() const { answersCounts } = useAnswersCount({ typebotId: publishedTypebot && typebot?.id, onError: (err) => showToast({ title: err.name, description: err.message }), }) return ( {publishedTypebot && answersCounts && stats ? ( ) : ( )} ) }