@mui/x-license 8.0.0-alpha.11 → 8.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +460 -1
  2. package/Unstable_LicenseInfoProvider/LicenseInfoProvider.d.ts +7 -4
  3. package/Unstable_LicenseInfoProvider/LicenseInfoProvider.js +13 -5
  4. package/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.d.ts +2 -2
  5. package/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js +8 -2
  6. package/Unstable_LicenseInfoProvider/index.d.ts +2 -2
  7. package/Unstable_LicenseInfoProvider/index.js +12 -1
  8. package/Watermark/Watermark.d.ts +4 -4
  9. package/Watermark/Watermark.js +23 -17
  10. package/Watermark/index.d.ts +1 -1
  11. package/Watermark/index.js +16 -1
  12. package/encoding/base64.d.ts +1 -1
  13. package/encoding/base64.js +11 -3
  14. package/encoding/md5.d.ts +1 -1
  15. package/encoding/md5.js +7 -1
  16. package/esm/Unstable_LicenseInfoProvider/LicenseInfoProvider.d.ts +16 -0
  17. package/esm/Unstable_LicenseInfoProvider/LicenseInfoProvider.js +19 -0
  18. package/esm/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.d.ts +4 -0
  19. package/esm/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js +10 -0
  20. package/esm/Unstable_LicenseInfoProvider/index.d.ts +2 -0
  21. package/esm/Unstable_LicenseInfoProvider/index.js +1 -0
  22. package/esm/Watermark/Watermark.d.ts +9 -0
  23. package/esm/Watermark/Watermark.js +51 -0
  24. package/esm/Watermark/index.d.ts +1 -0
  25. package/esm/Watermark/index.js +1 -0
  26. package/esm/encoding/base64.d.ts +2 -0
  27. package/{node → esm}/encoding/base64.js +3 -11
  28. package/esm/encoding/md5.d.ts +1 -0
  29. package/{node → esm}/encoding/md5.js +1 -7
  30. package/esm/generateLicense/generateLicense.d.ts +10 -0
  31. package/esm/generateLicense/generateLicense.js +19 -0
  32. package/esm/generateLicense/index.d.ts +1 -0
  33. package/esm/generateLicense/index.js +1 -0
  34. package/esm/index.d.ts +7 -0
  35. package/esm/index.js +14 -0
  36. package/esm/package.json +1 -0
  37. package/esm/useLicenseVerifier/index.d.ts +1 -0
  38. package/esm/useLicenseVerifier/index.js +1 -0
  39. package/esm/useLicenseVerifier/useLicenseVerifier.d.ts +11 -0
  40. package/esm/useLicenseVerifier/useLicenseVerifier.js +69 -0
  41. package/esm/utils/commercialPackages.d.ts +1 -0
  42. package/esm/utils/commercialPackages.js +1 -0
  43. package/esm/utils/index.d.ts +6 -0
  44. package/esm/utils/index.js +4 -0
  45. package/esm/utils/licenseErrorMessageUtils.d.ts +33 -0
  46. package/{node → esm}/utils/licenseErrorMessageUtils.js +7 -19
  47. package/esm/utils/licenseInfo.d.ts +11 -0
  48. package/{node → esm}/utils/licenseInfo.js +5 -11
  49. package/esm/utils/licenseModel.d.ts +2 -0
  50. package/{node → esm}/utils/licenseModel.js +1 -7
  51. package/esm/utils/licenseStatus.d.ts +11 -0
  52. package/{node → esm}/utils/licenseStatus.js +1 -7
  53. package/esm/utils/plan.d.ts +4 -0
  54. package/esm/utils/plan.js +2 -0
  55. package/esm/verifyLicense/index.d.ts +1 -0
  56. package/esm/verifyLicense/index.js +1 -0
  57. package/esm/verifyLicense/verifyLicense.d.ts +15 -0
  58. package/{node → esm}/verifyLicense/verifyLicense.js +25 -32
  59. package/generateLicense/generateLicense.d.ts +8 -8
  60. package/generateLicense/generateLicense.js +14 -8
  61. package/generateLicense/index.d.ts +1 -1
  62. package/generateLicense/index.js +16 -1
  63. package/index.d.ts +7 -6
  64. package/index.js +88 -7
  65. package/modern/Unstable_LicenseInfoProvider/LicenseInfoProvider.d.ts +16 -0
  66. package/modern/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.d.ts +4 -0
  67. package/modern/Unstable_LicenseInfoProvider/index.d.ts +2 -0
  68. package/modern/Watermark/Watermark.d.ts +9 -0
  69. package/modern/Watermark/index.d.ts +1 -0
  70. package/modern/encoding/base64.d.ts +2 -0
  71. package/modern/encoding/md5.d.ts +1 -0
  72. package/modern/generateLicense/generateLicense.d.ts +10 -0
  73. package/modern/generateLicense/index.d.ts +1 -0
  74. package/modern/index.d.ts +7 -0
  75. package/modern/index.js +3 -2
  76. package/modern/package.json +1 -0
  77. package/modern/useLicenseVerifier/index.d.ts +1 -0
  78. package/modern/useLicenseVerifier/useLicenseVerifier.d.ts +11 -0
  79. package/modern/useLicenseVerifier/useLicenseVerifier.js +8 -0
  80. package/modern/utils/commercialPackages.d.ts +1 -0
  81. package/modern/utils/index.d.ts +6 -0
  82. package/modern/utils/licenseErrorMessageUtils.d.ts +33 -0
  83. package/modern/utils/licenseInfo.d.ts +11 -0
  84. package/modern/utils/licenseModel.d.ts +2 -0
  85. package/modern/utils/licenseStatus.d.ts +11 -0
  86. package/modern/utils/plan.d.ts +4 -0
  87. package/modern/verifyLicense/index.d.ts +1 -0
  88. package/modern/verifyLicense/verifyLicense.d.ts +15 -0
  89. package/package.json +37 -6
  90. package/tsconfig.build.tsbuildinfo +1 -0
  91. package/useLicenseVerifier/index.d.ts +1 -1
  92. package/useLicenseVerifier/index.js +12 -1
  93. package/useLicenseVerifier/useLicenseVerifier.d.ts +10 -12
  94. package/useLicenseVerifier/useLicenseVerifier.js +44 -27
  95. package/utils/commercialPackages.d.ts +1 -1
  96. package/utils/commercialPackages.js +5 -1
  97. package/utils/index.d.ts +4 -4
  98. package/utils/index.js +38 -4
  99. package/utils/licenseErrorMessageUtils.d.ts +27 -14
  100. package/utils/licenseErrorMessageUtils.js +19 -7
  101. package/utils/licenseInfo.d.ts +5 -5
  102. package/utils/licenseInfo.js +11 -5
  103. package/utils/licenseModel.d.ts +1 -1
  104. package/utils/licenseModel.js +7 -1
  105. package/utils/licenseStatus.d.ts +9 -9
  106. package/utils/licenseStatus.js +7 -1
  107. package/utils/plan.d.ts +1 -1
  108. package/utils/plan.js +8 -2
  109. package/verifyLicense/index.d.ts +1 -1
  110. package/verifyLicense/index.js +16 -1
  111. package/verifyLicense/verifyLicense.d.ts +13 -9
  112. package/verifyLicense/verifyLicense.js +32 -25
  113. package/Unstable_LicenseInfoProvider/package.json +0 -6
  114. package/Watermark/package.json +0 -6
  115. package/generateLicense/package.json +0 -6
  116. package/node/Unstable_LicenseInfoProvider/LicenseInfoProvider.js +0 -27
  117. package/node/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js +0 -16
  118. package/node/Unstable_LicenseInfoProvider/index.js +0 -12
  119. package/node/Watermark/Watermark.js +0 -57
  120. package/node/Watermark/index.js +0 -16
  121. package/node/generateLicense/generateLicense.js +0 -25
  122. package/node/generateLicense/index.js +0 -16
  123. package/node/index.js +0 -78
  124. package/node/useLicenseVerifier/index.js +0 -12
  125. package/node/useLicenseVerifier/useLicenseVerifier.js +0 -70
  126. package/node/utils/commercialPackages.js +0 -5
  127. package/node/utils/index.js +0 -38
  128. package/node/utils/plan.js +0 -8
  129. package/node/verifyLicense/index.js +0 -16
  130. package/useLicenseVerifier/package.json +0 -6
  131. package/utils/package.json +0 -6
  132. package/verifyLicense/package.json +0 -6
