@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.
Files changed (133) hide show
  1. package/CHANGELOG.md +2566 -687
  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 +10 -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/MuiLicenseInfoContext.js +2 -0
  68. package/modern/Unstable_LicenseInfoProvider/index.d.ts +2 -0
  69. package/modern/Watermark/Watermark.d.ts +9 -0
  70. package/modern/Watermark/index.d.ts +1 -0
  71. package/modern/encoding/base64.d.ts +2 -0
  72. package/modern/encoding/md5.d.ts +1 -0
  73. package/modern/generateLicense/generateLicense.d.ts +10 -0
  74. package/modern/generateLicense/index.d.ts +1 -0
  75. package/modern/index.d.ts +7 -0
  76. package/modern/index.js +3 -2
  77. package/modern/package.json +1 -0
  78. package/modern/useLicenseVerifier/index.d.ts +1 -0
  79. package/modern/useLicenseVerifier/useLicenseVerifier.d.ts +11 -0
  80. package/modern/useLicenseVerifier/useLicenseVerifier.js +8 -0
  81. package/modern/utils/commercialPackages.d.ts +1 -0
  82. package/modern/utils/index.d.ts +6 -0
  83. package/modern/utils/licenseErrorMessageUtils.d.ts +33 -0
  84. package/modern/utils/licenseInfo.d.ts +11 -0
  85. package/modern/utils/licenseModel.d.ts +2 -0
  86. package/modern/utils/licenseStatus.d.ts +11 -0
  87. package/modern/utils/plan.d.ts +4 -0
  88. package/modern/verifyLicense/index.d.ts +1 -0
  89. package/modern/verifyLicense/verifyLicense.d.ts +15 -0
  90. package/package.json +40 -6
  91. package/tsconfig.build.tsbuildinfo +1 -0
  92. package/useLicenseVerifier/index.d.ts +1 -1
  93. package/useLicenseVerifier/index.js +12 -1
  94. package/useLicenseVerifier/useLicenseVerifier.d.ts +10 -12
  95. package/useLicenseVerifier/useLicenseVerifier.js +44 -27
  96. package/utils/commercialPackages.d.ts +1 -1
  97. package/utils/commercialPackages.js +5 -1
  98. package/utils/index.d.ts +4 -4
  99. package/utils/index.js +38 -4
  100. package/utils/licenseErrorMessageUtils.d.ts +27 -14
  101. package/utils/licenseErrorMessageUtils.js +19 -7
  102. package/utils/licenseInfo.d.ts +5 -5
  103. package/utils/licenseInfo.js +11 -5
  104. package/utils/licenseModel.d.ts +1 -1
  105. package/utils/licenseModel.js +7 -1
  106. package/utils/licenseStatus.d.ts +9 -9
  107. package/utils/licenseStatus.js +7 -1
  108. package/utils/plan.d.ts +1 -1
  109. package/utils/plan.js +8 -2
  110. package/verifyLicense/index.d.ts +1 -1
  111. package/verifyLicense/index.js +16 -1
  112. package/verifyLicense/verifyLicense.d.ts +13 -9
  113. package/verifyLicense/verifyLicense.js +32 -25
  114. package/Unstable_LicenseInfoProvider/package.json +0 -6
  115. package/Watermark/package.json +0 -6
  116. package/generateLicense/package.json +0 -6
  117. package/node/Unstable_LicenseInfoProvider/LicenseInfoProvider.js +0 -27
  118. package/node/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.js +0 -15
  119. package/node/Unstable_LicenseInfoProvider/index.js +0 -12
  120. package/node/Watermark/Watermark.js +0 -57
  121. package/node/Watermark/index.js +0 -16
  122. package/node/generateLicense/generateLicense.js +0 -25
  123. package/node/generateLicense/index.js +0 -16
  124. package/node/index.js +0 -78
  125. package/node/useLicenseVerifier/index.js +0 -12
  126. package/node/useLicenseVerifier/useLicenseVerifier.js +0 -70
  127. package/node/utils/commercialPackages.js +0 -5
  128. package/node/utils/index.js +0 -38
  129. package/node/utils/plan.js +0 -8
  130. package/node/verifyLicense/index.js +0 -16
  131. package/useLicenseVerifier/package.json +0 -6
  132. package/utils/package.json +0 -6
  133. package/verifyLicense/package.json +0 -6
package/utils/index.js CHANGED
@@ -1,4 +1,38 @@
1
- export * from "./licenseErrorMessageUtils.js";
2
- export * from "./licenseInfo.js";
3
- export * from "./licenseStatus.js";
4
- export {};
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _licenseErrorMessageUtils = require("./licenseErrorMessageUtils");
7
+ Object.keys(_licenseErrorMessageUtils).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _licenseErrorMessageUtils[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _licenseErrorMessageUtils[key];
14
+ }
15
+ });
16
+ });
17
+ var _licenseInfo = require("./licenseInfo");
18
+ Object.keys(_licenseInfo).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _licenseInfo[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _licenseInfo[key];
25
+ }
26
+ });
27
+ });
28
+ var _licenseStatus = require("./licenseStatus");
29
+ Object.keys(_licenseStatus).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _licenseStatus[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _licenseStatus[key];
36
+ }
37
+ });
38
+ });
@@ -1,20 +1,33 @@
1
1
  export declare function showInvalidLicenseKeyError(): void;
2
2
  export declare function showLicenseKeyPlanMismatchError(): void;
3
3
  export declare function showNotAvailableInInitialProPlanError(): void;
4
- export declare function showMissingLicenseKeyError({ plan, packageName, }: {
5
- plan: string;
6
- packageName: string;
4
+ export declare function showMissingLicenseKeyError({
5
+ plan,
6
+ packageName
7
+ }: {
8
+ plan: string;
9
+ packageName: string;
7
10
  }): void;
8
- export declare function showExpiredPackageVersionError({ packageName }: {
9
- packageName: string;
11
+ export declare function showExpiredPackageVersionError({
12
+ packageName
13
+ }: {
14
+ packageName: string;
10
15
  }): void;
11
- export declare function showExpiredAnnualGraceLicenseKeyError({ plan, licenseKey, expiryTimestamp, }: {
12
- plan: string;
13
- licenseKey: string;
14
- expiryTimestamp: number;
15
- }): void;
16
- export declare function showExpiredAnnualLicenseKeyError({ plan, licenseKey, expiryTimestamp, }: {
17
- plan: string;
18
- licenseKey: string;
19
- expiryTimestamp: number;
16
+ export declare function showExpiredAnnualGraceLicenseKeyError({
17
+ plan,
18
+ licenseKey,
19
+ expiryTimestamp
20
+ }: {
21
+ plan: string;
22
+ licenseKey: string;
23
+ expiryTimestamp: number;
20
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,3 +1,15 @@
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;
1
13
  /**
2
14
  * Workaround for the codesadbox preview error.
3
15
  *
@@ -13,34 +25,34 @@ function showError(message) {
13
25
  const logger = isCodeSandbox ? console.log : console.error;
14
26
  logger(['*************************************************************', '', ...message, '', '*************************************************************'].join('\n'));
15
27
  }
16
- export function showInvalidLicenseKeyError() {
28
+ function showInvalidLicenseKeyError() {
17
29
  showError(['MUI X: Invalid license key.', '', "Your MUI X license key format isn't valid. It could be because the license key is missing a character or has a typo.", '', 'To solve the issue, you need to double check that `setLicenseKey()` is called with the right argument', 'Please check the license key installation https://mui.com/r/x-license-key-installation.']);
18
30
  }
19
- export function showLicenseKeyPlanMismatchError() {
31
+ function showLicenseKeyPlanMismatchError() {
20
32
  showError(['MUI X: License key plan mismatch.', '', 'Your use of MUI X is not compatible with the plan of your license key. The feature you are trying to use is not included in the plan of your license key. This happens if you try to use Data Grid Premium with a license key for the Pro plan.', '', 'To solve the issue, you can upgrade your plan from Pro to Premium at https://mui.com/r/x-get-license?scope=premium.', "Of if you didn't intend to use Premium features, you can replace the import of `@mui/x-data-grid-premium` with `@mui/x-data-grid-pro`."]);
21
33
  }
22
- export function showNotAvailableInInitialProPlanError() {
34
+ function showNotAvailableInInitialProPlanError() {
23
35
  showError(['MUI X: Component not included in your license.', '', 'The component you are trying to use is not included in the Pro Plan you purchased.', '', 'Your license is from an old version of the Pro Plan that is only compatible with the `@mui/x-data-grid-pro` and `@mui/x-date-pickers-pro` commercial packages.', '', 'To start using another Pro package, please consider reaching to our sales team to upgrade your license or visit https://mui.com/r/x-get-license to get a new license key.']);
24
36
  }
25
- export function showMissingLicenseKeyError({
37
+ function showMissingLicenseKeyError({
26
38
  plan,
27
39
  packageName
28
40
  }) {
29
41
  showError(['MUI X: Missing license key.', '', `The license key is missing. You might not be allowed to use \`${packageName}\` which is part of MUI X ${plan}.`, '', 'To solve the issue, you can check the free trial conditions: https://mui.com/r/x-license-trial.', 'If you are eligible no actions are required. If you are not eligible to the free trial, you need to purchase a license https://mui.com/r/x-get-license or stop using the software immediately.']);
30
42
  }
31
- export function showExpiredPackageVersionError({
43
+ function showExpiredPackageVersionError({
32
44
  packageName
33
45
  }) {
34
46
  showError(['MUI X: Expired package version.', '', `You have installed a version of \`${packageName}\` that is outside of the maintenance plan of your license key. By default, commercial licenses provide access to new versions released during the first year after the purchase.`, '', 'To solve the issue, you can renew your license https://mui.com/r/x-get-license or install an older version of the npm package that is compatible with your license key.']);
35
47
  }
36
- export function showExpiredAnnualGraceLicenseKeyError({
48
+ function showExpiredAnnualGraceLicenseKeyError({
37
49
  plan,
38
50
  licenseKey,
39
51
  expiryTimestamp
40
52
  }) {
41
53
  showError(['MUI X: Expired license key.', '', `Your annual license key to use MUI X ${plan} in non-production environments has expired. If you are seeing this development console message, you might be close to breach the license terms by making direct or indirect changes to the frontend of an app that render a MUI X ${plan} component (more details in https://mui.com/r/x-license-annual).`, '', 'To solve the problem you can either:', '', '- Renew your license https://mui.com/r/x-get-license and use the new key', `- Stop making changes to code depending directly or indirectly on MUI X ${plan}'s APIs`, '', 'Note that your license is perpetual in production environments with any version released before your license term ends.', '', `- License key expiry timestamp: ${new Date(expiryTimestamp)}`, `- Installed license key: ${licenseKey}`, '']);
42
54
  }
43
- export function showExpiredAnnualLicenseKeyError({
55
+ function showExpiredAnnualLicenseKeyError({
44
56
  plan,
45
57
  licenseKey,
46
58
  expiryTimestamp
@@ -2,10 +2,10 @@
2
2
  * @ignore - do not document.
3
3
  */
4
4
  export interface MuiLicenseInfo {
5
- key: string | undefined;
5
+ key: string | undefined;
6
6
  }
7
7
  export declare class LicenseInfo {
8
- private static getLicenseInfo;
9
- static getLicenseKey(): MuiLicenseInfo['key'];
10
- static setLicenseKey(key: string): void;
11
- }
8
+ private static getLicenseInfo;
9
+ static getLicenseKey(): MuiLicenseInfo['key'];
10
+ static setLicenseKey(key: string): void;
11
+ }
@@ -1,5 +1,10 @@
1
- import { ponyfillGlobal } from '@mui/utils';
1
+ "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LicenseInfo = void 0;
7
+ var _utils = require("@mui/utils");
3
8
  /**
4
9
  * @ignore - do not document.
5
10
  */
@@ -9,13 +14,13 @@ import { ponyfillGlobal } from '@mui/utils';
9
14
  // if using multiple version of MUI X at the same time of the bundler
10
15
  // decide to duplicate to improve the size of the chunks.
11
16
  // eslint-disable-next-line no-underscore-dangle
12
- ponyfillGlobal.__MUI_LICENSE_INFO__ = ponyfillGlobal.__MUI_LICENSE_INFO__ || {
17
+ _utils.ponyfillGlobal.__MUI_LICENSE_INFO__ = _utils.ponyfillGlobal.__MUI_LICENSE_INFO__ || {
13
18
  key: undefined
14
19
  };
15
- export class LicenseInfo {
20
+ class LicenseInfo {
16
21
  static getLicenseInfo() {
17
22
  // eslint-disable-next-line no-underscore-dangle
18
- return ponyfillGlobal.__MUI_LICENSE_INFO__;
23
+ return _utils.ponyfillGlobal.__MUI_LICENSE_INFO__;
19
24
  }
20
25
  static getLicenseKey() {
21
26
  return LicenseInfo.getLicenseInfo().key;
@@ -24,4 +29,5 @@ export class LicenseInfo {
24
29
  const licenseInfo = LicenseInfo.getLicenseInfo();
25
30
  licenseInfo.key = key;
26
31
  }
27
- }
32
+ }
33
+ exports.LicenseInfo = LicenseInfo;
@@ -1,2 +1,2 @@
1
1
  export declare const LICENSE_MODELS: readonly ["perpetual", "annual", "subscription"];
2
- export type LicenseModel = (typeof LICENSE_MODELS)[number];
2
+ export type LicenseModel = (typeof LICENSE_MODELS)[number];
@@ -1,4 +1,10 @@
1
- export const LICENSE_MODELS = [
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 = [
2
8
  /**
3
9
  * A license is outdated if the current version of the software was released after the expiry date of the license.
4
10
  * But the license can be used indefinitely with an older version of the software.
@@ -1,11 +1,11 @@
1
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"
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
10
  }
11
- export type LicenseStatus = keyof typeof LICENSE_STATUS;
11
+ export type LicenseStatus = keyof typeof LICENSE_STATUS;
@@ -1,5 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LICENSE_STATUS = void 0;
1
7
  // eslint-disable-next-line @typescript-eslint/naming-convention
2
- export let LICENSE_STATUS = /*#__PURE__*/function (LICENSE_STATUS) {
8
+ let LICENSE_STATUS = exports.LICENSE_STATUS = /*#__PURE__*/function (LICENSE_STATUS) {
3
9
  LICENSE_STATUS["NotFound"] = "NotFound";
4
10
  LICENSE_STATUS["Invalid"] = "Invalid";
5
11
  LICENSE_STATUS["ExpiredAnnual"] = "ExpiredAnnual";
package/utils/plan.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare const PLAN_SCOPES: readonly ["pro", "premium"];
2
2
  export declare const PLAN_VERSIONS: readonly ["initial", "Q3-2024"];
3
3
  export type PlanScope = (typeof PLAN_SCOPES)[number];
4
- export type PlanVersion = (typeof PLAN_VERSIONS)[number];
4
+ export type PlanVersion = (typeof PLAN_VERSIONS)[number];
package/utils/plan.js CHANGED
@@ -1,2 +1,8 @@
1
- export const PLAN_SCOPES = ['pro', 'premium'];
2
- export const PLAN_VERSIONS = ['initial', 'Q3-2024'];
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PLAN_VERSIONS = exports.PLAN_SCOPES = void 0;
7
+ const PLAN_SCOPES = exports.PLAN_SCOPES = ['pro', 'premium'];
8
+ const PLAN_VERSIONS = exports.PLAN_VERSIONS = ['initial', 'Q3-2024'];
@@ -1 +1 @@
1
- export * from './verifyLicense';
1
+ export * from "./verifyLicense.js";
@@ -1 +1,16 @@
1
- export * from "./verifyLicense.js";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _verifyLicense = require("./verifyLicense");
7
+ Object.keys(_verifyLicense).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _verifyLicense[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _verifyLicense[key];
14
+ }
15
+ });
16
+ });
@@ -1,11 +1,15 @@
1
- import { LicenseStatus } from '../utils/licenseStatus';
2
- import { MuiCommercialPackageName } from '../utils/commercialPackages';
1
+ import { LicenseStatus } from "../utils/licenseStatus.js";
2
+ import { MuiCommercialPackageName } from "../utils/commercialPackages.js";
3
3
  export declare function generateReleaseInfo(releaseDate?: Date): string;
4
- export declare function verifyLicense({ releaseInfo, licenseKey, packageName, }: {
5
- releaseInfo: string;
6
- licenseKey?: string;
7
- packageName: MuiCommercialPackageName;
4
+ export declare function verifyLicense({
5
+ releaseInfo,
6
+ licenseKey,
7
+ packageName
8
+ }: {
9
+ releaseInfo: string;
10
+ licenseKey?: string;
11
+ packageName: MuiCommercialPackageName;
8
12
  }): {
9
- status: LicenseStatus;
10
- meta?: any;
11
- };
13
+ status: LicenseStatus;
14
+ meta?: any;
15
+ };
@@ -1,15 +1,22 @@
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";
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");
6
13
  const getDefaultReleaseDate = () => {
7
14
  const today = new Date();
8
15
  today.setHours(0, 0, 0, 0);
9
16
  return today;
10
17
  };
11
- export function generateReleaseInfo(releaseDate = getDefaultReleaseDate()) {
12
- return base64Encode(releaseDate.getTime().toString());
18
+ function generateReleaseInfo(releaseDate = getDefaultReleaseDate()) {
19
+ return (0, _base.base64Encode)(releaseDate.getTime().toString());
13
20
  }
14
21
  function isPlanScopeSufficient(packageName, planScope) {
15
22
  let acceptedScopes;
@@ -80,7 +87,7 @@ const decodeLicenseVersion2 = license => {
80
87
  * Decode the license based on its key version and return a version-agnostic `MuiLicense` object.
81
88
  */
82
89
  const decodeLicense = encodedLicense => {
83
- const license = base64Decode(encodedLicense);
90
+ const license = (0, _base.base64Decode)(encodedLicense);
84
91
  if (license.includes('KEYVERSION=1')) {
85
92
  return decodeLicenseVersion1(license);
86
93
  }
@@ -89,7 +96,7 @@ const decodeLicense = encodedLicense => {
89
96
  }
90
97
  return null;
91
98
  };
92
- export function verifyLicense({
99
+ function verifyLicense({
93
100
  releaseInfo,
94
101
  licenseKey,
95
102
  packageName
@@ -99,43 +106,43 @@ export function verifyLicense({
99
106
  }
100
107
  if (!licenseKey) {
101
108
  return {
102
- status: LICENSE_STATUS.NotFound
109
+ status: _licenseStatus.LICENSE_STATUS.NotFound
103
110
  };
104
111
  }
105
112
  const hash = licenseKey.substr(0, 32);
106
113
  const encoded = licenseKey.substr(32);
107
- if (hash !== md5(encoded)) {
114
+ if (hash !== (0, _md.md5)(encoded)) {
108
115
  return {
109
- status: LICENSE_STATUS.Invalid
116
+ status: _licenseStatus.LICENSE_STATUS.Invalid
110
117
  };
111
118
  }
112
119
  const license = decodeLicense(encoded);
113
120
  if (license == null) {
114
121
  console.error('MUI X: Error checking license. Key version not found!');
115
122
  return {
116
- status: LICENSE_STATUS.Invalid
123
+ status: _licenseStatus.LICENSE_STATUS.Invalid
117
124
  };
118
125
  }
119
- if (license.licenseModel == null || !LICENSE_MODELS.includes(license.licenseModel)) {
126
+ if (license.licenseModel == null || !_licenseModel.LICENSE_MODELS.includes(license.licenseModel)) {
120
127
  console.error('MUI X: Error checking license. Licensing model not found or invalid!');
121
128
  return {
122
- status: LICENSE_STATUS.Invalid
129
+ status: _licenseStatus.LICENSE_STATUS.Invalid
123
130
  };
124
131
  }
125
132
  if (license.expiryTimestamp == null) {
126
133
  console.error('MUI X: Error checking license. Expiry timestamp not found or invalid!');
127
134
  return {
128
- status: LICENSE_STATUS.Invalid
135
+ status: _licenseStatus.LICENSE_STATUS.Invalid
129
136
  };
130
137
  }
131
138
  if (license.licenseModel === 'perpetual' || process.env.NODE_ENV === 'production') {
132
- const pkgTimestamp = parseInt(base64Decode(releaseInfo), 10);
139
+ const pkgTimestamp = parseInt((0, _base.base64Decode)(releaseInfo), 10);
133
140
  if (Number.isNaN(pkgTimestamp)) {
134
141
  throw new Error('MUI X: The release information is invalid. Not able to validate license.');
135
142
  }
136
143
  if (license.expiryTimestamp < pkgTimestamp) {
137
144
  return {
138
- status: LICENSE_STATUS.ExpiredVersion
145
+ status: _licenseStatus.LICENSE_STATUS.ExpiredVersion
139
146
  };
140
147
  }
141
148
  } else if (license.licenseModel === 'subscription' || license.licenseModel === 'annual') {
@@ -144,7 +151,7 @@ export function verifyLicense({
144
151
  // 30 days grace
145
152
  new Date().getTime() < license.expiryTimestamp + 1000 * 3600 * 24 * 30 || process.env.NODE_ENV !== 'development') {
146
153
  return {
147
- status: LICENSE_STATUS.ExpiredAnnualGrace,
154
+ status: _licenseStatus.LICENSE_STATUS.ExpiredAnnualGrace,
148
155
  meta: {
149
156
  expiryTimestamp: license.expiryTimestamp,
150
157
  licenseKey
@@ -152,7 +159,7 @@ export function verifyLicense({
152
159
  };
153
160
  }
154
161
  return {
155
- status: LICENSE_STATUS.ExpiredAnnual,
162
+ status: _licenseStatus.LICENSE_STATUS.ExpiredAnnual,
156
163
  meta: {
157
164
  expiryTimestamp: license.expiryTimestamp,
158
165
  licenseKey
@@ -160,25 +167,25 @@ export function verifyLicense({
160
167
  };
161
168
  }
162
169
  }
163
- if (license.planScope == null || !PLAN_SCOPES.includes(license.planScope)) {
170
+ if (license.planScope == null || !_plan.PLAN_SCOPES.includes(license.planScope)) {
164
171
  console.error('MUI X: Error checking license. planScope not found or invalid!');
165
172
  return {
166
- status: LICENSE_STATUS.Invalid
173
+ status: _licenseStatus.LICENSE_STATUS.Invalid
167
174
  };
168
175
  }
169
176
  if (!isPlanScopeSufficient(packageName, license.planScope)) {
170
177
  return {
171
- status: LICENSE_STATUS.OutOfScope
178
+ status: _licenseStatus.LICENSE_STATUS.OutOfScope
172
179
  };
173
180
  }
174
181
 
175
182
  // 'charts-pro' or 'tree-view-pro' can only be used with a newer Pro license
176
183
  if (license.planVersion === 'initial' && license.planScope === 'pro' && !PRO_PACKAGES_AVAILABLE_IN_INITIAL_PRO_PLAN.includes(packageName)) {
177
184
  return {
178
- status: LICENSE_STATUS.NotAvailableInInitialProPlan
185
+ status: _licenseStatus.LICENSE_STATUS.NotAvailableInInitialProPlan
179
186
  };
180
187
  }
181
188
  return {
182
- status: LICENSE_STATUS.Valid
189
+ status: _licenseStatus.LICENSE_STATUS.Valid
183
190
  };
184
191
  }
@@ -1,6 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "module": "./index.js",
4
- "main": "../node/Unstable_LicenseInfoProvider/index.js",
5
- "types": "./index.d.ts"
6
- }
@@ -1,6 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "module": "./index.js",
4
- "main": "../node/Watermark/index.js",
5
- "types": "./index.d.ts"
6
- }
@@ -1,6 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "module": "./index.js",
4
- "main": "../node/generateLicense/index.js",
5
- "types": "./index.d.ts"
6
- }
@@ -1,27 +0,0 @@
1
- "use strict";
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");
12
- /**
13
- * @ignore - do not document.
14
- */
15
-
16
- /**
17
- * @ignore - do not document.
18
- */
19
- function LicenseInfoProvider({
20
- info,
21
- children
22
- }) {
23
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MuiLicenseInfoContext.default.Provider, {
24
- value: info,
25
- children: children
26
- });
27
- }
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var React = _interopRequireWildcard(require("react"));
9
- const MuiLicenseInfoContext = /*#__PURE__*/React.createContext({
10
- key: undefined
11
- });
12
- if (process.env.NODE_ENV !== 'production') {
13
- MuiLicenseInfoContext.displayName = 'MuiLicenseInfoContext';
14
- }
15
- var _default = exports.default = MuiLicenseInfoContext;
@@ -1,12 +0,0 @@
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");
@@ -1,57 +0,0 @@
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");
13
- function getLicenseErrorMessage(licenseStatus) {
14
- switch (licenseStatus) {
15
- case _licenseStatus.LICENSE_STATUS.ExpiredAnnualGrace:
16
- case _licenseStatus.LICENSE_STATUS.ExpiredAnnual:
17
- return 'MUI X Expired license key';
18
- case _licenseStatus.LICENSE_STATUS.ExpiredVersion:
19
- return 'MUI X Expired package version';
20
- case _licenseStatus.LICENSE_STATUS.Invalid:
21
- return 'MUI X Invalid license key';
22
- case _licenseStatus.LICENSE_STATUS.OutOfScope:
23
- return 'MUI X License key plan mismatch';
24
- case _licenseStatus.LICENSE_STATUS.NotAvailableInInitialProPlan:
25
- return 'MUI X Product not covered by plan';
26
- case _licenseStatus.LICENSE_STATUS.NotFound:
27
- return 'MUI X Missing license key';
28
- default:
29
- throw new Error('Unhandled MUI X license status.');
30
- }
31
- }
32
- function Watermark(props) {
33
- const {
34
- packageName,
35
- releaseInfo
36
- } = props;
37
- const licenseStatus = (0, _useLicenseVerifier.useLicenseVerifier)(packageName, releaseInfo);
38
- if (licenseStatus.status === _licenseStatus.LICENSE_STATUS.Valid) {
39
- return null;
40
- }
41
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
42
- style: {
43
- position: 'absolute',
44
- pointerEvents: 'none',
45
- color: '#8282829e',
46
- zIndex: 100000,
47
- width: '100%',
48
- textAlign: 'center',
49
- bottom: '50%',
50
- right: 0,
51
- letterSpacing: 5,
52
- fontSize: 24
53
- },
54
- children: getLicenseErrorMessage(licenseStatus.status)
55
- });
56
- }
57
- const MemoizedWatermark = exports.Watermark = (0, _fastMemo.fastMemo)(Watermark);
@@ -1,16 +0,0 @@
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
- });