From 149cecda61c257795d56fa323d56e10cc1d93e21 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Mon, 16 Sep 2024 13:27:07 +0200 Subject: [PATCH] [license] Finish renaming of LicensingModel (#14615) Signed-off-by: Olivier Tassinari --- .../tests/license.DataGridPremium.test.tsx | 2 +- .../src/generateLicense/generateLicense.ts | 21 ++----------------- packages/x-license/src/utils/licenseModel.ts | 4 +++- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/packages/x-data-grid-premium/src/tests/license.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/license.DataGridPremium.test.tsx index 1b6d15e194f2..d3e861a8e353 100644 --- a/packages/x-data-grid-premium/src/tests/license.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/license.DataGridPremium.test.tsx @@ -14,7 +14,7 @@ describe(' - License', () => { expiryDate: addYears(new Date(), 1), orderNumber: 'Test', licenseModel: 'subscription', - scope: 'pro', + planScope: 'pro', planVersion: 'initial', }), ); diff --git a/packages/x-license/src/generateLicense/generateLicense.ts b/packages/x-license/src/generateLicense/generateLicense.ts index dc2b64d5bd83..dc3e0896c56c 100644 --- a/packages/x-license/src/generateLicense/generateLicense.ts +++ b/packages/x-license/src/generateLicense/generateLicense.ts @@ -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'); } diff --git a/packages/x-license/src/utils/licenseModel.ts b/packages/x-license/src/utils/licenseModel.ts index c9d7ebe170f8..1eff21831f57 100644 --- a/packages/x-license/src/utils/licenseModel.ts +++ b/packages/x-license/src/utils/licenseModel.ts @@ -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;