import { ExclamationIcon } from "@heroicons/react/solid"; import { useSession } from "next-auth/react"; import React, { AriaRole, ComponentType, FC, Fragment } from "react"; import { CONSOLE_URL } from "@calcom/lib/constants"; import EmptyScreen from "@calcom/ui/EmptyScreen"; type LicenseRequiredProps = { as?: keyof JSX.IntrinsicElements | ""; className?: string; role?: AriaRole | undefined; children: React.ReactNode; }; /** * This component will only render it's children if the installation has a valid * license. */ const LicenseRequired: FC = ({ children, as = "", ...rest }) => { const session = useSession(); const Component = as || Fragment; return ( {session.data?.hasValidLicense ? ( children ) : ( To enable this feature, get a deployment key at{" "} Cal.com console . If your team already has a license, please contact{" "} peer@cal.com {" "} for help. } /> )} ); }; export function withLicenseRequired(Component: ComponentType) { // eslint-disable-next-line react/display-name return (hocProps: T) => { return ( ; ); }; } export default LicenseRequired;