@@ -27,7 +27,7 @@ import { LicensingErrorCodes } from '@Shared/types'
2727
2828import { Button , ButtonComponentType , ButtonVariantType } from '../Button'
2929import { Icon } from '../Icon'
30- import { DevtronLicenseCardProps , LicenseStatus } from './types'
30+ import { DevtronLicenseCardProps , LicenseCardSubTextProps , LicenseStatus } from './types'
3131import { getLicenseColorsAccordingToStatus } from './utils'
3232
3333import './licenseCard.scss'
@@ -49,10 +49,13 @@ const LicenseCardSubText = ({
4949 isFreemium,
5050 licenseStatus,
5151 licenseStatusError,
52- } : Pick < DevtronLicenseCardProps , 'isFreemium' | 'licenseStatus' | 'licenseStatusError' > ) => {
53- if ( isFreemium ) {
54- const freemiumLimitReached = licenseStatusError ?. code === LicensingErrorCodes . ClusterLimitExceeded
52+ isFreeForever,
53+ } : LicenseCardSubTextProps ) => {
54+ const freemiumLimitReached = isFreemium && licenseStatusError ?. code === LicensingErrorCodes . ClusterLimitExceeded
55+ const showFreemiumMessage =
56+ isFreeForever || freemiumLimitReached || ( isFreemium && licenseStatus === LicenseStatus . ACTIVE )
5557
58+ if ( showFreemiumMessage ) {
5659 return (
5760 < div className = "p-16 fs-13 lh-1-5 flexbox-col dc__gap-8" >
5861 < div className = "flexbox dc__gap-8 dc__content-space fs-13 fw-4 lh-20 cn-9" >
@@ -130,10 +133,17 @@ export const DevtronLicenseCard = ({
130133 appTheme,
131134 handleCopySuccess,
132135 licenseStatusError,
136+ isSaasInstance,
133137} : DevtronLicenseCardProps ) => {
134- const { bgColor, textColor } = getLicenseColorsAccordingToStatus ( { isFreemium, licenseStatus, licenseStatusError } )
135- const remainingTime = getTTLInHumanReadableFormat ( ttl )
136- const remainingTimeString = ttl < 0 ? `Expired ${ remainingTime } ago` : `${ remainingTime } remaining`
138+ const isFreeForever = isFreemium && ! isSaasInstance
139+
140+ const { bgColor, textColor } = getLicenseColorsAccordingToStatus ( {
141+ isFreemium,
142+ licenseStatus,
143+ licenseStatusError,
144+ isSaasInstance,
145+ } )
146+
137147 const isThemeDark = appTheme === AppThemeType . dark
138148
139149 const cardRef = useRef < HTMLDivElement > ( null )
@@ -178,6 +188,15 @@ export const DevtronLicenseCard = ({
178188 ? useMotionTemplate `linear-gradient(55deg, transparent, rgba(122, 127, 131, ${ sheenOpacity } ) ${ sheenPosition } %, transparent)`
179189 : useMotionTemplate `linear-gradient(55deg, transparent, rgba(255, 255, 255, ${ sheenOpacity } ) ${ sheenPosition } %, transparent)`
180190
191+ const getRemainingTimeString = ( ) => {
192+ if ( isFreeForever ) {
193+ return null
194+ }
195+
196+ const remainingTime = getTTLInHumanReadableFormat ( ttl )
197+ return ttl < 0 ? `Expired ${ remainingTime } ago` : `${ remainingTime } remaining`
198+ }
199+
181200 return (
182201 < div className = "license-card-wrapper flexbox-col p-8 br-16" style = { { backgroundColor : bgColor } } >
183202 < div style = { { perspective : '1000px' } } >
@@ -217,12 +236,12 @@ export const DevtronLicenseCard = ({
217236 </ div >
218237 < div className = "flexbox dc__align-items-center dc__gap-4 flex-wrap fs-12" >
219238 < span className = "font-ibm-plex-mono cn-9" >
220- { isFreemium ? 'VALID FOREVER' : expiryDate }
239+ { isFreeForever ? 'VALID FOREVER' : expiryDate }
221240 </ span >
222- { ! isFreemium && (
241+ { ! isFreeForever && (
223242 < >
224243 < span className = "cn-9" > ·</ span >
225- < span style = { { color : textColor } } > { remainingTimeString } </ span >
244+ < span style = { { color : textColor } } > { getRemainingTimeString ( ) } </ span >
226245 </ >
227246 ) }
228247 </ div >
@@ -239,6 +258,7 @@ export const DevtronLicenseCard = ({
239258 isFreemium = { isFreemium }
240259 licenseStatusError = { licenseStatusError }
241260 licenseStatus = { licenseStatus }
261+ isFreeForever = { isFreeForever }
242262 />
243263 </ div >
244264 )
0 commit comments