-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[license] Allow to limit some packages to a specific license plan #4651
[license] Allow to limit some packages to a specific license plan #4651
Conversation
@@ -27,7 +28,11 @@ export function useLicenseVerifier( | |||
return sharedLicenseStatuses[packageName]!.status; | |||
} | |||
|
|||
const licenseStatus = verifyLicense(releaseInfo, licenseKey); | |||
const acceptedScopes: LicenseScope[] = packageName.includes('premium') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic would have to become smarter if we release other plans
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So to be sure that I understand it - the goal here is to if you have premium
you also get pro
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
I first did a scale const scopes = ['community', 'pro', 'premium']
and then compare the index of the current plan with the one of the license
But it would not work with more granular scopes if we have some in the future
Right now it's a very basic check so both options work fine.
}); | ||
describe('key version: 1', () => { | ||
const license = | ||
'0f94d8b65161817ca5d7f7af8ac2f042T1JERVI6TVVJLVN0b3J5Ym9vayxFWFBJUlk9MTY1NDg1ODc1MzU1MCxLRVlWRVJTSU9OPTE='; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have the v1 generation anymore but it's worth testing it
This key is the doc key
These are the results for the performance tests:
|
@@ -0,0 +1 @@ | |||
export type LicenseScope = 'pro' | 'premium'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I was thinking to rework this to an enum
because we are also using the strings themselves and it would be nice to avoid typos. It will also help if we have more licenses in the future. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure
Here we type the value, so we are sure that TS will complain if we put scope = "pri"
, just like for the enum.
And it will be obvious that a change to the type is breaking.
But if we use an enum, the typing is on the key of the enum, not its values.
So if by mistake we switch from
enum LicenseScope {
pro = 'pro',
premium = 'premium'
}
To
enum LicenseScope {
pro, // defaults to 0
premium, // defaults to 1
}
Then all our code will still work, but we will have done a breaking change for the licenses generated.
With that being said, I think both are viable as long as we follow the rule that an enum whose value can be stringified in any way must have its keys equal to its values.
In my previous company we had a ton of them on the plan generator specification and it never caused any issue.
We need to be able to distinguish between Pro perpetual and Pro subscription, and display the appropriate console message/watermark when the license is expiring soon/expired. (Existing perpetual customers will be able to renew their perpetual license.) |
@DanailH that's information we currently don't have I think |
Nope, we don't have that info in the license. When I was updating it I didn't know what this was a requirement. |
Me neither @mbrookes, here is the current v2 format:
We would need to add a Do we switch the |
No, I thought that'd be the case, and then we could simply use the expiryDate. But renewals from perpetual plans will remain perpetual as well. So we'll need an extra attribute for those cases. |
Yes, otherwise we could have said "if license creation date > XXX then if's perpetual". |
How about |
What's |
We use the term "plan" to differentiate "pro plan" and "premium plan" so I would not use it to describe the duration during which the license is valid.
|
|
The alternative is that we continue to use the v1 key format for perpetual licenses. |
We dropped the algo so we would need to re-add it @DanailH @oliviertassinari what's your opinion here ? |
I think it would be better to just use the new version. I guess even if we use v1 for perpetual licenses we would still have the problem of not knowing the SCOPE unless the Premium plan can't be perpetual (initially it was PLAN but as we can have addons in the future we thought that SCOPE is more appropriate). |
Ok, breaking is probably not the correct term but rather if we do it like this then you should also update the Pro product on the store. With the other approach, one only needs to handle the Premium product in the store. |
The new pro licenses will be perpetual ? I thought they were going to be annual just like the premium licenses. |
What about We may also consider, in the future, removing the console warning from test environments (and leaving the watermark). We have complaints on zendesk about the annoying volume of log messages related to the license. We might not need to expand it though.* |
New Pro licenses generated for a previous customer will still be perpetual in development. But for new customers, it will be perpetual in production only. |
Can we call the "annual in dev but perpetual in prod" just "annual" for simplicity ? |
Not a huge fan tbh And if we decide to remove the warning on test, I guess it should be retroactive, not just for the new licenses. Otherwise we would basically be saying to the user complaining "ok you are right, you will get the fix in one year". |
Me neither, sorry, just for the name alone.
That would be "subscription in dev, perpetual in prod", and its proposed to just call it "subscription", so sounds like that's agreed. |
Ok, np. But I think "term" is not really exact either. I think it's going to be confused with the "License Term" we'll use to define how many years the license will be valid. License Term means the period of time during which Licensee is authorized to use Program(s) in accordance with the applicable license grant. |
|
Validity and duration kinda mix two concepts, but I like the idea of using very explicit keys. But I'm pondering, and If you think model is not clear, what about: p.s.: TERM doesn't need to be accounted for on the key generation as it will receive a correct expiry date based on the license term picked in the UI |
|
It's "licensing model". I used "model" for short as we were looking for short words. https://www.10duke.com/software-licensing-models/ Now that we're using initials instead, it isn't a problem.
A sales model is something different. |
I will name it |
throw new Error('MUI: Invalid sales model'); | ||
} | ||
|
||
return `O=${details.orderNumber},E=${details.expiryDate.getTime()},S=${ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this change, a v2 license key is not usable by < v5.11.0 of the software. It's not backward compatible. It surfaced in https://groups.google.com/a/mui.com/g/x/c/Nkq2fQbGkn0/. Time will tell if this causes trouble with more users, I suspect it will. If the intent is to shorten the string key, I doubt it's worth the breaking change. If a breaking change needs to happen, then I think bundling with #4892 could be great.
How about?
- We revert the breaking change:
return `O=${details.orderNumber},E=${details.expiryDate.getTime()},S=${ | |
return `O=${details.orderNumber},EXPIRY=${details.expiryDate.getTime()},S=${ |
- We add support for both E and EXPIRY as license key prefix
- We add support for [x-license] Use a simpler checksum for the license key #4892
- We release and wait 6 months.
- We replace EXPIRY -> E, md5 -> simpler checksum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joserodolfofreitas we are one week in, how are the upgrades support cases going? I haven't seen new ones, so maybe it's fine.
KEYVERSION=2
inverifyLicense
perpetual
andsubscription
sales modelssalesModel
andscope
value validity both on license encoding and decoding to avoid typosClose #3925
https://deploy-preview-4651--material-ui-x.netlify.app/x/advanced-components/#license-key-installation