From a70c756538cf38325d265a0882c9744b4c5a636c Mon Sep 17 00:00:00 2001 From: Aleksander Nicacio da Silva Date: Wed, 25 Oct 2023 11:12:41 -0300 Subject: [PATCH] chore: NBJ watermark support for new licenses (#30469) --- .../sidebar/footer/SidebarFooterWatermark.tsx | 16 ++++++++++++---- .../license/src/definition/LicenseModule.ts | 3 ++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/meteor/ee/client/sidebar/footer/SidebarFooterWatermark.tsx b/apps/meteor/ee/client/sidebar/footer/SidebarFooterWatermark.tsx index 8fc2bfa5c94ce..353fd213e5263 100644 --- a/apps/meteor/ee/client/sidebar/footer/SidebarFooterWatermark.tsx +++ b/apps/meteor/ee/client/sidebar/footer/SidebarFooterWatermark.tsx @@ -3,17 +3,25 @@ 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 ( @@ -21,7 +29,7 @@ export const SidebarFooterWatermark = (): ReactElement | null => { {t('Powered_by_RocketChat')} - {t('Free_Edition')} + {[planName, license.trial ? 'trial' : ''].filter(Boolean).join(' ')} diff --git a/ee/packages/license/src/definition/LicenseModule.ts b/ee/packages/license/src/definition/LicenseModule.ts index 8ecebba1983bc..a67a3fd54cb05 100644 --- a/ee/packages/license/src/definition/LicenseModule.ts +++ b/ee/packages/license/src/definition/LicenseModule.ts @@ -15,4 +15,5 @@ export type LicenseModule = | 'federation' | 'videoconference-enterprise' | 'message-read-receipt' - | 'outlook-calendar'; + | 'outlook-calendar' + | 'hide-watermark';