From 2e9f2d084cca1a93c53ba70e66a192b754a15b6d Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Mon, 26 Aug 2024 01:55:25 +0200 Subject: [PATCH] [license] Prepare renaming of argument names --- .../src/generateLicense/generateLicense.ts | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/packages/x-license/src/generateLicense/generateLicense.ts b/packages/x-license/src/generateLicense/generateLicense.ts index badebb90d782..107b510888d0 100644 --- a/packages/x-license/src/generateLicense/generateLicense.ts +++ b/packages/x-license/src/generateLicense/generateLicense.ts @@ -8,25 +8,36 @@ const licenseVersion = '2'; export interface LicenseDetails { orderNumber: string; expiryDate: Date; - scope: LicenseScope; - licensingModel: LicensingModel; + scope?: LicenseScope; + planScope?: LicenseScope; // TODO deprecate + licenseModel?: LicensingModel; + licensingModel?: LicensingModel; // TODO deprecate planVersion: PlanVersion; } function getClearLicenseString(details: LicenseDetails) { - if (details.scope && !LICENSE_SCOPES.includes(details.scope)) { + // TODO remove + if (details.licensingModel) { + details.licenseModel = details.licensingModel; + } + // TODO remove + if (details.scope) { + details.planScope = details.scope; + } + + if (details.planScope && !LICENSE_SCOPES.includes(details.planScope)) { throw new Error('MUI X: Invalid scope'); } - if (details.licensingModel && !LICENSING_MODELS.includes(details.licensingModel)) { + if (details.licenseModel && !LICENSING_MODELS.includes(details.licenseModel)) { throw new Error('MUI X: Invalid licensing model'); } const keyParts = [ `O=${details.orderNumber}`, `E=${details.expiryDate.getTime()}`, - `S=${details.scope}`, - `LM=${details.licensingModel}`, + `S=${details.planScope}`, + `LM=${details.licenseModel}`, `PV=${details.planVersion}`, `KV=${licenseVersion}`, ];