import type { LicenseInfo } from '@rocket.chat/core-typings';
import { Callout } from '@rocket.chat/fuselage';
import { ExternalLink } from '@rocket.chat/ui-client';
import { Trans, useTranslation } from 'react-i18next';
import { useCheckoutUrl } from './hooks/useCheckoutUrl';
import { useLicenseLimitsByBehavior } from '../../../hooks/useLicenseLimitsByBehavior';
export const SubscriptionCalloutLimits = () => {
const manageSubscriptionUrl = useCheckoutUrl();
const { t } = useTranslation();
const licenseLimits = useLicenseLimitsByBehavior();
if (!licenseLimits) {
return null;
}
const { prevent_action, disable_modules, invalidate_license, start_fair_policy } = licenseLimits;
const toTranslationKey = (key: keyof LicenseInfo['limits']) => t(`subscription.callout.${key}`);
return (
<>
{start_fair_policy && (
Your workspace reached the <>{start_fair_policy.map(toTranslationKey)}> limit.
Manage your subscription
to increase limits.
)}
{prevent_action && (
Your workspace exceeded the <>{prevent_action.map(toTranslationKey)}> license limit.
Manage your subscription
to increase limits.
)}
{disable_modules && (
Your workspace exceeded the <>{disable_modules.map(toTranslationKey)}> license limit.
Manage your subscription
to increase limits.
)}
{invalidate_license && (
Your workspace exceeded the <>{invalidate_license.map(toTranslationKey)}> license limit.
Manage your subscription
to increase limits.
)}
>
);
};