import DOMPurify from "dompurify"; import { useSession } from "next-auth/react"; import type { AriaRole, ComponentType } from "react"; import React, { Fragment } from "react"; import { APP_NAME, CONSOLE_URL, SUPPORT_MAIL_ADDRESS, WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { EmptyScreen } from "@calcom/ui"; import { FiAlertTriangle } from "@calcom/ui/components/icon"; type LicenseRequiredProps = { as?: keyof JSX.IntrinsicElements | ""; className?: string; role?: AriaRole | undefined; children: React.ReactNode; }; const LicenseRequired = ({ children, as = "", ...rest }: LicenseRequiredProps) => { const session = useSession(); const { t } = useLocale(); const Component = as || Fragment; const hasValidLicense = session.data ? session.data.hasValidLicense : null; return ( {hasValidLicense === null || hasValidLicense ? ( children ) : ( ${APP_NAME} `, setupUrl: `/auth/setup`, supportMail: ` ${SUPPORT_MAIL_ADDRESS}`, }) ), }} /> } /> )} ); }; export const withLicenseRequired = (Component: ComponentType) => // eslint-disable-next-line react/display-name (hocProps: T) => ( ); export default LicenseRequired;