@mui/x-license 9.0.0-alpha.2 → 9.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +246 -1
  2. package/Watermark/Watermark.d.mts +2 -3
  3. package/Watermark/Watermark.d.ts +2 -3
  4. package/Watermark/Watermark.js +4 -3
  5. package/Watermark/Watermark.mjs +4 -3
  6. package/index.d.mts +0 -1
  7. package/index.d.ts +0 -1
  8. package/index.js +1 -1
  9. package/index.mjs +1 -1
  10. package/internals/index.d.mts +13 -0
  11. package/internals/index.d.ts +13 -0
  12. package/internals/index.js +108 -0
  13. package/internals/index.mjs +9 -0
  14. package/package.json +9 -93
  15. package/test-keys.d.mts +10 -0
  16. package/test-keys.d.ts +10 -0
  17. package/test-keys.js +16 -2
  18. package/test-keys.mjs +15 -1
  19. package/useLicenseVerifier/useLicenseVerifier.d.mts +2 -2
  20. package/useLicenseVerifier/useLicenseVerifier.d.ts +2 -2
  21. package/useLicenseVerifier/useLicenseVerifier.js +13 -7
  22. package/useLicenseVerifier/useLicenseVerifier.mjs +14 -8
  23. package/utils/commercialPackages.d.mts +6 -1
  24. package/utils/commercialPackages.d.ts +6 -1
  25. package/utils/index.d.mts +1 -1
  26. package/utils/index.d.ts +1 -1
  27. package/utils/licenseErrorMessageUtils.d.mts +1 -0
  28. package/utils/licenseErrorMessageUtils.d.ts +1 -0
  29. package/utils/licenseErrorMessageUtils.js +4 -0
  30. package/utils/licenseErrorMessageUtils.mjs +3 -0
  31. package/utils/licensePlan.d.mts +8 -1
  32. package/utils/licensePlan.d.ts +8 -1
  33. package/utils/licensePlan.js +13 -1
  34. package/utils/licensePlan.mjs +12 -1
  35. package/utils/licenseStatus.d.mts +1 -0
  36. package/utils/licenseStatus.d.ts +1 -0
  37. package/utils/licenseStatus.js +1 -0
  38. package/utils/licenseStatus.mjs +1 -0
  39. package/verifyLicense/verifyLicense.d.mts +4 -6
  40. package/verifyLicense/verifyLicense.d.ts +4 -6
  41. package/verifyLicense/verifyLicense.js +26 -5
  42. package/verifyLicense/verifyLicense.mjs +27 -6
  43. package/license-env.d.mts +0 -6
  44. package/license-env.d.ts +0 -6
package/test-keys.js CHANGED
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TEST_LICENSE_KEY_PRO = exports.TEST_LICENSE_KEY_PREMIUM = exports.TEST_KEY_V1 = exports.TEST_KEY_UNKNOWN_VERSION = exports.TEST_KEY_PRO_SUBSCRIPTION_FUTURE = exports.TEST_KEY_PRO_SUBSCRIPTION = exports.TEST_KEY_PRO_PERPETUAL_EXPIRED = exports.TEST_KEY_PRO_PERPETUAL = exports.TEST_KEY_PRO_ANNUAL_V3 = exports.TEST_KEY_PRO_ANNUAL_Q1_2026_V3 = exports.TEST_KEY_PRO_ANNUAL_INITIAL = exports.TEST_KEY_PREMIUM_SUBSCRIPTION_FUTURE = exports.TEST_KEY_PREMIUM_SUBSCRIPTION = exports.TEST_KEY_PREMIUM_ANNUAL_Q1_2026_V3 = exports.TEST_KEY_PREMIUM_ANNUAL_INITIAL = exports.TEST_KEY_INVALID = exports.TEST_KEY_EXPIRED_GRACE = exports.TEST_KEY_EXPIRED_30DAYS = void 0;
6
+ exports.TEST_LICENSE_KEY_PRO = exports.TEST_LICENSE_KEY_PREMIUM = exports.TEST_KEY_V1 = exports.TEST_KEY_UNKNOWN_VERSION = exports.TEST_KEY_PRO_SUBSCRIPTION_FUTURE = exports.TEST_KEY_PRO_SUBSCRIPTION = exports.TEST_KEY_PRO_PERPETUAL_Q1_2026_EXPIRED = exports.TEST_KEY_PRO_PERPETUAL_Q1_2026 = exports.TEST_KEY_PRO_PERPETUAL_EXPIRED = exports.TEST_KEY_PRO_PERPETUAL = exports.TEST_KEY_PRO_ANNUAL_V3 = exports.TEST_KEY_PRO_ANNUAL_Q1_2026_V3 = exports.TEST_KEY_PRO_ANNUAL_INITIAL = exports.TEST_KEY_PREMIUM_SUBSCRIPTION_FUTURE = exports.TEST_KEY_PREMIUM_SUBSCRIPTION = exports.TEST_KEY_PREMIUM_ANNUAL_Q1_2026_V3 = exports.TEST_KEY_PREMIUM_ANNUAL_INITIAL = exports.TEST_KEY_INVALID = exports.TEST_KEY_EXPIRED_GRACE = exports.TEST_KEY_EXPIRED_30DAYS = void 0;
7
7
  // =============================================================================
