From d880aa2f40a49b1f4af5eaa433654cd7c6faa8a8 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Fri, 13 Sep 2024 23:59:51 +0200 Subject: [PATCH 1/2] [license] Last clean-up for the license model --- .../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..ba62650fa06b 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. + * It could up to 2030. */ 'subscription', ] as const; From b3f10d6aa751facd98ab693e60c314f09237123e Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Mon, 16 Sep 2024 13:24:38 +0200 Subject: [PATCH 2/2] Clarify this comment Signed-off-by: Olivier Tassinari --- packages/x-license/src/utils/licenseModel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/x-license/src/utils/licenseModel.ts b/packages/x-license/src/utils/licenseModel.ts index ba62650fa06b..1eff21831f57 100644 --- a/packages/x-license/src/utils/licenseModel.ts +++ b/packages/x-license/src/utils/licenseModel.ts @@ -12,7 +12,7 @@ export const LICENSE_MODELS = [ /** * 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. + * To support for a while. We need more years of backward support and we sell multi year licenses. */ 'subscription', ] as const;