/**
* @deprecated file
* All new changes should be made to the V2 file in
* `/packages/features/ee/common/components/v2/LicenseRequired.tsx`
*/
import { useSession } from "next-auth/react";
import React, { AriaRole, ComponentType, Fragment } from "react";
import { CONSOLE_URL } from "@calcom/lib/constants";
import EmptyScreen from "@calcom/ui/EmptyScreen";
import { Icon } from "@calcom/ui/Icon";
type LicenseRequiredProps = {
as?: keyof JSX.IntrinsicElements | "";
className?: string;
role?: AriaRole | undefined;
children: React.ReactNode;
};
/**
* @deprecated file
* All new changes should be made to the V2 file in
* `/packages/features/ee/common/components/v2/LicenseRequired.tsx`
* This component will only render it's children if the installation has a valid
* license.
*/
const LicenseRequired = ({ children, as = "", ...rest }: LicenseRequiredProps) => {
const session = useSession();
const Component = as || Fragment;
return (
{session.data?.hasValidLicense ? (
children
) : (
To enable this feature, get a deployment key at{" "}
Cal.com console
{" "}
and add it to your .env as CALCOM_LICENSE_KEY
. If your team already has a license,
please contact{" "}
peer@cal.com
{" "}
for help.
>
}
/>
)}
);
};
export const withLicenseRequired =
(Component: ComponentType) =>
// eslint-disable-next-line react/display-name
(hocProps: T) =>
(
);
export default LicenseRequired;