8
8
  // Test license keys for use in test suites.
9
9
  // All keys contain T=true in their payload and are rejected outside test environments.
10
- // Import via '@mui/x-license/test-keys'.
10
+ // Import via '@mui/x-license/internals'.
11
11
  // =============================================================================
12
12
 
13
13
  /**
@@ -120,6 +120,20 @@ const TEST_KEY_PRO_ANNUAL_Q1_2026_V3 = exports.TEST_KEY_PRO_ANNUAL_Q1_2026_V3 =
120
120
  */
121
121
  const TEST_KEY_PREMIUM_ANNUAL_Q1_2026_V3 = exports.TEST_KEY_PREMIUM_ANNUAL_Q1_2026_V3 = '450d9fc1b28e709fcb73969bd10e1c30Tz0xMjMsRT0zMjUzNTEyNjAwMDAwMCxTPXByZW1pdW0sTE09YW5udWFsLFBWPVExLTIwMjYsUT0xMCxBVD1zaW5nbGUsVD10cnVlLEtWPTM=';
122
122
 
123
+ // --- Keys for v9 plan version check tests (perpetual + Q1-2026) ---
124
+
125
+ /**
126
+ * Pro perpetual, Q1-2026, expiry = releaseDate + 1 day (not expired).
127
+ * orderId: #123, keyVersion: 2
128
+ */
129
+ const TEST_KEY_PRO_PERPETUAL_Q1_2026 = exports.TEST_KEY_PRO_PERPETUAL_Q1_2026 = '5f78509380f3ea3b3c91d7af3f5496eaTz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJvLExNPXBlcnBldHVhbCxQVj1RMS0yMDI2LFQ9dHJ1ZSxLVj0y';
130
+
131
+ /**
132
+ * Pro perpetual, Q1-2026, expiry = releaseDate - 1 day (expired before release).
133
+ * orderId: #123, keyVersion: 2
134
+ */
135
+ const TEST_KEY_PRO_PERPETUAL_Q1_2026_EXPIRED = exports.TEST_KEY_PRO_PERPETUAL_Q1_2026_EXPIRED = '191d8aaf174e38bcbf367e07fa39e423Tz0xMjMsRT0xNTE0NTg4NDAwMDAwLFM9cHJvLExNPXBlcnBldHVhbCxQVj1RMS0yMDI2LFQ9dHJ1ZSxLVj0y';
136
+
123
137
  // --- Invalid / edge-case keys ---
124
138
 
125
139
  /**
package/test-keys.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // =============================================================================
2
2
  // Test license keys for use in test suites.
3
3
  // All keys contain T=true in their payload and are rejected outside test environments.
4
- // Import via '@mui/x-license/test-keys'.
4
+ // Import via '@mui/x-license/internals'.
5
5
  // =============================================================================
6
6
 
7
7
  /**
@@ -114,6 +114,20 @@ export const TEST_KEY_PRO_ANNUAL_Q1_2026_V3 = '5f52871b5845f28ebdd0fabbe0b89695T
114
114
  */
115
115
  export const TEST_KEY_PREMIUM_ANNUAL_Q1_2026_V3 = '450d9fc1b28e709fcb73969bd10e1c30Tz0xMjMsRT0zMjUzNTEyNjAwMDAwMCxTPXByZW1pdW0sTE09YW5udWFsLFBWPVExLTIwMjYsUT0xMCxBVD1zaW5nbGUsVD10cnVlLEtWPTM=';
116
116
 
117
+ // --- Keys for v9 plan version check tests (perpetual + Q1-2026) ---
118
+
119
+ /**
120
+ * Pro perpetual, Q1-2026, expiry = releaseDate + 1 day (not expired).
121
+ * orderId: #123, keyVersion: 2
122
+ */
123
+ export const TEST_KEY_PRO_PERPETUAL_Q1_2026 = '5f78509380f3ea3b3c91d7af3f5496eaTz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJvLExNPXBlcnBldHVhbCxQVj1RMS0yMDI2LFQ9dHJ1ZSxLVj0y';
124
+
125
+ /**
126
+ * Pro perpetual, Q1-2026, expiry = releaseDate - 1 day (expired before release).
127
+ * orderId: #123, keyVersion: 2
128
+ */
129
+ export const TEST_KEY_PRO_PERPETUAL_Q1_2026_EXPIRED = '191d8aaf174e38bcbf367e07fa39e423Tz0xMjMsRT0xNTE0NTg4NDAwMDAwLFM9cHJvLExNPXBlcnBldHVhbCxQVj1RMS0yMDI2LFQ9dHJ1ZSxLVj0y';
130
+
117
131
  // --- Invalid / edge-case keys ---
118
132
 
119
133
  /**
@@ -1,5 +1,5 @@
1
1
  import { LicenseStatus } from "../utils/licenseStatus.mjs";
2
- import { MuiCommercialPackageName } from "../utils/commercialPackages.mjs";
2
+ import { MuiCommercialPackageName, CommercialPackageInfo } from "../utils/commercialPackages.mjs";
3
3
  export declare const sharedLicenseStatuses: { [packageName in MuiCommercialPackageName]?: {
4
4
  key: string | undefined;
5
5
  licenseVerifier: {
@@ -11,6 +11,6 @@ export declare const sharedLicenseStatuses: { [packageName in MuiCommercialPacka
11
11
  * This should not be used in production code, but can be useful for testing purposes.
12
12
  */
