Socket
Socket
Sign inDemoInstall

@mui/x-license-pro

Package Overview
Dependencies
Maintainers
8
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mui/x-license-pro - npm Package Compare versions

Comparing version 6.0.0-alpha.8 to 6.0.0-alpha.9

12

encoding/base64.js
/* eslint-disable */
const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
function utf8Encode(str) {
for (let n = 0; n < str.length; n++) {
const c = str.charCodeAt(n);
if (c >= 128) {

@@ -12,6 +10,4 @@ throw new Error('ASCII only support');

}
return str;
}
export const base64Decode = input => {

@@ -23,3 +19,2 @@ let output = '';

input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
while (i < input.length) {

@@ -34,7 +29,5 @@ enc1 = _keyStr.indexOf(input.charAt(i++));

output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {

@@ -44,3 +37,2 @@ output = output + String.fromCharCode(chr3);

}
return output;

@@ -53,3 +45,2 @@ };

input = utf8Encode(input);
while (i < input.length) {

@@ -63,3 +54,2 @@ chr1 = input.charCodeAt(i++);

enc4 = chr3 & 63;
if (isNaN(chr2)) {

@@ -70,7 +60,5 @@ enc3 = enc4 = 64;

}
output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
};

28

encoding/md5.js

@@ -5,5 +5,5 @@ /* eslint-disable */

let i = 0;
for (; i < 64;) {
k[i] = 0 | Math.sin(++i % Math.PI) * 4294967296; // k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296);
k[i] = 0 | Math.sin(++i % Math.PI) * 4294967296;
// k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296);
}

@@ -14,11 +14,11 @@

let b,
c,
d,
j = unescape(encodeURI(s)) + '\x80',
a = j.length;
c,
d,
j = unescape(encodeURI(s)) + '\x80',
a = j.length;
const h = [b = 0x67452301, c = 0xefcdab89, ~b, ~c];
s = --a / 4 + 2 | 15; // See "Length bits" in notes
s = --a / 4 + 2 | 15;
// See "Length bits" in notes
words[--s] = a * 8;
for (; ~a;) {

@@ -28,18 +28,18 @@ // a !== -1

}
for (i = j = 0; i < s; i += 16) {
a = h;
for (; j < 64; a = [d = a[3], b + ((d = a[0] + [b & c | ~b & d, d & b | ~d & c, b ^ c ^ d, c ^ (b | ~d)][a = j >> 4] + k[j] + ~~words[i | [j, 5 * j + 1, 3 * j + 5, 7 * j][a] & 15]) << (a = [7, 12, 17, 22, 5, 9, 14, 20, 4, 11, 16, 23, 6, 10, 15, 21][4 * a + j++ % 4]) | d >>> -a), b, c]) {
b = a[1] | 0;
c = a[2];
} // See "Integer safety" in notes
}
// See "Integer safety" in notes
for (j = 4; j;) h[--j] += a[j];
for (j = 4; j;) h[--j] += a[j]; // j === 0
// j === 0
}
for (s = ''; j < 32;) {
s += (h[j >> 3] >> (1 ^ j++) * 4 & 15).toString(16); // s += ((h[j >> 3] >> (4 ^ 4 * j++)) & 15).toString(16);
s += (h[j >> 3] >> (1 ^ j++) * 4 & 15).toString(16);
// s += ((h[j >> 3] >> (4 ^ 4 * j++)) & 15).toString(16);
}

@@ -46,0 +46,0 @@

@@ -6,17 +6,12 @@ import { md5 } from '../encoding/md5';

const licenseVersion = '2';
function getClearLicenseString(details) {
var _details$scope, _details$licensingMod;
if (details.scope && !LICENSE_SCOPES.includes(details.scope)) {
throw new Error('MUI: Invalid scope');
}
if (details.licensingModel && !LICENSING_MODELS.includes(details.licensingModel)) {
throw new Error('MUI: Invalid sales model');
}
return `O=${details.orderNumber},E=${details.expiryDate.getTime()},S=${(_details$scope = details.scope) != null ? _details$scope : 'pro'},LM=${(_details$licensingMod = details.licensingModel) != null ? _details$licensingMod : 'perpetual'},KV=${licenseVersion}`;
}
export function generateLicense(details) {

@@ -23,0 +18,0 @@ const licenseStr = getClearLicenseString(details);

@@ -1,2 +0,2 @@

/** @license MUI v6.0.0-alpha.8
/** @license MUI v6.0.0-alpha.9
*

@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the

/* eslint-disable */
var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
function utf8Encode(str) {
for (var n = 0; n < str.length; n++) {
var c = str.charCodeAt(n);
if (c >= 128) {

@@ -12,6 +10,4 @@ throw new Error('ASCII only support');

}
return str;
}
export var base64Decode = function base64Decode(input) {

@@ -23,3 +19,2 @@ var output = '';

input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
while (i < input.length) {

@@ -34,7 +29,5 @@ enc1 = _keyStr.indexOf(input.charAt(i++));

output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {

@@ -44,3 +37,2 @@ output = output + String.fromCharCode(chr3);

}
return output;

@@ -53,3 +45,2 @@ };

input = utf8Encode(input);
while (i < input.length) {

@@ -63,3 +54,2 @@ chr1 = input.charCodeAt(i++);

enc4 = chr3 & 63;
if (isNaN(chr2)) {

@@ -70,7 +60,5 @@ enc3 = enc4 = 64;

}
output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
};

@@ -5,5 +5,5 @@ /* eslint-disable */

var i = 0;
for (; i < 64;) {
k[i] = 0 | Math.sin(++i % Math.PI) * 4294967296; // k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296);
k[i] = 0 | Math.sin(++i % Math.PI) * 4294967296;
// k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296);
}

@@ -14,11 +14,11 @@

var b,
c,
d,
j = unescape(encodeURI(s)) + '\x80',
a = j.length;
c,
d,
j = unescape(encodeURI(s)) + '\x80',
a = j.length;
var h = [b = 0x67452301, c = 0xefcdab89, ~b, ~c];
s = --a / 4 + 2 | 15; // See "Length bits" in notes
s = --a / 4 + 2 | 15;
// See "Length bits" in notes
words[--s] = a * 8;
for (; ~a;) {

@@ -28,20 +28,20 @@ // a !== -1

}
for (i = j = 0; i < s; i += 16) {
a = h;
for (; j < 64; a = [d = a[3], b + ((d = a[0] + [b & c | ~b & d, d & b | ~d & c, b ^ c ^ d, c ^ (b | ~d)][a = j >> 4] + k[j] + ~~words[i | [j, 5 * j + 1, 3 * j + 5, 7 * j][a] & 15]) << (a = [7, 12, 17, 22, 5, 9, 14, 20, 4, 11, 16, 23, 6, 10, 15, 21][4 * a + j++ % 4]) | d >>> -a), b, c]) {
b = a[1] | 0;
c = a[2];
} // See "Integer safety" in notes
}
// See "Integer safety" in notes
for (j = 4; j;) {
h[--j] += a[j];
} // j === 0
}
// j === 0
}
for (s = ''; j < 32;) {
s += (h[j >> 3] >> (1 ^ j++) * 4 & 15).toString(16); // s += ((h[j >> 3] >> (4 ^ 4 * j++)) & 15).toString(16);
s += (h[j >> 3] >> (1 ^ j++) * 4 & 15).toString(16);
// s += ((h[j >> 3] >> (4 ^ 4 * j++)) & 15).toString(16);
}

@@ -48,0 +48,0 @@

@@ -6,17 +6,12 @@ import { md5 } from '../encoding/md5';

var licenseVersion = '2';
function getClearLicenseString(details) {
var _details$scope, _details$licensingMod;
if (details.scope && !LICENSE_SCOPES.includes(details.scope)) {
throw new Error('MUI: Invalid scope');
}
if (details.licensingModel && !LICENSING_MODELS.includes(details.licensingModel)) {
throw new Error('MUI: Invalid sales model');
}
return "O=".concat(details.orderNumber, ",E=").concat(details.expiryDate.getTime(), ",S=").concat((_details$scope = details.scope) != null ? _details$scope : 'pro', ",LM=").concat((_details$licensingMod = details.licensingModel) != null ? _details$licensingMod : 'perpetual', ",KV=").concat(licenseVersion);
}
export function generateLicense(details) {

@@ -23,0 +18,0 @@ var licenseStr = getClearLicenseString(details);

@@ -1,2 +0,2 @@

/** @license MUI v6.0.0-alpha.8
/** @license MUI v6.0.0-alpha.9
*

@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the

import * as React from 'react';
import { verifyLicense } from '../verifyLicense/verifyLicense';
import { LicenseInfo } from '../utils/licenseInfo';
import { showExpiredLicenseError, showInvalidLicenseError, showNotFoundLicenseError, showOutOfScopeLicenseError } from '../utils/licenseErrorMessageUtils';
import { showExpiredLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError } from '../utils/licenseErrorMessageUtils';
import { LicenseStatus } from '../utils/licenseStatus';

@@ -10,7 +10,5 @@ export var sharedLicenseStatuses = {};

var licenseKey = LicenseInfo.getLicenseKey();
if (sharedLicenseStatuses[packageName] && sharedLicenseStatuses[packageName].key === licenseKey) {
return sharedLicenseStatuses[packageName].status;
}
var acceptedScopes = packageName.includes('premium') ? ['premium'] : ['pro', 'premium'];

@@ -28,18 +26,21 @@ var plan = packageName.includes('premium') ? 'Premium' : 'Pro';

};
var fullPackageName = "@mui/".concat(packageName);
if (licenseStatus === LicenseStatus.Invalid) {
showInvalidLicenseError();
showInvalidLicenseKeyError();
} else if (licenseStatus === LicenseStatus.OutOfScope) {
showOutOfScopeLicenseError();
showLicenseKeyPlanMismatchError();
} else if (licenseStatus === LicenseStatus.NotFound) {
showNotFoundLicenseError({
showMissingLicenseKeyError({
plan: plan,
packageName: "@mui/".concat(packageName)
packageName: fullPackageName
});
} else if (licenseStatus === LicenseStatus.Expired) {
showExpiredLicenseError();
showExpiredLicenseKeyError();
} else if (licenseStatus === LicenseStatus.ExpiredVersion) {
showExpiredPackageVersionError({
packageName: fullPackageName
});
}
return licenseStatus;
}, [packageName, releaseInfo]);
}
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
function showError(message) {
console.error(['*************************************************************', ''].concat(_toConsumableArray(message), ['', '*************************************************************']).join('\n'));
}
export function showInvalidLicenseError() {
showError(['MUI: Invalid license key.', '', "Your MUI X license key isn't valid. Please check your license key installation https://mui.com/r/x-license-key-installation.", '', 'To purchase a license, please visit https://mui.com/r/x-get-license.']);
export function showInvalidLicenseKeyError() {
showError(['MUI: 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.']);
}
export function showOutOfScopeLicenseError() {
showError(['MUI: License key plan mismatch.', '', 'Your use of MUI X is not compatible with the plan of your license key.', 'You are rendering a `DataGridPremium` component that requires a license key for the Premium plan but your license key is for the Pro plan.', '', 'You can solve the issue by upgrading to Premium at https://mui.com/r/x-get-license?scope=premium', 'Alternatively, you can replace the import of `DataGridPremium` with `DataGridPro`.']);
export function showLicenseKeyPlanMismatchError() {
showError(['MUI: License key plan mismatch.', '', 'Your use of MUI X is not compatible with the plan of your license key. The feature you are trying to use is not included in the plan of your license key. This happens if you try to use `DataGridPremium` with a license key for the Pro plan.', '', 'To solve the issue, you can upgrade your plan from Pro to Premium at https://mui.com/r/x-get-license?scope=premium.', "Of if you didn't intend to use Premium features, you can replace the import of `@mui/x-data-grid-premium` with `@mui/x-data-grid-pro`."]);
}
export function showNotFoundLicenseError(_ref) {
export function showMissingLicenseKeyError(_ref) {
var plan = _ref.plan,
packageName = _ref.packageName;
showError(["MUI: License key not found for ".concat(packageName, "."), '', "This is a trial-only version of MUI X ".concat(plan, "."), 'See the conditons here: https://mui.com/r/x-license-trial.', '', 'To purchase a license, please visit https://mui.com/r/x-get-license.']);
packageName = _ref.packageName;
showError(['MUI: Missing license key.', '', "The license key is missing. You might not be allowed to use `".concat(packageName, "` which is part of MUI X ").concat(plan, "."), '', 'To solve the issue, you can check the free trial conditions: https://mui.com/r/x-license-trial.', 'If you are eligible no actions are required. If you are not eligible to the free trial, you need to purchase a license https://mui.com/r/x-get-license or stop using the software immediately.']);
}
export function showExpiredLicenseError() {
showError(['MUI: License key expired.', '', 'Please visit https://mui.com/r/x-get-license to renew your subscription of MUI X.']);
export function showExpiredPackageVersionError(_ref2) {
var packageName = _ref2.packageName;
showError(['MUI: Expired package version.', '', "You have installed a version of `".concat(packageName, "` that is outside of the maintenance plan of your license key. By default, commercial licenses provide access to new versions released during the first year after the purchase."), '', 'To solve the issue, you can renew your license https://mui.com/r/x-get-license or install an older version of the npm package that is compatible with your license key.']);
}
export function showExpiredLicenseKeyError() {
showError(['MUI: Expired license key.', '', 'The subscription license key works forever in production with any version released before your license term ends. However, when the term ends, you are not allowed to use the current or older versions in development.', '', "To solve the issue, you can renew your license https://mui.com/r/x-get-license or stop making changes to code depending on MUI X's APIs."]);
}

@@ -16,3 +16,2 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";

}
_createClass(LicenseInfo, null, [{

@@ -36,4 +35,3 @@ key: "getLicenseInfo",

}]);
return LicenseInfo;
}();
var LicenseStatus;
(function (LicenseStatus) {

@@ -7,6 +6,6 @@ LicenseStatus["NotFound"] = "NotFound";

LicenseStatus["Expired"] = "Expired";
LicenseStatus["ExpiredVersion"] = "ExpiredVersion";
LicenseStatus["Valid"] = "Valid";
LicenseStatus["OutOfScope"] = "OutOfScope";
})(LicenseStatus || (LicenseStatus = {}));
export { LicenseStatus };

@@ -7,3 +7,2 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";

import { LICENSING_MODELS } from '../utils/licensingModel';
var getDefaultReleaseDate = function getDefaultReleaseDate() {

@@ -14,3 +13,2 @@ var today = new Date();

};
export function generateReleaseInfo() {

@@ -21,3 +19,2 @@ var releaseDate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getDefaultReleaseDate();

var expiryReg = /^.*EXPIRY=([0-9]+),.*$/;
/**

@@ -28,6 +25,4 @@ * Format: ORDER:${orderNumber},EXPIRY=${expiryTimestamp},KEYVERSION=1

var expiryTimestamp;
try {
expiryTimestamp = parseInt(license.match(expiryReg)[1], 10);
if (!expiryTimestamp || Number.isNaN(expiryTimestamp)) {

@@ -39,3 +34,2 @@ expiryTimestamp = null;

}
return {

@@ -47,7 +41,6 @@ scope: 'pro',

};
/**
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},KV=2`;
*/
var decodeLicenseVersion2 = function decodeLicenseVersion2(license) {

@@ -65,16 +58,12 @@ var licenseInfo = {

var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
value = _ref2[1];
key = _ref2[0],
value = _ref2[1];
if (key === 'S') {
licenseInfo.scope = value;
}
if (key === 'LM') {
licenseInfo.licensingModel = value;
}
if (key === 'E') {
var expiryTimestamp = parseInt(value, 10);
if (expiryTimestamp && !Number.isNaN(expiryTimestamp)) {

@@ -87,44 +76,33 @@ licenseInfo.expiryTimestamp = expiryTimestamp;

};
/**
* Decode the license based on its key version and return a version-agnostic `MuiLicense` object.
*/
var decodeLicense = function decodeLicense(encodedLicense) {
var license = base64Decode(encodedLicense);
if (license.includes('KEYVERSION=1')) {
return decodeLicenseVersion1(license);
}
if (license.includes('KV=2')) {
return decodeLicenseVersion2(license);
}
return null;
};
export function verifyLicense(_ref3) {
var releaseInfo = _ref3.releaseInfo,
licenseKey = _ref3.licenseKey,
acceptedScopes = _ref3.acceptedScopes,
isProduction = _ref3.isProduction;
licenseKey = _ref3.licenseKey,
acceptedScopes = _ref3.acceptedScopes,
isProduction = _ref3.isProduction;
if (!releaseInfo) {
throw new Error('MUI: The release information is missing. Not able to validate license.');
}
if (!licenseKey) {
return LicenseStatus.NotFound;
}
var hash = licenseKey.substr(0, 32);
var encoded = licenseKey.substr(32);
if (hash !== md5(encoded)) {
return LicenseStatus.Invalid;
}
var license = decodeLicense(encoded);
if (license == null) {

@@ -134,3 +112,2 @@ console.error('Error checking license. Key version not found!');

}
if (license.licensingModel == null || !LICENSING_MODELS.includes(license.licensingModel)) {

@@ -140,3 +117,2 @@ console.error('Error checking license. Sales model not found or invalid!');

}
if (license.expiryTimestamp == null) {

@@ -146,12 +122,9 @@ console.error('Error checking license. Expiry timestamp not found or invalid!');

}
if (license.licensingModel === 'perpetual' || isProduction) {
var pkgTimestamp = parseInt(base64Decode(releaseInfo), 10);
if (Number.isNaN(pkgTimestamp)) {
throw new Error('MUI: The release information is invalid. Not able to validate license.');
}
if (license.expiryTimestamp < pkgTimestamp) {
return LicenseStatus.Expired;
return LicenseStatus.ExpiredVersion;
}

@@ -163,3 +136,2 @@ } else if (license.licensingModel === 'subscription') {

}
if (license.scope == null || !LICENSE_SCOPES.includes(license.scope)) {

@@ -169,8 +141,6 @@ console.error('Error checking license. scope not found or invalid!');

}
if (!acceptedScopes.includes(license.scope)) {
return LicenseStatus.OutOfScope;
}
return LicenseStatus.Valid;
}

@@ -5,17 +5,14 @@ import * as React from 'react';

import { jsx as _jsx } from "react/jsx-runtime";
function getLicenseErrorMessage(licenseStatus) {
switch (licenseStatus) {
case LicenseStatus.Expired:
return 'MUI X: License key expired';
return 'MUI X Expired license key';
case LicenseStatus.ExpiredVersion:
return 'MUI X Expired package version';
case LicenseStatus.Invalid:
return 'MUI X: Invalid license key';
return 'MUI X Invalid license key';
case LicenseStatus.OutOfScope:
return 'MUI X: License key plan mismatch';
return 'MUI X License key plan mismatch';
case LicenseStatus.NotFound:
return 'MUI X: Missing license key';
return 'MUI X Missing license key';
default:

@@ -25,12 +22,9 @@ throw new Error('MUI: Unhandled MUI X license status.');

}
export function Watermark(props) {
var packageName = props.packageName,
releaseInfo = props.releaseInfo;
releaseInfo = props.releaseInfo;
var licenseStatus = useLicenseVerifier(packageName, releaseInfo);
if (licenseStatus === LicenseStatus.Valid) {
return null;
}
return /*#__PURE__*/_jsx("div", {

@@ -37,0 +31,0 @@ style: {

/* eslint-disable */
const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
function utf8Encode(str) {
for (let n = 0; n < str.length; n++) {
const c = str.charCodeAt(n);
if (c >= 128) {

@@ -12,6 +10,4 @@ throw new Error('ASCII only support');

}
return str;
}
export const base64Decode = input => {

@@ -23,3 +19,2 @@ let output = '';

input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
while (i < input.length) {

@@ -34,7 +29,5 @@ enc1 = _keyStr.indexOf(input.charAt(i++));

output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {

@@ -44,3 +37,2 @@ output = output + String.fromCharCode(chr3);

}
return output;

@@ -53,3 +45,2 @@ };

input = utf8Encode(input);
while (i < input.length) {

@@ -63,3 +54,2 @@ chr1 = input.charCodeAt(i++);

enc4 = chr3 & 63;
if (isNaN(chr2)) {

@@ -70,7 +60,5 @@ enc3 = enc4 = 64;

}
output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
};

@@ -5,5 +5,5 @@ /* eslint-disable */

let i = 0;
for (; i < 64;) {
k[i] = 0 | Math.sin(++i % Math.PI) * 4294967296; // k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296);
k[i] = 0 | Math.sin(++i % Math.PI) * 4294967296;
// k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296);
}

@@ -14,11 +14,11 @@

let b,
c,
d,
j = unescape(encodeURI(s)) + '\x80',
a = j.length;
c,
d,
j = unescape(encodeURI(s)) + '\x80',
a = j.length;
const h = [b = 0x67452301, c = 0xefcdab89, ~b, ~c];
s = --a / 4 + 2 | 15; // See "Length bits" in notes
s = --a / 4 + 2 | 15;
// See "Length bits" in notes
words[--s] = a * 8;
for (; ~a;) {

@@ -28,18 +28,18 @@ // a !== -1

}
for (i = j = 0; i < s; i += 16) {
a = h;
for (; j < 64; a = [d = a[3], b + ((d = a[0] + [b & c | ~b & d, d & b | ~d & c, b ^ c ^ d, c ^ (b | ~d)][a = j >> 4] + k[j] + ~~words[i | [j, 5 * j + 1, 3 * j + 5, 7 * j][a] & 15]) << (a = [7, 12, 17, 22, 5, 9, 14, 20, 4, 11, 16, 23, 6, 10, 15, 21][4 * a + j++ % 4]) | d >>> -a), b, c]) {
b = a[1] | 0;
c = a[2];
} // See "Integer safety" in notes
}
// See "Integer safety" in notes
for (j = 4; j;) h[--j] += a[j];
for (j = 4; j;) h[--j] += a[j]; // j === 0
// j === 0
}
for (s = ''; j < 32;) {
s += (h[j >> 3] >> (1 ^ j++) * 4 & 15).toString(16); // s += ((h[j >> 3] >> (4 ^ 4 * j++)) & 15).toString(16);
s += (h[j >> 3] >> (1 ^ j++) * 4 & 15).toString(16);
// s += ((h[j >> 3] >> (4 ^ 4 * j++)) & 15).toString(16);
}

@@ -46,0 +46,0 @@

@@ -6,3 +6,2 @@ import { md5 } from '../encoding/md5';

const licenseVersion = '2';
function getClearLicenseString(details) {

@@ -12,10 +11,7 @@ if (details.scope && !LICENSE_SCOPES.includes(details.scope)) {

}
if (details.licensingModel && !LICENSING_MODELS.includes(details.licensingModel)) {
throw new Error('MUI: Invalid sales model');
}
return `O=${details.orderNumber},E=${details.expiryDate.getTime()},S=${details.scope ?? 'pro'},LM=${details.licensingModel ?? 'perpetual'},KV=${licenseVersion}`;
}
export function generateLicense(details) {

@@ -22,0 +18,0 @@ const licenseStr = getClearLicenseString(details);

@@ -1,2 +0,2 @@

/** @license MUI v6.0.0-alpha.8
/** @license MUI v6.0.0-alpha.9
*

@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the

import * as React from 'react';
import { verifyLicense } from '../verifyLicense/verifyLicense';
import { LicenseInfo } from '../utils/licenseInfo';
import { showExpiredLicenseError, showInvalidLicenseError, showNotFoundLicenseError, showOutOfScopeLicenseError } from '../utils/licenseErrorMessageUtils';
import { showExpiredLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError } from '../utils/licenseErrorMessageUtils';
import { LicenseStatus } from '../utils/licenseStatus';

@@ -10,7 +10,5 @@ export const sharedLicenseStatuses = {};

const licenseKey = LicenseInfo.getLicenseKey();
if (sharedLicenseStatuses[packageName] && sharedLicenseStatuses[packageName].key === licenseKey) {
return sharedLicenseStatuses[packageName].status;
}
const acceptedScopes = packageName.includes('premium') ? ['premium'] : ['pro', 'premium'];

@@ -28,18 +26,21 @@ const plan = packageName.includes('premium') ? 'Premium' : 'Pro';

};
const fullPackageName = `@mui/${packageName}`;
if (licenseStatus === LicenseStatus.Invalid) {
showInvalidLicenseError();
showInvalidLicenseKeyError();
} else if (licenseStatus === LicenseStatus.OutOfScope) {
showOutOfScopeLicenseError();
showLicenseKeyPlanMismatchError();
} else if (licenseStatus === LicenseStatus.NotFound) {
showNotFoundLicenseError({
showMissingLicenseKeyError({
plan,
packageName: `@mui/${packageName}`
packageName: fullPackageName
});
} else if (licenseStatus === LicenseStatus.Expired) {
showExpiredLicenseError();
showExpiredLicenseKeyError();
} else if (licenseStatus === LicenseStatus.ExpiredVersion) {
showExpiredPackageVersionError({
packageName: fullPackageName
});
}
return licenseStatus;
}, [packageName, releaseInfo]);
}
function showError(message) {
console.error(['*************************************************************', '', ...message, '', '*************************************************************'].join('\n'));
}
export function showInvalidLicenseError() {
showError(['MUI: Invalid license key.', '', "Your MUI X license key isn't valid. Please check your license key installation https://mui.com/r/x-license-key-installation.", '', 'To purchase a license, please visit https://mui.com/r/x-get-license.']);
export function showInvalidLicenseKeyError() {
showError(['MUI: 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.']);
}
export function showOutOfScopeLicenseError() {
showError(['MUI: License key plan mismatch.', '', 'Your use of MUI X is not compatible with the plan of your license key.', 'You are rendering a `DataGridPremium` component that requires a license key for the Premium plan but your license key is for the Pro plan.', '', 'You can solve the issue by upgrading to Premium at https://mui.com/r/x-get-license?scope=premium', 'Alternatively, you can replace the import of `DataGridPremium` with `DataGridPro`.']);
export function showLicenseKeyPlanMismatchError() {
showError(['MUI: License key plan mismatch.', '', 'Your use of MUI X is not compatible with the plan of your license key. The feature you are trying to use is not included in the plan of your license key. This happens if you try to use `DataGridPremium` with a license key for the Pro plan.', '', 'To solve the issue, you can upgrade your plan from Pro to Premium at https://mui.com/r/x-get-license?scope=premium.', "Of if you didn't intend to use Premium features, you can replace the import of `@mui/x-data-grid-premium` with `@mui/x-data-grid-pro`."]);
}
export function showNotFoundLicenseError({
export function showMissingLicenseKeyError({
plan,
packageName
}) {
showError([`MUI: License key not found for ${packageName}.`, '', `This is a trial-only version of MUI X ${plan}.`, 'See the conditons here: https://mui.com/r/x-license-trial.', '', 'To purchase a license, please visit https://mui.com/r/x-get-license.']);
showError(['MUI: 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.']);
}
export function showExpiredLicenseError() {
showError(['MUI: License key expired.', '', 'Please visit https://mui.com/r/x-get-license to renew your subscription of MUI X.']);
export function showExpiredPackageVersionError({
packageName
}) {
showError(['MUI: 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.']);
}
export function showExpiredLicenseKeyError() {
showError(['MUI: Expired license key.', '', 'The subscription license key works forever in production with any version released before your license term ends. However, when the term ends, you are not allowed to use the current or older versions in development.', '', "To solve the issue, you can renew your license https://mui.com/r/x-get-license or stop making changes to code depending on MUI X's APIs."]);
}

@@ -15,7 +15,5 @@ import { ponyfillGlobal } from '@mui/utils';

}
static getLicenseKey() {
return LicenseInfo.getLicenseInfo().key;
}
static setLicenseKey(key) {

@@ -25,3 +23,2 @@ const licenseInfo = LicenseInfo.getLicenseInfo();

}
}
var LicenseStatus;
(function (LicenseStatus) {

@@ -7,6 +6,6 @@ LicenseStatus["NotFound"] = "NotFound";

LicenseStatus["Expired"] = "Expired";
LicenseStatus["ExpiredVersion"] = "ExpiredVersion";
LicenseStatus["Valid"] = "Valid";
LicenseStatus["OutOfScope"] = "OutOfScope";
})(LicenseStatus || (LicenseStatus = {}));
export { LicenseStatus };

@@ -6,3 +6,2 @@ import { base64Decode, base64Encode } from '../encoding/base64';

import { LICENSING_MODELS } from '../utils/licensingModel';
const getDefaultReleaseDate = () => {

@@ -13,3 +12,2 @@ const today = new Date();

};
export function generateReleaseInfo(releaseDate = getDefaultReleaseDate()) {

@@ -19,3 +17,2 @@ return base64Encode(releaseDate.getTime().toString());

const expiryReg = /^.*EXPIRY=([0-9]+),.*$/;
/**

@@ -26,6 +23,4 @@ * Format: ORDER:${orderNumber},EXPIRY=${expiryTimestamp},KEYVERSION=1

let expiryTimestamp;
try {
expiryTimestamp = parseInt(license.match(expiryReg)[1], 10);
if (!expiryTimestamp || Number.isNaN(expiryTimestamp)) {

@@ -37,3 +32,2 @@ expiryTimestamp = null;

}
return {

@@ -45,7 +39,6 @@ scope: 'pro',

};
/**
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},KV=2`;
*/
const decodeLicenseVersion2 = license => {

@@ -61,10 +54,7 @@ const licenseInfo = {

}
if (key === 'LM') {
licenseInfo.licensingModel = value;
}
if (key === 'E') {
const expiryTimestamp = parseInt(value, 10);
if (expiryTimestamp && !Number.isNaN(expiryTimestamp)) {

@@ -77,21 +67,16 @@ licenseInfo.expiryTimestamp = expiryTimestamp;

};
/**
* Decode the license based on its key version and return a version-agnostic `MuiLicense` object.
*/
const decodeLicense = encodedLicense => {
const license = base64Decode(encodedLicense);
if (license.includes('KEYVERSION=1')) {
return decodeLicenseVersion1(license);
}
if (license.includes('KV=2')) {
return decodeLicenseVersion2(license);
}
return null;
};
export function verifyLicense({

@@ -106,16 +91,11 @@ releaseInfo,

}
if (!licenseKey) {
return LicenseStatus.NotFound;
}
const hash = licenseKey.substr(0, 32);
const encoded = licenseKey.substr(32);
if (hash !== md5(encoded)) {
return LicenseStatus.Invalid;
}
const license = decodeLicense(encoded);
if (license == null) {

@@ -125,3 +105,2 @@ console.error('Error checking license. Key version not found!');

}
if (license.licensingModel == null || !LICENSING_MODELS.includes(license.licensingModel)) {

@@ -131,3 +110,2 @@ console.error('Error checking license. Sales model not found or invalid!');

}
if (license.expiryTimestamp == null) {

@@ -137,12 +115,9 @@ console.error('Error checking license. Expiry timestamp not found or invalid!');

}
if (license.licensingModel === 'perpetual' || isProduction) {
const pkgTimestamp = parseInt(base64Decode(releaseInfo), 10);
if (Number.isNaN(pkgTimestamp)) {
throw new Error('MUI: The release information is invalid. Not able to validate license.');
}
if (license.expiryTimestamp < pkgTimestamp) {
return LicenseStatus.Expired;
return LicenseStatus.ExpiredVersion;
}

@@ -154,3 +129,2 @@ } else if (license.licensingModel === 'subscription') {

}
if (license.scope == null || !LICENSE_SCOPES.includes(license.scope)) {

@@ -160,8 +134,6 @@ console.error('Error checking license. scope not found or invalid!');

}
if (!acceptedScopes.includes(license.scope)) {
return LicenseStatus.OutOfScope;
}
return LicenseStatus.Valid;
}

@@ -5,17 +5,14 @@ import * as React from 'react';

import { jsx as _jsx } from "react/jsx-runtime";
function getLicenseErrorMessage(licenseStatus) {
switch (licenseStatus) {
case LicenseStatus.Expired:
return 'MUI X: License key expired';
return 'MUI X Expired license key';
case LicenseStatus.ExpiredVersion:
return 'MUI X Expired package version';
case LicenseStatus.Invalid:
return 'MUI X: Invalid license key';
return 'MUI X Invalid license key';
case LicenseStatus.OutOfScope:
return 'MUI X: License key plan mismatch';
return 'MUI X License key plan mismatch';
case LicenseStatus.NotFound:
return 'MUI X: Missing license key';
return 'MUI X Missing license key';
default:

@@ -25,3 +22,2 @@ throw new Error('MUI: Unhandled MUI X license status.');

}
export function Watermark(props) {

@@ -33,7 +29,5 @@ const {

const licenseStatus = useLicenseVerifier(packageName, releaseInfo);
if (licenseStatus === LicenseStatus.Valid) {
return null;
}
return /*#__PURE__*/_jsx("div", {

@@ -40,0 +34,0 @@ style: {

@@ -7,10 +7,7 @@ "use strict";

exports.base64Encode = exports.base64Decode = void 0;
/* eslint-disable */
const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
function utf8Encode(str) {
for (let n = 0; n < str.length; n++) {
const c = str.charCodeAt(n);
if (c >= 128) {

@@ -20,6 +17,4 @@ throw new Error('ASCII only support');

}
return str;
}
const base64Decode = input => {

@@ -31,3 +26,2 @@ let output = '';

input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
while (i < input.length) {

@@ -42,7 +36,5 @@ enc1 = _keyStr.indexOf(input.charAt(i++));

output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {

@@ -52,8 +44,5 @@ output = output + String.fromCharCode(chr3);

}
return output;
};
exports.base64Decode = base64Decode;
const base64Encode = input => {

@@ -64,3 +53,2 @@ let output = '';

input = utf8Encode(input);
while (i < input.length) {

@@ -74,3 +62,2 @@ chr1 = input.charCodeAt(i++);

enc4 = chr3 & 63;
if (isNaN(chr2)) {

@@ -81,9 +68,6 @@ enc3 = enc4 = 64;

}
output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
};
exports.base64Encode = base64Encode;

@@ -7,3 +7,2 @@ "use strict";

exports.md5 = md5;
/* eslint-disable */

@@ -13,5 +12,5 @@ // See "precomputation" in notes

let i = 0;
for (; i < 64;) {
k[i] = 0 | Math.sin(++i % Math.PI) * 4294967296; // k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296);
k[i] = 0 | Math.sin(++i % Math.PI) * 4294967296;
// k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296);
}

@@ -22,11 +21,11 @@

let b,
c,
d,
j = unescape(encodeURI(s)) + '\x80',
a = j.length;
c,
d,
j = unescape(encodeURI(s)) + '\x80',
a = j.length;
const h = [b = 0x67452301, c = 0xefcdab89, ~b, ~c];
s = --a / 4 + 2 | 15; // See "Length bits" in notes
s = --a / 4 + 2 | 15;
// See "Length bits" in notes
words[--s] = a * 8;
for (; ~a;) {

@@ -36,18 +35,18 @@ // a !== -1

}
for (i = j = 0; i < s; i += 16) {
a = h;
for (; j < 64; a = [d = a[3], b + ((d = a[0] + [b & c | ~b & d, d & b | ~d & c, b ^ c ^ d, c ^ (b | ~d)][a = j >> 4] + k[j] + ~~words[i | [j, 5 * j + 1, 3 * j + 5, 7 * j][a] & 15]) << (a = [7, 12, 17, 22, 5, 9, 14, 20, 4, 11, 16, 23, 6, 10, 15, 21][4 * a + j++ % 4]) | d >>> -a), b, c]) {
b = a[1] | 0;
c = a[2];
} // See "Integer safety" in notes
}
// See "Integer safety" in notes
for (j = 4; j;) h[--j] += a[j];
for (j = 4; j;) h[--j] += a[j]; // j === 0
// j === 0
}
for (s = ''; j < 32;) {
s += (h[j >> 3] >> (1 ^ j++) * 4 & 15).toString(16); // s += ((h[j >> 3] >> (4 ^ 4 * j++)) & 15).toString(16);
s += (h[j >> 3] >> (1 ^ j++) * 4 & 15).toString(16);
// s += ((h[j >> 3] >> (4 ^ 4 * j++)) & 15).toString(16);
}

@@ -54,0 +53,0 @@

@@ -7,27 +7,16 @@ "use strict";

exports.generateLicense = generateLicense;
var _md = require("../encoding/md5");
var _base = require("../encoding/base64");
var _licenseScope = require("../utils/licenseScope");
var _licensingModel = require("../utils/licensingModel");
const licenseVersion = '2';
function getClearLicenseString(details) {
var _details$scope, _details$licensingMod;
if (details.scope && !_licenseScope.LICENSE_SCOPES.includes(details.scope)) {
throw new Error('MUI: Invalid scope');
}
if (details.licensingModel && !_licensingModel.LICENSING_MODELS.includes(details.licensingModel)) {
throw new Error('MUI: Invalid sales model');
}
return `O=${details.orderNumber},E=${details.expiryDate.getTime()},S=${(_details$scope = details.scope) != null ? _details$scope : 'pro'},LM=${(_details$licensingMod = details.licensingModel) != null ? _details$licensingMod : 'perpetual'},KV=${licenseVersion}`;
return `O=${details.orderNumber},E=${details.expiryDate.getTime()},S=${details.scope ?? 'pro'},LM=${details.licensingModel ?? 'perpetual'},KV=${licenseVersion}`;
}
function generateLicense(details) {

@@ -34,0 +23,0 @@ const licenseStr = getClearLicenseString(details);

@@ -6,5 +6,3 @@ "use strict";

});
var _generateLicense = require("./generateLicense");
Object.keys(_generateLicense).forEach(function (key) {

@@ -11,0 +9,0 @@ if (key === "default" || key === "__esModule") return;

@@ -1,2 +0,2 @@

/** @license MUI v6.0.0-alpha.8
/** @license MUI v6.0.0-alpha.9
*

@@ -11,5 +11,3 @@ * This source code is licensed under the MIT license found in the

});
var _generateLicense = require("./generateLicense");
Object.keys(_generateLicense).forEach(function (key) {

@@ -25,5 +23,3 @@ if (key === "default" || key === "__esModule") return;

});
var _utils = require("./utils");
Object.keys(_utils).forEach(function (key) {

@@ -39,5 +35,3 @@ if (key === "default" || key === "__esModule") return;

});
var _verifyLicense = require("./verifyLicense");
Object.keys(_verifyLicense).forEach(function (key) {

@@ -53,5 +47,3 @@ if (key === "default" || key === "__esModule") return;

});
var _useLicenseVerifier = require("./useLicenseVerifier");
Object.keys(_useLicenseVerifier).forEach(function (key) {

@@ -67,5 +59,3 @@ if (key === "default" || key === "__esModule") return;

});
var _Watermark = require("./Watermark");
Object.keys(_Watermark).forEach(function (key) {

@@ -72,0 +62,0 @@ if (key === "default" || key === "__esModule") return;

@@ -12,3 +12,2 @@ "use strict";

});
var _useLicenseVerifier = require("./useLicenseVerifier");

@@ -8,28 +8,17 @@ "use strict";

exports.useLicenseVerifier = useLicenseVerifier;
var React = _interopRequireWildcard(require("react"));
var _verifyLicense = require("../verifyLicense/verifyLicense");
var _licenseInfo = require("../utils/licenseInfo");
var _licenseErrorMessageUtils = require("../utils/licenseErrorMessageUtils");
var _licenseStatus = require("../utils/licenseStatus");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const sharedLicenseStatuses = {};
exports.sharedLicenseStatuses = sharedLicenseStatuses;
function useLicenseVerifier(packageName, releaseInfo) {
return React.useMemo(() => {
const licenseKey = _licenseInfo.LicenseInfo.getLicenseKey();
if (sharedLicenseStatuses[packageName] && sharedLicenseStatuses[packageName].key === licenseKey) {
return sharedLicenseStatuses[packageName].status;
}
const acceptedScopes = packageName.includes('premium') ? ['premium'] : ['pro', 'premium'];

@@ -47,18 +36,21 @@ const plan = packageName.includes('premium') ? 'Premium' : 'Pro';

};
const fullPackageName = `@mui/${packageName}`;
if (licenseStatus === _licenseStatus.LicenseStatus.Invalid) {
(0, _licenseErrorMessageUtils.showInvalidLicenseError)();
(0, _licenseErrorMessageUtils.showInvalidLicenseKeyError)();
} else if (licenseStatus === _licenseStatus.LicenseStatus.OutOfScope) {
(0, _licenseErrorMessageUtils.showOutOfScopeLicenseError)();
(0, _licenseErrorMessageUtils.showLicenseKeyPlanMismatchError)();
} else if (licenseStatus === _licenseStatus.LicenseStatus.NotFound) {
(0, _licenseErrorMessageUtils.showNotFoundLicenseError)({
(0, _licenseErrorMessageUtils.showMissingLicenseKeyError)({
plan,
packageName: `@mui/${packageName}`
packageName: fullPackageName
});
} else if (licenseStatus === _licenseStatus.LicenseStatus.Expired) {
(0, _licenseErrorMessageUtils.showExpiredLicenseError)();
(0, _licenseErrorMessageUtils.showExpiredLicenseKeyError)();
} else if (licenseStatus === _licenseStatus.LicenseStatus.ExpiredVersion) {
(0, _licenseErrorMessageUtils.showExpiredPackageVersionError)({
packageName: fullPackageName
});
}
return licenseStatus;
}, [packageName, releaseInfo]);
}

@@ -6,5 +6,3 @@ "use strict";

});
var _licenseErrorMessageUtils = require("./licenseErrorMessageUtils");
Object.keys(_licenseErrorMessageUtils).forEach(function (key) {

@@ -20,5 +18,3 @@ if (key === "default" || key === "__esModule") return;

});
var _licenseInfo = require("./licenseInfo");
Object.keys(_licenseInfo).forEach(function (key) {

@@ -34,5 +30,3 @@ if (key === "default" || key === "__esModule") return;

});
var _licenseStatus = require("./licenseStatus");
Object.keys(_licenseStatus).forEach(function (key) {

@@ -39,0 +33,0 @@ if (key === "default" || key === "__esModule") return;

@@ -6,28 +6,29 @@ "use strict";

});
exports.showExpiredLicenseError = showExpiredLicenseError;
exports.showInvalidLicenseError = showInvalidLicenseError;
exports.showNotFoundLicenseError = showNotFoundLicenseError;
exports.showOutOfScopeLicenseError = showOutOfScopeLicenseError;
exports.showExpiredLicenseKeyError = showExpiredLicenseKeyError;
exports.showExpiredPackageVersionError = showExpiredPackageVersionError;
exports.showInvalidLicenseKeyError = showInvalidLicenseKeyError;
exports.showLicenseKeyPlanMismatchError = showLicenseKeyPlanMismatchError;
exports.showMissingLicenseKeyError = showMissingLicenseKeyError;
function showError(message) {
console.error(['*************************************************************', '', ...message, '', '*************************************************************'].join('\n'));
}
function showInvalidLicenseError() {
showError(['MUI: Invalid license key.', '', "Your MUI X license key isn't valid. Please check your license key installation https://mui.com/r/x-license-key-installation.", '', 'To purchase a license, please visit https://mui.com/r/x-get-license.']);
function showInvalidLicenseKeyError() {
showError(['MUI: 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.']);
}
function showOutOfScopeLicenseError() {
showError(['MUI: License key plan mismatch.', '', 'Your use of MUI X is not compatible with the plan of your license key.', 'You are rendering a `DataGridPremium` component that requires a license key for the Premium plan but your license key is for the Pro plan.', '', 'You can solve the issue by upgrading to Premium at https://mui.com/r/x-get-license?scope=premium', 'Alternatively, you can replace the import of `DataGridPremium` with `DataGridPro`.']);
function showLicenseKeyPlanMismatchError() {
showError(['MUI: License key plan mismatch.', '', 'Your use of MUI X is not compatible with the plan of your license key. The feature you are trying to use is not included in the plan of your license key. This happens if you try to use `DataGridPremium` with a license key for the Pro plan.', '', 'To solve the issue, you can upgrade your plan from Pro to Premium at https://mui.com/r/x-get-license?scope=premium.', "Of if you didn't intend to use Premium features, you can replace the import of `@mui/x-data-grid-premium` with `@mui/x-data-grid-pro`."]);
}
function showNotFoundLicenseError({
function showMissingLicenseKeyError({
plan,
packageName
}) {
showError([`MUI: License key not found for ${packageName}.`, '', `This is a trial-only version of MUI X ${plan}.`, 'See the conditons here: https://mui.com/r/x-license-trial.', '', 'To purchase a license, please visit https://mui.com/r/x-get-license.']);
showError(['MUI: 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.']);
}
function showExpiredLicenseError() {
showError(['MUI: License key expired.', '', 'Please visit https://mui.com/r/x-get-license to renew your subscription of MUI X.']);
function showExpiredPackageVersionError({
packageName
}) {
showError(['MUI: 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.']);
}
function showExpiredLicenseKeyError() {
showError(['MUI: Expired license key.', '', 'The subscription license key works forever in production with any version released before your license term ends. However, when the term ends, you are not allowed to use the current or older versions in development.', '', "To solve the issue, you can renew your license https://mui.com/r/x-get-license or stop making changes to code depending on MUI X's APIs."]);
}

@@ -7,5 +7,3 @@ "use strict";

exports.LicenseInfo = void 0;
var _utils = require("@mui/utils");
// Store the license information in a global, so it can be shared

@@ -19,3 +17,2 @@ // when module duplication occurs. The duplication of the modules can happen

};
class LicenseInfo {

@@ -26,7 +23,5 @@ static getLicenseInfo() {

}
static getLicenseKey() {
return LicenseInfo.getLicenseInfo().key;
}
static setLicenseKey(key) {

@@ -36,5 +31,3 @@ const licenseInfo = LicenseInfo.getLicenseInfo();

}
}
exports.LicenseInfo = LicenseInfo;

@@ -9,3 +9,2 @@ "use strict";

exports.LicenseStatus = LicenseStatus;
(function (LicenseStatus) {

@@ -15,4 +14,5 @@ LicenseStatus["NotFound"] = "NotFound";

LicenseStatus["Expired"] = "Expired";
LicenseStatus["ExpiredVersion"] = "ExpiredVersion";
LicenseStatus["Valid"] = "Valid";
LicenseStatus["OutOfScope"] = "OutOfScope";
})(LicenseStatus || (exports.LicenseStatus = LicenseStatus = {}));

@@ -6,5 +6,3 @@ "use strict";

});
var _verifyLicense = require("./verifyLicense");
Object.keys(_verifyLicense).forEach(function (key) {

@@ -11,0 +9,0 @@ if (key === "default" || key === "__esModule") return;

@@ -8,13 +8,7 @@ "use strict";

exports.verifyLicense = verifyLicense;
var _base = require("../encoding/base64");
var _md = require("../encoding/md5");
var _licenseStatus = require("../utils/licenseStatus");
var _licenseScope = require("../utils/licenseScope");
var _licensingModel = require("../utils/licensingModel");
const getDefaultReleaseDate = () => {

@@ -25,9 +19,6 @@ const today = new Date();

};
function generateReleaseInfo(releaseDate = getDefaultReleaseDate()) {
return (0, _base.base64Encode)(releaseDate.getTime().toString());
}
const expiryReg = /^.*EXPIRY=([0-9]+),.*$/;
/**

@@ -38,6 +29,4 @@ * Format: ORDER:${orderNumber},EXPIRY=${expiryTimestamp},KEYVERSION=1

let expiryTimestamp;
try {
expiryTimestamp = parseInt(license.match(expiryReg)[1], 10);
if (!expiryTimestamp || Number.isNaN(expiryTimestamp)) {

@@ -49,3 +38,2 @@ expiryTimestamp = null;

}
return {

@@ -57,7 +45,6 @@ scope: 'pro',

};
/**
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},KV=2`;
*/
const decodeLicenseVersion2 = license => {

@@ -73,10 +60,7 @@ const licenseInfo = {

}
if (key === 'LM') {
licenseInfo.licensingModel = value;
}
if (key === 'E') {
const expiryTimestamp = parseInt(value, 10);
if (expiryTimestamp && !Number.isNaN(expiryTimestamp)) {

@@ -89,21 +73,16 @@ licenseInfo.expiryTimestamp = expiryTimestamp;

};
/**
* Decode the license based on its key version and return a version-agnostic `MuiLicense` object.
*/
const decodeLicense = encodedLicense => {
const license = (0, _base.base64Decode)(encodedLicense);
if (license.includes('KEYVERSION=1')) {
return decodeLicenseVersion1(license);
}
if (license.includes('KV=2')) {
return decodeLicenseVersion2(license);
}
return null;
};
function verifyLicense({

@@ -118,16 +97,11 @@ releaseInfo,

}
if (!licenseKey) {
return _licenseStatus.LicenseStatus.NotFound;
}
const hash = licenseKey.substr(0, 32);
const encoded = licenseKey.substr(32);
if (hash !== (0, _md.md5)(encoded)) {
return _licenseStatus.LicenseStatus.Invalid;
}
const license = decodeLicense(encoded);
if (license == null) {

@@ -137,3 +111,2 @@ console.error('Error checking license. Key version not found!');

}
if (license.licensingModel == null || !_licensingModel.LICENSING_MODELS.includes(license.licensingModel)) {

@@ -143,3 +116,2 @@ console.error('Error checking license. Sales model not found or invalid!');

}
if (license.expiryTimestamp == null) {

@@ -149,12 +121,9 @@ console.error('Error checking license. Expiry timestamp not found or invalid!');

}
if (license.licensingModel === 'perpetual' || isProduction) {
const pkgTimestamp = parseInt((0, _base.base64Decode)(releaseInfo), 10);
if (Number.isNaN(pkgTimestamp)) {
throw new Error('MUI: The release information is invalid. Not able to validate license.');
}
if (license.expiryTimestamp < pkgTimestamp) {
return _licenseStatus.LicenseStatus.Expired;
return _licenseStatus.LicenseStatus.ExpiredVersion;
}

@@ -166,3 +135,2 @@ } else if (license.licensingModel === 'subscription') {

}
if (license.scope == null || !_licenseScope.LICENSE_SCOPES.includes(license.scope)) {

@@ -172,8 +140,6 @@ console.error('Error checking license. scope not found or invalid!');

}
if (!acceptedScopes.includes(license.scope)) {
return _licenseStatus.LicenseStatus.OutOfScope;
}
return _licenseStatus.LicenseStatus.Valid;
}

@@ -6,5 +6,3 @@ "use strict";

});
var _Watermark = require("./Watermark");
Object.keys(_Watermark).forEach(function (key) {

@@ -11,0 +9,0 @@ if (key === "default" || key === "__esModule") return;

@@ -7,29 +7,20 @@ "use strict";

exports.Watermark = Watermark;
var React = _interopRequireWildcard(require("react"));
var _useLicenseVerifier = require("../useLicenseVerifier");
var _licenseStatus = require("../utils/licenseStatus");
var _jsxRuntime = require("react/jsx-runtime");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function getLicenseErrorMessage(licenseStatus) {
switch (licenseStatus) {
case _licenseStatus.LicenseStatus.Expired:
return 'MUI X: License key expired';
return 'MUI X Expired license key';
case _licenseStatus.LicenseStatus.ExpiredVersion:
return 'MUI X Expired package version';
case _licenseStatus.LicenseStatus.Invalid:
return 'MUI X: Invalid license key';
return 'MUI X Invalid license key';
case _licenseStatus.LicenseStatus.OutOfScope:
return 'MUI X: License key plan mismatch';
return 'MUI X License key plan mismatch';
case _licenseStatus.LicenseStatus.NotFound:
return 'MUI X: Missing license key';
return 'MUI X Missing license key';
default:

@@ -39,3 +30,2 @@ throw new Error('MUI: Unhandled MUI X license status.');

}
function Watermark(props) {

@@ -47,7 +37,5 @@ const {

const licenseStatus = (0, _useLicenseVerifier.useLicenseVerifier)(packageName, releaseInfo);
if (licenseStatus === _licenseStatus.LicenseStatus.Valid) {
return null;
}
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {

@@ -54,0 +42,0 @@ style: {

{
"name": "@mui/x-license-pro",
"version": "6.0.0-alpha.8",
"version": "6.0.0-alpha.9",
"description": "MUI X License verification",

@@ -22,3 +22,3 @@ "author": "MUI Team",

"dependencies": {
"@babel/runtime": "^7.19.0",
"@babel/runtime": "^7.20.1",
"@mui/utils": "^5.10.14"

@@ -33,3 +33,3 @@ },

"engines": {
"node": ">=12.0.0"
"node": ">=14.0.0"
},

@@ -36,0 +36,0 @@ "private": false,

import * as React from 'react';
import { verifyLicense } from '../verifyLicense/verifyLicense';
import { LicenseInfo } from '../utils/licenseInfo';
import { showExpiredLicenseError, showInvalidLicenseError, showNotFoundLicenseError, showOutOfScopeLicenseError } from '../utils/licenseErrorMessageUtils';
import { showExpiredLicenseKeyError, showInvalidLicenseKeyError, showMissingLicenseKeyError, showLicenseKeyPlanMismatchError, showExpiredPackageVersionError } from '../utils/licenseErrorMessageUtils';
import { LicenseStatus } from '../utils/licenseStatus';

@@ -10,7 +10,5 @@ export const sharedLicenseStatuses = {};

const licenseKey = LicenseInfo.getLicenseKey();
if (sharedLicenseStatuses[packageName] && sharedLicenseStatuses[packageName].key === licenseKey) {
return sharedLicenseStatuses[packageName].status;
}
const acceptedScopes = packageName.includes('premium') ? ['premium'] : ['pro', 'premium'];

@@ -28,18 +26,21 @@ const plan = packageName.includes('premium') ? 'Premium' : 'Pro';

};
const fullPackageName = `@mui/${packageName}`;
if (licenseStatus === LicenseStatus.Invalid) {
showInvalidLicenseError();
showInvalidLicenseKeyError();
} else if (licenseStatus === LicenseStatus.OutOfScope) {
showOutOfScopeLicenseError();
showLicenseKeyPlanMismatchError();
} else if (licenseStatus === LicenseStatus.NotFound) {
showNotFoundLicenseError({
showMissingLicenseKeyError({
plan,
packageName: `@mui/${packageName}`
packageName: fullPackageName
});
} else if (licenseStatus === LicenseStatus.Expired) {
showExpiredLicenseError();
showExpiredLicenseKeyError();
} else if (licenseStatus === LicenseStatus.ExpiredVersion) {
showExpiredPackageVersionError({
packageName: fullPackageName
});
}
return licenseStatus;
}, [packageName, releaseInfo]);
}

@@ -1,7 +0,10 @@

export declare function showInvalidLicenseError(): void;
export declare function showOutOfScopeLicenseError(): void;
export declare function showNotFoundLicenseError({ plan, packageName, }: {
export declare function showInvalidLicenseKeyError(): void;
export declare function showLicenseKeyPlanMismatchError(): void;
export declare function showMissingLicenseKeyError({ plan, packageName, }: {
plan: string;
packageName: string;
}): void;
export declare function showExpiredLicenseError(): void;
export declare function showExpiredPackageVersionError({ packageName }: {
packageName: string;
}): void;
export declare function showExpiredLicenseKeyError(): void;
function showError(message) {
console.error(['*************************************************************', '', ...message, '', '*************************************************************'].join('\n'));
}
export function showInvalidLicenseError() {
showError(['MUI: Invalid license key.', '', "Your MUI X license key isn't valid. Please check your license key installation https://mui.com/r/x-license-key-installation.", '', 'To purchase a license, please visit https://mui.com/r/x-get-license.']);
export function showInvalidLicenseKeyError() {
showError(['MUI: 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.']);
}
export function showOutOfScopeLicenseError() {
showError(['MUI: License key plan mismatch.', '', 'Your use of MUI X is not compatible with the plan of your license key.', 'You are rendering a `DataGridPremium` component that requires a license key for the Premium plan but your license key is for the Pro plan.', '', 'You can solve the issue by upgrading to Premium at https://mui.com/r/x-get-license?scope=premium', 'Alternatively, you can replace the import of `DataGridPremium` with `DataGridPro`.']);
export function showLicenseKeyPlanMismatchError() {
showError(['MUI: License key plan mismatch.', '', 'Your use of MUI X is not compatible with the plan of your license key. The feature you are trying to use is not included in the plan of your license key. This happens if you try to use `DataGridPremium` with a license key for the Pro plan.', '', 'To solve the issue, you can upgrade your plan from Pro to Premium at https://mui.com/r/x-get-license?scope=premium.', "Of if you didn't intend to use Premium features, you can replace the import of `@mui/x-data-grid-premium` with `@mui/x-data-grid-pro`."]);
}
export function showNotFoundLicenseError({
export function showMissingLicenseKeyError({
plan,
packageName
}) {
showError([`MUI: License key not found for ${packageName}.`, '', `This is a trial-only version of MUI X ${plan}.`, 'See the conditons here: https://mui.com/r/x-license-trial.', '', 'To purchase a license, please visit https://mui.com/r/x-get-license.']);
showError(['MUI: 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.']);
}
export function showExpiredLicenseError() {
showError(['MUI: License key expired.', '', 'Please visit https://mui.com/r/x-get-license to renew your subscription of MUI X.']);
export function showExpiredPackageVersionError({
packageName
}) {
showError(['MUI: 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.']);
}
export function showExpiredLicenseKeyError() {
showError(['MUI: Expired license key.', '', 'The subscription license key works forever in production with any version released before your license term ends. However, when the term ends, you are not allowed to use the current or older versions in development.', '', "To solve the issue, you can renew your license https://mui.com/r/x-get-license or stop making changes to code depending on MUI X's APIs."]);
}

@@ -15,7 +15,5 @@ import { ponyfillGlobal } from '@mui/utils';

}
static getLicenseKey() {
return LicenseInfo.getLicenseInfo().key;
}
static setLicenseKey(key) {

@@ -25,3 +23,2 @@ const licenseInfo = LicenseInfo.getLicenseInfo();

}
}

@@ -5,2 +5,3 @@ declare enum LicenseStatus {

Expired = "Expired",
ExpiredVersion = "ExpiredVersion",
Valid = "Valid",

@@ -7,0 +8,0 @@ OutOfScope = "OutOfScope"

var LicenseStatus;
(function (LicenseStatus) {

@@ -7,6 +6,6 @@ LicenseStatus["NotFound"] = "NotFound";

LicenseStatus["Expired"] = "Expired";
LicenseStatus["ExpiredVersion"] = "ExpiredVersion";
LicenseStatus["Valid"] = "Valid";
LicenseStatus["OutOfScope"] = "OutOfScope";
})(LicenseStatus || (LicenseStatus = {}));
export { LicenseStatus };

@@ -6,3 +6,2 @@ import { base64Decode, base64Encode } from '../encoding/base64';

import { LICENSING_MODELS } from '../utils/licensingModel';
const getDefaultReleaseDate = () => {

@@ -13,3 +12,2 @@ const today = new Date();

};
export function generateReleaseInfo(releaseDate = getDefaultReleaseDate()) {

@@ -19,3 +17,2 @@ return base64Encode(releaseDate.getTime().toString());

const expiryReg = /^.*EXPIRY=([0-9]+),.*$/;
/**

@@ -26,6 +23,4 @@ * Format: ORDER:${orderNumber},EXPIRY=${expiryTimestamp},KEYVERSION=1

let expiryTimestamp;
try {
expiryTimestamp = parseInt(license.match(expiryReg)[1], 10);
if (!expiryTimestamp || Number.isNaN(expiryTimestamp)) {

@@ -37,3 +32,2 @@ expiryTimestamp = null;

}
return {

@@ -45,7 +39,6 @@ scope: 'pro',

};
/**
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},KV=2`;
*/
const decodeLicenseVersion2 = license => {

@@ -61,10 +54,7 @@ const licenseInfo = {

}
if (key === 'LM') {
licenseInfo.licensingModel = value;
}
if (key === 'E') {
const expiryTimestamp = parseInt(value, 10);
if (expiryTimestamp && !Number.isNaN(expiryTimestamp)) {

@@ -77,21 +67,16 @@ licenseInfo.expiryTimestamp = expiryTimestamp;

};
/**
* Decode the license based on its key version and return a version-agnostic `MuiLicense` object.
*/
const decodeLicense = encodedLicense => {
const license = base64Decode(encodedLicense);
if (license.includes('KEYVERSION=1')) {
return decodeLicenseVersion1(license);
}
if (license.includes('KV=2')) {
return decodeLicenseVersion2(license);
}
return null;
};
export function verifyLicense({

@@ -106,16 +91,11 @@ releaseInfo,

}
if (!licenseKey) {
return LicenseStatus.NotFound;
}
const hash = licenseKey.substr(0, 32);
const encoded = licenseKey.substr(32);
if (hash !== md5(encoded)) {
return LicenseStatus.Invalid;
}
const license = decodeLicense(encoded);
if (license == null) {

@@ -125,3 +105,2 @@ console.error('Error checking license. Key version not found!');

}
if (license.licensingModel == null || !LICENSING_MODELS.includes(license.licensingModel)) {

@@ -131,3 +110,2 @@ console.error('Error checking license. Sales model not found or invalid!');

}
if (license.expiryTimestamp == null) {

@@ -137,12 +115,9 @@ console.error('Error checking license. Expiry timestamp not found or invalid!');

}
if (license.licensingModel === 'perpetual' || isProduction) {
const pkgTimestamp = parseInt(base64Decode(releaseInfo), 10);
if (Number.isNaN(pkgTimestamp)) {
throw new Error('MUI: The release information is invalid. Not able to validate license.');
}
if (license.expiryTimestamp < pkgTimestamp) {
return LicenseStatus.Expired;
return LicenseStatus.ExpiredVersion;
}

@@ -154,3 +129,2 @@ } else if (license.licensingModel === 'subscription') {

}
if (license.scope == null || !LICENSE_SCOPES.includes(license.scope)) {

@@ -160,8 +134,6 @@ console.error('Error checking license. scope not found or invalid!');

}
if (!acceptedScopes.includes(license.scope)) {
return LicenseStatus.OutOfScope;
}
return LicenseStatus.Valid;
}

@@ -5,17 +5,14 @@ import * as React from 'react';

import { jsx as _jsx } from "react/jsx-runtime";
function getLicenseErrorMessage(licenseStatus) {
switch (licenseStatus) {
case LicenseStatus.Expired:
return 'MUI X: License key expired';
return 'MUI X Expired license key';
case LicenseStatus.ExpiredVersion:
return 'MUI X Expired package version';
case LicenseStatus.Invalid:
return 'MUI X: Invalid license key';
return 'MUI X Invalid license key';
case LicenseStatus.OutOfScope:
return 'MUI X: License key plan mismatch';
return 'MUI X License key plan mismatch';
case LicenseStatus.NotFound:
return 'MUI X: Missing license key';
return 'MUI X Missing license key';
default:

@@ -25,3 +22,2 @@ throw new Error('MUI: Unhandled MUI X license status.');

}
export function Watermark(props) {

@@ -33,7 +29,5 @@ const {

const licenseStatus = useLicenseVerifier(packageName, releaseInfo);
if (licenseStatus === LicenseStatus.Valid) {
return null;
}
return /*#__PURE__*/_jsx("div", {

@@ -40,0 +34,0 @@ style: {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc