Skip to content

Commit

Permalink
chore: NBJ watermark support for new licenses (#30469)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandernsilva authored and debdutdeb committed Oct 26, 2023
1 parent 570721b commit a70c756
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 12 additions & 4 deletions apps/meteor/ee/client/sidebar/footer/SidebarFooterWatermark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,33 @@ import { useTranslation } from '@rocket.chat/ui-contexts';
import type { ReactElement } from 'react';
import React from 'react';

import { useIsEnterprise } from '../../../../client/hooks/useIsEnterprise';
import { useLicense } from '../../../../client/hooks/useLicense';

export const SidebarFooterWatermark = (): ReactElement | null => {
const t = useTranslation();

const { isLoading, isError, data } = useIsEnterprise();
const response = useLicense();

if (isError || isLoading || data?.isEnterprise) {
if (response.isLoading || response.isError) {
return null;
}

const license = response.data;

if (license.activeModules.includes('hide-watermark') && !license.trial) {
return null;
}

const [{ name: planName } = { name: 'Community' }] = license.tags ?? [];

return (
<Box pi={16} pbe={8}>
<Box is='a' href='https://rocket.chat/' target='_blank' rel='noopener noreferrer'>
<Box fontScale='micro' color='hint' pbe={4}>
{t('Powered_by_RocketChat')}
</Box>
<Box fontScale='micro' color='pure-white' pbe={4}>
{t('Free_Edition')}
{[planName, license.trial ? 'trial' : ''].filter(Boolean).join(' ')}
</Box>
</Box>
</Box>
Expand Down
3 changes: 2 additions & 1 deletion ee/packages/license/src/definition/LicenseModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ export type LicenseModule =
| 'federation'
| 'videoconference-enterprise'
| 'message-read-receipt'
| 'outlook-calendar';
| 'outlook-calendar'
| 'hide-watermark';

0 comments on commit a70c756

Please sign in to comment.