@@ -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
- export const base64Decode = input => {
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
- export const base64Encode = input => {
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
- export function md5(s) {
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,4 @@
1
+ import * as React from 'react';
2
+ import { MuiLicenseInfo } from "../utils/licenseInfo.js";
3
+ declare const MuiLicenseInfoContext: React.Context<MuiLicenseInfo>;
4
+ export default MuiLicenseInfoContext;
@@ -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,2 @@
1
+ export { LicenseInfoProvider as Unstable_LicenseInfoProvider } from "./LicenseInfoProvider.js";
2
+ export type { LicenseInfoProviderProps as Unstable_LicenseInfoProviderProps } from './LicenseInfoProvider';
@@ -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";
@@ -0,0 +1,2 @@
1
+ export declare const base64Decode: (input: string) => string;
2
+ export declare const base64Encode: (input: string) => string;
@@ -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
- exports.base64Decode = base64Decode;
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-alpha.13
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';
@@ -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';
@@ -0,0 +1,4 @@
1
+ export * from "./licenseErrorMessageUtils.js";
2
+ export * from "./licenseInfo.js";
3
+ export * from "./licenseStatus.js";
4
+ export {};
@@ -0,0 +1,33 @@
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,15 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.showExpiredAnnualGraceLicenseKeyError = showExpiredAnnualGraceLicenseKeyError;
7
- exports.showExpiredAnnualLicenseKeyError = showExpiredAnnualLicenseKeyError;
8
- exports.showExpiredPackageVersionError = showExpiredPackageVersionError;
9
- exports.showInvalidLicenseKeyError = showInvalidLicenseKeyError;
10
- exports.showLicenseKeyPlanMismatchError = showLicenseKeyPlanMismatchError;
11
- exports.showMissingLicenseKeyError = showMissingLicenseKeyError;
12
- exports.showNotAvailableInInitialProPlanError = showNotAvailableInInitialProPlanError;
13
1
  /**
14
2
  * Workaround for the codesadbox preview error.
15
3
  *
@@ -25,34 +13,34 @@ function showError(message) {
25
13
  const logger = isCodeSandbox ? console.log : console.error;
26
14
  logger(['*************************************************************', '', ...message, '', '*************************************************************'].join('\n'));
27
15
  }
28
- function showInvalidLicenseKeyError() {
16
+ export function showInvalidLicenseKeyError() {
29
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.']);
30
18
  }
31
- function showLicenseKeyPlanMismatchError() {
19
+ export function showLicenseKeyPlanMismatchError() {
32
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`."]);
33
21
  }
34
- function showNotAvailableInInitialProPlanError() {
22
+ export function showNotAvailableInInitialProPlanError() {
35
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.']);
36
24
  }
37
- function showMissingLicenseKeyError({
25
+ export function showMissingLicenseKeyError({
38
26
  plan,
39
27
  packageName
40
28
  }) {
41
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.']);
42
30
  }
43
- function showExpiredPackageVersionError({
31
+ export function showExpiredPackageVersionError({
44
32
  packageName
45
33
  }) {
46
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.']);
47
35
  }
48
- function showExpiredAnnualGraceLicenseKeyError({
36
+ export function showExpiredAnnualGraceLicenseKeyError({
49
37
  plan,
50
38
  licenseKey,
51
39
  expiryTimestamp
52
40
  }) {
53
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}`, '']);
54
42
  }
55
- function showExpiredAnnualLicenseKeyError({
43
+ export function showExpiredAnnualLicenseKeyError({
56
44
  plan,
57
45
  licenseKey,
58
46
  expiryTimestamp
@@ -0,0 +1,11 @@
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,10 +1,5 @@
1
- "use strict";
1
+ import { ponyfillGlobal } from '@mui/utils';
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.LicenseInfo = void 0;
7
- var _utils = require("@mui/utils");
8
3
  /**
9
4
  * @ignore - do not document.
10
5
  */
@@ -14,13 +9,13 @@ var _utils = require("@mui/utils");
14
9
  // if using multiple version of MUI X at the same time of the bundler
15
10
  // decide to duplicate to improve the size of the chunks.
16
11
  // eslint-disable-next-line no-underscore-dangle
17
- _utils.ponyfillGlobal.__MUI_LICENSE_INFO__ = _utils.ponyfillGlobal.__MUI_LICENSE_INFO__ || {
12
+ ponyfillGlobal.__MUI_LICENSE_INFO__ = ponyfillGlobal.__MUI_LICENSE_INFO__ || {
18
13
  key: undefined
19
14
  };
20
- class LicenseInfo {
15
+ export class LicenseInfo {
21
16
  static getLicenseInfo() {
22
17
  // eslint-disable-next-line no-underscore-dangle
23
- return _utils.ponyfillGlobal.__MUI_LICENSE_INFO__;
18
+ return ponyfillGlobal.__MUI_LICENSE_INFO__;
24
19
  }
25
20
  static getLicenseKey() {
26
21
  return LicenseInfo.getLicenseInfo().key;
@@ -29,5 +24,4 @@ class LicenseInfo {
29
24
  const licenseInfo = LicenseInfo.getLicenseInfo();
30
25
  licenseInfo.key = key;
31
26
  }
32
- }
33
- exports.LicenseInfo = LicenseInfo;
27
+ }
@@ -0,0 +1,2 @@
1
+ export declare const LICENSE_MODELS: readonly ["perpetual", "annual", "subscription"];
2
+ export type LicenseModel = (typeof LICENSE_MODELS)[number];
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.LICENSE_MODELS = void 0;
7
- const LICENSE_MODELS = exports.LICENSE_MODELS = [
1
+ export const LICENSE_MODELS = [
8
2
  /**
9
3
  * A license is outdated if the current version of the software was released after the expiry date of the license.
10
4
  * But the license can be used indefinitely with an older version of the software.
@@ -0,0 +1,11 @@
1
+ export declare enum LICENSE_STATUS {
2
+ NotFound = "NotFound",
3
+ Invalid = "Invalid",
4
+ ExpiredAnnual = "ExpiredAnnual",
5
+ ExpiredAnnualGrace = "ExpiredAnnualGrace",
6
+ ExpiredVersion = "ExpiredVersion",
7
+ Valid = "Valid",
8
+ OutOfScope = "OutOfScope",
9
+ NotAvailableInInitialProPlan = "NotAvailableInInitialProPlan",
10
+ }
11
+ export type LicenseStatus = keyof typeof LICENSE_STATUS;
@@ -1,11 +1,5 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.LICENSE_STATUS = void 0;
7
1
  // eslint-disable-next-line @typescript-eslint/naming-convention
8
- let LICENSE_STATUS = exports.LICENSE_STATUS = /*#__PURE__*/function (LICENSE_STATUS) {
2
+ export let LICENSE_STATUS = /*#__PURE__*/function (LICENSE_STATUS) {
9
3
  LICENSE_STATUS["NotFound"] = "NotFound";
10
4
  LICENSE_STATUS["Invalid"] = "Invalid";
11
5
  LICENSE_STATUS["ExpiredAnnual"] = "ExpiredAnnual";
@@ -0,0 +1,4 @@
1
+ export declare const PLAN_SCOPES: readonly ["pro", "premium"];
2
+ export declare const PLAN_VERSIONS: readonly ["initial", "Q3-2024"];
3
+ export type PlanScope = (typeof PLAN_SCOPES)[number];
4
+ export type PlanVersion = (typeof PLAN_VERSIONS)[number];
@@ -0,0 +1,2 @@
1
+ export const PLAN_SCOPES = ['pro', 'premium'];
2
+ export const PLAN_VERSIONS = ['initial', 'Q3-2024'];
@@ -0,0 +1 @@
1
+ export * from "./verifyLicense.js";
@@ -0,0 +1 @@
1
+ export * from "./verifyLicense.js";