@mui/x-license 7.6.1 → 7.7.1
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.
- package/CHANGELOG.md +229 -0
- package/Watermark/Watermark.js +2 -0
- package/generateLicense/generateLicense.d.ts +2 -1
- package/generateLicense/generateLicense.js +2 -1
- package/index.js +1 -1
- package/modern/Watermark/Watermark.js +2 -0
- package/modern/generateLicense/generateLicense.js +2 -1
- package/modern/index.js +1 -1
- package/modern/useLicenseVerifier/useLicenseVerifier.js +8 -3
- package/modern/utils/licenseErrorMessageUtils.js +3 -0
- package/modern/utils/licenseScope.js +12 -1
- package/modern/utils/licenseStatus.js +1 -0
- package/modern/verifyLicense/verifyLicense.js +19 -5
- package/node/Watermark/Watermark.js +2 -0
- package/node/generateLicense/generateLicense.js +2 -1
- package/node/index.js +1 -1
- package/node/useLicenseVerifier/useLicenseVerifier.js +7 -2
- package/node/utils/licenseErrorMessageUtils.js +4 -0
- package/node/utils/licenseScope.js +15 -2
- package/node/utils/licenseStatus.js +1 -0
- package/node/verifyLicense/verifyLicense.js +19 -5
- package/package.json +3 -3
- package/useLicenseVerifier/useLicenseVerifier.js +8 -3
- package/utils/licenseErrorMessageUtils.d.ts +1 -0
- package/utils/licenseErrorMessageUtils.js +3 -0
- package/utils/licenseScope.d.ts +6 -0
- package/utils/licenseScope.js +12 -1
- package/utils/licenseStatus.d.ts +2 -1
- package/utils/licenseStatus.js +1 -0
- package/verifyLicense/verifyLicense.d.ts +5 -4
- package/verifyLicense/verifyLicense.js +19 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,235 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.7.1
|
|
7
|
+
|
|
8
|
+
_Jun 21, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🌍 Improve Portuguese (pt-PT) locale on the Data Grid
|
|
13
|
+
- 🌍 Improve Danish (da-DK) locale on the Date and Time Pickers
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
- 📚 Documentation improvements
|
|
16
|
+
|
|
17
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
18
|
+
|
|
19
|
+
### Data Grid
|
|
20
|
+
|
|
21
|
+
#### `@mui/x-data-grid@7.7.1`
|
|
22
|
+
|
|
23
|
+
- [DataGrid][docs] Clarify enabling pagination (#13350) @oliviertassinari
|
|
24
|
+
- [DataGrid] Fix CSV export escaping for non-string values (#13560) @joeycumines-scw
|
|
25
|
+
- [l10n] Improve Portuguese (pt-PT) locale (#13348) @joaosreis
|
|
26
|
+
|
|
27
|
+
#### `@mui/x-data-grid-pro@7.7.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
28
|
+
|
|
29
|
+
Same changes as in `@mui/x-data-grid@7.7.1`, plus:
|
|
30
|
+
|
|
31
|
+
- [DataGrid] Warn about `getTreeDataPath` reference (#13519) @cherniavskii
|
|
32
|
+
|
|
33
|
+
#### `@mui/x-data-grid-premium@7.7.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
34
|
+
|
|
35
|
+
Same changes as in `@mui/x-data-grid-pro@7.7.1`.
|
|
36
|
+
|
|
37
|
+
### Date and Time Pickers
|
|
38
|
+
|
|
39
|
+
#### `@mui/x-date-pickers@7.7.1`
|
|
40
|
+
|
|
41
|
+
- [fields] Prevent digit editing on the `Space` key down (#13510) @flaviendelangle
|
|
42
|
+
- [l10n] Improve Danish (da-DK) locale (#13375) @jacrowland1
|
|
43
|
+
- [pickers] Add context to `onAccept` callback (#13511) @flaviendelangle
|
|
44
|
+
- [pickers] Always use the same timezone in the field, the view and the layout components (#13481) @flaviendelangle
|
|
45
|
+
- [pickers] Fix `AdapterDateFnsV3` generated method types (#13464) @alexey-kozlenkov
|
|
46
|
+
- [pickers] Fix controlled `view` behavior (#13552) @LukasTy
|
|
47
|
+
- [TimePicker] Improves RTL verification for the time pickers default views (#13447) @arthurbalduini
|
|
48
|
+
|
|
49
|
+
#### `@mui/x-date-pickers-pro@7.7.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
50
|
+
|
|
51
|
+
Same changes as in `@mui/x-date-pickers@7.7.1`, plus:
|
|
52
|
+
|
|
53
|
+
- [DateRangePicker] Add accessible name to calendar grid (#13538) @LukasTy
|
|
54
|
+
|
|
55
|
+
### Charts
|
|
56
|
+
|
|
57
|
+
#### `@mui/x-charts@7.7.1`
|
|
58
|
+
|
|
59
|
+
- [charts] Divide `CartesianProvider` to use logic in Pro package (#13531) @JCQuintas
|
|
60
|
+
- [charts] Do not publish the pro package (#13539) @alexfauquette
|
|
61
|
+
- [charts] Export `Pro` versions of regular charts (#13547) @JCQuintas
|
|
62
|
+
- [charts] Prepare `ChartContainerPro` for future Zoom changes (#13532) @JCQuintas
|
|
63
|
+
- [charts] Remove unnecessary proptypes from internal component (#13518) @JCQuintas
|
|
64
|
+
|
|
65
|
+
### Tree View
|
|
66
|
+
|
|
67
|
+
#### `@mui/x-tree-view@7.7.1`
|
|
68
|
+
|
|
69
|
+
- [TreeView] Improve typing to support optional dependencies in plugins and in the item (#13523) @flaviendelangle
|
|
70
|
+
- [TreeView] Move `useTreeViewId` to the core plugins (#13566) @flaviendelangle
|
|
71
|
+
- [TreeView] Remove unused state from `useTreeViewId` (#13579) @flaviendelangle
|
|
72
|
+
- [TreeView] Support `itemId` with escaping characters when using `SimpleTreeView` (#13487) @oukunan
|
|
73
|
+
|
|
74
|
+
### Docs
|
|
75
|
+
|
|
76
|
+
- [docs] Add section about the new uncovered product watermark (#13568) @michelengelen
|
|
77
|
+
- [docs] Document the `PickerValidDate` type override (#13476) @flaviendelangle
|
|
78
|
+
- [docs] Fix typo (#13507) @anshtiwatne
|
|
79
|
+
- [docs] Remove "-" in heat-map and tree-map urls (#13569) @alexfauquette
|
|
80
|
+
- [docs] Use dedicated tab for weather dataset (#13513) @alexfauquette
|
|
81
|
+
- [x-license] license update proposal (#13459) @michelengelen
|
|
82
|
+
|
|
83
|
+
### Core
|
|
84
|
+
|
|
85
|
+
- [core] Fix failing CI test (#13574) @alexfauquette
|
|
86
|
+
- [infra] Remove explicit `@testing-library/react` dependency (#13478) @LukasTy
|
|
87
|
+
|
|
88
|
+
## 7.7.0
|
|
89
|
+
|
|
90
|
+
_Jun 13, 2024_
|
|
91
|
+
|
|
92
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
93
|
+
|
|
94
|
+
- 🎁 Allow customization of the Pickers month and the year buttons
|
|
95
|
+
- 🌍 Improve Persian (fa-IR), Portuguese (pt-PT), and Russian (ru-RU) locales on the Data Grid
|
|
96
|
+
- 🌍 Improve Korean (ko-KR) and Persian (fa-IR) locales on the Date and Time Pickers
|
|
97
|
+
- 🐞 Bugfixes
|
|
98
|
+
- 📚 Documentation improvements
|
|
99
|
+
|
|
100
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
101
|
+
|
|
102
|
+
### Data Grid
|
|
103
|
+
|
|
104
|
+
#### `@mui/x-data-grid@7.7.0`
|
|
105
|
+
|
|
106
|
+
- [DataGrid] Add `getFilterState` method (#13418) @cherniavskii
|
|
107
|
+
- [DataGrid] Do not show resize separators for column groups (#13455) @cherniavskii
|
|
108
|
+
- [l10n] Improve Persian (fa-IR) locale (#13402) @fakhamatia
|
|
109
|
+
- [l10n] Improve Portuguese (pt-PT) locale (#13384) @olavocarvalho
|
|
110
|
+
- [l10n] Improve Russian (ru-RU) locale (#11210) @dastan-akhmetov-scity
|
|
111
|
+
|
|
112
|
+
#### `@mui/x-data-grid-pro@7.7.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
113
|
+
|
|
114
|
+
Same changes as in `@mui/x-data-grid@7.7.0`, plus:
|
|
115
|
+
|
|
116
|
+
- [DataGridPro] Do not render detail panel if the focused cell is not visible (#13456) @cherniavskii
|
|
117
|
+
|
|
118
|
+
#### `@mui/x-data-grid-premium@7.7.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
119
|
+
|
|
120
|
+
Same changes as in `@mui/x-data-grid-pro@7.7.0`.
|
|
121
|
+
|
|
122
|
+
### Date and Time Pickers
|
|
123
|
+
|
|
124
|
+
#### `@mui/x-date-pickers@7.7.0`
|
|
125
|
+
|
|
126
|
+
- [l10n] Improve Korean (ko-KR) locale (#13452) @ryxxn
|
|
127
|
+
- [l10n] Improve Persian (fa-IR) locale (#13402) @fakhamatia
|
|
128
|
+
- [pickers] Allow to customize the month and the year buttons (#13321) @flaviendelangle
|
|
129
|
+
|
|
130
|
+
#### `@mui/x-date-pickers-pro@7.7.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
131
|
+
|
|
132
|
+
Same changes as in `@mui/x-date-pickers@7.7.0`.
|
|
133
|
+
|
|
134
|
+
### Charts
|
|
135
|
+
|
|
136
|
+
#### `@mui/x-charts@7.7.0`
|
|
137
|
+
|
|
138
|
+
- [charts] Add watermark on the pro `ResponsiveChartContainer` (#13398) @alexfauquette
|
|
139
|
+
- [charts] Allow to specify y-axis configuration (#13438) @alexfauquette
|
|
140
|
+
- [charts] Fix eslint for react compiler (#13444) @alexfauquette
|
|
141
|
+
- [charts] Improve themeAugmentation typing (#13433) @noraleonte
|
|
142
|
+
- [charts] Move the `ZAxisContextProvider` by default in the `ChartContainer` (#13465) @alexfauquette
|
|
143
|
+
- [charts] Use plugins to define series extremum and colors (#13397) @alexfauquette
|
|
144
|
+
|
|
145
|
+
### Tree View
|
|
146
|
+
|
|
147
|
+
#### `@mui/x-tree-view@7.7.0`
|
|
148
|
+
|
|
149
|
+
- [TreeView] Improve TypeScript for plugins (#13380) @flaviendelangle
|
|
150
|
+
- [TreeView] Improve the typing of the cancelable events (#13152) @flaviendelangle
|
|
151
|
+
- [TreeView] Prepare support for PigmentCSS (#13412) @flaviendelangle
|
|
152
|
+
- [TreeView] Refactor the tree view internals to prepare for headless API (#13311) @flaviendelangle
|
|
153
|
+
|
|
154
|
+
### Docs
|
|
155
|
+
|
|
156
|
+
- [docs] Add `renderHeader` recipe to the Master Details docs (#13370) @michelengelen
|
|
157
|
+
- [docs] Add lazy loading detail panel demo (#13453) @cherniavskii
|
|
158
|
+
- [docs] Add small edits to the Data Grid overview page (#13060) @danilo-leal
|
|
159
|
+
- [docs] Update a11y pages description (#13417) @danilo-leal
|
|
160
|
+
- [docs] improve the writing on the "Quick filter outside of the grid" example (#13155) @michelengelen
|
|
161
|
+
|
|
162
|
+
### Core
|
|
163
|
+
|
|
164
|
+
- [core] Add `eslint-plugin-react-compiler` experimental version and rules (#13415) @JCQuintas
|
|
165
|
+
- [core] Minor setup cleanup (#13467) @LukasTy
|
|
166
|
+
- [infra] Adjust CI setup (#13448) @LukasTy
|
|
167
|
+
- [test] Add tests for the custom slots of `TreeItem2` (#13314) @flaviendelangle
|
|
168
|
+
|
|
169
|
+
## 7.6.2
|
|
170
|
+
|
|
171
|
+
_Jun 6, 2024_
|
|
172
|
+
|
|
173
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
174
|
+
|
|
175
|
+
- 📚 Adds Date and Time Pickers accessibility page
|
|
176
|
+
- 🐞 Bugfixes
|
|
177
|
+
- 📚 Documentation improvements
|
|
178
|
+
|
|
179
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
180
|
+
|
|
181
|
+
### Data Grid
|
|
182
|
+
|
|
183
|
+
#### `@mui/x-data-grid@7.6.2`
|
|
184
|
+
|
|
185
|
+
- [DataGrid] Add the `areElementSizesEqual` utility to improve code readability (#13254) @layerok
|
|
186
|
+
- [DataGrid] Clean up IE remnants from the codebase (#13390) @MBilalShafi
|
|
187
|
+
|
|
188
|
+
#### `@mui/x-data-grid-pro@7.6.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
189
|
+
|
|
190
|
+
Same changes as in `@mui/x-data-grid@7.6.2`.
|
|
191
|
+
|
|
192
|
+
#### `@mui/x-data-grid-premium@7.6.2` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
193
|
+
|
|
194
|
+
Same changes as in `@mui/x-data-grid-pro@7.6.2`.
|
|
195
|
+
|
|
196
|
+
### Date and Time Pickers
|
|
197
|
+
|
|
198
|
+
#### `@mui/x-date-pickers@7.6.2`
|
|
199
|
+
|
|
200
|
+
- [fields] Fix `PageUp` and `PageDown` editing on letter sections (#13310) @arthurbalduini
|
|
201
|
+
- [pickers] Fix `AdapterDayjs` timezone behavior (#13362) @LukasTy
|
|
202
|
+
- [pickers] Use `useRtl` instead of `useTheme` to access direction (#13363) @flaviendelangle
|
|
203
|
+
|
|
204
|
+
#### `@mui/x-date-pickers-pro@7.6.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
205
|
+
|
|
206
|
+
Same changes as in `@mui/x-date-pickers@7.6.2`.
|
|
207
|
+
|
|
208
|
+
### Charts
|
|
209
|
+
|
|
210
|
+
#### `@mui/x-charts@7.6.2`
|
|
211
|
+
|
|
212
|
+
- [charts] Add `Initializable` type and behaviour to allow checking if a complex context has been initialized. (#13365) @JCQuintas
|
|
213
|
+
- [charts] Fix some props not working in `xAxis` and `yAxis` (#13372) @Valyok26
|
|
214
|
+
- [charts] Harmonize charts types (#13366) @alexfauquette
|
|
215
|
+
- [charts] Introduce plugins system (#13367) @alexfauquette
|
|
216
|
+
- [charts] Simplify plugin types (#13396) @JCQuintas
|
|
217
|
+
|
|
218
|
+
### Docs
|
|
219
|
+
|
|
220
|
+
- [docs] Add badges like in Material UI @oliviertassinari
|
|
221
|
+
- [docs] Update twitter.com to x.com @oliviertassinari
|
|
222
|
+
- [docs] Fix the description of `tickInterval` (#13355) @alexfauquette
|
|
223
|
+
- [docs] Adjust the code example for `quickFilterValues` (#12919) @michelengelen
|
|
224
|
+
- [docs] Create Pickers accessibility page (#13274) @arthurbalduini
|
|
225
|
+
|
|
226
|
+
### Core
|
|
227
|
+
|
|
228
|
+
- [core] Comment on `CSS.escape` for the future @oliviertassinari
|
|
229
|
+
- [core] Fix `l10n` action setup (#13382) @LukasTy
|
|
230
|
+
- [core] Fixes in preparation for React 18.3 (#13378) @LukasTy
|
|
231
|
+
- [core] Remove explicit `marked` dependency (#13383) @LukasTy
|
|
232
|
+
- [core] Remove unused `@types/prettier` dependency (#13389) @LukasTy
|
|
233
|
+
- [core] Add `docs/.env.local` to `.gitignore` (#13377) @KenanYusuf
|
|
234
|
+
|
|
6
235
|
## 7.6.1
|
|
7
236
|
|
|
8
237
|
_May 31, 2024_
|
package/Watermark/Watermark.js
CHANGED
|
@@ -13,6 +13,8 @@ function getLicenseErrorMessage(licenseStatus) {
|
|
|
13
13
|
return 'MUI X Invalid license key';
|
|
14
14
|
case LICENSE_STATUS.OutOfScope:
|
|
15
15
|
return 'MUI X License key plan mismatch';
|
|
16
|
+
case LICENSE_STATUS.NotAvailableInInitialProPlan:
|
|
17
|
+
return 'MUI X Product not covered by plan';
|
|
16
18
|
case LICENSE_STATUS.NotFound:
|
|
17
19
|
return 'MUI X Missing license key';
|
|
18
20
|
default:
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { LicenseScope } from '../utils/licenseScope';
|
|
1
|
+
import { LicenseScope, PlanVersion } from '../utils/licenseScope';
|
|
2
2
|
import { LicensingModel } from '../utils/licensingModel';
|
|
3
3
|
export interface LicenseDetails {
|
|
4
4
|
orderNumber: string;
|
|
5
5
|
expiryDate: Date;
|
|
6
6
|
scope: LicenseScope;
|
|
7
7
|
licensingModel: LicensingModel;
|
|
8
|
+
planVersion: PlanVersion;
|
|
8
9
|
}
|
|
9
10
|
export declare function generateLicense(details: LicenseDetails): string;
|
|
@@ -10,7 +10,8 @@ function getClearLicenseString(details) {
|
|
|
10
10
|
if (details.licensingModel && !LICENSING_MODELS.includes(details.licensingModel)) {
|
|
11
11
|
throw new Error('MUI X: Invalid licensing model');
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
const keyParts = [`O=${details.orderNumber}`, `E=${details.expiryDate.getTime()}`, `S=${details.scope}`, `LM=${details.licensingModel}`, `PV=${details.planVersion}`, `KV=${licenseVersion}`];
|
|
14
|
+
return keyParts.join(',');
|
|
14
15
|
}
|
|
15
16
|
export function generateLicense(details) {
|
|
16
17
|
const licenseStr = getClearLicenseString(details);
|
package/index.js
CHANGED
|
@@ -13,6 +13,8 @@ function getLicenseErrorMessage(licenseStatus) {
|
|
|
13
13
|
return 'MUI X Invalid license key';
|
|
14
14
|
case LICENSE_STATUS.OutOfScope:
|
|
15
15
|
return 'MUI X License key plan mismatch';
|
|
16
|
+
case LICENSE_STATUS.NotAvailableInInitialProPlan:
|
|
17
|
+
return 'MUI X Product not covered by plan';
|
|
16
18
|
case LICENSE_STATUS.NotFound:
|
|
17
19
|
return 'MUI X Missing license key';
|
|
18
20
|
default:
|
|
@@ -10,7 +10,8 @@ function getClearLicenseString(details) {
|
|
|
10
10
|
if (details.licensingModel && !LICENSING_MODELS.includes(details.licensingModel)) {
|
|
11
11
|
throw new Error('MUI X: Invalid licensing model');
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
const keyParts = [`O=${details.orderNumber}`, `E=${details.expiryDate.getTime()}`, `S=${details.scope}`, `LM=${details.licensingModel}`, `PV=${details.planVersion}`, `KV=${licenseVersion}`];
|
|
14
|
+
return keyParts.join(',');
|
|
14
15
|
}
|
|
15
16
|
export function generateLicense(details) {
|
|
16
17
|
const licenseStr = getClearLicenseString(details);
|
package/modern/index.js
CHANGED
|
@@ -2,8 +2,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { verifyLicense } from '../verifyLicense/verifyLicense';
|
|
4
4
|
import { LicenseInfo } from '../utils/licenseInfo';
|
|
5
|
-
import { showExpiredAnnualGraceLicenseKeyError, showExpiredAnnualLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError } from '../utils/licenseErrorMessageUtils';
|
|
5
|
+
import { showExpiredAnnualGraceLicenseKeyError, showExpiredAnnualLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError, showNotAvailableInInitialProPlanError } from '../utils/licenseErrorMessageUtils';
|
|
6
6
|
import { LICENSE_STATUS } from '../utils/licenseStatus';
|
|
7
|
+
import { extractAcceptedScopes, extractProductScope } from '../utils/licenseScope';
|
|
7
8
|
import MuiLicenseInfoContext from '../Unstable_LicenseInfoProvider/MuiLicenseInfoContext';
|
|
8
9
|
export const sharedLicenseStatuses = {};
|
|
9
10
|
export function useLicenseVerifier(packageName, releaseInfo) {
|
|
@@ -17,18 +18,22 @@ export function useLicenseVerifier(packageName, releaseInfo) {
|
|
|
17
18
|
if (sharedLicenseStatuses[packageName] && sharedLicenseStatuses[packageName].key === licenseKey) {
|
|
18
19
|
return sharedLicenseStatuses[packageName].licenseVerifier;
|
|
19
20
|
}
|
|
20
|
-
const acceptedScopes = packageName
|
|
21
|
+
const acceptedScopes = extractAcceptedScopes(packageName);
|
|
22
|
+
const productScope = extractProductScope(packageName);
|
|
21
23
|
const plan = packageName.includes('premium') ? 'Premium' : 'Pro';
|
|
22
24
|
const licenseStatus = verifyLicense({
|
|
23
25
|
releaseInfo,
|
|
24
26
|
licenseKey,
|
|
25
|
-
acceptedScopes
|
|
27
|
+
acceptedScopes,
|
|
28
|
+
productScope
|
|
26
29
|
});
|
|
27
30
|
const fullPackageName = `@mui/${packageName}`;
|
|
28
31
|
if (licenseStatus.status === LICENSE_STATUS.Valid) {
|
|
29
32
|
// Skip
|
|
30
33
|
} else if (licenseStatus.status === LICENSE_STATUS.Invalid) {
|
|
31
34
|
showInvalidLicenseKeyError();
|
|
35
|
+
} else if (licenseStatus.status === LICENSE_STATUS.NotAvailableInInitialProPlan) {
|
|
36
|
+
showNotAvailableInInitialProPlanError();
|
|
32
37
|
} else if (licenseStatus.status === LICENSE_STATUS.OutOfScope) {
|
|
33
38
|
showLicenseKeyPlanMismatchError();
|
|
34
39
|
} else if (licenseStatus.status === LICENSE_STATUS.NotFound) {
|
|
@@ -7,6 +7,9 @@ export function showInvalidLicenseKeyError() {
|
|
|
7
7
|
export function showLicenseKeyPlanMismatchError() {
|
|
8
8
|
showError(['MUI X: License key plan mismatch.', '', 'Your use of MUI X is not compatible with the plan of your license key. The feature you are trying to use is not included in the plan of your license key. This happens if you try to use `DataGridPremium` with a license key for the Pro plan.', '', 'To solve the issue, you can upgrade your plan from Pro to Premium at https://mui.com/r/x-get-license?scope=premium.', "Of if you didn't intend to use Premium features, you can replace the import of `@mui/x-data-grid-premium` with `@mui/x-data-grid-pro`."]);
|
|
9
9
|
}
|
|
10
|
+
export function showNotAvailableInInitialProPlanError() {
|
|
11
|
+
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.']);
|
|
12
|
+
}
|
|
10
13
|
export function showMissingLicenseKeyError({
|
|
11
14
|
plan,
|
|
12
15
|
packageName
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
export const LICENSE_SCOPES = ['pro', 'premium'];
|
|
1
|
+
export const LICENSE_SCOPES = ['pro', 'premium'];
|
|
2
|
+
export const PRODUCT_SCOPES = ['data-grid', 'date-pickers', 'charts', 'tree-view'];
|
|
3
|
+
export const PLAN_VERSIONS = ['initial', 'Q3-2024'];
|
|
4
|
+
export const extractProductScope = packageName => {
|
|
5
|
+
// extract the part between "x-" and "-pro"/"-premium"
|
|
6
|
+
const regex = /x-(.*?)(-pro|-premium)?$/;
|
|
7
|
+
const match = packageName.match(regex);
|
|
8
|
+
return match[1];
|
|
9
|
+
};
|
|
10
|
+
export const extractAcceptedScopes = packageName => {
|
|
11
|
+
return packageName.includes('premium') ? LICENSE_SCOPES.filter(scope => scope.includes('premium')) : LICENSE_SCOPES;
|
|
12
|
+
};
|
|
@@ -7,5 +7,6 @@ export let LICENSE_STATUS = /*#__PURE__*/function (LICENSE_STATUS) {
|
|
|
7
7
|
LICENSE_STATUS["ExpiredVersion"] = "ExpiredVersion";
|
|
8
8
|
LICENSE_STATUS["Valid"] = "Valid";
|
|
9
9
|
LICENSE_STATUS["OutOfScope"] = "OutOfScope";
|
|
10
|
+
LICENSE_STATUS["NotAvailableInInitialProPlan"] = "NotAvailableInInitialProPlan";
|
|
10
11
|
return LICENSE_STATUS;
|
|
11
12
|
}({});
|
|
@@ -28,18 +28,20 @@ const decodeLicenseVersion1 = license => {
|
|
|
28
28
|
return {
|
|
29
29
|
scope: 'pro',
|
|
30
30
|
licensingModel: 'perpetual',
|
|
31
|
-
expiryTimestamp
|
|
31
|
+
expiryTimestamp,
|
|
32
|
+
planVersion: 'initial'
|
|
32
33
|
};
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
|
-
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},KV=2`;
|
|
37
|
+
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},PV=${planVersion},KV=2`;
|
|
37
38
|
*/
|
|
38
39
|
const decodeLicenseVersion2 = license => {
|
|
39
40
|
const licenseInfo = {
|
|
40
41
|
scope: null,
|
|
41
42
|
licensingModel: null,
|
|
42
|
-
expiryTimestamp: null
|
|
43
|
+
expiryTimestamp: null,
|
|
44
|
+
planVersion: 'initial'
|
|
43
45
|
};
|
|
44
46
|
license.split(',').map(token => token.split('=')).filter(el => el.length === 2).forEach(([key, value]) => {
|
|
45
47
|
if (key === 'S') {
|
|
@@ -54,6 +56,9 @@ const decodeLicenseVersion2 = license => {
|
|
|
54
56
|
licenseInfo.expiryTimestamp = expiryTimestamp;
|
|
55
57
|
}
|
|
56
58
|
}
|
|
59
|
+
if (key === 'PV') {
|
|
60
|
+
licenseInfo.planVersion = value;
|
|
61
|
+
}
|
|
57
62
|
});
|
|
58
63
|
return licenseInfo;
|
|
59
64
|
};
|
|
@@ -74,7 +79,8 @@ const decodeLicense = encodedLicense => {
|
|
|
74
79
|
export function verifyLicense({
|
|
75
80
|
releaseInfo,
|
|
76
81
|
licenseKey,
|
|
77
|
-
acceptedScopes
|
|
82
|
+
acceptedScopes,
|
|
83
|
+
productScope
|
|
78
84
|
}) {
|
|
79
85
|
if (!releaseInfo) {
|
|
80
86
|
throw new Error('MUI X: The release information is missing. Not able to validate license.');
|
|
@@ -143,11 +149,19 @@ export function verifyLicense({
|
|
|
143
149
|
}
|
|
144
150
|
}
|
|
145
151
|
if (license.scope == null || !LICENSE_SCOPES.includes(license.scope)) {
|
|
146
|
-
console.error('Error checking license. scope not found or invalid!');
|
|
152
|
+
console.error('MUI X: Error checking license. scope not found or invalid!');
|
|
147
153
|
return {
|
|
148
154
|
status: LICENSE_STATUS.Invalid
|
|
149
155
|
};
|
|
150
156
|
}
|
|
157
|
+
if (license.planVersion === 'initial') {
|
|
158
|
+
// 'charts-pro' or 'tree-view-pro' can only be used with a newer license
|
|
159
|
+
if (productScope === 'charts' || productScope === 'tree-view') {
|
|
160
|
+
return {
|
|
161
|
+
status: LICENSE_STATUS.NotAvailableInInitialProPlan
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
151
165
|
if (!acceptedScopes.includes(license.scope)) {
|
|
152
166
|
return {
|
|
153
167
|
status: LICENSE_STATUS.OutOfScope
|
|
@@ -21,6 +21,8 @@ function getLicenseErrorMessage(licenseStatus) {
|
|
|
21
21
|
return 'MUI X Invalid license key';
|
|
22
22
|
case _licenseStatus.LICENSE_STATUS.OutOfScope:
|
|
23
23
|
return 'MUI X License key plan mismatch';
|
|
24
|
+
case _licenseStatus.LICENSE_STATUS.NotAvailableInInitialProPlan:
|
|
25
|
+
return 'MUI X Product not covered by plan';
|
|
24
26
|
case _licenseStatus.LICENSE_STATUS.NotFound:
|
|
25
27
|
return 'MUI X Missing license key';
|
|
26
28
|
default:
|
|
@@ -16,7 +16,8 @@ function getClearLicenseString(details) {
|
|
|
16
16
|
if (details.licensingModel && !_licensingModel.LICENSING_MODELS.includes(details.licensingModel)) {
|
|
17
17
|
throw new Error('MUI X: Invalid licensing model');
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
const keyParts = [`O=${details.orderNumber}`, `E=${details.expiryDate.getTime()}`, `S=${details.scope}`, `LM=${details.licensingModel}`, `PV=${details.planVersion}`, `KV=${licenseVersion}`];
|
|
20
|
+
return keyParts.join(',');
|
|
20
21
|
}
|
|
21
22
|
function generateLicense(details) {
|
|
22
23
|
const licenseStr = getClearLicenseString(details);
|
package/node/index.js
CHANGED
|
@@ -12,6 +12,7 @@ var _verifyLicense = require("../verifyLicense/verifyLicense");
|
|
|
12
12
|
var _licenseInfo = require("../utils/licenseInfo");
|
|
13
13
|
var _licenseErrorMessageUtils = require("../utils/licenseErrorMessageUtils");
|
|
14
14
|
var _licenseStatus = require("../utils/licenseStatus");
|
|
15
|
+
var _licenseScope = require("../utils/licenseScope");
|
|
15
16
|
var _MuiLicenseInfoContext = _interopRequireDefault(require("../Unstable_LicenseInfoProvider/MuiLicenseInfoContext"));
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -27,18 +28,22 @@ function useLicenseVerifier(packageName, releaseInfo) {
|
|
|
27
28
|
if (sharedLicenseStatuses[packageName] && sharedLicenseStatuses[packageName].key === licenseKey) {
|
|
28
29
|
return sharedLicenseStatuses[packageName].licenseVerifier;
|
|
29
30
|
}
|
|
30
|
-
const acceptedScopes =
|
|
31
|
+
const acceptedScopes = (0, _licenseScope.extractAcceptedScopes)(packageName);
|
|
32
|
+
const productScope = (0, _licenseScope.extractProductScope)(packageName);
|
|
31
33
|
const plan = packageName.includes('premium') ? 'Premium' : 'Pro';
|
|
32
34
|
const licenseStatus = (0, _verifyLicense.verifyLicense)({
|
|
33
35
|
releaseInfo,
|
|
34
36
|
licenseKey,
|
|
35
|
-
acceptedScopes
|
|
37
|
+
acceptedScopes,
|
|
38
|
+
productScope
|
|
36
39
|
});
|
|
37
40
|
const fullPackageName = `@mui/${packageName}`;
|
|
38
41
|
if (licenseStatus.status === _licenseStatus.LICENSE_STATUS.Valid) {
|
|
39
42
|
// Skip
|
|
40
43
|
} else if (licenseStatus.status === _licenseStatus.LICENSE_STATUS.Invalid) {
|
|
41
44
|
(0, _licenseErrorMessageUtils.showInvalidLicenseKeyError)();
|
|
45
|
+
} else if (licenseStatus.status === _licenseStatus.LICENSE_STATUS.NotAvailableInInitialProPlan) {
|
|
46
|
+
(0, _licenseErrorMessageUtils.showNotAvailableInInitialProPlanError)();
|
|
42
47
|
} else if (licenseStatus.status === _licenseStatus.LICENSE_STATUS.OutOfScope) {
|
|
43
48
|
(0, _licenseErrorMessageUtils.showLicenseKeyPlanMismatchError)();
|
|
44
49
|
} else if (licenseStatus.status === _licenseStatus.LICENSE_STATUS.NotFound) {
|
|
@@ -9,6 +9,7 @@ exports.showExpiredPackageVersionError = showExpiredPackageVersionError;
|
|
|
9
9
|
exports.showInvalidLicenseKeyError = showInvalidLicenseKeyError;
|
|
10
10
|
exports.showLicenseKeyPlanMismatchError = showLicenseKeyPlanMismatchError;
|
|
11
11
|
exports.showMissingLicenseKeyError = showMissingLicenseKeyError;
|
|
12
|
+
exports.showNotAvailableInInitialProPlanError = showNotAvailableInInitialProPlanError;
|
|
12
13
|
function showError(message) {
|
|
13
14
|
console.error(['*************************************************************', '', ...message, '', '*************************************************************'].join('\n'));
|
|
14
15
|
}
|
|
@@ -18,6 +19,9 @@ function showInvalidLicenseKeyError() {
|
|
|
18
19
|
function showLicenseKeyPlanMismatchError() {
|
|
19
20
|
showError(['MUI X: License key plan mismatch.', '', 'Your use of MUI X is not compatible with the plan of your license key. The feature you are trying to use is not included in the plan of your license key. This happens if you try to use `DataGridPremium` with a license key for the Pro plan.', '', 'To solve the issue, you can upgrade your plan from Pro to Premium at https://mui.com/r/x-get-license?scope=premium.', "Of if you didn't intend to use Premium features, you can replace the import of `@mui/x-data-grid-premium` with `@mui/x-data-grid-pro`."]);
|
|
20
21
|
}
|
|
22
|
+
function showNotAvailableInInitialProPlanError() {
|
|
23
|
+
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.']);
|
|
24
|
+
}
|
|
21
25
|
function showMissingLicenseKeyError({
|
|
22
26
|
plan,
|
|
23
27
|
packageName
|
|
@@ -3,5 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.LICENSE_SCOPES = void 0;
|
|
7
|
-
const LICENSE_SCOPES = exports.LICENSE_SCOPES = ['pro', 'premium'];
|
|
6
|
+
exports.extractProductScope = exports.extractAcceptedScopes = exports.PRODUCT_SCOPES = exports.PLAN_VERSIONS = exports.LICENSE_SCOPES = void 0;
|
|
7
|
+
const LICENSE_SCOPES = exports.LICENSE_SCOPES = ['pro', 'premium'];
|
|
8
|
+
const PRODUCT_SCOPES = exports.PRODUCT_SCOPES = ['data-grid', 'date-pickers', 'charts', 'tree-view'];
|
|
9
|
+
const PLAN_VERSIONS = exports.PLAN_VERSIONS = ['initial', 'Q3-2024'];
|
|
10
|
+
const extractProductScope = packageName => {
|
|
11
|
+
// extract the part between "x-" and "-pro"/"-premium"
|
|
12
|
+
const regex = /x-(.*?)(-pro|-premium)?$/;
|
|
13
|
+
const match = packageName.match(regex);
|
|
14
|
+
return match[1];
|
|
15
|
+
};
|
|
16
|
+
exports.extractProductScope = extractProductScope;
|
|
17
|
+
const extractAcceptedScopes = packageName => {
|
|
18
|
+
return packageName.includes('premium') ? LICENSE_SCOPES.filter(scope => scope.includes('premium')) : LICENSE_SCOPES;
|
|
19
|
+
};
|
|
20
|
+
exports.extractAcceptedScopes = extractAcceptedScopes;
|
|
@@ -13,5 +13,6 @@ let LICENSE_STATUS = exports.LICENSE_STATUS = /*#__PURE__*/function (LICENSE_STA
|
|
|
13
13
|
LICENSE_STATUS["ExpiredVersion"] = "ExpiredVersion";
|
|
14
14
|
LICENSE_STATUS["Valid"] = "Valid";
|
|
15
15
|
LICENSE_STATUS["OutOfScope"] = "OutOfScope";
|
|
16
|
+
LICENSE_STATUS["NotAvailableInInitialProPlan"] = "NotAvailableInInitialProPlan";
|
|
16
17
|
return LICENSE_STATUS;
|
|
17
18
|
}({});
|
|
@@ -35,18 +35,20 @@ const decodeLicenseVersion1 = license => {
|
|
|
35
35
|
return {
|
|
36
36
|
scope: 'pro',
|
|
37
37
|
licensingModel: 'perpetual',
|
|
38
|
-
expiryTimestamp
|
|
38
|
+
expiryTimestamp,
|
|
39
|
+
planVersion: 'initial'
|
|
39
40
|
};
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
|
-
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},KV=2`;
|
|
44
|
+
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},PV=${planVersion},KV=2`;
|
|
44
45
|
*/
|
|
45
46
|
const decodeLicenseVersion2 = license => {
|
|
46
47
|
const licenseInfo = {
|
|
47
48
|
scope: null,
|
|
48
49
|
licensingModel: null,
|
|
49
|
-
expiryTimestamp: null
|
|
50
|
+
expiryTimestamp: null,
|
|
51
|
+
planVersion: 'initial'
|
|
50
52
|
};
|
|
51
53
|
license.split(',').map(token => token.split('=')).filter(el => el.length === 2).forEach(([key, value]) => {
|
|
52
54
|
if (key === 'S') {
|
|
@@ -61,6 +63,9 @@ const decodeLicenseVersion2 = license => {
|
|
|
61
63
|
licenseInfo.expiryTimestamp = expiryTimestamp;
|
|
62
64
|
}
|
|
63
65
|
}
|
|
66
|
+
if (key === 'PV') {
|
|
67
|
+
licenseInfo.planVersion = value;
|
|
68
|
+
}
|
|
64
69
|
});
|
|
65
70
|
return licenseInfo;
|
|
66
71
|
};
|
|
@@ -81,7 +86,8 @@ const decodeLicense = encodedLicense => {
|
|
|
81
86
|
function verifyLicense({
|
|
82
87
|
releaseInfo,
|
|
83
88
|
licenseKey,
|
|
84
|
-
acceptedScopes
|
|
89
|
+
acceptedScopes,
|
|
90
|
+
productScope
|
|
85
91
|
}) {
|
|
86
92
|
if (!releaseInfo) {
|
|
87
93
|
throw new Error('MUI X: The release information is missing. Not able to validate license.');
|
|
@@ -150,11 +156,19 @@ function verifyLicense({
|
|
|
150
156
|
}
|
|
151
157
|
}
|
|
152
158
|
if (license.scope == null || !_licenseScope.LICENSE_SCOPES.includes(license.scope)) {
|
|
153
|
-
console.error('Error checking license. scope not found or invalid!');
|
|
159
|
+
console.error('MUI X: Error checking license. scope not found or invalid!');
|
|
154
160
|
return {
|
|
155
161
|
status: _licenseStatus.LICENSE_STATUS.Invalid
|
|
156
162
|
};
|
|
157
163
|
}
|
|
164
|
+
if (license.planVersion === 'initial') {
|
|
165
|
+
// 'charts-pro' or 'tree-view-pro' can only be used with a newer license
|
|
166
|
+
if (productScope === 'charts' || productScope === 'tree-view') {
|
|
167
|
+
return {
|
|
168
|
+
status: _licenseStatus.LICENSE_STATUS.NotAvailableInInitialProPlan
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}
|
|
158
172
|
if (!acceptedScopes.includes(license.scope)) {
|
|
159
173
|
return {
|
|
160
174
|
status: _licenseStatus.LICENSE_STATUS.OutOfScope
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-license",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.1",
|
|
4
4
|
"description": "MUI X License verification",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"directory": "packages/x-license"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@babel/runtime": "^7.24.
|
|
28
|
-
"@mui/utils": "^5.15.
|
|
27
|
+
"@babel/runtime": "^7.24.7",
|
|
28
|
+
"@mui/utils": "^5.15.20"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "^17.0.0 || ^18.0.0"
|
|
@@ -2,8 +2,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { verifyLicense } from '../verifyLicense/verifyLicense';
|
|
4
4
|
import { LicenseInfo } from '../utils/licenseInfo';
|
|
5
|
-
import { showExpiredAnnualGraceLicenseKeyError, showExpiredAnnualLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError } from '../utils/licenseErrorMessageUtils';
|
|
5
|
+
import { showExpiredAnnualGraceLicenseKeyError, showExpiredAnnualLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError, showNotAvailableInInitialProPlanError } from '../utils/licenseErrorMessageUtils';
|
|
6
6
|
import { LICENSE_STATUS } from '../utils/licenseStatus';
|
|
7
|
+
import { extractAcceptedScopes, extractProductScope } from '../utils/licenseScope';
|
|
7
8
|
import MuiLicenseInfoContext from '../Unstable_LicenseInfoProvider/MuiLicenseInfoContext';
|
|
8
9
|
export const sharedLicenseStatuses = {};
|
|
9
10
|
export function useLicenseVerifier(packageName, releaseInfo) {
|
|
@@ -17,18 +18,22 @@ export function useLicenseVerifier(packageName, releaseInfo) {
|
|
|
17
18
|
if (sharedLicenseStatuses[packageName] && sharedLicenseStatuses[packageName].key === licenseKey) {
|
|
18
19
|
return sharedLicenseStatuses[packageName].licenseVerifier;
|
|
19
20
|
}
|
|
20
|
-
const acceptedScopes = packageName
|
|
21
|
+
const acceptedScopes = extractAcceptedScopes(packageName);
|
|
22
|
+
const productScope = extractProductScope(packageName);
|
|
21
23
|
const plan = packageName.includes('premium') ? 'Premium' : 'Pro';
|
|
22
24
|
const licenseStatus = verifyLicense({
|
|
23
25
|
releaseInfo,
|
|
24
26
|
licenseKey,
|
|
25
|
-
acceptedScopes
|
|
27
|
+
acceptedScopes,
|
|
28
|
+
productScope
|
|
26
29
|
});
|
|
27
30
|
const fullPackageName = `@mui/${packageName}`;
|
|
28
31
|
if (licenseStatus.status === LICENSE_STATUS.Valid) {
|
|
29
32
|
// Skip
|
|
30
33
|
} else if (licenseStatus.status === LICENSE_STATUS.Invalid) {
|
|
31
34
|
showInvalidLicenseKeyError();
|
|
35
|
+
} else if (licenseStatus.status === LICENSE_STATUS.NotAvailableInInitialProPlan) {
|
|
36
|
+
showNotAvailableInInitialProPlanError();
|
|
32
37
|
} else if (licenseStatus.status === LICENSE_STATUS.OutOfScope) {
|
|
33
38
|
showLicenseKeyPlanMismatchError();
|
|
34
39
|
} else if (licenseStatus.status === LICENSE_STATUS.NotFound) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare function showInvalidLicenseKeyError(): void;
|
|
2
2
|
export declare function showLicenseKeyPlanMismatchError(): void;
|
|
3
|
+
export declare function showNotAvailableInInitialProPlanError(): void;
|
|
3
4
|
export declare function showMissingLicenseKeyError({ plan, packageName, }: {
|
|
4
5
|
plan: string;
|
|
5
6
|
packageName: string;
|
|
@@ -7,6 +7,9 @@ export function showInvalidLicenseKeyError() {
|
|
|
7
7
|
export function showLicenseKeyPlanMismatchError() {
|
|
8
8
|
showError(['MUI X: License key plan mismatch.', '', 'Your use of MUI X is not compatible with the plan of your license key. The feature you are trying to use is not included in the plan of your license key. This happens if you try to use `DataGridPremium` with a license key for the Pro plan.', '', 'To solve the issue, you can upgrade your plan from Pro to Premium at https://mui.com/r/x-get-license?scope=premium.', "Of if you didn't intend to use Premium features, you can replace the import of `@mui/x-data-grid-premium` with `@mui/x-data-grid-pro`."]);
|
|
9
9
|
}
|
|
10
|
+
export function showNotAvailableInInitialProPlanError() {
|
|
11
|
+
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.']);
|
|
12
|
+
}
|
|
10
13
|
export function showMissingLicenseKeyError({
|
|
11
14
|
plan,
|
|
12
15
|
packageName
|
package/utils/licenseScope.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export declare const LICENSE_SCOPES: readonly ["pro", "premium"];
|
|
2
|
+
export declare const PRODUCT_SCOPES: readonly ["data-grid", "date-pickers", "charts", "tree-view"];
|
|
3
|
+
export declare const PLAN_VERSIONS: readonly ["initial", "Q3-2024"];
|
|
2
4
|
export type LicenseScope = (typeof LICENSE_SCOPES)[number];
|
|
5
|
+
export type ProductScope = (typeof PRODUCT_SCOPES)[number];
|
|
6
|
+
export type PlanVersion = (typeof PLAN_VERSIONS)[number];
|
|
7
|
+
export declare const extractProductScope: (packageName: string) => ProductScope;
|
|
8
|
+
export declare const extractAcceptedScopes: (packageName: string) => readonly LicenseScope[];
|
package/utils/licenseScope.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
export const LICENSE_SCOPES = ['pro', 'premium'];
|
|
1
|
+
export const LICENSE_SCOPES = ['pro', 'premium'];
|
|
2
|
+
export const PRODUCT_SCOPES = ['data-grid', 'date-pickers', 'charts', 'tree-view'];
|
|
3
|
+
export const PLAN_VERSIONS = ['initial', 'Q3-2024'];
|
|
4
|
+
export const extractProductScope = packageName => {
|
|
5
|
+
// extract the part between "x-" and "-pro"/"-premium"
|
|
6
|
+
const regex = /x-(.*?)(-pro|-premium)?$/;
|
|
7
|
+
const match = packageName.match(regex);
|
|
8
|
+
return match[1];
|
|
9
|
+
};
|
|
10
|
+
export const extractAcceptedScopes = packageName => {
|
|
11
|
+
return packageName.includes('premium') ? LICENSE_SCOPES.filter(scope => scope.includes('premium')) : LICENSE_SCOPES;
|
|
12
|
+
};
|
package/utils/licenseStatus.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare enum LICENSE_STATUS {
|
|
|
5
5
|
ExpiredAnnualGrace = "ExpiredAnnualGrace",
|
|
6
6
|
ExpiredVersion = "ExpiredVersion",
|
|
7
7
|
Valid = "Valid",
|
|
8
|
-
OutOfScope = "OutOfScope"
|
|
8
|
+
OutOfScope = "OutOfScope",
|
|
9
|
+
NotAvailableInInitialProPlan = "NotAvailableInInitialProPlan"
|
|
9
10
|
}
|
|
10
11
|
export type LicenseStatus = keyof typeof LICENSE_STATUS;
|
package/utils/licenseStatus.js
CHANGED
|
@@ -7,5 +7,6 @@ export let LICENSE_STATUS = /*#__PURE__*/function (LICENSE_STATUS) {
|
|
|
7
7
|
LICENSE_STATUS["ExpiredVersion"] = "ExpiredVersion";
|
|
8
8
|
LICENSE_STATUS["Valid"] = "Valid";
|
|
9
9
|
LICENSE_STATUS["OutOfScope"] = "OutOfScope";
|
|
10
|
+
LICENSE_STATUS["NotAvailableInInitialProPlan"] = "NotAvailableInInitialProPlan";
|
|
10
11
|
return LICENSE_STATUS;
|
|
11
12
|
}({});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { LicenseStatus } from '../utils/licenseStatus';
|
|
2
|
-
import { LicenseScope } from '../utils/licenseScope';
|
|
2
|
+
import { LicenseScope, ProductScope } from '../utils/licenseScope';
|
|
3
3
|
export declare function generateReleaseInfo(releaseDate?: Date): string;
|
|
4
|
-
export declare function verifyLicense({ releaseInfo, licenseKey, acceptedScopes, }: {
|
|
4
|
+
export declare function verifyLicense({ releaseInfo, licenseKey, acceptedScopes, productScope, }: {
|
|
5
5
|
releaseInfo: string;
|
|
6
|
-
licenseKey
|
|
7
|
-
acceptedScopes: LicenseScope[];
|
|
6
|
+
licenseKey?: string;
|
|
7
|
+
acceptedScopes: readonly LicenseScope[];
|
|
8
|
+
productScope: ProductScope;
|
|
8
9
|
}): {
|
|
9
10
|
status: LicenseStatus;
|
|
10
11
|
meta?: any;
|
|
@@ -28,18 +28,20 @@ const decodeLicenseVersion1 = license => {
|
|
|
28
28
|
return {
|
|
29
29
|
scope: 'pro',
|
|
30
30
|
licensingModel: 'perpetual',
|
|
31
|
-
expiryTimestamp
|
|
31
|
+
expiryTimestamp,
|
|
32
|
+
planVersion: 'initial'
|
|
32
33
|
};
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
|
-
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},KV=2`;
|
|
37
|
+
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},PV=${planVersion},KV=2`;
|
|
37
38
|
*/
|
|
38
39
|
const decodeLicenseVersion2 = license => {
|
|
39
40
|
const licenseInfo = {
|
|
40
41
|
scope: null,
|
|
41
42
|
licensingModel: null,
|
|
42
|
-
expiryTimestamp: null
|
|
43
|
+
expiryTimestamp: null,
|
|
44
|
+
planVersion: 'initial'
|
|
43
45
|
};
|
|
44
46
|
license.split(',').map(token => token.split('=')).filter(el => el.length === 2).forEach(([key, value]) => {
|
|
45
47
|
if (key === 'S') {
|
|
@@ -54,6 +56,9 @@ const decodeLicenseVersion2 = license => {
|
|
|
54
56
|
licenseInfo.expiryTimestamp = expiryTimestamp;
|
|
55
57
|
}
|
|
56
58
|
}
|
|
59
|
+
if (key === 'PV') {
|
|
60
|
+
licenseInfo.planVersion = value;
|
|
61
|
+
}
|
|
57
62
|
});
|
|
58
63
|
return licenseInfo;
|
|
59
64
|
};
|
|
@@ -74,7 +79,8 @@ const decodeLicense = encodedLicense => {
|
|
|
74
79
|
export function verifyLicense({
|
|
75
80
|
releaseInfo,
|
|
76
81
|
licenseKey,
|
|
77
|
-
acceptedScopes
|
|
82
|
+
acceptedScopes,
|
|
83
|
+
productScope
|
|
78
84
|
}) {
|
|
79
85
|
if (!releaseInfo) {
|
|
80
86
|
throw new Error('MUI X: The release information is missing. Not able to validate license.');
|
|
@@ -143,11 +149,19 @@ export function verifyLicense({
|
|
|
143
149
|
}
|
|
144
150
|
}
|
|
145
151
|
if (license.scope == null || !LICENSE_SCOPES.includes(license.scope)) {
|
|
146
|
-
console.error('Error checking license. scope not found or invalid!');
|
|
152
|
+
console.error('MUI X: Error checking license. scope not found or invalid!');
|
|
147
153
|
return {
|
|
148
154
|
status: LICENSE_STATUS.Invalid
|
|
149
155
|
};
|
|
150
156
|
}
|
|
157
|
+
if (license.planVersion === 'initial') {
|
|
158
|
+
// 'charts-pro' or 'tree-view-pro' can only be used with a newer license
|
|
159
|
+
if (productScope === 'charts' || productScope === 'tree-view') {
|
|
160
|
+
return {
|
|
161
|
+
status: LICENSE_STATUS.NotAvailableInInitialProPlan
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
151
165
|
if (!acceptedScopes.includes(license.scope)) {
|
|
152
166
|
return {
|
|
153
167
|
status: LICENSE_STATUS.OutOfScope
|