@mui/x-license 8.0.0-beta.2 → 8.0.0
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 +423 -96
- package/esm/index.js +1 -1
- package/esm/package.json +1 -1
- package/esm/verifyLicense/verifyLicense.js +7 -0
- package/index.js +1 -1
- package/package.json +6 -16
- package/verifyLicense/verifyLicense.js +7 -0
- package/modern/Unstable_LicenseInfoProvider/LicenseInfoProvider.d.ts +0 -16
- package/modern/Unstable_LicenseInfoProvider/LicenseInfoProvider.js +0 -19
- package/modern/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.d.ts +0 -4
- package/modern/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js +0 -10
- package/modern/Unstable_LicenseInfoProvider/index.d.ts +0 -2
- package/modern/Unstable_LicenseInfoProvider/index.js +0 -1
- package/modern/Watermark/Watermark.d.ts +0 -9
- package/modern/Watermark/Watermark.js +0 -51
- package/modern/Watermark/index.d.ts +0 -1
- package/modern/Watermark/index.js +0 -1
- package/modern/encoding/base64.d.ts +0 -2
- package/modern/encoding/base64.js +0 -57
- package/modern/encoding/md5.d.ts +0 -1
- package/modern/encoding/md5.js +0 -42
- package/modern/generateLicense/generateLicense.d.ts +0 -10
- package/modern/generateLicense/generateLicense.js +0 -19
- package/modern/generateLicense/index.d.ts +0 -1
- package/modern/generateLicense/index.js +0 -1
- package/modern/index.d.ts +0 -7
- package/modern/index.js +0 -14
- package/modern/package.json +0 -1
- package/modern/useLicenseVerifier/index.d.ts +0 -1
- package/modern/useLicenseVerifier/index.js +0 -1
- package/modern/useLicenseVerifier/useLicenseVerifier.d.ts +0 -11
- package/modern/useLicenseVerifier/useLicenseVerifier.js +0 -69
- package/modern/utils/commercialPackages.d.ts +0 -1
- package/modern/utils/commercialPackages.js +0 -1
- package/modern/utils/index.d.ts +0 -6
- package/modern/utils/index.js +0 -4
- package/modern/utils/licenseErrorMessageUtils.d.ts +0 -33
- package/modern/utils/licenseErrorMessageUtils.js +0 -49
- package/modern/utils/licenseInfo.d.ts +0 -11
- package/modern/utils/licenseInfo.js +0 -27
- package/modern/utils/licenseModel.d.ts +0 -2
- package/modern/utils/licenseModel.js +0 -17
- package/modern/utils/licenseStatus.d.ts +0 -11
- package/modern/utils/licenseStatus.js +0 -12
- package/modern/utils/plan.d.ts +0 -4
- package/modern/utils/plan.js +0 -2
- package/modern/verifyLicense/index.d.ts +0 -1
- package/modern/verifyLicense/index.js +0 -1
- package/modern/verifyLicense/verifyLicense.d.ts +0 -15
- package/modern/verifyLicense/verifyLicense.js +0 -184
- package/tsconfig.build.tsbuildinfo +0 -1
package/esm/index.js
CHANGED
package/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","sideEffects":
|
|
1
|
+
{"type":"module","sideEffects":["./utils/licenseInfo.js"]}
|
|
@@ -94,6 +94,13 @@ export function verifyLicense({
|
|
|
94
94
|
licenseKey,
|
|
95
95
|
packageName
|
|
96
96
|
}) {
|
|
97
|
+
// Gets replaced at build time
|
|
98
|
+
// @ts-ignore
|
|
99
|
+
if (false) {
|
|
100
|
+
return {
|
|
101
|
+
status: LICENSE_STATUS.Valid
|
|
102
|
+
};
|
|
103
|
+
}
|
|
97
104
|
if (!releaseInfo) {
|
|
98
105
|
throw new Error('MUI X: The release information is missing. Not able to validate license.');
|
|
99
106
|
}
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-license",
|
|
3
|
-
"version": "8.0.0
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "MUI X License verification",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"homepage": "https://mui.com/x/introduction/licensing/",
|
|
12
12
|
"sideEffects": [
|
|
13
|
-
"./utils/licenseInfo.js"
|
|
14
|
-
"./modern/utils/licenseInfo.js",
|
|
15
|
-
"./node/utils/licenseInfo.js"
|
|
13
|
+
"./utils/licenseInfo.js"
|
|
16
14
|
],
|
|
17
15
|
"publishConfig": {
|
|
18
16
|
"access": "public",
|
|
@@ -24,10 +22,10 @@
|
|
|
24
22
|
"directory": "packages/x-license"
|
|
25
23
|
},
|
|
26
24
|
"dependencies": {
|
|
27
|
-
"@babel/runtime": "^7.
|
|
28
|
-
"@mui/utils": "^7.0.
|
|
29
|
-
"@mui/x-internals": "8.0.0
|
|
30
|
-
"@mui/x-telemetry": "8.0.0
|
|
25
|
+
"@babel/runtime": "^7.27.0",
|
|
26
|
+
"@mui/utils": "^7.0.2",
|
|
27
|
+
"@mui/x-internals": "8.0.0",
|
|
28
|
+
"@mui/x-telemetry": "8.0.0"
|
|
31
29
|
},
|
|
32
30
|
"peerDependencies": {
|
|
33
31
|
"react": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
@@ -47,10 +45,6 @@
|
|
|
47
45
|
"import": {
|
|
48
46
|
"types": "./esm/index.d.ts",
|
|
49
47
|
"default": "./esm/index.js"
|
|
50
|
-
},
|
|
51
|
-
"mui-modern": {
|
|
52
|
-
"types": "./modern/index.d.ts",
|
|
53
|
-
"default": "./modern/index.js"
|
|
54
48
|
}
|
|
55
49
|
},
|
|
56
50
|
"./*": {
|
|
@@ -61,10 +55,6 @@
|
|
|
61
55
|
"import": {
|
|
62
56
|
"types": "./esm/*/index.d.ts",
|
|
63
57
|
"default": "./esm/*/index.js"
|
|
64
|
-
},
|
|
65
|
-
"mui-modern": {
|
|
66
|
-
"types": "./modern/*/index.d.ts",
|
|
67
|
-
"default": "./modern/*/index.js"
|
|
68
58
|
}
|
|
69
59
|
},
|
|
70
60
|
"./esm": null,
|
|
@@ -101,6 +101,13 @@ function verifyLicense({
|
|
|
101
101
|
licenseKey,
|
|
102
102
|
packageName
|
|
103
103
|
}) {
|
|
104
|
+
// Gets replaced at build time
|
|
105
|
+
// @ts-ignore
|
|
106
|
+
if (false) {
|
|
107
|
+
return {
|
|
108
|
+
status: _licenseStatus.LICENSE_STATUS.Valid
|
|
109
|
+
};
|
|
110
|
+
}
|
|
104
111
|
if (!releaseInfo) {
|
|
105
112
|
throw new Error('MUI X: The release information is missing. Not able to validate license.');
|
|
106
113
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { MuiLicenseInfo } from "../utils/licenseInfo.js";
|
|
3
|
-
/**
|
|
4
|
-
* @ignore - do not document.
|
|
5
|
-
*/
|
|
6
|
-
export interface LicenseInfoProviderProps {
|
|
7
|
-
info: MuiLicenseInfo;
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* @ignore - do not document.
|
|
12
|
-
*/
|
|
13
|
-
export declare function LicenseInfoProvider({
|
|
14
|
-
info,
|
|
15
|
-
children
|
|
16
|
-
}: LicenseInfoProviderProps): React.JSX.Element;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import MuiLicenseInfoContext from "./MuiLicenseInfoContext.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @ignore - do not document.
|
|
6
|
-
*/
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
/**
|
|
9
|
-
* @ignore - do not document.
|
|
10
|
-
*/
|
|
11
|
-
export function LicenseInfoProvider({
|
|
12
|
-
info,
|
|
13
|
-
children
|
|
14
|
-
}) {
|
|
15
|
-
return /*#__PURE__*/_jsx(MuiLicenseInfoContext.Provider, {
|
|
16
|
-
value: info,
|
|
17
|
-
children: children
|
|
18
|
-
});
|
|
19
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
const MuiLicenseInfoContext = /*#__PURE__*/React.createContext({
|
|
5
|
-
key: undefined
|
|
6
|
-
});
|
|
7
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
8
|
-
MuiLicenseInfoContext.displayName = 'MuiLicenseInfoContext';
|
|
9
|
-
}
|
|
10
|
-
export default MuiLicenseInfoContext;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { LicenseInfoProvider as Unstable_LicenseInfoProvider } from "./LicenseInfoProvider.js";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { MuiCommercialPackageName } from "../utils/commercialPackages.js";
|
|
3
|
-
interface WatermarkProps {
|
|
4
|
-
packageName: MuiCommercialPackageName;
|
|
5
|
-
releaseInfo: string;
|
|
6
|
-
}
|
|
7
|
-
declare function Watermark(props: WatermarkProps): React.JSX.Element | null;
|
|
8
|
-
declare const MemoizedWatermark: typeof Watermark;
|
|
9
|
-
export { MemoizedWatermark as Watermark };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
3
|
-
import { useLicenseVerifier } from "../useLicenseVerifier/index.js";
|
|
4
|
-
import { LICENSE_STATUS } from "../utils/licenseStatus.js";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
function getLicenseErrorMessage(licenseStatus) {
|
|
7
|
-
switch (licenseStatus) {
|
|
8
|
-
case LICENSE_STATUS.ExpiredAnnualGrace:
|
|
9
|
-
case LICENSE_STATUS.ExpiredAnnual:
|
|
10
|
-
return 'MUI X Expired license key';
|
|
11
|
-
case LICENSE_STATUS.ExpiredVersion:
|
|
12
|
-
return 'MUI X Expired package version';
|
|
13
|
-
case LICENSE_STATUS.Invalid:
|
|
14
|
-
return 'MUI X Invalid license key';
|
|
15
|
-
case LICENSE_STATUS.OutOfScope:
|
|
16
|
-
return 'MUI X License key plan mismatch';
|
|
17
|
-
case LICENSE_STATUS.NotAvailableInInitialProPlan:
|
|
18
|
-
return 'MUI X Product not covered by plan';
|
|
19
|
-
case LICENSE_STATUS.NotFound:
|
|
20
|
-
return 'MUI X Missing license key';
|
|
21
|
-
default:
|
|
22
|
-
throw new Error('Unhandled MUI X license status.');
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function Watermark(props) {
|
|
26
|
-
const {
|
|
27
|
-
packageName,
|
|
28
|
-
releaseInfo
|
|
29
|
-
} = props;
|
|
30
|
-
const licenseStatus = useLicenseVerifier(packageName, releaseInfo);
|
|
31
|
-
if (licenseStatus.status === LICENSE_STATUS.Valid) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
return /*#__PURE__*/_jsx("div", {
|
|
35
|
-
style: {
|
|
36
|
-
position: 'absolute',
|
|
37
|
-
pointerEvents: 'none',
|
|
38
|
-
color: '#8282829e',
|
|
39
|
-
zIndex: 100000,
|
|
40
|
-
width: '100%',
|
|
41
|
-
textAlign: 'center',
|
|
42
|
-
bottom: '50%',
|
|
43
|
-
right: 0,
|
|
44
|
-
letterSpacing: 5,
|
|
45
|
-
fontSize: 24
|
|
46
|
-
},
|
|
47
|
-
children: getLicenseErrorMessage(licenseStatus.status)
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
const MemoizedWatermark = fastMemo(Watermark);
|
|
51
|
-
export { MemoizedWatermark as Watermark };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Watermark.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Watermark.js";
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
3
|
-
function utf8Encode(str) {
|
|
4
|
-
for (let n = 0; n < str.length; n++) {
|
|
5
|
-
const c = str.charCodeAt(n);
|
|
6
|
-
if (c >= 128) {
|
|
7
|
-
throw new Error('ASCII only support');
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return str;
|
|
11
|
-
}
|
|
12
|
-
export const base64Decode = input => {
|
|
13
|
-
let output = '';
|
|
14
|
-
let chr1, chr2, chr3;
|
|
15
|
-
let enc1, enc2, enc3, enc4;
|
|
16
|
-
let i = 0;
|
|
17
|
-
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
|
|
18
|
-
while (i < input.length) {
|
|
19
|
-
enc1 = _keyStr.indexOf(input.charAt(i++));
|
|
20
|
-
enc2 = _keyStr.indexOf(input.charAt(i++));
|
|
21
|
-
enc3 = _keyStr.indexOf(input.charAt(i++));
|
|
22
|
-
enc4 = _keyStr.indexOf(input.charAt(i++));
|
|
23
|
-
chr1 = enc1 << 2 | enc2 >> 4;
|
|
24
|
-
chr2 = (enc2 & 15) << 4 | enc3 >> 2;
|
|
25
|
-
chr3 = (enc3 & 3) << 6 | enc4;
|
|
26
|
-
output = output + String.fromCharCode(chr1);
|
|
27
|
-
if (enc3 != 64) {
|
|
28
|
-
output = output + String.fromCharCode(chr2);
|
|
29
|
-
}
|
|
30
|
-
if (enc4 != 64) {
|
|
31
|
-
output = output + String.fromCharCode(chr3);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return output;
|
|
35
|
-
};
|
|
36
|
-
export const base64Encode = input => {
|
|
37
|
-
let output = '';
|
|
38
|
-
let chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
|
39
|
-
let i = 0;
|
|
40
|
-
input = utf8Encode(input);
|
|
41
|
-
while (i < input.length) {
|
|
42
|
-
chr1 = input.charCodeAt(i++);
|
|
43
|
-
chr2 = input.charCodeAt(i++);
|
|
44
|
-
chr3 = input.charCodeAt(i++);
|
|
45
|
-
enc1 = chr1 >> 2;
|
|
46
|
-
enc2 = (chr1 & 3) << 4 | chr2 >> 4;
|
|
47
|
-
enc3 = (chr2 & 15) << 2 | chr3 >> 6;
|
|
48
|
-
enc4 = chr3 & 63;
|
|
49
|
-
if (isNaN(chr2)) {
|
|
50
|
-
enc3 = enc4 = 64;
|
|
51
|
-
} else if (isNaN(chr3)) {
|
|
52
|
-
enc4 = 64;
|
|
53
|
-
}
|
|
54
|
-
output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
|
|
55
|
-
}
|
|
56
|
-
return output;
|
|
57
|
-
};
|
package/modern/encoding/md5.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function md5(s: any): any;
|
package/modern/encoding/md5.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// See "precomputation" in notes
|
|
3
|
-
const k = [];
|
|
4
|
-
let i = 0;
|
|
5
|
-
for (; i < 64;) {
|
|
6
|
-
k[i] = 0 | Math.sin(++i % Math.PI) * 4294967296;
|
|
7
|
-
// k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296);
|
|
8
|
-
}
|
|
9
|
-
export function md5(s) {
|
|
10
|
-
const words = [];
|
|
11
|
-
let b,
|
|
12
|
-
c,
|
|
13
|
-
d,
|
|
14
|
-
j = unescape(encodeURI(s)) + '\x80',
|
|
15
|
-
a = j.length;
|
|
16
|
-
const h = [b = 0x67452301, c = 0xefcdab89, ~b, ~c];
|
|
17
|
-
s = --a / 4 + 2 | 15;
|
|
18
|
-
|
|
19
|
-
// See "Length bits" in notes
|
|
20
|
-
words[--s] = a * 8;
|
|
21
|
-
for (; ~a;) {
|
|
22
|
-
// a !== -1
|
|
23
|
-
words[a >> 2] |= j.charCodeAt(a) << 8 * a--;
|
|
24
|
-
}
|
|
25
|
-
for (i = j = 0; i < s; i += 16) {
|
|
26
|
-
a = h;
|
|
27
|
-
for (; j < 64; a = [d = a[3], b + ((d = a[0] + [b & c | ~b & d, d & b | ~d & c, b ^ c ^ d, c ^ (b | ~d)][a = j >> 4] + k[j] + ~~words[i | [j, 5 * j + 1, 3 * j + 5, 7 * j][a] & 15]) << (a = [7, 12, 17, 22, 5, 9, 14, 20, 4, 11, 16, 23, 6, 10, 15, 21][4 * a + j++ % 4]) | d >>> -a), b, c]) {
|
|
28
|
-
b = a[1] | 0;
|
|
29
|
-
c = a[2];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// See "Integer safety" in notes
|
|
33
|
-
for (j = 4; j;) h[--j] += a[j];
|
|
34
|
-
|
|
35
|
-
// j === 0
|
|
36
|
-
}
|
|
37
|
-
for (s = ''; j < 32;) {
|
|
38
|
-
s += (h[j >> 3] >> (1 ^ j++) * 4 & 15).toString(16);
|
|
39
|
-
// s += ((h[j >> 3] >> (4 ^ 4 * j++)) & 15).toString(16);
|
|
40
|
-
}
|
|
41
|
-
return s;
|
|
42
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PlanScope, PlanVersion } from "../utils/plan.js";
|
|
2
|
-
import { LicenseModel } from "../utils/licenseModel.js";
|
|
3
|
-
export interface LicenseDetails {
|
|
4
|
-
expiryDate: Date;
|
|
5
|
-
licenseModel?: LicenseModel;
|
|
6
|
-
orderNumber: string;
|
|
7
|
-
planScope?: PlanScope;
|
|
8
|
-
planVersion: PlanVersion;
|
|
9
|
-
}
|
|
10
|
-
export declare function generateLicense(details: LicenseDetails): string;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { md5 } from "../encoding/md5.js";
|
|
2
|
-
import { base64Encode } from "../encoding/base64.js";
|
|
3
|
-
import { PLAN_SCOPES } from "../utils/plan.js";
|
|
4
|
-
import { LICENSE_MODELS } from "../utils/licenseModel.js";
|
|
5
|
-
const licenseVersion = '2';
|
|
6
|
-
function getClearLicenseString(details) {
|
|
7
|
-
if (details.planScope && !PLAN_SCOPES.includes(details.planScope)) {
|
|
8
|
-
throw new Error('MUI X: Invalid scope');
|
|
9
|
-
}
|
|
10
|
-
if (details.licenseModel && !LICENSE_MODELS.includes(details.licenseModel)) {
|
|
11
|
-
throw new Error('MUI X: Invalid licensing model');
|
|
12
|
-
}
|
|
13
|
-
const keyParts = [`O=${details.orderNumber}`, `E=${details.expiryDate.getTime()}`, `S=${details.planScope}`, `LM=${details.licenseModel}`, `PV=${details.planVersion}`, `KV=${licenseVersion}`];
|
|
14
|
-
return keyParts.join(',');
|
|
15
|
-
}
|
|
16
|
-
export function generateLicense(details) {
|
|
17
|
-
const licenseStr = getClearLicenseString(details);
|
|
18
|
-
return `${md5(base64Encode(licenseStr))}${base64Encode(licenseStr)}`;
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./generateLicense.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./generateLicense.js";
|
package/modern/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "./generateLicense/index.js";
|
|
2
|
-
export * from "./utils/index.js";
|
|
3
|
-
export * from "./verifyLicense/index.js";
|
|
4
|
-
export * from "./useLicenseVerifier/index.js";
|
|
5
|
-
export * from "./Watermark/index.js";
|
|
6
|
-
export * from "./Unstable_LicenseInfoProvider/index.js";
|
|
7
|
-
export { muiXTelemetrySettings } from '@mui/x-telemetry';
|
package/modern/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @mui/x-license v8.0.0-beta.2
|
|
3
|
-
*
|
|
4
|
-
* @license MUI X Commercial
|
|
5
|
-
* This source code is licensed under the commercial license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
export * from "./generateLicense/index.js";
|
|
9
|
-
export * from "./utils/index.js";
|
|
10
|
-
export * from "./verifyLicense/index.js";
|
|
11
|
-
export * from "./useLicenseVerifier/index.js";
|
|
12
|
-
export * from "./Watermark/index.js";
|
|
13
|
-
export * from "./Unstable_LicenseInfoProvider/index.js";
|
|
14
|
-
export { muiXTelemetrySettings } from '@mui/x-telemetry';
|
package/modern/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module","sideEffects":false}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useLicenseVerifier } from "./useLicenseVerifier.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useLicenseVerifier } from "./useLicenseVerifier.js";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { LicenseStatus } from "../utils/licenseStatus.js";
|
|
2
|
-
import { MuiCommercialPackageName } from "../utils/commercialPackages.js";
|
|
3
|
-
export declare const sharedLicenseStatuses: { [packageName in MuiCommercialPackageName]?: {
|
|
4
|
-
key: string | undefined;
|
|
5
|
-
licenseVerifier: {
|
|
6
|
-
status: LicenseStatus;
|
|
7
|
-
};
|
|
8
|
-
} };
|
|
9
|
-
export declare function useLicenseVerifier(packageName: MuiCommercialPackageName, releaseInfo: string): {
|
|
10
|
-
status: LicenseStatus;
|
|
11
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { sendMuiXTelemetryEvent, muiXTelemetryEvents } from '@mui/x-telemetry';
|
|
4
|
-
import { verifyLicense } from "../verifyLicense/verifyLicense.js";
|
|
5
|
-
import { LicenseInfo } from "../utils/licenseInfo.js";
|
|
6
|
-
import { showExpiredAnnualGraceLicenseKeyError, showExpiredAnnualLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError, showNotAvailableInInitialProPlanError } from "../utils/licenseErrorMessageUtils.js";
|
|
7
|
-
import { LICENSE_STATUS } from "../utils/licenseStatus.js";
|
|
8
|
-
import MuiLicenseInfoContext from "../Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js";
|
|
9
|
-
export const sharedLicenseStatuses = {};
|
|
10
|
-
export function useLicenseVerifier(packageName, releaseInfo) {
|
|
11
|
-
const {
|
|
12
|
-
key: contextKey
|
|
13
|
-
} = React.useContext(MuiLicenseInfoContext);
|
|
14
|
-
return React.useMemo(() => {
|
|
15
|
-
const licenseKey = contextKey ?? LicenseInfo.getLicenseKey();
|
|
16
|
-
|
|
17
|
-
// Cache the response to not trigger the error twice.
|
|
18
|
-
if (sharedLicenseStatuses[packageName] && sharedLicenseStatuses[packageName].key === licenseKey) {
|
|
19
|
-
return sharedLicenseStatuses[packageName].licenseVerifier;
|
|
20
|
-
}
|
|
21
|
-
const plan = packageName.includes('premium') ? 'Premium' : 'Pro';
|
|
22
|
-
const licenseStatus = verifyLicense({
|
|
23
|
-
releaseInfo,
|
|
24
|
-
licenseKey,
|
|
25
|
-
packageName
|
|
26
|
-
});
|
|
27
|
-
const fullPackageName = `@mui/${packageName}`;
|
|
28
|
-
sendMuiXTelemetryEvent(muiXTelemetryEvents.licenseVerification({
|
|
29
|
-
licenseKey
|
|
30
|
-
}, {
|
|
31
|
-
packageName,
|
|
32
|
-
packageReleaseInfo: releaseInfo,
|
|
33
|
-
licenseStatus: licenseStatus?.status
|
|
34
|
-
}));
|
|
35
|
-
if (licenseStatus.status === LICENSE_STATUS.Valid) {
|
|
36
|
-
// Skip
|
|
37
|
-
} else if (licenseStatus.status === LICENSE_STATUS.Invalid) {
|
|
38
|
-
showInvalidLicenseKeyError();
|
|
39
|
-
} else if (licenseStatus.status === LICENSE_STATUS.NotAvailableInInitialProPlan) {
|
|
40
|
-
showNotAvailableInInitialProPlanError();
|
|
41
|
-
} else if (licenseStatus.status === LICENSE_STATUS.OutOfScope) {
|
|
42
|
-
showLicenseKeyPlanMismatchError();
|
|
43
|
-
} else if (licenseStatus.status === LICENSE_STATUS.NotFound) {
|
|
44
|
-
showMissingLicenseKeyError({
|
|
45
|
-
plan,
|
|
46
|
-
packageName: fullPackageName
|
|
47
|
-
});
|
|
48
|
-
} else if (licenseStatus.status === LICENSE_STATUS.ExpiredAnnualGrace) {
|
|
49
|
-
showExpiredAnnualGraceLicenseKeyError(_extends({
|
|
50
|
-
plan
|
|
51
|
-
}, licenseStatus.meta));
|
|
52
|
-
} else if (licenseStatus.status === LICENSE_STATUS.ExpiredAnnual) {
|
|
53
|
-
showExpiredAnnualLicenseKeyError(_extends({
|
|
54
|
-
plan
|
|
55
|
-
}, licenseStatus.meta));
|
|
56
|
-
} else if (licenseStatus.status === LICENSE_STATUS.ExpiredVersion) {
|
|
57
|
-
showExpiredPackageVersionError({
|
|
58
|
-
packageName: fullPackageName
|
|
59
|
-
});
|
|
60
|
-
} else if (process.env.NODE_ENV !== 'production') {
|
|
61
|
-
throw new Error('missing status handler');
|
|
62
|
-
}
|
|
63
|
-
sharedLicenseStatuses[packageName] = {
|
|
64
|
-
key: licenseKey,
|
|
65
|
-
licenseVerifier: licenseStatus
|
|
66
|
-
};
|
|
67
|
-
return licenseStatus;
|
|
68
|
-
}, [packageName, releaseInfo, contextKey]);
|
|
69
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type MuiCommercialPackageName = 'x-data-grid-pro' | 'x-data-grid-premium' | 'x-date-pickers-pro' | 'x-tree-view-pro' | 'x-charts-pro';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/modern/utils/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from "./licenseErrorMessageUtils.js";
|
|
2
|
-
export * from "./licenseInfo.js";
|
|
3
|
-
export * from "./licenseStatus.js";
|
|
4
|
-
export type { PlanScope } from './plan';
|
|
5
|
-
export type { LicenseModel } from './licenseModel';
|
|
6
|
-
export type { MuiCommercialPackageName } from './commercialPackages';
|
package/modern/utils/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export declare function showInvalidLicenseKeyError(): void;
|
|
2
|
-
export declare function showLicenseKeyPlanMismatchError(): void;
|
|
3
|
-
export declare function showNotAvailableInInitialProPlanError(): void;
|
|
4
|
-
export declare function showMissingLicenseKeyError({
|
|
5
|
-
plan,
|
|
6
|
-
packageName
|
|
7
|
-
}: {
|
|
8
|
-
plan: string;
|
|
9
|
-
packageName: string;
|
|
10
|
-
}): void;
|
|
11
|
-
export declare function showExpiredPackageVersionError({
|
|
12
|
-
packageName
|
|
13
|
-
}: {
|
|
14
|
-
packageName: string;
|
|
15
|
-
}): void;
|
|
16
|
-
export declare function showExpiredAnnualGraceLicenseKeyError({
|
|
17
|
-
plan,
|
|
18
|
-
licenseKey,
|
|
19
|
-
expiryTimestamp
|
|
20
|
-
}: {
|
|
21
|
-
plan: string;
|
|
22
|
-
licenseKey: string;
|
|
23
|
-
expiryTimestamp: number;
|
|
24
|
-
}): void;
|
|
25
|
-
export declare function showExpiredAnnualLicenseKeyError({
|
|
26
|
-
plan,
|
|
27
|
-
licenseKey,
|
|
28
|
-
expiryTimestamp
|
|
29
|
-
}: {
|
|
30
|
-
plan: string;
|
|
31
|
-
licenseKey: string;
|
|
32
|
-
expiryTimestamp: number;
|
|
33
|
-
}): void;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Workaround for the codesadbox preview error.
|
|
3
|
-
*
|
|
4
|
-
* Once these issues are resolved
|
|
5
|
-
* https://github.com/mui/mui-x/issues/15765
|
|
6
|
-
* https://github.com/codesandbox/codesandbox-client/issues/8673
|
|
7
|
-
*
|
|
8
|
-
* `showError` can simply use `console.error` again.
|
|
9
|
-
*/
|
|
10
|
-
const isCodeSandbox = typeof window !== 'undefined' && window.location.hostname.endsWith('.csb.app');
|
|
11
|
-
function showError(message) {
|
|
12
|
-
// eslint-disable-next-line no-console
|
|
13
|
-
const logger = isCodeSandbox ? console.log : console.error;
|
|
14
|
-
logger(['*************************************************************', '', ...message, '', '*************************************************************'].join('\n'));
|
|
15
|
-
}
|
|
16
|
-
export function showInvalidLicenseKeyError() {
|
|
17
|
-
showError(['MUI X: Invalid license key.', '', "Your MUI X license key format isn't valid. It could be because the license key is missing a character or has a typo.", '', 'To solve the issue, you need to double check that `setLicenseKey()` is called with the right argument', 'Please check the license key installation https://mui.com/r/x-license-key-installation.']);
|
|
18
|
-
}
|
|
19
|
-
export function showLicenseKeyPlanMismatchError() {
|
|
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 Data Grid Premium 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`."]);
|
|
21
|
-
}
|
|
22
|
-
export 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
|
-
}
|
|
25
|
-
export function showMissingLicenseKeyError({
|
|
26
|
-
plan,
|
|
27
|
-
packageName
|
|
28
|
-
}) {
|
|
29
|
-
showError(['MUI X: Missing license key.', '', `The license key is missing. You might not be allowed to use \`${packageName}\` which is part of MUI X ${plan}.`, '', 'To solve the issue, you can check the free trial conditions: https://mui.com/r/x-license-trial.', 'If you are eligible no actions are required. If you are not eligible to the free trial, you need to purchase a license https://mui.com/r/x-get-license or stop using the software immediately.']);
|
|
30
|
-
}
|
|
31
|
-
export function showExpiredPackageVersionError({
|
|
32
|
-
packageName
|
|
33
|
-
}) {
|
|
34
|
-
showError(['MUI X: Expired package version.', '', `You have installed a version of \`${packageName}\` that is outside of the maintenance plan of your license key. By default, commercial licenses provide access to new versions released during the first year after the purchase.`, '', 'To solve the issue, you can renew your license https://mui.com/r/x-get-license or install an older version of the npm package that is compatible with your license key.']);
|
|
35
|
-
}
|
|
36
|
-
export function showExpiredAnnualGraceLicenseKeyError({
|
|
37
|
-
plan,
|
|
38
|
-
licenseKey,
|
|
39
|
-
expiryTimestamp
|
|
40
|
-
}) {
|
|
41
|
-
showError(['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}`, '']);
|
|
42
|
-
}
|
|
43
|
-
export function showExpiredAnnualLicenseKeyError({
|
|
44
|
-
plan,
|
|
45
|
-
licenseKey,
|
|
46
|
-
expiryTimestamp
|
|
47
|
-
}) {
|
|
48
|
-
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'));
|
|
49
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @ignore - do not document.
|
|
3
|
-
*/
|
|
4
|
-
export interface MuiLicenseInfo {
|
|
5
|
-
key: string | undefined;
|
|
6
|
-
}
|
|
7
|
-
export declare class LicenseInfo {
|
|
8
|
-
private static getLicenseInfo;
|
|
9
|
-
static getLicenseKey(): MuiLicenseInfo['key'];
|
|
10
|
-
static setLicenseKey(key: string): void;
|
|
11
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ponyfillGlobal } from '@mui/utils';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @ignore - do not document.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// Store the license information in a global, so it can be shared
|
|
8
|
-
// when module duplication occurs. The duplication of the modules can happen
|
|
9
|
-
// if using multiple version of MUI X at the same time of the bundler
|
|
10
|
-
// decide to duplicate to improve the size of the chunks.
|
|
11
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
12
|
-
ponyfillGlobal.__MUI_LICENSE_INFO__ = ponyfillGlobal.__MUI_LICENSE_INFO__ || {
|
|
13
|
-
key: undefined
|
|
14
|
-
};
|
|
15
|
-
export class LicenseInfo {
|
|
16
|
-
static getLicenseInfo() {
|
|
17
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
18
|
-
return ponyfillGlobal.__MUI_LICENSE_INFO__;
|
|
19
|
-
}
|
|
20
|
-
static getLicenseKey() {
|
|
21
|
-
return LicenseInfo.getLicenseInfo().key;
|
|
22
|
-
}
|
|
23
|
-
static setLicenseKey(key) {
|
|
24
|
-
const licenseInfo = LicenseInfo.getLicenseInfo();
|
|
25
|
-
licenseInfo.key = key;
|
|
26
|
-
}
|
|
27
|
-
}
|