Skip to content

Commit 6118d11

Browse files
committed
feat: add module limits in freemium
1 parent d2e9fbb commit 6118d11

4 files changed

Lines changed: 12 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const ALLOWED_CLUSTER_IN_FREEMIUM = 2

src/Shared/Components/License/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export type DevtronLicenseCardProps = {
4646
)
4747

4848
export type DevtronLicenseInfo = Omit<DevtronLicenseCardProps, 'appTheme'> &
49-
Pick<DevtronLicenseDTO, 'fingerprint' | 'showLicenseData' | 'licenseStatusError'>
49+
Pick<DevtronLicenseDTO, 'fingerprint' | 'showLicenseData' | 'licenseStatusError' | 'moduleLimits'>
5050

5151
export interface ActivateLicenseDialogProps extends Pick<DevtronLicenseBaseDTO, 'fingerprint'> {
5252
enterpriseName: string

src/Shared/Components/License/utils.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { DATE_TIME_FORMATS } from '@Common/Constants'
2020
import { getUrlWithSearchParams } from '@Common/index'
2121
import { DevtronLicenseDTO } from '@Shared/types'
2222

23+
import { ALLOWED_CLUSTER_IN_FREEMIUM } from './constants'
2324
import { DevtronLicenseCardProps, DevtronLicenseInfo, LicenseStatus } from './types'
2425

2526
export const getLicenseColorsAccordingToStatus = (
@@ -87,6 +88,10 @@ export const parseDevtronLicenseData = (result: DevtronLicenseDTO): DevtronLicen
8788
fingerprint: result?.fingerprint || '',
8889
showLicenseData: result?.showLicenseData,
8990
licenseStatusError: result?.licenseStatusError,
91+
moduleLimits: {
92+
allAllowed: result?.moduleLimits?.allAllowed || false,
93+
maxAllowedClusters: result?.moduleLimits?.maxAllowedClusters || ALLOWED_CLUSTER_IN_FREEMIUM,
94+
},
9095
}
9196
}
9297

src/Shared/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,11 +1141,16 @@ export type DevtronLicenseDTO<isCentralDashboard extends boolean = false> = Devt
11411141
} | null
11421142
showLicenseData?: never
11431143
licenseStatusError?: never
1144+
moduleLimits?: never
11441145
}
11451146
: {
11461147
claimedByUserDetails?: never
11471148
showLicenseData: boolean
11481149
licenseStatusError?: LicenseErrorStruct
1150+
moduleLimits: {
1151+
allAllowed: boolean
1152+
maxAllowedClusters: number
1153+
}
11491154
})
11501155

11511156
export type CountryISO2Type = ParsedCountry['iso2']

0 commit comments

Comments
 (0)