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] Finish renaming of LicensingModel #14615

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('<DataGridPremium /> - License', () => {
expiryDate: addYears(new Date(), 1),
orderNumber: 'Test',
licenseModel: 'subscription',
scope: 'pro',
planScope: 'pro',
planVersion: 'initial',
}),
);
Expand Down
21 changes: 2 additions & 19 deletions packages/x-license/src/generateLicense/generateLicense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,14 @@ import { LICENSE_MODELS, LicenseModel } from '../utils/licenseModel';
const licenseVersion = '2';

export interface LicenseDetails {
orderNumber: string;
expiryDate: Date;
/**
* @deprecated Use planScope instead.
*/
scope?: PlanScope;
planScope?: PlanScope;
/**
* @deprecated Use licenseModel instead.
*/
licensingModel?: LicenseModel; // TODO deprecate
licenseModel?: LicenseModel;
orderNumber: string;
planScope?: PlanScope;
planVersion: PlanVersion;
}

function getClearLicenseString(details: LicenseDetails) {
// TODO remove
if (details.licensingModel) {
details.licenseModel = details.licensingModel;
}
// TODO remove
if (details.scope) {
details.planScope = details.scope;
}

if (details.planScope && !PLAN_SCOPES.includes(details.planScope)) {
throw new Error('MUI X: Invalid scope');
}
Expand Down
4 changes: 3 additions & 1 deletion packages/x-license/src/utils/licenseModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export const LICENSE_MODELS = [
*/
'annual',
/**
* TODO 2026 remove, legacy name of annual.
* Legacy. The previous name for 'annual'.
* Can be removed once old license keys generated with 'subscription' are no longer supported.
* To support for a while. We need more years of backward support and we sell multi year licenses.
*/
'subscription',
] as const;
Expand Down