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

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 (89) hide show
  1. package/CHANGELOG.md +591 -3
  2. package/{esm/Unstable_LicenseInfoProvider/LicenseInfoProvider.d.ts → Unstable_LicenseInfoProvider/LicenseInfoProvider.d.mts} +1 -1
  3. package/{esm/Unstable_LicenseInfoProvider/LicenseInfoProvider.js → Unstable_LicenseInfoProvider/LicenseInfoProvider.mjs} +1 -1
  4. package/{esm/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.d.ts → Unstable_LicenseInfoProvider/MuiLicenseInfoContext.d.mts} +1 -1
  5. package/{esm/Unstable_LicenseInfoProvider/index.d.ts → Unstable_LicenseInfoProvider/index.d.mts} +2 -2
  6. package/{esm/Unstable_LicenseInfoProvider/index.js → Unstable_LicenseInfoProvider/index.mjs} +1 -1
  7. package/{esm/Watermark/Watermark.d.ts → Watermark/Watermark.d.mts} +1 -1
  8. package/Watermark/Watermark.js +3 -1
  9. package/{esm/Watermark/Watermark.js → Watermark/Watermark.mjs} +4 -3
  10. package/Watermark/index.d.mts +1 -0
  11. package/Watermark/index.mjs +1 -0
  12. package/encoding/base64.js +3 -1
  13. package/{esm/encoding/base64.js → encoding/base64.mjs} +2 -1
  14. package/encoding/index.d.mts +2 -0
  15. package/encoding/index.mjs +2 -0
  16. package/index.d.mts +4 -0
  17. package/index.d.ts +3 -6
  18. package/index.js +14 -75
  19. package/index.mjs +10 -0
  20. package/license-env.d.mts +6 -0
  21. package/license-env.d.ts +6 -0
  22. package/package.json +107 -16
  23. package/test-keys.d.mts +92 -0
  24. package/test-keys.d.ts +92 -0
  25. package/test-keys.js +135 -0
  26. package/test-keys.mjs +129 -0
  27. package/{esm/useLicenseVerifier/index.d.ts → useLicenseVerifier/index.d.mts} +1 -1
  28. package/{esm/useLicenseVerifier/index.js → useLicenseVerifier/index.mjs} +1 -1
  29. package/{esm/useLicenseVerifier/useLicenseVerifier.d.ts → useLicenseVerifier/useLicenseVerifier.d.mts} +2 -2
  30. package/useLicenseVerifier/useLicenseVerifier.js +2 -1
  31. package/{esm/useLicenseVerifier/useLicenseVerifier.js → useLicenseVerifier/useLicenseVerifier.mjs} +7 -6
  32. package/{esm/utils/commercialPackages.d.ts → utils/commercialPackages.d.mts} +1 -1
  33. package/utils/commercialPackages.d.ts +1 -1
  34. package/utils/index.d.mts +8 -0
  35. package/utils/index.d.ts +3 -1
  36. package/utils/index.mjs +4 -0
  37. package/utils/licenseAppType.d.mts +8 -0
  38. package/utils/licenseAppType.d.ts +8 -0
  39. package/utils/licenseAppType.js +16 -0
  40. package/utils/licenseAppType.mjs +10 -0
  41. package/utils/licenseDetails.d.mts +60 -0
  42. package/utils/licenseDetails.d.ts +60 -0
  43. package/utils/licenseDetails.js +5 -0
  44. package/utils/licenseDetails.mjs +1 -0
  45. package/utils/licenseErrorMessageUtils.js +15 -1
  46. package/{esm/utils/licenseErrorMessageUtils.js → utils/licenseErrorMessageUtils.mjs} +14 -1
  47. package/{esm/utils/plan.d.ts → utils/licensePlan.d.mts} +1 -1
  48. package/utils/{plan.d.ts → licensePlan.d.ts} +1 -1
  49. package/utils/{plan.js → licensePlan.js} +1 -1
  50. package/utils/licensePlan.mjs +2 -0
  51. package/verifyLicense/index.d.mts +1 -0
  52. package/verifyLicense/index.mjs +1 -0
  53. package/verifyLicense/verifyLicense.d.mts +32 -0
  54. package/verifyLicense/verifyLicense.d.ts +18 -1
  55. package/verifyLicense/verifyLicense.js +86 -36
  56. package/{esm/verifyLicense/verifyLicense.js → verifyLicense/verifyLicense.mjs} +85 -39
  57. package/esm/Watermark/index.d.ts +0 -1
  58. package/esm/Watermark/index.js +0 -1
  59. package/esm/encoding/index.d.ts +0 -2
  60. package/esm/encoding/index.js +0 -2
  61. package/esm/generateLicense/generateLicense.d.ts +0 -10
  62. package/esm/generateLicense/generateLicense.js +0 -19
  63. package/esm/generateLicense/index.d.ts +0 -1
  64. package/esm/generateLicense/index.js +0 -1
  65. package/esm/index.d.ts +0 -7
  66. package/esm/index.js +0 -14
  67. package/esm/package.json +0 -1
  68. package/esm/utils/index.d.ts +0 -6
  69. package/esm/utils/index.js +0 -4
  70. package/esm/utils/plan.js +0 -2
  71. package/esm/verifyLicense/index.d.ts +0 -1
  72. package/esm/verifyLicense/index.js +0 -1
  73. package/esm/verifyLicense/verifyLicense.d.ts +0 -15
  74. package/generateLicense/generateLicense.d.ts +0 -10
  75. package/generateLicense/generateLicense.js +0 -25
  76. package/generateLicense/index.d.ts +0 -1
  77. package/generateLicense/index.js +0 -16
  78. /package/{esm/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js → Unstable_LicenseInfoProvider/MuiLicenseInfoContext.mjs} +0 -0
  79. /package/{esm/encoding/base64.d.ts → encoding/base64.d.mts} +0 -0
  80. /package/{esm/encoding/md5.d.ts → encoding/md5.d.mts} +0 -0
  81. /package/{esm/encoding/md5.js → encoding/md5.mjs} +0 -0
  82. /package/{esm/utils/commercialPackages.js → utils/commercialPackages.mjs} +0 -0
  83. /package/{esm/utils/licenseErrorMessageUtils.d.ts → utils/licenseErrorMessageUtils.d.mts} +0 -0
  84. /package/{esm/utils/licenseInfo.d.ts → utils/licenseInfo.d.mts} +0 -0
  85. /package/{esm/utils/licenseInfo.js → utils/licenseInfo.mjs} +0 -0
  86. /package/{esm/utils/licenseModel.d.ts → utils/licenseModel.d.mts} +0 -0
  87. /package/{esm/utils/licenseModel.js → utils/licenseModel.mjs} +0 -0
  88. /package/{esm/utils/licenseStatus.d.ts → utils/licenseStatus.d.mts} +0 -0
  89. /package/{esm/utils/licenseStatus.js → utils/licenseStatus.mjs} +0 -0
