Skip to content

Commit

Permalink
[license] Last clean-up for the license model
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Sep 13, 2024
1 parent 298e1b6 commit 61cdc80
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
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.
* It could up to 2030.
*/
'subscription',
] as const;
Expand Down

0 comments on commit 61cdc80

Please sign in to comment.