Skip to content

Commit

Permalink
[license] Finish renaming of LicensingModel (#14615)
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Tassinari <olivier.tassinari@gmail.com>
  • Loading branch information
oliviertassinari authored Sep 16, 2024
1 parent 4fe6da6 commit 149cecd
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.
* To support for a while. We need more years of backward support and we sell multi year licenses.
*/
'subscription',
] as const;
Expand Down

0 comments on commit 149cecd

Please sign in to comment.