package/test-keys.js ADDED
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
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;
7
+ // =============================================================================
8
+ // Test license keys for use in test suites.
9
+ // All keys contain T=true in their payload and are rejected outside test environments.
10
+ // Import via '@mui/x-license/test-keys'.
11
+ // =============================================================================
12
+
13
+ /**
14
+ * Test Premium license key.
15
+ * orderId: #123, scope: premium, licenseModel: annual, planVersion: Q3-2024
16
+ * keyVersion: 2, expiryDate: 2099-12-30T23:00:00.000Z
17
+ */
18
+ const TEST_LICENSE_KEY_PREMIUM = exports.TEST_LICENSE_KEY_PREMIUM = '715a2f48d6140e8e6f2484e6c4b981aeTz0xMjMsRT00MTAyMzU0ODAwMDAwLFM9cHJlbWl1bSxMTT1hbm51YWwsUFY9UTMtMjAyNCxUPXRydWUsS1Y9Mg==';
19
+
20
+ /**
21
+ * Test Pro license key.
22
+ * orderId: #123, scope: pro, licenseModel: annual, planVersion: Q3-2024
23
+ * keyVersion: 2, expiryDate: 2099-12-30T23:00:00.000Z
24
+ */
25
+ const TEST_LICENSE_KEY_PRO = exports.TEST_LICENSE_KEY_PRO = '8d0500f3fe93ffea84445b2aed17c59cTz0xMjMsRT00MTAyMzU0ODAwMDAwLFM9cHJvLExNPWFubnVhbCxQVj1RMy0yMDI0LFQ9dHJ1ZSxLVj0y';
26
+
27
+ // --- Key format v1 ---
28
+
29
+ /**
30
+ * Key version 1 format (pro, perpetual, initial implied).
31
+ * orderId: #123, expiryDate: 2026-08-02
32
+ */
33
+ const TEST_KEY_V1 = exports.TEST_KEY_V1 = '8f5bd7d70e4d7aeecd1d5b9d0d1759bbT1JERVI6MTIzLEVYUElSWT0xNzg1ODc0MDEwNzA4LFQ9dHJ1ZSxLRVlWRVJTSU9OPTE=';
34
+
35
+ // --- Keys for verifyLicense tests (paired with releaseDate = 2018-01-01) ---
36
+
37
+ /**
38
+ * Pro subscription, initial, expiry = releaseDate + 1 day.
39
+ * orderId: #123, keyVersion: 2
40
+ */
41
+ const TEST_KEY_PRO_SUBSCRIPTION = exports.TEST_KEY_PRO_SUBSCRIPTION = 'b4cb282aa165b05f65f70a4caddadc81Tz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1pbml0aWFsLFQ9dHJ1ZSxLVj0y';
42
+
43
+ /**
44
+ * Premium subscription, initial, expiry = releaseDate + 1 day.
45
+ * orderId: #123, keyVersion: 2
46
+ */
47
+ const TEST_KEY_PREMIUM_SUBSCRIPTION = exports.TEST_KEY_PREMIUM_SUBSCRIPTION = '22bd1051015e3c663f8ca5cba9ebe56aTz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJlbWl1bSxMTT1zdWJzY3JpcHRpb24sUFY9aW5pdGlhbCxUPXRydWUsS1Y9Mg==';
48
+
49
+ /**
50
+ * Pro perpetual, initial, expiry = releaseDate + 1 day (valid).
51
+ * orderId: #123, keyVersion: 2
52
+ */
53
+ const TEST_KEY_PRO_PERPETUAL = exports.TEST_KEY_PRO_PERPETUAL = 'f4221ac32d1b8b102c143dcf65080414Tz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJvLExNPXBlcnBldHVhbCxQVj1pbml0aWFsLFQ9dHJ1ZSxLVj0y';
54
+
55
+ /**
56
+ * Pro perpetual, initial, expiry = releaseDate - 1 day (expired before release).
57
+ * orderId: #123, keyVersion: 2
58
+ */
59
+ const TEST_KEY_PRO_PERPETUAL_EXPIRED = exports.TEST_KEY_PRO_PERPETUAL_EXPIRED = '64245e2bb861fc92856e682b32dc8bf2Tz0xMjMsRT0xNTE0NTg4NDAwMDAwLFM9cHJvLExNPXBlcnBldHVhbCxQVj1pbml0aWFsLFQ9dHJ1ZSxLVj0y';
60
+
61
+ /**
62
+ * Pro annual, initial, expiry = releaseDate + 1 day.
63
+ * orderId: #123, keyVersion: 2
64
+ */
65
+ const TEST_KEY_PRO_ANNUAL_INITIAL = exports.TEST_KEY_PRO_ANNUAL_INITIAL = 'd82e3196c55fc5dc21a4145b796a77a7Tz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJvLExNPWFubnVhbCxQVj1pbml0aWFsLFQ9dHJ1ZSxLVj0y';
66
+
67
+ /**
68
+ * Premium annual, initial, expiry = releaseDate + 1 day.
69
+ * orderId: #123, keyVersion: 2
70
+ */
71
+ const TEST_KEY_PREMIUM_ANNUAL_INITIAL = exports.TEST_KEY_PREMIUM_ANNUAL_INITIAL = '8fc9fa79e1b5f30ce737ccec8f3e36f4Tz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJlbWl1bSxMTT1hbm51YWwsUFY9aW5pdGlhbCxUPXRydWUsS1Y9Mg==';
72
+
73
+ // --- Keys for time-sensitive tests (used with vi.useFakeTimers, fakeNow = 2024-06-15) ---
74
+
75
+ /**
76
+ * Pro subscription, initial, expiry = 2024-06-14 (fakeNow - 1 day, within grace period).
77
+ * orderId: #123, keyVersion: 2
78
+ */
79
+ const TEST_KEY_EXPIRED_GRACE = exports.TEST_KEY_EXPIRED_GRACE = '84dcbd1c5a6169c74e6c70ec23e0df55Tz0xMjMsRT0xNzE4MzIzMjAwMDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1pbml0aWFsLFQ9dHJ1ZSxLVj0y';
80
+
81
+ /**
82
+ * Pro subscription, initial, expiry = 2024-05-16 (fakeNow - 30 days, past grace period).
83
+ * orderId: #123, keyVersion: 2
84
+ */
85
+ const TEST_KEY_EXPIRED_30DAYS = exports.TEST_KEY_EXPIRED_30DAYS = '4081d3863dda2ca60be4a5b29f582117Tz0xMjMsRT0xNzE1ODE3NjAwMDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1pbml0aWFsLFQ9dHJ1ZSxLVj0y';
86
+
87
+ // --- Keys for useLicenseVerifier plan combination tests (initial planVersion, far-future expiry) ---
88
+
89
+ /**
90
+ * Pro subscription, initial, expiry = 3001-01-01.
91
+ * orderId: #123, keyVersion: 2
92
+ */
93
+ const TEST_KEY_PRO_SUBSCRIPTION_FUTURE = exports.TEST_KEY_PRO_SUBSCRIPTION_FUTURE = 'e83a283135bbd911e4aa0fd55ceea3ebTz0xMjMsRT0zMjUzNTEyNjAwMDAwMCxTPXBybyxMTT1zdWJzY3JpcHRpb24sUFY9aW5pdGlhbCxUPXRydWUsS1Y9Mg==';
94
+
95
+ /**
96
+ * Premium subscription, initial, expiry = 3001-01-01.
97
+ * orderId: #123, keyVersion: 2
98
+ */
99
+ const TEST_KEY_PREMIUM_SUBSCRIPTION_FUTURE = exports.TEST_KEY_PREMIUM_SUBSCRIPTION_FUTURE = '1c6ea00fadedfcb3f2ef393f1de32f29Tz0xMjMsRT0zMjUzNTEyNjAwMDAwMCxTPXByZW1pdW0sTE09c3Vic2NyaXB0aW9uLFBWPWluaXRpYWwsVD10cnVlLEtWPTI=';
100
+
101
+ // --- Key format v3 ---
102
+
103
+ /**
104
+ * Pro annual, Q3-2024, quantity: 5, appType: single.
105
+ * orderId: #123, keyVersion: 3, expiryDate: 2099-12-30T23:00:00.000Z
106
+ */
107
+ const TEST_KEY_PRO_ANNUAL_V3 = exports.TEST_KEY_PRO_ANNUAL_V3 = '521a75b4cf0d0c5e8990ce070886e167Tz0xMjMsRT00MTAyMzU0ODAwMDAwLFM9cHJvLExNPWFubnVhbCxQVj1RMy0yMDI0LFE9NSxBVD1zaW5nbGUsVD10cnVlLEtWPTM=';
108
+
109
+ // --- Key format v3 Q1-2026 ---
110
+
111
+ /**
112
+ * Pro annual, Q1-2026, quantity: 5, appType: single.
113
+ * orderId: #123, keyVersion: 3, expiryDate: 3001-01-01
114
+ */
115
+ const TEST_KEY_PRO_ANNUAL_Q1_2026_V3 = exports.TEST_KEY_PRO_ANNUAL_Q1_2026_V3 = '5f52871b5845f28ebdd0fabbe0b89695Tz0xMjMsRT0zMjUzNTEyNjAwMDAwMCxTPXBybyxMTT1hbm51YWwsUFY9UTEtMjAyNixRPTUsQVQ9c2luZ2xlLFQ9dHJ1ZSxLVj0z';
116
+
117
+ /**
118
+ * Premium annual, Q1-2026, quantity: 10, appType: single.
119
+ * orderId: #123, keyVersion: 3, expiryDate: 3001-01-01
120
+ */
121
+ const TEST_KEY_PREMIUM_ANNUAL_Q1_2026_V3 = exports.TEST_KEY_PREMIUM_ANNUAL_Q1_2026_V3 = '450d9fc1b28e709fcb73969bd10e1c30Tz0xMjMsRT0zMjUzNTEyNjAwMDAwMCxTPXByZW1pdW0sTE09YW5udWFsLFBWPVExLTIwMjYsUT0xMCxBVD1zaW5nbGUsVD10cnVlLEtWPTM=';
122
+
123
+ // --- Invalid / edge-case keys ---
124
+
125
+ /**
126
+ * Invalid key: hash does not match payload (tampered).
127
+ * Used to test that verifyLicense rejects tampered keys.
128
+ */
129
+ const TEST_KEY_INVALID = exports.TEST_KEY_INVALID = 'c0b3c1c31055976260628def9b697020TkFNRTpNYC1VSSBTQVMsREVWRUxPUEVSX0NPVU5UPTEwLEVYUElSWT0xNTkxNzIzMDY3MDQyLFZFUlNJT049MS4yLjMsVD10cnVl';
130
+
131
+ /**
132
+ * Valid hash but unknown key version (KV=99).
133
+ * Used to test that decodeLicense returns null for unrecognized versions.
134
+ */
135
+ const TEST_KEY_UNKNOWN_VERSION = exports.TEST_KEY_UNKNOWN_VERSION = '64152474c774ae343484f08bbbc1a231Tz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJvLExNPWFubnVhbCxQVj1pbml0aWFsLFQ9dHJ1ZSxLVj05OQ==';
package/test-keys.mjs ADDED
@@ -0,0 +1,129 @@
1
+ // =============================================================================
2
+ // Test license keys for use in test suites.
3
+ // All keys contain T=true in their payload and are rejected outside test environments.
4
+ // Import via '@mui/x-license/test-keys'.
5
+ // =============================================================================
6
+
7
+ /**
8
+ * Test Premium license key.
9
+ * orderId: #123, scope: premium, licenseModel: annual, planVersion: Q3-2024
10
+ * keyVersion: 2, expiryDate: 2099-12-30T23:00:00.000Z
11
+ */
12
+ export const TEST_LICENSE_KEY_PREMIUM = '715a2f48d6140e8e6f2484e6c4b981aeTz0xMjMsRT00MTAyMzU0ODAwMDAwLFM9cHJlbWl1bSxMTT1hbm51YWwsUFY9UTMtMjAyNCxUPXRydWUsS1Y9Mg==';
13
+
14
+ /**
15
+ * Test Pro license key.
16
+ * orderId: #123, scope: pro, licenseModel: annual, planVersion: Q3-2024
17
+ * keyVersion: 2, expiryDate: 2099-12-30T23:00:00.000Z
18
+ */
19
+ export const TEST_LICENSE_KEY_PRO = '8d0500f3fe93ffea84445b2aed17c59cTz0xMjMsRT00MTAyMzU0ODAwMDAwLFM9cHJvLExNPWFubnVhbCxQVj1RMy0yMDI0LFQ9dHJ1ZSxLVj0y';
20
+
21
+ // --- Key format v1 ---
22
+
23
+ /**
24
+ * Key version 1 format (pro, perpetual, initial implied).
25
+ * orderId: #123, expiryDate: 2026-08-02
26
+ */
27
+ export const TEST_KEY_V1 = '8f5bd7d70e4d7aeecd1d5b9d0d1759bbT1JERVI6MTIzLEVYUElSWT0xNzg1ODc0MDEwNzA4LFQ9dHJ1ZSxLRVlWRVJTSU9OPTE=';
28
+
29
+ // --- Keys for verifyLicense tests (paired with releaseDate = 2018-01-01) ---
30
+
31
+ /**
32
+ * Pro subscription, initial, expiry = releaseDate + 1 day.
33
+ * orderId: #123, keyVersion: 2
34
+ */
35
+ export const TEST_KEY_PRO_SUBSCRIPTION = 'b4cb282aa165b05f65f70a4caddadc81Tz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1pbml0aWFsLFQ9dHJ1ZSxLVj0y';
36
+
37
+ /**
38
+ * Premium subscription, initial, expiry = releaseDate + 1 day.
39
+ * orderId: #123, keyVersion: 2
40
+ */
41
+ export const TEST_KEY_PREMIUM_SUBSCRIPTION = '22bd1051015e3c663f8ca5cba9ebe56aTz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJlbWl1bSxMTT1zdWJzY3JpcHRpb24sUFY9aW5pdGlhbCxUPXRydWUsS1Y9Mg==';
42
+
43
+ /**
44
+ * Pro perpetual, initial, expiry = releaseDate + 1 day (valid).
45
+ * orderId: #123, keyVersion: 2
46
+ */
47
+ export const TEST_KEY_PRO_PERPETUAL = 'f4221ac32d1b8b102c143dcf65080414Tz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJvLExNPXBlcnBldHVhbCxQVj1pbml0aWFsLFQ9dHJ1ZSxLVj0y';
48
+
49
+ /**
50
+ * Pro perpetual, initial, expiry = releaseDate - 1 day (expired before release).
51
+ * orderId: #123, keyVersion: 2
52
+ */
53
+ export const TEST_KEY_PRO_PERPETUAL_EXPIRED = '64245e2bb861fc92856e682b32dc8bf2Tz0xMjMsRT0xNTE0NTg4NDAwMDAwLFM9cHJvLExNPXBlcnBldHVhbCxQVj1pbml0aWFsLFQ9dHJ1ZSxLVj0y';
54
+
55
+ /**
56
+ * Pro annual, initial, expiry = releaseDate + 1 day.
57
+ * orderId: #123, keyVersion: 2
58
+ */
59
+ export const TEST_KEY_PRO_ANNUAL_INITIAL = 'd82e3196c55fc5dc21a4145b796a77a7Tz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJvLExNPWFubnVhbCxQVj1pbml0aWFsLFQ9dHJ1ZSxLVj0y';
60
+
61
+ /**
62
+ * Premium annual, initial, expiry = releaseDate + 1 day.
63
+ * orderId: #123, keyVersion: 2
64
+ */
65
+ export const TEST_KEY_PREMIUM_ANNUAL_INITIAL = '8fc9fa79e1b5f30ce737ccec8f3e36f4Tz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJlbWl1bSxMTT1hbm51YWwsUFY9aW5pdGlhbCxUPXRydWUsS1Y9Mg==';
66
+
67
+ // --- Keys for time-sensitive tests (used with vi.useFakeTimers, fakeNow = 2024-06-15) ---
68
+
69
+ /**
70
+ * Pro subscription, initial, expiry = 2024-06-14 (fakeNow - 1 day, within grace period).
71
+ * orderId: #123, keyVersion: 2
72
+ */
73
+ export const TEST_KEY_EXPIRED_GRACE = '84dcbd1c5a6169c74e6c70ec23e0df55Tz0xMjMsRT0xNzE4MzIzMjAwMDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1pbml0aWFsLFQ9dHJ1ZSxLVj0y';
74
+
75
+ /**
76
+ * Pro subscription, initial, expiry = 2024-05-16 (fakeNow - 30 days, past grace period).
77
+ * orderId: #123, keyVersion: 2
78
+ */
79
+ export const TEST_KEY_EXPIRED_30DAYS = '4081d3863dda2ca60be4a5b29f582117Tz0xMjMsRT0xNzE1ODE3NjAwMDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1pbml0aWFsLFQ9dHJ1ZSxLVj0y';
80
+
81
+ // --- Keys for useLicenseVerifier plan combination tests (initial planVersion, far-future expiry) ---
82
+
83
+ /**
84
+ * Pro subscription, initial, expiry = 3001-01-01.
85
+ * orderId: #123, keyVersion: 2
86
+ */
87
+ export const TEST_KEY_PRO_SUBSCRIPTION_FUTURE = 'e83a283135bbd911e4aa0fd55ceea3ebTz0xMjMsRT0zMjUzNTEyNjAwMDAwMCxTPXBybyxMTT1zdWJzY3JpcHRpb24sUFY9aW5pdGlhbCxUPXRydWUsS1Y9Mg==';
88
+
89
+ /**
90
+ * Premium subscription, initial, expiry = 3001-01-01.
91
+ * orderId: #123, keyVersion: 2
92
+ */
93
+ export const TEST_KEY_PREMIUM_SUBSCRIPTION_FUTURE = '1c6ea00fadedfcb3f2ef393f1de32f29Tz0xMjMsRT0zMjUzNTEyNjAwMDAwMCxTPXByZW1pdW0sTE09c3Vic2NyaXB0aW9uLFBWPWluaXRpYWwsVD10cnVlLEtWPTI=';
94
+
95
+ // --- Key format v3 ---
96
+
97
+ /**
98
+ * Pro annual, Q3-2024, quantity: 5, appType: single.
99
+ * orderId: #123, keyVersion: 3, expiryDate: 2099-12-30T23:00:00.000Z
100
+ */
101
+ export const TEST_KEY_PRO_ANNUAL_V3 = '521a75b4cf0d0c5e8990ce070886e167Tz0xMjMsRT00MTAyMzU0ODAwMDAwLFM9cHJvLExNPWFubnVhbCxQVj1RMy0yMDI0LFE9NSxBVD1zaW5nbGUsVD10cnVlLEtWPTM=';
102
+
103
+ // --- Key format v3 Q1-2026 ---
104
+
105
+ /**
106
+ * Pro annual, Q1-2026, quantity: 5, appType: single.
107
+ * orderId: #123, keyVersion: 3, expiryDate: 3001-01-01
108
+ */
109
+ export const TEST_KEY_PRO_ANNUAL_Q1_2026_V3 = '5f52871b5845f28ebdd0fabbe0b89695Tz0xMjMsRT0zMjUzNTEyNjAwMDAwMCxTPXBybyxMTT1hbm51YWwsUFY9UTEtMjAyNixRPTUsQVQ9c2luZ2xlLFQ9dHJ1ZSxLVj0z';
110
+
111
+ /**
112
+ * Premium annual, Q1-2026, quantity: 10, appType: single.
113
+ * orderId: #123, keyVersion: 3, expiryDate: 3001-01-01
114
+ */
115
+ export const TEST_KEY_PREMIUM_ANNUAL_Q1_2026_V3 = '450d9fc1b28e709fcb73969bd10e1c30Tz0xMjMsRT0zMjUzNTEyNjAwMDAwMCxTPXByZW1pdW0sTE09YW5udWFsLFBWPVExLTIwMjYsUT0xMCxBVD1zaW5nbGUsVD10cnVlLEtWPTM=';
116
+
117
+ // --- Invalid / edge-case keys ---
118
+
119
+ /**
120
+ * Invalid key: hash does not match payload (tampered).
121
+ * Used to test that verifyLicense rejects tampered keys.
122
+ */
123
+ export const TEST_KEY_INVALID = 'c0b3c1c31055976260628def9b697020TkFNRTpNYC1VSSBTQVMsREVWRUxPUEVSX0NPVU5UPTEwLEVYUElSWT0xNTkxNzIzMDY3MDQyLFZFUlNJT049MS4yLjMsVD10cnVl';
124
+
125
+ /**
126
+ * Valid hash but unknown key version (KV=99).
127
+ * Used to test that decodeLicense returns null for unrecognized versions.
128
+ */
129
+ export const TEST_KEY_UNKNOWN_VERSION = '64152474c774ae343484f08bbbc1a231Tz0xMjMsRT0xNTE0NzYxMjAwMDAwLFM9cHJvLExNPWFubnVhbCxQVj1pbml0aWFsLFQ9dHJ1ZSxLVj05OQ==';
@@ -1 +1 @@
1
- export { clearLicenseStatusCache, useLicenseVerifier } from "./useLicenseVerifier.js";
1
+ export { clearLicenseStatusCache, useLicenseVerifier } from "./useLicenseVerifier.mjs";
@@ -1 +1 @@
1
- export { clearLicenseStatusCache, useLicenseVerifier } from "./useLicenseVerifier.js";
1
+ export { clearLicenseStatusCache, useLicenseVerifier } from "./useLicenseVerifier.mjs";
@@ -1,5 +1,5 @@
1
- import { LicenseStatus } from "../utils/licenseStatus.js";
2
- import { MuiCommercialPackageName } from "../utils/commercialPackages.js";
1
+ import { LicenseStatus } from "../utils/licenseStatus.mjs";
2
+ import { MuiCommercialPackageName } from "../utils/commercialPackages.mjs";
3
3
  export declare const sharedLicenseStatuses: { [packageName in MuiCommercialPackageName]?: {
4
4
  key: string | undefined;
5
5
  licenseVerifier: {
@@ -49,7 +49,8 @@ function useLicenseVerifier(packageName, releaseInfo) {
49
49
  });
50
50
  const fullPackageName = `@mui/${packageName}`;
51
51
  (0, _xTelemetry.sendMuiXTelemetryEvent)(_xTelemetry.muiXTelemetryEvents.licenseVerification({
52
- licenseKey
52
+ licenseKey,
53
+ xLicenseClientVersion: "9.0.0-alpha.2"
53
54
  }, {
54
55
  packageName,
55
56
  packageReleaseInfo: releaseInfo,
@@ -3,11 +3,11 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import { sendMuiXTelemetryEvent, muiXTelemetryEvents } from '@mui/x-telemetry';
6
- import { verifyLicense } from "../verifyLicense/verifyLicense.js";
7
- import { LicenseInfo } from "../utils/licenseInfo.js";
8
- import { showExpiredAnnualGraceLicenseKeyError, showExpiredAnnualLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError, showNotAvailableInInitialProPlanError } from "../utils/licenseErrorMessageUtils.js";
9
- import { LICENSE_STATUS } from "../utils/licenseStatus.js";
10
- import MuiLicenseInfoContext from "../Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js";
6
+ import { verifyLicense } from "../verifyLicense/verifyLicense.mjs";
7
+ import { LicenseInfo } from "../utils/licenseInfo.mjs";
8
+ import { showExpiredAnnualGraceLicenseKeyError, showExpiredAnnualLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError, showNotAvailableInInitialProPlanError } from "../utils/licenseErrorMessageUtils.mjs";
9
+ import { LICENSE_STATUS } from "../utils/licenseStatus.mjs";
10
+ import MuiLicenseInfoContext from "../Unstable_LicenseInfoProvider/MuiLicenseInfoContext.mjs";
11
11
  export const sharedLicenseStatuses = {};
12
12
 
13
13
  /**
@@ -40,7 +40,8 @@ export function useLicenseVerifier(packageName, releaseInfo) {
40
40
  });
41
41
  const fullPackageName = `@mui/${packageName}`;
42
42
  sendMuiXTelemetryEvent(muiXTelemetryEvents.licenseVerification({
43
- licenseKey
43
+ licenseKey,
44
+ xLicenseClientVersion: "9.0.0-alpha.2"
44
45
  }, {
45
46
  packageName,
46
47
  packageReleaseInfo: releaseInfo,
@@ -1 +1 @@
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';
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 +1 @@
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';
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';
@@ -0,0 +1,8 @@
1
+ export * from "./licenseErrorMessageUtils.mjs";
2
+ export * from "./licenseInfo.mjs";
3
+ export * from "./licenseStatus.mjs";
4
+ export type { AppType } from "./licenseAppType.mjs";
5
+ export type { PlanScope } from "./licensePlan.mjs";
6
+ export type { LicenseModel } from "./licenseModel.mjs";
7
+ export type { KeyVersion, LicenseDetails, NullableLicenseDetails } from "./licenseDetails.mjs";
8
+ export type { MuiCommercialPackageName } from "./commercialPackages.mjs";
package/utils/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export * from "./licenseErrorMessageUtils.js";
2
2
  export * from "./licenseInfo.js";
3
3
  export * from "./licenseStatus.js";
4
- export type { PlanScope } from "./plan.js";
4
+ export type { AppType } from "./licenseAppType.js";
5
+ export type { PlanScope } from "./licensePlan.js";
5
6
  export type { LicenseModel } from "./licenseModel.js";
7
+ export type { KeyVersion, LicenseDetails, NullableLicenseDetails } from "./licenseDetails.js";
6
8
  export type { MuiCommercialPackageName } from "./commercialPackages.js";
@@ -0,0 +1,4 @@
1
+ export * from "./licenseErrorMessageUtils.mjs";
2
+ export * from "./licenseInfo.mjs";
3
+ export * from "./licenseStatus.mjs";
4
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The supported application types for a MUI X license.
3
+ */
4
+ export declare const APP_TYPES: readonly ["single", "multi"];
5
+ /**
6
+ * The type of application the license covers.
7
+ */
8
+ export type AppType = (typeof APP_TYPES)[number];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The supported application types for a MUI X license.
3
+ */
4
+ export declare const APP_TYPES: readonly ["single", "multi"];
5
+ /**
6
+ * The type of application the license covers.
7
+ */
8
+ export type AppType = (typeof APP_TYPES)[number];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.APP_TYPES = void 0;
7
+ /**
8
+ * The supported application types for a MUI X license.
9
+ */
10
+ const APP_TYPES = exports.APP_TYPES = [/** A single application. */
11
+ 'single', /** Multiple applications. */
12
+ 'multi'];
13
+
14
+ /**
15
+ * The type of application the license covers.
16
+ */
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The supported application types for a MUI X license.
3
+ */
4
+ export const APP_TYPES = [/** A single application. */
5
+ 'single', /** Multiple applications. */
6
+ 'multi'];
7
+
8
+ /**
9
+ * The type of application the license covers.
10
+ */
@@ -0,0 +1,60 @@
1
+ import { AppType } from "./licenseAppType.mjs";
2
+ import { LicenseModel } from "./licenseModel.mjs";
3
+ import { PlanScope, PlanVersion } from "./licensePlan.mjs";
4
+ /**
5
+ * The version of the license key encoding format.
6
+ * - `1`: Legacy format.
7
+ * - `2`: Adds plan scope and license model.
8
+ * - `3`: Adds quantity and app type.
9
+ */
10
+ export type KeyVersion = 1 | 2 | 3;
11
+ /**
12
+ * The details of a MUI X license.
13
+ */
14
+ export interface LicenseDetails {
15
+ /**
16
+ * The type of application the license covers.
17
+ * - `'single'`: A single application.
18
+ * - `'multi'`: Multiple applications.
19
+ * Only available in key version 3+.
20
+ */
21
+ appType?: AppType;
22
+ /**
23
+ * The date when the license expires.
24
+ */
25
+ expiryDate: Date;
26
+ /**
27
+ * The timestamp (in milliseconds) when the license expires.
28
+ */
29
+ expiryTimestamp: number;
30
+ /**
31
+ * The license model.
32
+ * Only available in key version 2+.
33
+ */
34
+ licenseModel?: LicenseModel;
35
+ /**
36
+ * The order id associated with the license.
37
+ */
38
+ orderId: number;
39
+ /**
40
+ * The plan scope (e.g., 'pro' or 'premium').
41
+ * Only available in key version 2+.
42
+ */
43
+ planScope?: PlanScope;
44
+ /**
45
+ * The plan version (e.g., 'initial', 'Q3-2024').
46
+ */
47
+ planVersion: PlanVersion;
48
+ /**
49
+ * The number of developer seats covered by the license.
50
+ * Only available in key version 3+.
51
+ */
52
+ quantity?: number;
53
+ /**
54
+ * The version of the license key encoding format.
55
+ */
56
+ keyVersion: KeyVersion;
57
+ }
58
+ export type NullableLicenseDetails = { [K in keyof LicenseDetails]: LicenseDetails[K] | null } & {
59
+ isTestKey: boolean;
60
+ };
@@ -0,0 +1,60 @@
1
+ import { AppType } from "./licenseAppType.js";
2
+ import { LicenseModel } from "./licenseModel.js";
3
+ import { PlanScope, PlanVersion } from "./licensePlan.js";
4
+ /**
5
+ * The version of the license key encoding format.
6
+ * - `1`: Legacy format.
7
+ * - `2`: Adds plan scope and license model.
8
+ * - `3`: Adds quantity and app type.
9
+ */
10
+ export type KeyVersion = 1 | 2 | 3;
11
+ /**
12
+ * The details of a MUI X license.
13
+ */
14
+ export interface LicenseDetails {
15
+ /**
16
+ * The type of application the license covers.
17
+ * - `'single'`: A single application.
18
+ * - `'multi'`: Multiple applications.
19
+ * Only available in key version 3+.
20
+ */
21
+ appType?: AppType;
22
+ /**
23
+ * The date when the license expires.
24
+ */
25
+ expiryDate: Date;
26
+ /**
27
+ * The timestamp (in milliseconds) when the license expires.
28
+ */
29
+ expiryTimestamp: number;
30
+ /**
31
+ * The license model.
32
+ * Only available in key version 2+.
33
+ */
34
+ licenseModel?: LicenseModel;
35
+ /**
36
+ * The order id associated with the license.
37
+ */
38
+ orderId: number;
39
+ /**
40
+ * The plan scope (e.g., 'pro' or 'premium').
41
+ * Only available in key version 2+.
42
+ */
43
+ planScope?: PlanScope;
44
+ /**
45
+ * The plan version (e.g., 'initial', 'Q3-2024').
46
+ */
47
+ planVersion: PlanVersion;
48
+ /**
49
+ * The number of developer seats covered by the license.
50
+ * Only available in key version 3+.
51
+ */
52
+ quantity?: number;
53
+ /**
54
+ * The version of the license key encoding format.
55
+ */
56
+ keyVersion: KeyVersion;
57
+ }
58
+ export type NullableLicenseDetails = { [K in keyof LicenseDetails]: LicenseDetails[K] | null } & {
59
+ isTestKey: boolean;
60
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -10,6 +11,7 @@ exports.showInvalidLicenseKeyError = showInvalidLicenseKeyError;
10
11
  exports.showLicenseKeyPlanMismatchError = showLicenseKeyPlanMismatchError;
11
12
  exports.showMissingLicenseKeyError = showMissingLicenseKeyError;
12
13
  exports.showNotAvailableInInitialProPlanError = showNotAvailableInInitialProPlanError;
14
+ var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
13
15
  /**
14
16
  * Workaround for the codesadbox preview error.
15
17
  *
@@ -60,5 +62,17 @@ function showExpiredAnnualLicenseKeyError({
60
62
  licenseKey,
61
63
  expiryTimestamp
62
64
  }) {
63
- throw new Error(['MUI X: Expired license key.', '', `Your annual license key to use MUI X ${plan} in non-production environments has expired. If you are seeing this development console message, you might be close to breach the license terms by making direct or indirect changes to the frontend of an app that render a MUI X ${plan} component (more details in https://mui.com/r/x-license-annual).`, '', 'To solve the problem you can either:', '', '- Renew your license https://mui.com/r/x-get-license and use the new key', `- Stop making changes to code depending directly or indirectly on MUI X ${plan}'s APIs`, '', 'Note that your license is perpetual in production environments with any version released before your license term ends.', '', `- License key expiry timestamp: ${new Date(expiryTimestamp)}`, `- Installed license key: ${licenseKey}`, ''].join('\n'));
65
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI X: Expired license key.
66
+
67
+ Your annual license key to use MUI X ${plan} in non-production environments has expired. If you are seeing this development console message, you might be close to breach the license terms by making direct or indirect changes to the frontend of an app that render a MUI X ${plan} component (more details in https://mui.com/r/x-license-annual).
68
+
69
+ To solve the problem you can either:
70
+
71
+ - Renew your license https://mui.com/r/x-get-license and use the new key
72
+ - Stop making changes to code depending directly or indirectly on MUI X ${plan}'s APIs
73
+
74
+ Note that your license is perpetual in production environments with any version released before your license term ends.
75
+
76
+ - License key expiry timestamp: ${new Date(expiryTimestamp)}
77
+ - Installed license key: ${licenseKey}` : (0, _formatErrorMessage2.default)(187, plan, plan, plan, new Date(expiryTimestamp), licenseKey));
64
78
  }
@@ -1,3 +1,4 @@
1
+ import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
1
2
  /**
2
3
  * Workaround for the codesadbox preview error.
3
4
  *
@@ -48,5 +49,17 @@ export function showExpiredAnnualLicenseKeyError({
48
49
  licenseKey,
49
50
  expiryTimestamp
50
51
  }) {
51
- throw new Error(['MUI X: Expired license key.', '', `Your annual license key to use MUI X ${plan} in non-production environments has expired. If you are seeing this development console message, you might be close to breach the license terms by making direct or indirect changes to the frontend of an app that render a MUI X ${plan} component (more details in https://mui.com/r/x-license-annual).`, '', 'To solve the problem you can either:', '', '- Renew your license https://mui.com/r/x-get-license and use the new key', `- Stop making changes to code depending directly or indirectly on MUI X ${plan}'s APIs`, '', 'Note that your license is perpetual in production environments with any version released before your license term ends.', '', `- License key expiry timestamp: ${new Date(expiryTimestamp)}`, `- Installed license key: ${licenseKey}`, ''].join('\n'));
52
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI X: Expired license key.
53
+
54
+ Your annual license key to use MUI X ${plan} in non-production environments has expired. If you are seeing this development console message, you might be close to breach the license terms by making direct or indirect changes to the frontend of an app that render a MUI X ${plan} component (more details in https://mui.com/r/x-license-annual).
55
+
56
+ To solve the problem you can either:
57
+
58
+ - Renew your license https://mui.com/r/x-get-license and use the new key
59
+ - Stop making changes to code depending directly or indirectly on MUI X ${plan}'s APIs
60
+
61
+ Note that your license is perpetual in production environments with any version released before your license term ends.
62
+
63
+ - License key expiry timestamp: ${new Date(expiryTimestamp)}
64
+ - Installed license key: ${licenseKey}` : _formatErrorMessage(187, plan, plan, plan, new Date(expiryTimestamp), licenseKey));
52
65
  }
@@ -1,4 +1,4 @@
1
1
  export declare const PLAN_SCOPES: readonly ["pro", "premium"];
2
- export declare const PLAN_VERSIONS: readonly ["initial", "Q3-2024"];
2
+ export declare const PLAN_VERSIONS: readonly ["initial", "Q3-2024", "Q1-2026"];
3
3
  export type PlanScope = (typeof PLAN_SCOPES)[number];
4
4
  export type PlanVersion = (typeof PLAN_VERSIONS)[number];
@@ -1,4 +1,4 @@
1
1
  export declare const PLAN_SCOPES: readonly ["pro", "premium"];
2
- export declare const PLAN_VERSIONS: readonly ["initial", "Q3-2024"];
2
+ export declare const PLAN_VERSIONS: readonly ["initial", "Q3-2024", "Q1-2026"];
3
3
  export type PlanScope = (typeof PLAN_SCOPES)[number];
4
4
  export type PlanVersion = (typeof PLAN_VERSIONS)[number];
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.PLAN_VERSIONS = exports.PLAN_SCOPES = void 0;
7
7
  const PLAN_SCOPES = exports.PLAN_SCOPES = ['pro', 'premium'];
8
- const PLAN_VERSIONS = exports.PLAN_VERSIONS = ['initial', 'Q3-2024'];
8
+ const PLAN_VERSIONS = exports.PLAN_VERSIONS = ['initial', 'Q3-2024', 'Q1-2026'];
@@ -0,0 +1,2 @@
1
+ export const PLAN_SCOPES = ['pro', 'premium'];
2
+ export const PLAN_VERSIONS = ['initial', 'Q3-2024', 'Q1-2026'];
@@ -0,0 +1 @@
1
+ export * from "./verifyLicense.mjs";
@@ -0,0 +1 @@
1
+ export * from "./verifyLicense.mjs";