import { ButtonGroup, Button, Skeleton, Margins } from '@rocket.chat/fuselage'; import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; import React from 'react'; import Card from '../../../components/Card'; import PlanTag from '../../../components/PlanTag'; import { useSetModal } from '../../../contexts/ModalContext'; import { useSetting } from '../../../contexts/SettingsContext'; import { useTranslation } from '../../../contexts/TranslationContext'; import { AsyncStatePhase } from '../../../hooks/useAsyncState'; import { useEndpointData } from '../../../hooks/useEndpointData'; import Feature from './Feature'; import OfflineLicenseModal from './OfflineLicenseModal'; const LicenseCard = () => { const t = useTranslation(); const setModal = useSetModal(); const currentLicense = useSetting('Enterprise_License'); const licenseStatus = useSetting('Enterprise_License_Status'); const isAirGapped = true; const { value, phase, error } = useEndpointData('licenses.get'); const endpointLoading = phase === AsyncStatePhase.LOADING; const { modules = [] } = endpointLoading || error || !value.licenses.length ? {} : value.licenses[0]; const hasEngagement = modules.includes('engagement-dashboard'); const hasOmnichannel = modules.includes('livechat-enterprise'); const hasAuditing = modules.includes('auditing'); const hasCannedResponses = modules.includes('canned-responses'); const handleApplyLicense = useMutableCallback(() => setModal( { setModal(); }} license={currentLicense} licenseStatus={licenseStatus} />, ), ); return ( {t('License')} {t('Features')} {endpointLoading ? ( <> ) : ( <> )} {isAirGapped ? ( ) : ( )} ); }; export default LicenseCard;