@mui/x-license 8.0.0-alpha.9 → 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.
Files changed (132) hide show
  1. package/CHANGELOG.md +1446 -0
  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 +40 -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
@@ -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";
@@ -0,0 +1,15 @@
1
+ import { LicenseStatus } from "../utils/licenseStatus.js";
2
+ import { MuiCommercialPackageName } from "../utils/commercialPackages.js";
3
+ export declare function generateReleaseInfo(releaseDate?: Date): string;
4
+ export declare function verifyLicense({
5
+ releaseInfo,
6
+ licenseKey,
7
+ packageName
8
+ }: {
9
+ releaseInfo: string;
10
+ licenseKey?: string;
11
+ packageName: MuiCommercialPackageName;
12
+ }): {
13
+ status: LicenseStatus;
14
+ meta?: any;
15
+ };
@@ -1,22 +1,15 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.generateReleaseInfo = generateReleaseInfo;
7
- exports.verifyLicense = verifyLicense;
8
- var _base = require("../encoding/base64");
9
- var _md = require("../encoding/md5");
10
- var _licenseStatus = require("../utils/licenseStatus");
11
- var _plan = require("../utils/plan");
12
- var _licenseModel = require("../utils/licenseModel");
1
+ import { base64Decode, base64Encode } from "../encoding/base64.js";
2
+ import { md5 } from "../encoding/md5.js";
3
+ import { LICENSE_STATUS } from "../utils/licenseStatus.js";
4
+ import { PLAN_SCOPES } from "../utils/plan.js";
5
+ import { LICENSE_MODELS } from "../utils/licenseModel.js";
13
6
  const getDefaultReleaseDate = () => {
14
7
  const today = new Date();
15
8
  today.setHours(0, 0, 0, 0);
16
9
  return today;
17
10
  };
