Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[license] Allow usage of charts an tree view pro package for old premium licenses #13619

Merged
merged 7 commits into from
Jun 26, 2024

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Jun 25, 2024

A follow-up on #13459.

@flaviendelangle flaviendelangle added bug 🐛 Something doesn't work package: x-license Specific to @mui/x-license. labels Jun 25, 2024
@flaviendelangle flaviendelangle self-assigned this Jun 25, 2024
@mui-bot
Copy link

mui-bot commented Jun 25, 2024

Deploy preview: https://deploy-preview-13619--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 624b1c0

Copy link
Member

@joserodolfofreitas joserodolfofreitas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thank you!

Comment on lines 181 to 183
if (license.planVersion === 'initial' && license.scope === 'pro') {
// 'charts-pro' or 'tree-view-pro' can only be used with a newer license
if (productScope === 'charts' || productScope === 'tree-view') {
Copy link
Member

@alexfauquette alexfauquette Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion to be more robust to upcomming changes. Otherwise each new product will have to be added in this condition

Suggested change
if (license.planVersion === 'initial' && license.scope === 'pro') {
// 'charts-pro' or 'tree-view-pro' can only be used with a newer license
if (productScope === 'charts' || productScope === 'tree-view') {
const initialProductScopes = ['data-grid', 'date-pickers'];
if (license.planVersion === 'initial' && license.scope === 'pro') {
// Other pro packages can only be used with a newer license
if (!initialProScopes.includes(productScope)) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some changes to rely on the package name instead of creating the licenseScope and productScope abstractions that don't bring a lot of value and add a lot of complexity to the code.

I'd be curious to have your opinion.

}

if (!acceptedScopes.includes(license.scope)) {
return { status: LICENSE_STATUS.OutOfScope };
// 'charts-pro' or 'tree-view-pro' can only be used with a newer Pro license
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order change is here to make sure that a pro license used on a premium package always have the OutOfScope status and not the NotAvailableInInitialProPlan

flaviendelangle and others added 3 commits June 26, 2024 12:25
Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Signed-off-by: Flavien DELANGLE <flaviendelangle@gmail.com>
@flaviendelangle flaviendelangle merged commit 7128911 into mui:master Jun 26, 2024
17 checks passed
@flaviendelangle flaviendelangle deleted the fix-license-v2 branch June 26, 2024 11:04
DungTiger pushed a commit to DungTiger/mui-x that referenced this pull request Jul 23, 2024
…ium licenses (mui#13619)

Signed-off-by: Flavien DELANGLE <flaviendelangle@gmail.com>
Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
thomasmoon pushed a commit to thomasmoon/mui-x that referenced this pull request Sep 9, 2024
…ium licenses (mui#13619)

Signed-off-by: Flavien DELANGLE <flaviendelangle@gmail.com>
Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work package: x-license Specific to @mui/x-license.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants