The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/hooks/useAirGappedRestriction.ts

19 lines
813 B

import { useSetting } from '@rocket.chat/ui-contexts';
export const useAirGappedRestriction = (): [isRestrictionPhase: boolean, isWarningPhase: boolean, remainingDays: number] => {
const airGappedRestrictionRemainingDays = useSetting('Cloud_Workspace_AirGapped_Restrictions_Remaining_Days');
if (typeof airGappedRestrictionRemainingDays !== 'number') {
return [false, false, -1];
}
// If this value is negative, the user has a license with valid module
if (airGappedRestrictionRemainingDays < 0) {
return [false, false, airGappedRestrictionRemainingDays];
}
const isRestrictionPhase = airGappedRestrictionRemainingDays === 0;
const isWarningPhase = !isRestrictionPhase && airGappedRestrictionRemainingDays <= 7;
return [isRestrictionPhase, isWarningPhase, airGappedRestrictionRemainingDays];
};