18
- function generateReleaseInfo(releaseDate = getDefaultReleaseDate()) {
19
- return (0, _base.base64Encode)(releaseDate.getTime().toString());
11
+ export function generateReleaseInfo(releaseDate = getDefaultReleaseDate()) {
12
+ return base64Encode(releaseDate.getTime().toString());
20
13
  }
21
14
  function isPlanScopeSufficient(packageName, planScope) {
22
15
  let acceptedScopes;
@@ -87,7 +80,7 @@ const decodeLicenseVersion2 = license => {
87
80
  * Decode the license based on its key version and return a version-agnostic `MuiLicense` object.
88
81
  */
89
82
  const decodeLicense = encodedLicense => {
90
- const license = (0, _base.base64Decode)(encodedLicense);
83
+ const license = base64Decode(encodedLicense);
91
84
  if (license.includes('KEYVERSION=1')) {
92
85
  return decodeLicenseVersion1(license);
93
86
  }
@@ -96,7 +89,7 @@ const decodeLicense = encodedLicense => {
96
89
  }
97
90
  return null;
98
91
  };
99
- function verifyLicense({
92
+ export function verifyLicense({
100
93
  releaseInfo,
101
94
  licenseKey,
102
95
  packageName
@@ -106,43 +99,43 @@ function verifyLicense({
106
99
  }
107
100
  if (!licenseKey) {
108
101
  return {
109
- status: _licenseStatus.LICENSE_STATUS.NotFound
102
+ status: LICENSE_STATUS.NotFound
110
103
  };
111
104
  }
112
105
  const hash = licenseKey.substr(0, 32);
113
106
  const encoded = licenseKey.substr(32);
114
- if (hash !== (0, _md.md5)(encoded)) {
107
+ if (hash !== md5(encoded)) {
115
108
  return {
116
- status: _licenseStatus.LICENSE_STATUS.Invalid
109
+ status: LICENSE_STATUS.Invalid
117
110
  };
118
111
  }
119
112
  const license = decodeLicense(encoded);
120
113
  if (license == null) {
121
114
  console.error('MUI X: Error checking license. Key version not found!');
122
115
  return {
123
- status: _licenseStatus.LICENSE_STATUS.Invalid
116
+ status: LICENSE_STATUS.Invalid
124
117
  };
125
118
  }
126
- if (license.licenseModel == null || !_licenseModel.LICENSE_MODELS.includes(license.licenseModel)) {
119
+ if (license.licenseModel == null || !LICENSE_MODELS.includes(license.licenseModel)) {
127
120
  console.error('MUI X: Error checking license. Licensing model not found or invalid!');
128
121
  return {
129
- status: _licenseStatus.LICENSE_STATUS.Invalid
122
+ status: LICENSE_STATUS.Invalid
130
123
  };
131
124
  }
132
125
  if (license.expiryTimestamp == null) {
133
126
  console.error('MUI X: Error checking license. Expiry timestamp not found or invalid!');
134
127
  return {
135
- status: _licenseStatus.LICENSE_STATUS.Invalid
128
+ status: LICENSE_STATUS.Invalid
136
129
  };
137
130
  }
138
131
  if (license.licenseModel === 'perpetual' || process.env.NODE_ENV === 'production') {
139
- const pkgTimestamp = parseInt((0, _base.base64Decode)(releaseInfo), 10);
132
+ const pkgTimestamp = parseInt(base64Decode(releaseInfo), 10);
140
133
  if (Number.isNaN(pkgTimestamp)) {
141
134
  throw new Error('MUI X: The release information is invalid. Not able to validate license.');
142
135
  }
143
136
  if (license.expiryTimestamp < pkgTimestamp) {
144
137
  return {
145
- status: _licenseStatus.LICENSE_STATUS.ExpiredVersion
138
+ status: LICENSE_STATUS.ExpiredVersion
146
139
  };
147
140
  }
148
141
  } else if (license.licenseModel === 'subscription' || license.licenseModel === 'annual') {
@@ -151,7 +144,7 @@ function verifyLicense({
151
144
  // 30 days grace
152
145
  new Date().getTime() < license.expiryTimestamp + 1000 * 3600 * 24 * 30 || process.env.NODE_ENV !== 'development') {
153
146
  return {
154
- status: _licenseStatus.LICENSE_STATUS.ExpiredAnnualGrace,
147
+ status: LICENSE_STATUS.ExpiredAnnualGrace,
155
148
  meta: {
156
149
  expiryTimestamp: license.expiryTimestamp,
157
150
  licenseKey
@@ -159,7 +152,7 @@ function verifyLicense({
159
152
  };
160
153
  }
161
154
  return {
162
- status: _licenseStatus.LICENSE_STATUS.ExpiredAnnual,
155
+ status: LICENSE_STATUS.ExpiredAnnual,
163
156
  meta: {
164
157
  expiryTimestamp: license.expiryTimestamp,
165
158
  licenseKey
@@ -167,25 +160,25 @@ function verifyLicense({
167
160
  };
168
161
  }
169
162
  }
170
- if (license.planScope == null || !_plan.PLAN_SCOPES.includes(license.planScope)) {
163
+ if (license.planScope == null || !PLAN_SCOPES.includes(license.planScope)) {
171
164
  console.error('MUI X: Error checking license. planScope not found or invalid!');
172
165
  return {
173
- status: _licenseStatus.LICENSE_STATUS.Invalid
166
+ status: LICENSE_STATUS.Invalid
174
167
  };
175
168
  }
176
169
  if (!isPlanScopeSufficient(packageName, license.planScope)) {
177
170
  return {
178
- status: _licenseStatus.LICENSE_STATUS.OutOfScope
171
+ status: LICENSE_STATUS.OutOfScope
179
172
  };
180
173
  }
181
174
 
182
175
  // 'charts-pro' or 'tree-view-pro' can only be used with a newer Pro license
183
176
  if (license.planVersion === 'initial' && license.planScope === 'pro' && !PRO_PACKAGES_AVAILABLE_IN_INITIAL_PRO_PLAN.includes(packageName)) {
184
177
  return {
185
- status: _licenseStatus.LICENSE_STATUS.NotAvailableInInitialProPlan
178
+ status: LICENSE_STATUS.NotAvailableInInitialProPlan
186
179
  };
187
180
  }
188
181
  return {
189
- status: _licenseStatus.LICENSE_STATUS.Valid
182
+ status: LICENSE_STATUS.Valid
190
183
  };
191
184
  }
@@ -1,10 +1,10 @@
1
- import { PlanScope, PlanVersion } from '../utils/plan';
2
- import { LicenseModel } from '../utils/licenseModel';
1
+ import { PlanScope, PlanVersion } from "../utils/plan.js";
2
+ import { LicenseModel } from "../utils/licenseModel.js";
3
3
  export interface LicenseDetails {
4
- expiryDate: Date;
5
- licenseModel?: LicenseModel;
6
- orderNumber: string;
7
- planScope?: PlanScope;
8
- planVersion: PlanVersion;
4
+ expiryDate: Date;
5
+ licenseModel?: LicenseModel;
6
+ orderNumber: string;
7
+ planScope?: PlanScope;
8
+ planVersion: PlanVersion;
9
9
  }
10
- export declare function generateLicense(details: LicenseDetails): string;
10
+ export declare function generateLicense(details: LicenseDetails): string;
@@ -1,19 +1,25 @@
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";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generateLicense = generateLicense;
7
+ var _md = require("../encoding/md5");
8
+ var _base = require("../encoding/base64");
9
+ var _plan = require("../utils/plan");
10
+ var _licenseModel = require("../utils/licenseModel");
5
11
  const licenseVersion = '2';
6
12
  function getClearLicenseString(details) {
7
- if (details.planScope && !PLAN_SCOPES.includes(details.planScope)) {
13
+ if (details.planScope && !_plan.PLAN_SCOPES.includes(details.planScope)) {
8
14
  throw new Error('MUI X: Invalid scope');
9
15
  }
10
- if (details.licenseModel && !LICENSE_MODELS.includes(details.licenseModel)) {
16
+ if (details.licenseModel && !_licenseModel.LICENSE_MODELS.includes(details.licenseModel)) {
11
17
  throw new Error('MUI X: Invalid licensing model');
12
18
  }
13
19
  const keyParts = [`O=${details.orderNumber}`, `E=${details.expiryDate.getTime()}`, `S=${details.planScope}`, `LM=${details.licenseModel}`, `PV=${details.planVersion}`, `KV=${licenseVersion}`];
14
20
  return keyParts.join(',');
15
21
  }
16
- export function generateLicense(details) {
22
+ function generateLicense(details) {
17
23
  const licenseStr = getClearLicenseString(details);
18
- return `${md5(base64Encode(licenseStr))}${base64Encode(licenseStr)}`;
24
+ return `${(0, _md.md5)((0, _base.base64Encode)(licenseStr))}${(0, _base.base64Encode)(licenseStr)}`;
19
25
  }
@@ -1 +1 @@
1
- export * from './generateLicense';
1
+ export * from "./generateLicense.js";
@@ -1 +1,16 @@
1
- export * from "./generateLicense.js";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _generateLicense = require("./generateLicense");
7
+ Object.keys(_generateLicense).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _generateLicense[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _generateLicense[key];
14
+ }
15
+ });
16
+ });
package/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export * from './generateLicense';
2
- export * from './utils';
3
- export * from './verifyLicense';
4
- export * from './useLicenseVerifier';
5
- export * from './Watermark';
6
- export * from './Unstable_LicenseInfoProvider';
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/index.js CHANGED
@@ -1,13 +1,94 @@
1
1
  /**
2
- * @mui/x-license v8.0.0-alpha.9
2
+ * @mui/x-license v8.0.0-beta.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
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";
8
+ "use strict";
9
+
10
+ Object.defineProperty(exports, "__esModule", {
11
+ value: true
12
+ });
13
+ var _exportNames = {
14
+ muiXTelemetrySettings: true
15
+ };
16
+ Object.defineProperty(exports, "muiXTelemetrySettings", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return _xTelemetry.muiXTelemetrySettings;
20
+ }
21
+ });
22
+ var _generateLicense = require("./generateLicense");
23
+ Object.keys(_generateLicense).forEach(function (key) {
24
+ if (key === "default" || key === "__esModule") return;
25
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
26
+ if (key in exports && exports[key] === _generateLicense[key]) return;
27
+ Object.defineProperty(exports, key, {
28
+ enumerable: true,
29
+ get: function () {
30
+ return _generateLicense[key];
31
+ }
32
+ });
33
+ });
34
+ var _utils = require("./utils");
35
+ Object.keys(_utils).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
38
+ if (key in exports && exports[key] === _utils[key]) return;
39
+ Object.defineProperty(exports, key, {
40
+ enumerable: true,
41
+ get: function () {
42
+ return _utils[key];
43
+ }
44
+ });
45
+ });
46
+ var _verifyLicense = require("./verifyLicense");
47
+ Object.keys(_verifyLicense).forEach(function (key) {
48
+ if (key === "default" || key === "__esModule") return;
49
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
50
+ if (key in exports && exports[key] === _verifyLicense[key]) return;
51
+ Object.defineProperty(exports, key, {
52
+ enumerable: true,
53
+ get: function () {
54
+ return _verifyLicense[key];
55
+ }
56
+ });
57
+ });
58
+ var _useLicenseVerifier = require("./useLicenseVerifier");
59
+ Object.keys(_useLicenseVerifier).forEach(function (key) {
60
+ if (key === "default" || key === "__esModule") return;
61
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
62
+ if (key in exports && exports[key] === _useLicenseVerifier[key]) return;
63
+ Object.defineProperty(exports, key, {
64
+ enumerable: true,
65
+ get: function () {
66
+ return _useLicenseVerifier[key];
67
+ }
68
+ });
69
+ });
70
+ var _Watermark = require("./Watermark");
71
+ Object.keys(_Watermark).forEach(function (key) {
72
+ if (key === "default" || key === "__esModule") return;
73
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
74
+ if (key in exports && exports[key] === _Watermark[key]) return;
75
+ Object.defineProperty(exports, key, {
76
+ enumerable: true,
77
+ get: function () {
78
+ return _Watermark[key];
79
+ }
80
+ });
81
+ });
82
+ var _Unstable_LicenseInfoProvider = require("./Unstable_LicenseInfoProvider");
83
+ Object.keys(_Unstable_LicenseInfoProvider).forEach(function (key) {
84
+ if (key === "default" || key === "__esModule") return;
85
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
86
+ if (key in exports && exports[key] === _Unstable_LicenseInfoProvider[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function () {
90
+ return _Unstable_LicenseInfoProvider[key];
91
+ }
92
+ });
93
+ });
94
+ var _xTelemetry = require("@mui/x-telemetry");
@@ -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,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,2 @@
1
+ export { LicenseInfoProvider as Unstable_LicenseInfoProvider } from "./LicenseInfoProvider.js";
2
+ export type { LicenseInfoProviderProps as Unstable_LicenseInfoProviderProps } from './LicenseInfoProvider';
@@ -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 @@
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;
@@ -0,0 +1 @@
1
+ export declare function md5(s: any): any;
@@ -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 @@
1
+ export * from "./generateLicense.js";
@@ -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/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-license v8.0.0-alpha.9
2
+ * @mui/x-license v8.0.0-beta.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -10,4 +10,5 @@ export * from "./utils/index.js";
10
10
  export * from "./verifyLicense/index.js";
11
11
  export * from "./useLicenseVerifier/index.js";
12
12
  export * from "./Watermark/index.js";
13
- export * from "./Unstable_LicenseInfoProvider/index.js";
13
+ export * from "./Unstable_LicenseInfoProvider/index.js";
14
+ export { muiXTelemetrySettings } from '@mui/x-telemetry';