forked from mui/mui-x
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[license] Allow usage of charts an tree view pro package for old prem…
…ium licenses (mui#13619) Signed-off-by: Flavien DELANGLE <flaviendelangle@gmail.com> Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
- Loading branch information
1 parent
d4f09ce
commit 59ba23d
Showing
8 changed files
with
103 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export { useLicenseVerifier } from './useLicenseVerifier'; | ||
export type { MuiCommercialPackageName } from './useLicenseVerifier'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export type MuiCommercialPackageName = | ||
| 'x-data-grid-pro' | ||
| 'x-data-grid-premium' | ||
| 'x-date-pickers-pro' | ||
| 'x-tree-view-pro' | ||
| 'x-charts-pro'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,5 @@ | ||
export const LICENSE_SCOPES = ['pro', 'premium'] as const; | ||
export const PRODUCT_SCOPES = ['data-grid', 'date-pickers', 'charts', 'tree-view'] as const; | ||
export const PLAN_VERSIONS = ['initial', 'Q3-2024'] as const; | ||
|
||
export type LicenseScope = (typeof LICENSE_SCOPES)[number]; | ||
export type ProductScope = (typeof PRODUCT_SCOPES)[number]; | ||
export type PlanVersion = (typeof PLAN_VERSIONS)[number]; | ||
|
||
export const extractProductScope = (packageName: string): ProductScope => { | ||
// extract the part between "x-" and "-pro"/"-premium" | ||
const regex = /x-(.*?)(-pro|-premium)?$/; | ||
const match = packageName.match(regex); | ||
return match![1] as ProductScope; | ||
}; | ||
|
||
export const extractAcceptedScopes = (packageName: string): readonly LicenseScope[] => { | ||
return packageName.includes('premium') | ||
? LICENSE_SCOPES.filter((scope) => scope.includes('premium')) | ||
: LICENSE_SCOPES; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.