@mui/x-license 8.0.0-alpha.8 → 8.0.0-beta.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 +2566 -687
- package/Unstable_LicenseInfoProvider/LicenseInfoProvider.d.ts +7 -4
- package/Unstable_LicenseInfoProvider/LicenseInfoProvider.js +13 -5
- package/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.d.ts +2 -2
- package/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js +10 -2
- package/Unstable_LicenseInfoProvider/index.d.ts +2 -2
- package/Unstable_LicenseInfoProvider/index.js +12 -1
- package/Watermark/Watermark.d.ts +4 -4
- package/Watermark/Watermark.js +23 -17
- package/Watermark/index.d.ts +1 -1
- package/Watermark/index.js +16 -1
- package/encoding/base64.d.ts +1 -1
- package/encoding/base64.js +11 -3
- package/encoding/md5.d.ts +1 -1
- package/encoding/md5.js +7 -1
- package/esm/Unstable_LicenseInfoProvider/LicenseInfoProvider.d.ts +16 -0
- package/esm/Unstable_LicenseInfoProvider/LicenseInfoProvider.js +19 -0
- package/esm/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.d.ts +4 -0
- package/esm/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js +10 -0
- package/esm/Unstable_LicenseInfoProvider/index.d.ts +2 -0
- package/esm/Unstable_LicenseInfoProvider/index.js +1 -0
- package/esm/Watermark/Watermark.d.ts +9 -0
- package/esm/Watermark/Watermark.js +51 -0
- package/esm/Watermark/index.d.ts +1 -0
- package/esm/Watermark/index.js +1 -0
- package/esm/encoding/base64.d.ts +2 -0
- package/{node → esm}/encoding/base64.js +3 -11
- package/esm/encoding/md5.d.ts +1 -0
- package/{node → esm}/encoding/md5.js +1 -7
- package/esm/generateLicense/generateLicense.d.ts +10 -0
- package/esm/generateLicense/generateLicense.js +19 -0
- package/esm/generateLicense/index.d.ts +1 -0
- package/esm/generateLicense/index.js +1 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.js +14 -0
- package/esm/package.json +1 -0
- package/esm/useLicenseVerifier/index.d.ts +1 -0
- package/esm/useLicenseVerifier/index.js +1 -0
- package/esm/useLicenseVerifier/useLicenseVerifier.d.ts +11 -0
- package/esm/useLicenseVerifier/useLicenseVerifier.js +69 -0
- package/esm/utils/commercialPackages.d.ts +1 -0
- package/esm/utils/commercialPackages.js +1 -0
- package/esm/utils/index.d.ts +6 -0
- package/esm/utils/index.js +4 -0
- package/esm/utils/licenseErrorMessageUtils.d.ts +33 -0
- package/{node → esm}/utils/licenseErrorMessageUtils.js +7 -19
- package/esm/utils/licenseInfo.d.ts +11 -0
- package/{node → esm}/utils/licenseInfo.js +5 -11
- package/esm/utils/licenseModel.d.ts +2 -0
- package/{node → esm}/utils/licenseModel.js +1 -7
- package/esm/utils/licenseStatus.d.ts +11 -0
- package/{node → esm}/utils/licenseStatus.js +1 -7
- package/esm/utils/plan.d.ts +4 -0
- package/esm/utils/plan.js +2 -0
- package/esm/verifyLicense/index.d.ts +1 -0
- package/esm/verifyLicense/index.js +1 -0
- package/esm/verifyLicense/verifyLicense.d.ts +15 -0
- package/{node → esm}/verifyLicense/verifyLicense.js +25 -32
- package/generateLicense/generateLicense.d.ts +8 -8
- package/generateLicense/generateLicense.js +14 -8
- package/generateLicense/index.d.ts +1 -1
- package/generateLicense/index.js +16 -1
- package/index.d.ts +7 -6
- package/index.js +88 -7
- package/modern/Unstable_LicenseInfoProvider/LicenseInfoProvider.d.ts +16 -0
- package/modern/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.d.ts +4 -0
- package/modern/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js +2 -0
- package/modern/Unstable_LicenseInfoProvider/index.d.ts +2 -0
- package/modern/Watermark/Watermark.d.ts +9 -0
- package/modern/Watermark/index.d.ts +1 -0
- package/modern/encoding/base64.d.ts +2 -0
- package/modern/encoding/md5.d.ts +1 -0
- package/modern/generateLicense/generateLicense.d.ts +10 -0
- package/modern/generateLicense/index.d.ts +1 -0
- package/modern/index.d.ts +7 -0
- package/modern/index.js +3 -2
- package/modern/package.json +1 -0
- package/modern/useLicenseVerifier/index.d.ts +1 -0
- package/modern/useLicenseVerifier/useLicenseVerifier.d.ts +11 -0
- package/modern/useLicenseVerifier/useLicenseVerifier.js +8 -0
- package/modern/utils/commercialPackages.d.ts +1 -0
- package/modern/utils/index.d.ts +6 -0
- package/modern/utils/licenseErrorMessageUtils.d.ts +33 -0
- package/modern/utils/licenseInfo.d.ts +11 -0
- package/modern/utils/licenseModel.d.ts +2 -0
- package/modern/utils/licenseStatus.d.ts +11 -0
- package/modern/utils/plan.d.ts +4 -0
- package/modern/verifyLicense/index.d.ts +1 -0
- package/modern/verifyLicense/verifyLicense.d.ts +15 -0
- package/package.json +40 -6
- package/tsconfig.build.tsbuildinfo +1 -0
- package/useLicenseVerifier/index.d.ts +1 -1
- package/useLicenseVerifier/index.js +12 -1
- package/useLicenseVerifier/useLicenseVerifier.d.ts +10 -12
- package/useLicenseVerifier/useLicenseVerifier.js +44 -27
- package/utils/commercialPackages.d.ts +1 -1
- package/utils/commercialPackages.js +5 -1
- package/utils/index.d.ts +4 -4
- package/utils/index.js +38 -4
- package/utils/licenseErrorMessageUtils.d.ts +27 -14
- package/utils/licenseErrorMessageUtils.js +19 -7
- package/utils/licenseInfo.d.ts +5 -5
- package/utils/licenseInfo.js +11 -5
- package/utils/licenseModel.d.ts +1 -1
- package/utils/licenseModel.js +7 -1
- package/utils/licenseStatus.d.ts +9 -9
- package/utils/licenseStatus.js +7 -1
- package/utils/plan.d.ts +1 -1
- package/utils/plan.js +8 -2
- package/verifyLicense/index.d.ts +1 -1
- package/verifyLicense/index.js +16 -1
- package/verifyLicense/verifyLicense.d.ts +13 -9
- package/verifyLicense/verifyLicense.js +32 -25
- package/Unstable_LicenseInfoProvider/package.json +0 -6
- package/Watermark/package.json +0 -6
- package/generateLicense/package.json +0 -6
- package/node/Unstable_LicenseInfoProvider/LicenseInfoProvider.js +0 -27
- package/node/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js +0 -15
- package/node/Unstable_LicenseInfoProvider/index.js +0 -12
- package/node/Watermark/Watermark.js +0 -57
- package/node/Watermark/index.js +0 -16
- package/node/generateLicense/generateLicense.js +0 -25
- package/node/generateLicense/index.js +0 -16
- package/node/index.js +0 -78
- package/node/useLicenseVerifier/index.js +0 -12
- package/node/useLicenseVerifier/useLicenseVerifier.js +0 -70
- package/node/utils/commercialPackages.js +0 -5
- package/node/utils/index.js +0 -38
- package/node/utils/plan.js +0 -8
- package/node/verifyLicense/index.js +0 -16
- package/useLicenseVerifier/package.json +0 -6
- package/utils/package.json +0 -6
- package/verifyLicense/package.json +0 -6
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { MuiLicenseInfo } from
|
|
2
|
+
import { MuiLicenseInfo } from "../utils/licenseInfo.js";
|
|
3
3
|
/**
|
|
4
4
|
* @ignore - do not document.
|
|
5
5
|
*/
|
|
6
6
|
export interface LicenseInfoProviderProps {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
info: MuiLicenseInfo;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* @ignore - do not document.
|
|
12
12
|
*/
|
|
13
|
-
export declare function LicenseInfoProvider({
|
|
13
|
+
export declare function LicenseInfoProvider({
|
|
14
|
+
info,
|
|
15
|
+
children
|
|
16
|
+
}: LicenseInfoProviderProps): React.JSX.Element;
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
import MuiLicenseInfoContext from "./MuiLicenseInfoContext.js";
|
|
1
|
+
"use strict";
|
|
3
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.LicenseInfoProvider = LicenseInfoProvider;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _MuiLicenseInfoContext = _interopRequireDefault(require("./MuiLicenseInfoContext"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
4
12
|
/**
|
|
5
13
|
* @ignore - do not document.
|
|
6
14
|
*/
|
|
7
|
-
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
* @ignore - do not document.
|
|
10
18
|
*/
|
|
11
|
-
|
|
19
|
+
function LicenseInfoProvider({
|
|
12
20
|
info,
|
|
13
21
|
children
|
|
14
22
|
}) {
|
|
15
|
-
return /*#__PURE__*/
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MuiLicenseInfoContext.default.Provider, {
|
|
16
24
|
value: info,
|
|
17
25
|
children: children
|
|
18
26
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { MuiLicenseInfo } from
|
|
2
|
+
import { MuiLicenseInfo } from "../utils/licenseInfo.js";
|
|
3
3
|
declare const MuiLicenseInfoContext: React.Context<MuiLicenseInfo>;
|
|
4
|
-
export default MuiLicenseInfoContext;
|
|
4
|
+
export default MuiLicenseInfoContext;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
2
10
|
const MuiLicenseInfoContext = /*#__PURE__*/React.createContext({
|
|
3
11
|
key: undefined
|
|
4
12
|
});
|
|
5
13
|
if (process.env.NODE_ENV !== 'production') {
|
|
6
14
|
MuiLicenseInfoContext.displayName = 'MuiLicenseInfoContext';
|
|
7
15
|
}
|
|
8
|
-
|
|
16
|
+
var _default = exports.default = MuiLicenseInfoContext;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { LicenseInfoProvider as Unstable_LicenseInfoProvider } from
|
|
2
|
-
export type { LicenseInfoProviderProps as Unstable_LicenseInfoProviderProps } from './LicenseInfoProvider';
|
|
1
|
+
export { LicenseInfoProvider as Unstable_LicenseInfoProvider } from "./LicenseInfoProvider.js";
|
|
2
|
+
export type { LicenseInfoProviderProps as Unstable_LicenseInfoProviderProps } from './LicenseInfoProvider';
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Unstable_LicenseInfoProvider", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _LicenseInfoProvider.LicenseInfoProvider;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _LicenseInfoProvider = require("./LicenseInfoProvider");
|
package/Watermark/Watermark.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { MuiCommercialPackageName } from
|
|
2
|
+
import { MuiCommercialPackageName } from "../utils/commercialPackages.js";
|
|
3
3
|
interface WatermarkProps {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
packageName: MuiCommercialPackageName;
|
|
5
|
+
releaseInfo: string;
|
|
6
6
|
}
|
|
7
7
|
declare function Watermark(props: WatermarkProps): React.JSX.Element | null;
|
|
8
8
|
declare const MemoizedWatermark: typeof Watermark;
|
|
9
|
-
export { MemoizedWatermark as Watermark };
|
|
9
|
+
export { MemoizedWatermark as Watermark };
|
package/Watermark/Watermark.js
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Watermark = void 0;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
10
|
+
var _useLicenseVerifier = require("../useLicenseVerifier");
|
|
11
|
+
var _licenseStatus = require("../utils/licenseStatus");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
13
|
function getLicenseErrorMessage(licenseStatus) {
|
|
7
14
|
switch (licenseStatus) {
|
|
8
|
-
case LICENSE_STATUS.ExpiredAnnualGrace:
|
|
9
|
-
case LICENSE_STATUS.ExpiredAnnual:
|
|
15
|
+
case _licenseStatus.LICENSE_STATUS.ExpiredAnnualGrace:
|
|
16
|
+
case _licenseStatus.LICENSE_STATUS.ExpiredAnnual:
|
|
10
17
|
return 'MUI X Expired license key';
|
|
11
|
-
case LICENSE_STATUS.ExpiredVersion:
|
|
18
|
+
case _licenseStatus.LICENSE_STATUS.ExpiredVersion:
|
|
12
19
|
return 'MUI X Expired package version';
|
|
13
|
-
case LICENSE_STATUS.Invalid:
|
|
20
|
+
case _licenseStatus.LICENSE_STATUS.Invalid:
|
|
14
21
|
return 'MUI X Invalid license key';
|
|
15
|
-
case LICENSE_STATUS.OutOfScope:
|
|
22
|
+
case _licenseStatus.LICENSE_STATUS.OutOfScope:
|
|
16
23
|
return 'MUI X License key plan mismatch';
|
|
17
|
-
case LICENSE_STATUS.NotAvailableInInitialProPlan:
|
|
24
|
+
case _licenseStatus.LICENSE_STATUS.NotAvailableInInitialProPlan:
|
|
18
25
|
return 'MUI X Product not covered by plan';
|
|
19
|
-
case LICENSE_STATUS.NotFound:
|
|
26
|
+
case _licenseStatus.LICENSE_STATUS.NotFound:
|
|
20
27
|
return 'MUI X Missing license key';
|
|
21
28
|
default:
|
|
22
29
|
throw new Error('Unhandled MUI X license status.');
|
|
@@ -27,11 +34,11 @@ function Watermark(props) {
|
|
|
27
34
|
packageName,
|
|
28
35
|
releaseInfo
|
|
29
36
|
} = props;
|
|
30
|
-
const licenseStatus = useLicenseVerifier(packageName, releaseInfo);
|
|
31
|
-
if (licenseStatus.status === LICENSE_STATUS.Valid) {
|
|
37
|
+
const licenseStatus = (0, _useLicenseVerifier.useLicenseVerifier)(packageName, releaseInfo);
|
|
38
|
+
if (licenseStatus.status === _licenseStatus.LICENSE_STATUS.Valid) {
|
|
32
39
|
return null;
|
|
33
40
|
}
|
|
34
|
-
return /*#__PURE__*/
|
|
41
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
35
42
|
style: {
|
|
36
43
|
position: 'absolute',
|
|
37
44
|
pointerEvents: 'none',
|
|
@@ -47,5 +54,4 @@ function Watermark(props) {
|
|
|
47
54
|
children: getLicenseErrorMessage(licenseStatus.status)
|
|
48
55
|
});
|
|
49
56
|
}
|
|
50
|
-
const MemoizedWatermark = fastMemo(Watermark);
|
|
51
|
-
export { MemoizedWatermark as Watermark };
|
|
57
|
+
const MemoizedWatermark = exports.Watermark = (0, _fastMemo.fastMemo)(Watermark);
|
package/Watermark/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./Watermark.js";
|
package/Watermark/index.js
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Watermark = require("./Watermark");
|
|
7
|
+
Object.keys(_Watermark).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Watermark[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Watermark[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
package/encoding/base64.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const base64Decode: (input: string) => string;
|
|
2
|
-
export declare const base64Encode: (input: string) => string;
|
|
2
|
+
export declare const base64Encode: (input: string) => string;
|
package/encoding/base64.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.base64Encode = exports.base64Decode = void 0;
|
|
1
7
|
/* eslint-disable */
|
|
2
8
|
const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
3
9
|
function utf8Encode(str) {
|
|
@@ -9,7 +15,7 @@ function utf8Encode(str) {
|
|
|
9
15
|
}
|
|
10
16
|
return str;
|
|
11
17
|
}
|
|
12
|
-
|
|
18
|
+
const base64Decode = input => {
|
|
13
19
|
let output = '';
|
|
14
20
|
let chr1, chr2, chr3;
|
|
15
21
|
let enc1, enc2, enc3, enc4;
|
|
@@ -33,7 +39,8 @@ export const base64Decode = input => {
|
|
|
33
39
|
}
|
|
34
40
|
return output;
|
|
35
41
|
};
|
|
36
|
-
|
|
42
|
+
exports.base64Decode = base64Decode;
|
|
43
|
+
const base64Encode = input => {
|
|
37
44
|
let output = '';
|
|
38
45
|
let chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
|
39
46
|
let i = 0;
|
|
@@ -54,4 +61,5 @@ export const base64Encode = input => {
|
|
|
54
61
|
output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
|
|
55
62
|
}
|
|
56
63
|
return output;
|
|
57
|
-
};
|
|
64
|
+
};
|
|
65
|
+
exports.base64Encode = base64Encode;
|
package/encoding/md5.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function md5(s: any): any;
|
|
1
|
+
export declare function md5(s: any): any;
|
package/encoding/md5.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.md5 = md5;
|
|
1
7
|
/* eslint-disable */
|
|
2
8
|
// See "precomputation" in notes
|
|
3
9
|
const k = [];
|
|
@@ -6,7 +12,7 @@ for (; i < 64;) {
|
|
|
6
12
|
k[i] = 0 | Math.sin(++i % Math.PI) * 4294967296;
|
|
7
13
|
// k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296);
|
|
8
14
|
}
|
|
9
|
-
|
|
15
|
+
function md5(s) {
|
|
10
16
|
const words = [];
|
|
11
17
|
let b,
|
|
12
18
|
c,
|
|
@@ -0,0 +1,16 @@
|
|
|
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;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LicenseInfoProvider as Unstable_LicenseInfoProvider } from "./LicenseInfoProvider.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
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 };
|
|
@@ -0,0 +1,51 @@
|
|
|
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 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Watermark.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Watermark.js";
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.base64Encode = exports.base64Decode = void 0;
|
|
7
1
|
/* eslint-disable */
|
|
8
2
|
const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
9
3
|
function utf8Encode(str) {
|
|
@@ -15,7 +9,7 @@ function utf8Encode(str) {
|
|
|
15
9
|
}
|
|
16
10
|
return str;
|
|
17
11
|
}
|
|
18
|
-
const base64Decode = input => {
|
|
12
|
+
export const base64Decode = input => {
|
|
19
13
|
let output = '';
|
|
20
14
|
let chr1, chr2, chr3;
|
|
21
15
|
let enc1, enc2, enc3, enc4;
|
|
@@ -39,8 +33,7 @@ const base64Decode = input => {
|
|
|
39
33
|
}
|
|
40
34
|
return output;
|
|
41
35
|
};
|
|
42
|
-
|
|
43
|
-
const base64Encode = input => {
|
|
36
|
+
export const base64Encode = input => {
|
|
44
37
|
let output = '';
|
|
45
38
|
let chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
|
46
39
|
let i = 0;
|
|
@@ -61,5 +54,4 @@ const base64Encode = input => {
|
|
|
61
54
|
output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
|
|
62
55
|
}
|
|
63
56
|
return output;
|
|
64
|
-
};
|
|
65
|
-
exports.base64Encode = base64Encode;
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function md5(s: any): any;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.md5 = md5;
|
|
7
1
|
/* eslint-disable */
|
|
8
2
|
// See "precomputation" in notes
|
|
9
3
|
const k = [];
|
|
@@ -12,7 +6,7 @@ for (; i < 64;) {
|
|
|
12
6
|
k[i] = 0 | Math.sin(++i % Math.PI) * 4294967296;
|
|
13
7
|
// k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296);
|
|
14
8
|
}
|
|
15
|
-
function md5(s) {
|
|
9
|
+
export function md5(s) {
|
|
16
10
|
const words = [];
|
|
17
11
|
let b,
|
|
18
12
|
c,
|
|
@@ -0,0 +1,10 @@
|
|
|
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;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./generateLicense.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./generateLicense.js";
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
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/esm/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @mui/x-license v8.0.0-beta.0
|
|
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/esm/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module","sideEffects":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useLicenseVerifier } from "./useLicenseVerifier.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useLicenseVerifier } from "./useLicenseVerifier.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type MuiCommercialPackageName = 'x-data-grid-pro' | 'x-data-grid-premium' | 'x-date-pickers-pro' | 'x-tree-view-pro' | 'x-charts-pro';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
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';
|