13
13
  export declare function clearLicenseStatusCache(): void;
14
- export declare function useLicenseVerifier(packageName: MuiCommercialPackageName, releaseInfo: string): {
14
+ export declare function useLicenseVerifier(packageInfo: CommercialPackageInfo): {
15
15
  status: LicenseStatus;
16
16
  };
@@ -1,5 +1,5 @@
1
1
  import { LicenseStatus } from "../utils/licenseStatus.js";
2
- import { MuiCommercialPackageName } from "../utils/commercialPackages.js";
2
+ import { MuiCommercialPackageName, CommercialPackageInfo } from "../utils/commercialPackages.js";
3
3
  export declare const sharedLicenseStatuses: { [packageName in MuiCommercialPackageName]?: {
4
4
  key: string | undefined;
5
5
  licenseVerifier: {
@@ -11,6 +11,6 @@ export declare const sharedLicenseStatuses: { [packageName in MuiCommercialPacka
11
11
  * This should not be used in production code, but can be useful for testing purposes.
12
12
  */
13
13
  export declare function clearLicenseStatusCache(): void;
14
- export declare function useLicenseVerifier(packageName: MuiCommercialPackageName, releaseInfo: string): {
14
+ export declare function useLicenseVerifier(packageInfo: CommercialPackageInfo): {
15
15
  status: LicenseStatus;
16
16
  };
@@ -30,12 +30,17 @@ function clearLicenseStatusCache() {
30
30
  }
31
31
  }
32
32
  }
33
- function useLicenseVerifier(packageName, releaseInfo) {
33
+ function useLicenseVerifier(packageInfo) {
34
34
  const {
35
35
  key: contextKey
36
36
  } = React.useContext(_MuiLicenseInfoContext.default);
37
37
  return React.useMemo(() => {
38
38
  const licenseKey = contextKey ?? _licenseInfo.LicenseInfo.getLicenseKey();
39
+ const {
40
+ name: packageName,
41
+ releaseDate,
42
+ version: packageVersion
43
+ } = packageInfo;
39
44
 
40
45
  // Cache the response to not trigger the error twice.
41
46
  if (sharedLicenseStatuses[packageName] && sharedLicenseStatuses[packageName].key === licenseKey) {
@@ -43,17 +48,16 @@ function useLicenseVerifier(packageName, releaseInfo) {
43
48
  }
44
49
  const plan = packageName.includes('premium') ? 'Premium' : 'Pro';
45
50
  const licenseStatus = (0, _verifyLicense.verifyLicense)({
46
- releaseInfo,
47
- licenseKey,
48
- packageName
51
+ packageInfo,
52
+ licenseKey
49
53
  });
50
54
  const fullPackageName = `@mui/${packageName}`;
51
55
  (0, _xTelemetry.sendMuiXTelemetryEvent)(_xTelemetry.muiXTelemetryEvents.licenseVerification({
52
56
  licenseKey,
53
- xLicenseClientVersion: "9.0.0-alpha.2"
57
+ xLicenseClientVersion: packageVersion
54
58
  }, {
55
59
  packageName,
56
- packageReleaseInfo: releaseInfo,
60
+ packageReleaseInfo: releaseDate,
57
61
  licenseStatus: licenseStatus?.status
58
62
  }));
59
63
  if (licenseStatus.status === _licenseStatus.LICENSE_STATUS.Valid) {
@@ -83,6 +87,8 @@ function useLicenseVerifier(packageName, releaseInfo) {
83
87
  (0, _licenseErrorMessageUtils.showExpiredPackageVersionError)({
84
88
  packageName: fullPackageName
85
89
  });
90
+ } else if (licenseStatus.status === _licenseStatus.LICENSE_STATUS.NotValidForPackage) {
91
+ (0, _licenseErrorMessageUtils.showLicenseKeyVersionMismatchError)();
86
92
  } else if (process.env.NODE_ENV !== 'production') {
87
93
  throw new Error('missing status handler');
88
94
  }
@@ -91,5 +97,5 @@ function useLicenseVerifier(packageName, releaseInfo) {
91
97
  licenseVerifier: licenseStatus
92
98
  };
93
99
  return licenseStatus;
94
- }, [packageName, releaseInfo, contextKey]);
100
+ }, [packageInfo, contextKey]);
95
101
  }
@@ -5,7 +5,7 @@ import * as React from 'react';
5
5
  import { sendMuiXTelemetryEvent, muiXTelemetryEvents } from '@mui/x-telemetry';
6
6
  import { verifyLicense } from "../verifyLicense/verifyLicense.mjs";
7
7
  import { LicenseInfo } from "../utils/licenseInfo.mjs";
8
- import { showExpiredAnnualGraceLicenseKeyError, showExpiredAnnualLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError, showNotAvailableInInitialProPlanError } from "../utils/licenseErrorMessageUtils.mjs";
8
+ import { showExpiredAnnualGraceLicenseKeyError, showExpiredAnnualLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError, showNotAvailableInInitialProPlanError, showLicenseKeyVersionMismatchError } from "../utils/licenseErrorMessageUtils.mjs";
9
9
  import { LICENSE_STATUS } from "../utils/licenseStatus.mjs";
10
10
  import MuiLicenseInfoContext from "../Unstable_LicenseInfoProvider/MuiLicenseInfoContext.mjs";
11
11
  export const sharedLicenseStatuses = {};
@@ -21,12 +21,17 @@ export function clearLicenseStatusCache() {
21
21
  }
22
22
  }
23
23
  }
24
- export function useLicenseVerifier(packageName, releaseInfo) {
24
+ export function useLicenseVerifier(packageInfo) {
25
25
  const {
26
26
  key: contextKey
27
27
  } = React.useContext(MuiLicenseInfoContext);
28
28
  return React.useMemo(() => {
29
29
  const licenseKey = contextKey ?? LicenseInfo.getLicenseKey();
30
+ const {
31
+ name: packageName,
32
+ releaseDate,
33
+ version: packageVersion
34
+ } = packageInfo;
30
35
 
31
36
  // Cache the response to not trigger the error twice.
32
37
  if (sharedLicenseStatuses[packageName] && sharedLicenseStatuses[packageName].key === licenseKey) {
@@ -34,17 +39,16 @@ export function useLicenseVerifier(packageName, releaseInfo) {
34
39
  }
35
40
  const plan = packageName.includes('premium') ? 'Premium' : 'Pro';
36
41
  const licenseStatus = verifyLicense({
37
- releaseInfo,
38
- licenseKey,
39
- packageName
42
+ packageInfo,
43
+ licenseKey
40
44
  });
41
45
  const fullPackageName = `@mui/${packageName}`;
42
46
  sendMuiXTelemetryEvent(muiXTelemetryEvents.licenseVerification({
43
47
  licenseKey,
44
- xLicenseClientVersion: "9.0.0-alpha.2"
48
+ xLicenseClientVersion: packageVersion
45
49
  }, {
46
50
  packageName,
47
- packageReleaseInfo: releaseInfo,
51
+ packageReleaseInfo: releaseDate,
48
52
  licenseStatus: licenseStatus?.status
49
53
  }));
50
54
  if (licenseStatus.status === LICENSE_STATUS.Valid) {
@@ -74,6 +78,8 @@ export function useLicenseVerifier(packageName, releaseInfo) {
74
78
  showExpiredPackageVersionError({
75
79
  packageName: fullPackageName
76
80
  });
81
+ } else if (licenseStatus.status === LICENSE_STATUS.NotValidForPackage) {
82
+ showLicenseKeyVersionMismatchError();
77
83
  } else if (process.env.NODE_ENV !== 'production') {
78
84
  throw new Error('missing status handler');
79
85
  }
@@ -82,5 +88,5 @@ export function useLicenseVerifier(packageName, releaseInfo) {
82
88
  licenseVerifier: licenseStatus
83
89
  };
84
90
  return licenseStatus;
85
- }, [packageName, releaseInfo, contextKey]);
91
+ }, [packageInfo, contextKey]);
86
92
  }
@@ -1 +1,6 @@
1
- export type MuiCommercialPackageName = 'x-data-grid-pro' | 'x-data-grid-premium' | 'x-date-pickers-pro' | 'x-tree-view-pro' | 'x-charts-pro' | 'x-charts-premium' | 'x-scheduler-premium';
1
+ export type MuiCommercialPackageName = 'x-data-grid-pro' | 'x-data-grid-premium' | 'x-date-pickers-pro' | 'x-tree-view-pro' | 'x-charts-pro' | 'x-charts-premium' | 'x-scheduler-premium';
2
+ export interface CommercialPackageInfo {
3
+ releaseDate: string;
4
+ version: string;
5
+ name: MuiCommercialPackageName;
6
+ }
@@ -1 +1,6 @@
1
- export type MuiCommercialPackageName = 'x-data-grid-pro' | 'x-data-grid-premium' | 'x-date-pickers-pro' | 'x-tree-view-pro' | 'x-charts-pro' | 'x-charts-premium' | 'x-scheduler-premium';
1
+ export type MuiCommercialPackageName = 'x-data-grid-pro' | 'x-data-grid-premium' | 'x-date-pickers-pro' | 'x-tree-view-pro' | 'x-charts-pro' | 'x-charts-premium' | 'x-scheduler-premium';
2
+ export interface CommercialPackageInfo {
3
+ releaseDate: string;
4
+ version: string;
5
+ name: MuiCommercialPackageName;
6
+ }
package/utils/index.d.mts CHANGED
@@ -5,4 +5,4 @@ export type { AppType } from "./licenseAppType.mjs";
5
5
  export type { PlanScope } from "./licensePlan.mjs";
6
6
  export type { LicenseModel } from "./licenseModel.mjs";
7
7
  export type { KeyVersion, LicenseDetails, NullableLicenseDetails } from "./licenseDetails.mjs";
8
- export type { MuiCommercialPackageName } from "./commercialPackages.mjs";
8
+ export type { MuiCommercialPackageName, CommercialPackageInfo } from "./commercialPackages.mjs";
package/utils/index.d.ts CHANGED
@@ -5,4 +5,4 @@ export type { AppType } from "./licenseAppType.js";
5
5
  export type { PlanScope } from "./licensePlan.js";
6
6
  export type { LicenseModel } from "./licenseModel.js";
7
7
  export type { KeyVersion, LicenseDetails, NullableLicenseDetails } from "./licenseDetails.js";
8
- export type { MuiCommercialPackageName } from "./commercialPackages.js";
8
+ export type { MuiCommercialPackageName, CommercialPackageInfo } from "./commercialPackages.js";
@@ -5,6 +5,7 @@ export declare function showLicenseKeyPlanMismatchError({
5
5
  packageName: string;
6
6
  }): void;
7
7
  export declare function showNotAvailableInInitialProPlanError(): void;
8
+ export declare function showLicenseKeyVersionMismatchError(): void;
8
9
  export declare function showMissingLicenseKeyError({
9
10
  plan,
10
11
  packageName
@@ -5,6 +5,7 @@ export declare function showLicenseKeyPlanMismatchError({
5
5
  packageName: string;
6
6
  }): void;
7
7
  export declare function showNotAvailableInInitialProPlanError(): void;
8
+ export declare function showLicenseKeyVersionMismatchError(): void;
8
9
  export declare function showMissingLicenseKeyError({
9
10
  plan,
10
11
  packageName
@@ -9,6 +9,7 @@ exports.showExpiredAnnualLicenseKeyError = showExpiredAnnualLicenseKeyError;
9
9
  exports.showExpiredPackageVersionError = showExpiredPackageVersionError;
10
10
  exports.showInvalidLicenseKeyError = showInvalidLicenseKeyError;
11
11
  exports.showLicenseKeyPlanMismatchError = showLicenseKeyPlanMismatchError;
12
+ exports.showLicenseKeyVersionMismatchError = showLicenseKeyVersionMismatchError;
12
13
  exports.showMissingLicenseKeyError = showMissingLicenseKeyError;
13
14
  exports.showNotAvailableInInitialProPlanError = showNotAvailableInInitialProPlanError;
14
15
  var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
@@ -39,6 +40,9 @@ function showLicenseKeyPlanMismatchError({
39
40
  function showNotAvailableInInitialProPlanError() {
40
41
  showError(['MUI X: Component not included in your license.', '', 'The component you are trying to use is not included in the Pro Plan you purchased.', '', 'Your license is from an old version of the Pro Plan that is only compatible with the `@mui/x-data-grid-pro` and `@mui/x-date-pickers-pro` commercial packages.', '', 'To start using another Pro package, please consider reaching to our sales team to upgrade your license or visit https://mui.com/r/x-get-license to get a new license key.']);
41
42
  }
43
+ function showLicenseKeyVersionMismatchError() {
44
+ showError(['MUI X: License key version mismatch.', '', 'The license key you are using is not compatible with the version of the MUI X packages installed.', 'This happens when using a license key from a previous major version (e.g. a v8 license with v9 packages).', '', 'To resolve this, you can either get an new license key at https://mui.com/r/x-get-license or from your account profile at https://mui.com/store/account/licenses/, or downgrade to an older MUI X version that matches your current license key.']);
45
+ }
42
46
  function showMissingLicenseKeyError({
43
47
  plan,
44
48
  packageName
@@ -26,6 +26,9 @@ export function showLicenseKeyPlanMismatchError({
26
26
  export function showNotAvailableInInitialProPlanError() {
27
27
  showError(['MUI X: Component not included in your license.', '', 'The component you are trying to use is not included in the Pro Plan you purchased.', '', 'Your license is from an old version of the Pro Plan that is only compatible with the `@mui/x-data-grid-pro` and `@mui/x-date-pickers-pro` commercial packages.', '', 'To start using another Pro package, please consider reaching to our sales team to upgrade your license or visit https://mui.com/r/x-get-license to get a new license key.']);
28
28
  }
29
+ export function showLicenseKeyVersionMismatchError() {
30
+ showError(['MUI X: License key version mismatch.', '', 'The license key you are using is not compatible with the version of the MUI X packages installed.', 'This happens when using a license key from a previous major version (e.g. a v8 license with v9 packages).', '', 'To resolve this, you can either get an new license key at https://mui.com/r/x-get-license or from your account profile at https://mui.com/store/account/licenses/, or downgrade to an older MUI X version that matches your current license key.']);
31
+ }
29
32
  export function showMissingLicenseKeyError({
30
33
  plan,
31
34
  packageName
@@ -1,4 +1,11 @@
1
1
  export declare const PLAN_SCOPES: readonly ["pro", "premium"];
2
2
  export declare const PLAN_VERSIONS: readonly ["initial", "Q3-2024", "Q1-2026"];
3
3
  export type PlanScope = (typeof PLAN_SCOPES)[number];
4
- export type PlanVersion = (typeof PLAN_VERSIONS)[number];
4
+ export type PlanVersion = (typeof PLAN_VERSIONS)[number];
5
+ /**
6
+ * Checks if a plan version is older than or equal to the given threshold
7
+ * using the ordering defined in PLAN_VERSIONS.
8
+ * This can be reused for future major version gates
9
+ * (e.g. v10 could set its own max plan version).
10
+ */
11
+ export declare function isPlanVersionOlderOrEqual(planVersion: string, maxVersion: PlanVersion): boolean;
@@ -1,4 +1,11 @@
1
1
  export declare const PLAN_SCOPES: readonly ["pro", "premium"];
2
2
  export declare const PLAN_VERSIONS: readonly ["initial", "Q3-2024", "Q1-2026"];
3
3
  export type PlanScope = (typeof PLAN_SCOPES)[number];
4
- export type PlanVersion = (typeof PLAN_VERSIONS)[number];
4
+ export type PlanVersion = (typeof PLAN_VERSIONS)[number];
5
+ /**
6
+ * Checks if a plan version is older than or equal to the given threshold
7
+ * using the ordering defined in PLAN_VERSIONS.
8
+ * This can be reused for future major version gates
9
+ * (e.g. v10 could set its own max plan version).
10
+ */
11
+ export declare function isPlanVersionOlderOrEqual(planVersion: string, maxVersion: PlanVersion): boolean;
@@ -4,5 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.PLAN_VERSIONS = exports.PLAN_SCOPES = void 0;
7
+ exports.isPlanVersionOlderOrEqual = isPlanVersionOlderOrEqual;
7
8
  const PLAN_SCOPES = exports.PLAN_SCOPES = ['pro', 'premium'];
8
- const PLAN_VERSIONS = exports.PLAN_VERSIONS = ['initial', 'Q3-2024', 'Q1-2026'];
9
+ const PLAN_VERSIONS = exports.PLAN_VERSIONS = ['initial', 'Q3-2024', 'Q1-2026'];
10
+ /**
11
+ * Checks if a plan version is older than or equal to the given threshold
12
+ * using the ordering defined in PLAN_VERSIONS.
13
+ * This can be reused for future major version gates
14
+ * (e.g. v10 could set its own max plan version).
15
+ */
16
+ function isPlanVersionOlderOrEqual(planVersion, maxVersion) {
17
+ const index = PLAN_VERSIONS.indexOf(planVersion);
18
+ const maxIndex = PLAN_VERSIONS.indexOf(maxVersion);
19
+ return index !== -1 && index <= maxIndex;
20
+ }
@@ -1,2 +1,13 @@
1
1
  export const PLAN_SCOPES = ['pro', 'premium'];
2
- export const PLAN_VERSIONS = ['initial', 'Q3-2024', 'Q1-2026'];
2
+ export const PLAN_VERSIONS = ['initial', 'Q3-2024', 'Q1-2026'];
3
+ /**
4
+ * Checks if a plan version is older than or equal to the given threshold
5
+ * using the ordering defined in PLAN_VERSIONS.
6
+ * This can be reused for future major version gates
7
+ * (e.g. v10 could set its own max plan version).
8
+ */
9
+ export function isPlanVersionOlderOrEqual(planVersion, maxVersion) {
10
+ const index = PLAN_VERSIONS.indexOf(planVersion);
11
+ const maxIndex = PLAN_VERSIONS.indexOf(maxVersion);
12
+ return index !== -1 && index <= maxIndex;
13
+ }
@@ -7,5 +7,6 @@ export declare enum LICENSE_STATUS {
7
7
  Valid = "Valid",
8
8
  OutOfScope = "OutOfScope",
9
9
  NotAvailableInInitialProPlan = "NotAvailableInInitialProPlan",
10
+ NotValidForPackage = "NotValidForPackage",
10
11
  }
11
12
  export type LicenseStatus = keyof typeof LICENSE_STATUS;
@@ -7,5 +7,6 @@ export declare enum LICENSE_STATUS {
7
7
  Valid = "Valid",
8
8
  OutOfScope = "OutOfScope",
9
9
  NotAvailableInInitialProPlan = "NotAvailableInInitialProPlan",
10
+ NotValidForPackage = "NotValidForPackage",
10
11
  }
11
12
  export type LicenseStatus = keyof typeof LICENSE_STATUS;
@@ -14,5 +14,6 @@ let LICENSE_STATUS = exports.LICENSE_STATUS = /*#__PURE__*/function (LICENSE_STA
14
14
  LICENSE_STATUS["Valid"] = "Valid";
15
15
  LICENSE_STATUS["OutOfScope"] = "OutOfScope";
16
16
  LICENSE_STATUS["NotAvailableInInitialProPlan"] = "NotAvailableInInitialProPlan";
17
+ LICENSE_STATUS["NotValidForPackage"] = "NotValidForPackage";
17
18
  return LICENSE_STATUS;
18
19
  }({});
@@ -8,5 +8,6 @@ export let LICENSE_STATUS = /*#__PURE__*/function (LICENSE_STATUS) {
8
8
  LICENSE_STATUS["Valid"] = "Valid";
9
9
  LICENSE_STATUS["OutOfScope"] = "OutOfScope";
10
10
  LICENSE_STATUS["NotAvailableInInitialProPlan"] = "NotAvailableInInitialProPlan";
11
+ LICENSE_STATUS["NotValidForPackage"] = "NotValidForPackage";
11
12
  return LICENSE_STATUS;
12
13
  }({});
@@ -1,6 +1,6 @@
1
1
  import { LicenseStatus } from "../utils/licenseStatus.mjs";
2
2
  import type { NullableLicenseDetails } from "../utils/licenseDetails.mjs";
3
- import { MuiCommercialPackageName } from "../utils/commercialPackages.mjs";
3
+ import { CommercialPackageInfo } from "../utils/commercialPackages.mjs";
4
4
  /**
5
5
  * Parse a comma-separated key=value license string into a NullableLicenseDetails object.
6
6
  * Shared by v2 and v3 decoders.
@@ -19,13 +19,11 @@ export declare function decodeLicenseVersion3(license: string): NullableLicenseD
19
19
  */
20
20
  export declare function decodeLicense(encodedLicense: string): NullableLicenseDetails | null;
21
21
  export declare function verifyLicense({
22
- releaseInfo,
23
- licenseKey,
24
- packageName
22
+ packageInfo,
23
+ licenseKey
25
24
  }: {
26
- releaseInfo: string;
25
+ packageInfo: CommercialPackageInfo;
27
26
  licenseKey?: string;
28
- packageName: MuiCommercialPackageName;
29
27
  }): {
30
28
  status: LicenseStatus;
31
29
  meta?: any;
@@ -1,6 +1,6 @@
1
1
  import { LicenseStatus } from "../utils/licenseStatus.js";
2
2
  import type { NullableLicenseDetails } from "../utils/licenseDetails.js";
3
- import { MuiCommercialPackageName } from "../utils/commercialPackages.js";
3
+ import { CommercialPackageInfo } from "../utils/commercialPackages.js";
4
4
  /**
5
5
  * Parse a comma-separated key=value license string into a NullableLicenseDetails object.
6
6
  * Shared by v2 and v3 decoders.
@@ -19,13 +19,11 @@ export declare function decodeLicenseVersion3(license: string): NullableLicenseD
19
19
  */
20
20
  export declare function decodeLicense(encodedLicense: string): NullableLicenseDetails | null;
21
21
  export declare function verifyLicense({
22
- releaseInfo,
23
- licenseKey,
24
- packageName
22
+ packageInfo,
23
+ licenseKey
25
24
  }: {
26
- releaseInfo: string;
25
+ packageInfo: CommercialPackageInfo;
27
26
  licenseKey?: string;
28
- packageName: MuiCommercialPackageName;
29
27
  }): {
30
28
  status: LicenseStatus;
31
29
  meta?: any;
@@ -29,6 +29,7 @@ function isPlanScopeSufficient(packageName, planScope) {
29
29
  const expiryReg = /^.*EXPIRY=([0-9]+),.*$/;
30
30
  const orderReg = /^.*ORDER:([0-9]+),.*$/;
31
31
  const PRO_PACKAGES_AVAILABLE_IN_INITIAL_PRO_PLAN = ['x-data-grid-pro', 'x-date-pickers-pro'];
32
+ const MAX_V8_PLAN_VERSION = 'Q3-2024';
32
33
 
33
34
  /**
34
35
  * Format: ORDER:${orderNumber},EXPIRY=${expiryTimestamp},KEYVERSION=1
@@ -163,11 +164,16 @@ function decodeLicense(encodedLicense) {
163
164
  return null;
164
165
  }
165
166
  function verifyLicense({
166
- releaseInfo,
167
- licenseKey,
168
- packageName
167
+ packageInfo,
168
+ licenseKey
169
169
  }) {
170
- if (!releaseInfo) {
170
+ const {
171
+ name: packageName,
172
+ releaseDate,
173
+ version: packageVersion
174
+ } = packageInfo;
175
+ const packageMajorVersion = parseInt(packageVersion ?? '', 10);
176
+ if (!releaseDate) {
171
177
  throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: The release information is missing and license validation cannot proceed. ' + 'This is an internal error that should not occur in normal usage. ' + 'Please report this issue if you encounter it.' : (0, _formatErrorMessage2.default)(188));
172
178
  }
173
179
  if (!licenseKey) {
@@ -213,11 +219,18 @@ function verifyLicense({
213
219
  };
214
220
  }
215
221
  if (license.licenseModel === 'perpetual' || process.env.NODE_ENV === 'production') {
216
- const pkgTimestamp = parseInt((0, _base.base64Decode)(releaseInfo), 10);
222
+ const pkgTimestamp = parseInt((0, _base.base64Decode)(releaseDate), 10);
217
223
  if (Number.isNaN(pkgTimestamp)) {
218
224
  throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: The release information is invalid and license validation cannot proceed. ' + 'The package release timestamp could not be parsed. ' + 'This may indicate a corrupted package. Try reinstalling the MUI X packages.' : (0, _formatErrorMessage2.default)(189));
219
225
  }
220
226
  if (license.expiryTimestamp < pkgTimestamp) {
227
+ // Perpetual v8 (or older) licenses whose expiry predates this package release
228
+ // are not valid for v9 packages.
229
+ if (packageMajorVersion != null && packageMajorVersion >= 9 && license.licenseModel === 'perpetual' && (0, _licensePlan.isPlanVersionOlderOrEqual)(license.planVersion, MAX_V8_PLAN_VERSION)) {
230
+ return {
231
+ status: _licenseStatus.LICENSE_STATUS.NotValidForPackage
232
+ };
233
+ }
221
234
  return {
222
235
  status: _licenseStatus.LICENSE_STATUS.ExpiredVersion
223
236
  };
@@ -262,6 +275,14 @@ function verifyLicense({
262
275
  status: _licenseStatus.LICENSE_STATUS.NotAvailableInInitialProPlan
263
276
  };
264
277
  }
278
+
279
+ // v8 licenses (Q1-2026 and older) are not valid for v9 packages.
280
+ // Perpetual licenses are exempt as they are already gated by the expiry date check.
281
+ if (packageMajorVersion != null && packageMajorVersion >= 9 && license.licenseModel !== 'perpetual' && (0, _licensePlan.isPlanVersionOlderOrEqual)(license.planVersion, MAX_V8_PLAN_VERSION)) {
282
+ return {
283
+ status: _licenseStatus.LICENSE_STATUS.NotValidForPackage
284
+ };
285
+ }
265
286
  return {
266
287
  status: _licenseStatus.LICENSE_STATUS.Valid
267
288
  };
@@ -2,7 +2,7 @@ import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
2
2
  import { base64Decode } from "../encoding/base64.mjs";
3
3
  import { md5 } from "../encoding/md5.mjs";
4
4
  import { LICENSE_STATUS } from "../utils/licenseStatus.mjs";
5
- import { PLAN_SCOPES } from "../utils/licensePlan.mjs";
5
+ import { PLAN_SCOPES, isPlanVersionOlderOrEqual } from "../utils/licensePlan.mjs";
6
6
  import { LICENSE_MODELS } from "../utils/licenseModel.mjs";
7
7
  function isPlanScopeSufficient(packageName, planScope) {
8
8
  let acceptedScopes;
@@ -18,6 +18,7 @@ function isPlanScopeSufficient(packageName, planScope) {
18
18
  const expiryReg = /^.*EXPIRY=([0-9]+),.*$/;
19
19
  const orderReg = /^.*ORDER:([0-9]+),.*$/;
20
20
  const PRO_PACKAGES_AVAILABLE_IN_INITIAL_PRO_PLAN = ['x-data-grid-pro', 'x-date-pickers-pro'];
21
+ const MAX_V8_PLAN_VERSION = 'Q3-2024';
21
22
 
22
23
  /**
23
24
  * Format: ORDER:${orderNumber},EXPIRY=${expiryTimestamp},KEYVERSION=1
@@ -152,11 +153,16 @@ export function decodeLicense(encodedLicense) {
152
153
  return null;
153
154
  }
154
155
  export function verifyLicense({
155
- releaseInfo,
156
- licenseKey,
157
- packageName
156
+ packageInfo,
157
+ licenseKey
158
158
  }) {
159
- if (!releaseInfo) {
159
+ const {
160
+ name: packageName,
161
+ releaseDate,
162
+ version: packageVersion
163
+ } = packageInfo;
164
+ const packageMajorVersion = parseInt(packageVersion ?? '', 10);
165
+ if (!releaseDate) {
160
166
  throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: The release information is missing and license validation cannot proceed. ' + 'This is an internal error that should not occur in normal usage. ' + 'Please report this issue if you encounter it.' : _formatErrorMessage(188));
161
167
  }
162
168
  if (!licenseKey) {
@@ -202,11 +208,18 @@ export function verifyLicense({
202
208
  };
203
209
  }
204
210
  if (license.licenseModel === 'perpetual' || process.env.NODE_ENV === 'production') {
205
- const pkgTimestamp = parseInt(base64Decode(releaseInfo), 10);
211
+ const pkgTimestamp = parseInt(base64Decode(releaseDate), 10);
206
212
  if (Number.isNaN(pkgTimestamp)) {
207
213
  throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: The release information is invalid and license validation cannot proceed. ' + 'The package release timestamp could not be parsed. ' + 'This may indicate a corrupted package. Try reinstalling the MUI X packages.' : _formatErrorMessage(189));
208
214
  }
209
215
  if (license.expiryTimestamp < pkgTimestamp) {
216
+ // Perpetual v8 (or older) licenses whose expiry predates this package release
217
+ // are not valid for v9 packages.
218
+ if (packageMajorVersion != null && packageMajorVersion >= 9 && license.licenseModel === 'perpetual' && isPlanVersionOlderOrEqual(license.planVersion, MAX_V8_PLAN_VERSION)) {
219
+ return {
220
+ status: LICENSE_STATUS.NotValidForPackage
221
+ };
222
+ }
210
223
  return {
211
224
  status: LICENSE_STATUS.ExpiredVersion
212
225
  };
@@ -251,6 +264,14 @@ export function verifyLicense({
251
264
  status: LICENSE_STATUS.NotAvailableInInitialProPlan
252
265
  };
253
266
  }
267
+
268
+ // v8 licenses (Q1-2026 and older) are not valid for v9 packages.
269
+ // Perpetual licenses are exempt as they are already gated by the expiry date check.
270
+ if (packageMajorVersion != null && packageMajorVersion >= 9 && license.licenseModel !== 'perpetual' && isPlanVersionOlderOrEqual(license.planVersion, MAX_V8_PLAN_VERSION)) {
271
+ return {
272
+ status: LICENSE_STATUS.NotValidForPackage
273
+ };
274
+ }
254
275
  return {
255
276
  status: LICENSE_STATUS.Valid
256
277
  };
package/license-env.d.mts DELETED
@@ -1,6 +0,0 @@
1
- export {};
2
- declare global {
3
- interface MUIEnv {
4
- MUI_VERSION?: string;
5
- }
6
- }
package/license-env.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export {};
2
- declare global {
3
- interface MUIEnv {
4
- MUI_VERSION?: string;
5
- }
6
- }