@mui/x-license 7.0.0-beta.2 → 7.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 +865 -81
- package/Unstable_LicenseInfoProvider/LicenseInfoProvider.js +2 -2
- package/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.d.ts +4 -0
- package/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js +8 -0
- package/index.js +1 -1
- package/modern/Unstable_LicenseInfoProvider/LicenseInfoProvider.js +2 -2
- package/modern/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js +8 -0
- package/modern/index.js +1 -1
- package/modern/useLicenseVerifier/useLicenseVerifier.js +2 -2
- package/modern/utils/licenseErrorMessageUtils.js +2 -2
- package/node/Unstable_LicenseInfoProvider/LicenseInfoProvider.js +2 -2
- package/node/Unstable_LicenseInfoProvider/{LicenseInfoContext.js → MuiLicenseInfoContext.js} +6 -2
- package/node/index.js +1 -1
- package/node/useLicenseVerifier/useLicenseVerifier.js +2 -2
- package/node/utils/licenseErrorMessageUtils.js +2 -2
- package/package.json +3 -4
- package/useLicenseVerifier/useLicenseVerifier.js +3 -3
- package/utils/licenseErrorMessageUtils.js +2 -2
- package/Unstable_LicenseInfoProvider/LicenseInfoContext.d.ts +0 -4
- package/Unstable_LicenseInfoProvider/LicenseInfoContext.js +0 -4
- package/legacy/Unstable_LicenseInfoProvider/LicenseInfoContext.js +0 -4
- package/legacy/Unstable_LicenseInfoProvider/LicenseInfoProvider.js +0 -18
- package/legacy/Unstable_LicenseInfoProvider/index.js +0 -1
- package/legacy/Watermark/Watermark.js +0 -44
- package/legacy/Watermark/index.js +0 -1
- package/legacy/encoding/base64.js +0 -57
- package/legacy/encoding/md5.js +0 -42
- package/legacy/generateLicense/generateLicense.js +0 -18
- package/legacy/generateLicense/index.js +0 -1
- package/legacy/index.js +0 -13
- package/legacy/useLicenseVerifier/index.js +0 -1
- package/legacy/useLicenseVerifier/useLicenseVerifier.js +0 -59
- package/legacy/utils/index.js +0 -4
- package/legacy/utils/licenseErrorMessageUtils.js +0 -31
- package/legacy/utils/licenseInfo.js +0 -40
- package/legacy/utils/licenseScope.js +0 -1
- package/legacy/utils/licenseStatus.js +0 -11
- package/legacy/utils/licensingModel.js +0 -15
- package/legacy/verifyLicense/index.js +0 -1
- package/legacy/verifyLicense/verifyLicense.js +0 -167
- package/modern/Unstable_LicenseInfoProvider/LicenseInfoContext.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import MuiLicenseInfoContext from './MuiLicenseInfoContext';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @ignore - do not document.
|
|
@@ -12,7 +12,7 @@ export function LicenseInfoProvider({
|
|
|
12
12
|
info,
|
|
13
13
|
children
|
|
14
14
|
}) {
|
|
15
|
-
return /*#__PURE__*/_jsx(
|
|
15
|
+
return /*#__PURE__*/_jsx(MuiLicenseInfoContext.Provider, {
|
|
16
16
|
value: info,
|
|
17
17
|
children: children
|
|
18
18
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const MuiLicenseInfoContext = /*#__PURE__*/React.createContext({
|
|
3
|
+
key: undefined
|
|
4
|
+
});
|
|
5
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6
|
+
MuiLicenseInfoContext.displayName = 'MuiLicenseInfoContext';
|
|
7
|
+
}
|
|
8
|
+
export default MuiLicenseInfoContext;
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import MuiLicenseInfoContext from './MuiLicenseInfoContext';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @ignore - do not document.
|
|
@@ -12,7 +12,7 @@ export function LicenseInfoProvider({
|
|
|
12
12
|
info,
|
|
13
13
|
children
|
|
14
14
|
}) {
|
|
15
|
-
return /*#__PURE__*/_jsx(
|
|
15
|
+
return /*#__PURE__*/_jsx(MuiLicenseInfoContext.Provider, {
|
|
16
16
|
value: info,
|
|
17
17
|
children: children
|
|
18
18
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const MuiLicenseInfoContext = /*#__PURE__*/React.createContext({
|
|
3
|
+
key: undefined
|
|
4
|
+
});
|
|
5
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6
|
+
MuiLicenseInfoContext.displayName = 'MuiLicenseInfoContext';
|
|
7
|
+
}
|
|
8
|
+
export default MuiLicenseInfoContext;
|
package/modern/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import { verifyLicense } from '../verifyLicense/verifyLicense';
|
|
|
4
4
|
import { LicenseInfo } from '../utils/licenseInfo';
|
|
5
5
|
import { showExpiredAnnualGraceLicenseKeyError, showExpiredAnnualLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError } from '../utils/licenseErrorMessageUtils';
|
|
6
6
|
import { LICENSE_STATUS } from '../utils/licenseStatus';
|
|
7
|
-
import
|
|
7
|
+
import MuiLicenseInfoContext from '../Unstable_LicenseInfoProvider/MuiLicenseInfoContext';
|
|
8
8
|
export const sharedLicenseStatuses = {};
|
|
9
9
|
export function useLicenseVerifier(packageName, releaseInfo) {
|
|
10
10
|
const {
|
|
11
11
|
key: contextKey
|
|
12
|
-
} = React.useContext(
|
|
12
|
+
} = React.useContext(MuiLicenseInfoContext);
|
|
13
13
|
return React.useMemo(() => {
|
|
14
14
|
const licenseKey = contextKey ?? LicenseInfo.getLicenseKey();
|
|
15
15
|
|
|
@@ -23,12 +23,12 @@ export function showExpiredAnnualGraceLicenseKeyError({
|
|
|
23
23
|
licenseKey,
|
|
24
24
|
expiryTimestamp
|
|
25
25
|
}) {
|
|
26
|
-
showError(['MUI X: Expired license key.', '', `Your annual license key to use MUI X ${plan}
|
|
26
|
+
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}`, '']);
|
|
27
27
|
}
|
|
28
28
|
export function showExpiredAnnualLicenseKeyError({
|
|
29
29
|
plan,
|
|
30
30
|
licenseKey,
|
|
31
31
|
expiryTimestamp
|
|
32
32
|
}) {
|
|
33
|
-
throw new Error(['MUI X: Expired license key.', '', `Your annual license key to use MUI X ${plan}
|
|
33
|
+
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'));
|
|
34
34
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.LicenseInfoProvider = LicenseInfoProvider;
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _MuiLicenseInfoContext = _interopRequireDefault(require("./MuiLicenseInfoContext"));
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
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); }
|
|
12
12
|
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 && Object.prototype.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; }
|
|
@@ -21,7 +21,7 @@ function LicenseInfoProvider({
|
|
|
21
21
|
info,
|
|
22
22
|
children
|
|
23
23
|
}) {
|
|
24
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MuiLicenseInfoContext.default.Provider, {
|
|
25
25
|
value: info,
|
|
26
26
|
children: children
|
|
27
27
|
});
|
package/node/Unstable_LicenseInfoProvider/{LicenseInfoContext.js → MuiLicenseInfoContext.js}
RENAMED
|
@@ -7,6 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
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); }
|
|
9
9
|
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 && Object.prototype.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; }
|
|
10
|
-
|
|
10
|
+
const MuiLicenseInfoContext = /*#__PURE__*/React.createContext({
|
|
11
11
|
key: undefined
|
|
12
|
-
});
|
|
12
|
+
});
|
|
13
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
14
|
+
MuiLicenseInfoContext.displayName = 'MuiLicenseInfoContext';
|
|
15
|
+
}
|
|
16
|
+
var _default = exports.default = MuiLicenseInfoContext;
|
package/node/index.js
CHANGED
|
@@ -12,14 +12,14 @@ 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
|
|
15
|
+
var _MuiLicenseInfoContext = _interopRequireDefault(require("../Unstable_LicenseInfoProvider/MuiLicenseInfoContext"));
|
|
16
16
|
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
17
|
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 && Object.prototype.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; }
|
|
18
18
|
const sharedLicenseStatuses = exports.sharedLicenseStatuses = {};
|
|
19
19
|
function useLicenseVerifier(packageName, releaseInfo) {
|
|
20
20
|
const {
|
|
21
21
|
key: contextKey
|
|
22
|
-
} = React.useContext(
|
|
22
|
+
} = React.useContext(_MuiLicenseInfoContext.default);
|
|
23
23
|
return React.useMemo(() => {
|
|
24
24
|
const licenseKey = contextKey ?? _licenseInfo.LicenseInfo.getLicenseKey();
|
|
25
25
|
|
|
@@ -34,12 +34,12 @@ function showExpiredAnnualGraceLicenseKeyError({
|
|
|
34
34
|
licenseKey,
|
|
35
35
|
expiryTimestamp
|
|
36
36
|
}) {
|
|
37
|
-
showError(['MUI X: Expired license key.', '', `Your annual license key to use MUI X ${plan}
|
|
37
|
+
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}`, '']);
|
|
38
38
|
}
|
|
39
39
|
function showExpiredAnnualLicenseKeyError({
|
|
40
40
|
plan,
|
|
41
41
|
licenseKey,
|
|
42
42
|
expiryTimestamp
|
|
43
43
|
}) {
|
|
44
|
-
throw new Error(['MUI X: Expired license key.', '', `Your annual license key to use MUI X ${plan}
|
|
44
|
+
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'));
|
|
45
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-license",
|
|
3
|
-
"version": "7.0.0
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "MUI X License verification",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"homepage": "https://mui.com/x/introduction/licensing/",
|
|
12
12
|
"sideEffects": [
|
|
13
13
|
"./utils/licenseInfo.js",
|
|
14
|
-
"./legacy/utils/licenseInfo.js",
|
|
15
14
|
"./modern/utils/licenseInfo.js",
|
|
16
15
|
"./node/utils/licenseInfo.js"
|
|
17
16
|
],
|
|
@@ -24,8 +23,8 @@
|
|
|
24
23
|
"directory": "packages/x-license"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"@babel/runtime": "^7.
|
|
28
|
-
"@mui/utils": "^5.15.
|
|
26
|
+
"@babel/runtime": "^7.24.0",
|
|
27
|
+
"@mui/utils": "^5.15.14"
|
|
29
28
|
},
|
|
30
29
|
"peerDependencies": {
|
|
31
30
|
"react": "^17.0.0 || ^18.0.0"
|
|
@@ -4,14 +4,14 @@ import { verifyLicense } from '../verifyLicense/verifyLicense';
|
|
|
4
4
|
import { LicenseInfo } from '../utils/licenseInfo';
|
|
5
5
|
import { showExpiredAnnualGraceLicenseKeyError, showExpiredAnnualLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError } from '../utils/licenseErrorMessageUtils';
|
|
6
6
|
import { LICENSE_STATUS } from '../utils/licenseStatus';
|
|
7
|
-
import
|
|
7
|
+
import MuiLicenseInfoContext from '../Unstable_LicenseInfoProvider/MuiLicenseInfoContext';
|
|
8
8
|
export const sharedLicenseStatuses = {};
|
|
9
9
|
export function useLicenseVerifier(packageName, releaseInfo) {
|
|
10
10
|
const {
|
|
11
11
|
key: contextKey
|
|
12
|
-
} = React.useContext(
|
|
12
|
+
} = React.useContext(MuiLicenseInfoContext);
|
|
13
13
|
return React.useMemo(() => {
|
|
14
|
-
const licenseKey = contextKey
|
|
14
|
+
const licenseKey = contextKey ?? LicenseInfo.getLicenseKey();
|
|
15
15
|
|
|
16
16
|
// Cache the response to not trigger the error twice.
|
|
17
17
|
if (sharedLicenseStatuses[packageName] && sharedLicenseStatuses[packageName].key === licenseKey) {
|
|
@@ -23,12 +23,12 @@ export function showExpiredAnnualGraceLicenseKeyError({
|
|
|
23
23
|
licenseKey,
|
|
24
24
|
expiryTimestamp
|
|
25
25
|
}) {
|
|
26
|
-
showError(['MUI X: Expired license key.', '', `Your annual license key to use MUI X ${plan}
|
|
26
|
+
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}`, '']);
|
|
27
27
|
}
|
|
28
28
|
export function showExpiredAnnualLicenseKeyError({
|
|
29
29
|
plan,
|
|
30
30
|
licenseKey,
|
|
31
31
|
expiryTimestamp
|
|
32
32
|
}) {
|
|
33
|
-
throw new Error(['MUI X: Expired license key.', '', `Your annual license key to use MUI X ${plan}
|
|
33
|
+
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'));
|
|
34
34
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import LicenseInfoContext from './LicenseInfoContext';
|
|
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(_ref) {
|
|
12
|
-
var info = _ref.info,
|
|
13
|
-
children = _ref.children;
|
|
14
|
-
return /*#__PURE__*/_jsx(LicenseInfoContext.Provider, {
|
|
15
|
-
value: info,
|
|
16
|
-
children: children
|
|
17
|
-
});
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { LicenseInfoProvider as Unstable_LicenseInfoProvider } from './LicenseInfoProvider';
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useLicenseVerifier } from '../useLicenseVerifier';
|
|
3
|
-
import { LICENSE_STATUS } from '../utils/licenseStatus';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
function getLicenseErrorMessage(licenseStatus) {
|
|
6
|
-
switch (licenseStatus) {
|
|
7
|
-
case LICENSE_STATUS.ExpiredAnnualGrace:
|
|
8
|
-
case LICENSE_STATUS.ExpiredAnnual:
|
|
9
|
-
return 'MUI X Expired license key';
|
|
10
|
-
case LICENSE_STATUS.ExpiredVersion:
|
|
11
|
-
return 'MUI X Expired package version';
|
|
12
|
-
case LICENSE_STATUS.Invalid:
|
|
13
|
-
return 'MUI X Invalid license key';
|
|
14
|
-
case LICENSE_STATUS.OutOfScope:
|
|
15
|
-
return 'MUI X License key plan mismatch';
|
|
16
|
-
case LICENSE_STATUS.NotFound:
|
|
17
|
-
return 'MUI X Missing license key';
|
|
18
|
-
default:
|
|
19
|
-
throw new Error('Unhandled MUI X license status.');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export function Watermark(props) {
|
|
23
|
-
var packageName = props.packageName,
|
|
24
|
-
releaseInfo = props.releaseInfo;
|
|
25
|
-
var licenseStatus = useLicenseVerifier(packageName, releaseInfo);
|
|
26
|
-
if (licenseStatus.status === LICENSE_STATUS.Valid) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
return /*#__PURE__*/_jsx("div", {
|
|
30
|
-
style: {
|
|
31
|
-
position: 'absolute',
|
|
32
|
-
pointerEvents: 'none',
|
|
33
|
-
color: '#8282829e',
|
|
34
|
-
zIndex: 100000,
|
|
35
|
-
width: '100%',
|
|
36
|
-
textAlign: 'center',
|
|
37
|
-
bottom: '50%',
|
|
38
|
-
right: 0,
|
|
39
|
-
letterSpacing: 5,
|
|
40
|
-
fontSize: 24
|
|
41
|
-
},
|
|
42
|
-
children: getLicenseErrorMessage(licenseStatus.status)
|
|
43
|
-
});
|
|
44
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Watermark';
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
3
|
-
function utf8Encode(str) {
|
|
4
|
-
for (var n = 0; n < str.length; n++) {
|
|
5
|
-
var c = str.charCodeAt(n);
|
|
6
|
-
if (c >= 128) {
|
|
7
|
-
throw new Error('ASCII only support');
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return str;
|
|
11
|
-
}
|
|
12
|
-
export var base64Decode = function base64Decode(input) {
|
|
13
|
-
var output = '';
|
|
14
|
-
var chr1, chr2, chr3;
|
|
15
|
-
var enc1, enc2, enc3, enc4;
|
|
16
|
-
var 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 var base64Encode = function base64Encode(input) {
|
|
37
|
-
var output = '';
|
|
38
|
-
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
|
39
|
-
var 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/legacy/encoding/md5.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// See "precomputation" in notes
|
|
3
|
-
var k = [];
|
|
4
|
-
var 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
|
-
var words = [];
|
|
11
|
-
var b,
|
|
12
|
-
c,
|
|
13
|
-
d,
|
|
14
|
-
j = unescape(encodeURI(s)) + '\x80',
|
|
15
|
-
a = j.length;
|
|
16
|
-
var 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,18 +0,0 @@
|
|
|
1
|
-
import { md5 } from '../encoding/md5';
|
|
2
|
-
import { base64Encode } from '../encoding/base64';
|
|
3
|
-
import { LICENSE_SCOPES } from '../utils/licenseScope';
|
|
4
|
-
import { LICENSING_MODELS } from '../utils/licensingModel';
|
|
5
|
-
var licenseVersion = '2';
|
|
6
|
-
function getClearLicenseString(details) {
|
|
7
|
-
if (details.scope && !LICENSE_SCOPES.includes(details.scope)) {
|
|
8
|
-
throw new Error('MUI X: Invalid scope');
|
|
9
|
-
}
|
|
10
|
-
if (details.licensingModel && !LICENSING_MODELS.includes(details.licensingModel)) {
|
|
11
|
-
throw new Error('MUI X: Invalid licensing model');
|
|
12
|
-
}
|
|
13
|
-
return "O=".concat(details.orderNumber, ",E=").concat(details.expiryDate.getTime(), ",S=").concat(details.scope, ",LM=").concat(details.licensingModel, ",KV=").concat(licenseVersion);
|
|
14
|
-
}
|
|
15
|
-
export function generateLicense(details) {
|
|
16
|
-
var licenseStr = getClearLicenseString(details);
|
|
17
|
-
return "".concat(md5(base64Encode(licenseStr))).concat(base64Encode(licenseStr));
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './generateLicense';
|
package/legacy/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @mui/x-license v7.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';
|
|
9
|
-
export * from './utils';
|
|
10
|
-
export * from './verifyLicense';
|
|
11
|
-
export * from './useLicenseVerifier';
|
|
12
|
-
export * from './Watermark';
|
|
13
|
-
export * from './Unstable_LicenseInfoProvider';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useLicenseVerifier } from './useLicenseVerifier';
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { verifyLicense } from '../verifyLicense/verifyLicense';
|
|
4
|
-
import { LicenseInfo } from '../utils/licenseInfo';
|
|
5
|
-
import { showExpiredAnnualGraceLicenseKeyError, showExpiredAnnualLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError } from '../utils/licenseErrorMessageUtils';
|
|
6
|
-
import { LICENSE_STATUS } from '../utils/licenseStatus';
|
|
7
|
-
import LicenseInfoContext from '../Unstable_LicenseInfoProvider/LicenseInfoContext';
|
|
8
|
-
export var sharedLicenseStatuses = {};
|
|
9
|
-
export function useLicenseVerifier(packageName, releaseInfo) {
|
|
10
|
-
var _React$useContext = React.useContext(LicenseInfoContext),
|
|
11
|
-
contextKey = _React$useContext.key;
|
|
12
|
-
return React.useMemo(function () {
|
|
13
|
-
var licenseKey = contextKey != null ? contextKey : LicenseInfo.getLicenseKey();
|
|
14
|
-
|
|
15
|
-
// Cache the response to not trigger the error twice.
|
|
16
|
-
if (sharedLicenseStatuses[packageName] && sharedLicenseStatuses[packageName].key === licenseKey) {
|
|
17
|
-
return sharedLicenseStatuses[packageName].licenseVerifier;
|
|
18
|
-
}
|
|
19
|
-
var acceptedScopes = packageName.includes('premium') ? ['premium'] : ['pro', 'premium'];
|
|
20
|
-
var plan = packageName.includes('premium') ? 'Premium' : 'Pro';
|
|
21
|
-
var licenseStatus = verifyLicense({
|
|
22
|
-
releaseInfo: releaseInfo,
|
|
23
|
-
licenseKey: licenseKey,
|
|
24
|
-
acceptedScopes: acceptedScopes
|
|
25
|
-
});
|
|
26
|
-
var fullPackageName = "@mui/".concat(packageName);
|
|
27
|
-
if (licenseStatus.status === LICENSE_STATUS.Valid) {
|
|
28
|
-
// Skip
|
|
29
|
-
} else if (licenseStatus.status === LICENSE_STATUS.Invalid) {
|
|
30
|
-
showInvalidLicenseKeyError();
|
|
31
|
-
} else if (licenseStatus.status === LICENSE_STATUS.OutOfScope) {
|
|
32
|
-
showLicenseKeyPlanMismatchError();
|
|
33
|
-
} else if (licenseStatus.status === LICENSE_STATUS.NotFound) {
|
|
34
|
-
showMissingLicenseKeyError({
|
|
35
|
-
plan: plan,
|
|
36
|
-
packageName: fullPackageName
|
|
37
|
-
});
|
|
38
|
-
} else if (licenseStatus.status === LICENSE_STATUS.ExpiredAnnualGrace) {
|
|
39
|
-
showExpiredAnnualGraceLicenseKeyError(_extends({
|
|
40
|
-
plan: plan
|
|
41
|
-
}, licenseStatus.meta));
|
|
42
|
-
} else if (licenseStatus.status === LICENSE_STATUS.ExpiredAnnual) {
|
|
43
|
-
showExpiredAnnualLicenseKeyError(_extends({
|
|
44
|
-
plan: plan
|
|
45
|
-
}, licenseStatus.meta));
|
|
46
|
-
} else if (licenseStatus.status === LICENSE_STATUS.ExpiredVersion) {
|
|
47
|
-
showExpiredPackageVersionError({
|
|
48
|
-
packageName: fullPackageName
|
|
49
|
-
});
|
|
50
|
-
} else if (process.env.NODE_ENV !== 'production') {
|
|
51
|
-
throw new Error('missing status handler');
|
|
52
|
-
}
|
|
53
|
-
sharedLicenseStatuses[packageName] = {
|
|
54
|
-
key: licenseKey,
|
|
55
|
-
licenseVerifier: licenseStatus
|
|
56
|
-
};
|
|
57
|
-
return licenseStatus;
|
|
58
|
-
}, [packageName, releaseInfo, contextKey]);
|
|
59
|
-
}
|
package/legacy/utils/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
function showError(message) {
|
|
3
|
-
console.error(['*************************************************************', ''].concat(_toConsumableArray(message), ['', '*************************************************************']).join('\n'));
|
|
4
|
-
}
|
|
5
|
-
export function showInvalidLicenseKeyError() {
|
|
6
|
-
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.']);
|
|
7
|
-
}
|
|
8
|
-
export function showLicenseKeyPlanMismatchError() {
|
|
9
|
-
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`."]);
|
|
10
|
-
}
|
|
11
|
-
export function showMissingLicenseKeyError(_ref) {
|
|
12
|
-
var plan = _ref.plan,
|
|
13
|
-
packageName = _ref.packageName;
|
|
14
|
-
showError(['MUI X: Missing license key.', '', "The license key is missing. You might not be allowed to use `".concat(packageName, "` which is part of MUI X ").concat(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.']);
|
|
15
|
-
}
|
|
16
|
-
export function showExpiredPackageVersionError(_ref2) {
|
|
17
|
-
var packageName = _ref2.packageName;
|
|
18
|
-
showError(['MUI X: Expired package version.', '', "You have installed a version of `".concat(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.']);
|
|
19
|
-
}
|
|
20
|
-
export function showExpiredAnnualGraceLicenseKeyError(_ref3) {
|
|
21
|
-
var plan = _ref3.plan,
|
|
22
|
-
licenseKey = _ref3.licenseKey,
|
|
23
|
-
expiryTimestamp = _ref3.expiryTimestamp;
|
|
24
|
-
showError(['MUI X: Expired license key.', '', "Your annual license key to use MUI X ".concat(plan, "'s on non-production environments is 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 ").concat(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 ".concat(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: ".concat(new Date(expiryTimestamp)), "- Installed license key: ".concat(licenseKey), '']);
|
|
25
|
-
}
|
|
26
|
-
export function showExpiredAnnualLicenseKeyError(_ref4) {
|
|
27
|
-
var plan = _ref4.plan,
|
|
28
|
-
licenseKey = _ref4.licenseKey,
|
|
29
|
-
expiryTimestamp = _ref4.expiryTimestamp;
|
|
30
|
-
throw new Error(['MUI X: Expired license key.', '', "Your annual license key to use MUI X ".concat(plan, "'s on non-production environments is 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 ").concat(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 ".concat(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: ".concat(new Date(expiryTimestamp)), "- Installed license key: ".concat(licenseKey), ''].join('\n'));
|
|
31
|
-
}
|