UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

107 lines (105 loc) 5.13 kB
/** * DevExtreme (cjs/__internal/core/license/license_warnings.js) * Version: 26.1.3 * Build date: Wed Jun 10 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TEMPLATES = void 0; exports.logLicenseWarning = logLicenseWarning; const TEMPLATES = exports.TEMPLATES = Object.freeze({ warningPrefix: code => { let warningDescription = ""; switch (code) { case "W0019": warningDescription = "DevExtreme: You are using a trial (evaluation) version."; break; case "W0020": warningDescription = "DevExtreme: License Key Has Expired."; break; case "W0021": warningDescription = "DevExtreme: License Key Verification Has Failed."; break; default: warningDescription = "DevExtreme: For evaluation purposes only. Redistribution prohibited." } return `${code} - ${warningDescription}` }, keyNotFound: "A devextreme-license generated key has not been specified in the GlobalConfig.", keyWasFound: (type, path) => { switch (type) { case "envVariable": return "The DevExpress license key was retrieved from the 'DevExpress_License' environment variable."; case "envPath": return "The DevExpress license key was retrieved from the 'DevExpress_LicensePath' environment variable."; case "file": return `The DevExpress license key was retrieved from file: "${path}".`; default: return "The DevExpress license key was retrieved." } }, keyVerificationFailed: (type, keyVersion, requiredVersion) => { if ("incompatibleVersion" === type) { return `Incompatible DevExpress license key version (v${keyVersion}). Download and register an updated DevExpress license key (v${requiredVersion}+). Clear npm/IDE/NuGet cache and rebuild your project (https://devexpress.com/DX1002).` } else { return "" } }, purchaseLicense: "Please register an existing license (https://devexpress.com/DX1000) or purchase a new license (https://devexpress.com/Buy/) to continue use of the following DevExpress product libraries: DevExtreme - Included in Subscriptions: Universal, DXperience, ASP.NET and Blazor, DevExtreme Complete.", installationInstructions: "If you own a licensed/registered version or if you are using a 30-day trial version of DevExpress product libraries on a development machine, download your personal license key and verify it with the devextreme-license tool (https://devexpress.com/DX1001).", lcxUsedInsteadOfLcp: "A DevExpress license key has been specified instead of a key generated using devextreme-license.", oldDevExtremeKey: "A DevExtreme key (v25.2 or earlier) has been detected in the GlobalConfig. Generate a key with devextreme-license instead.", licenseId: id => `License ID: ${id}` }); function logLicenseWarning(warningType, version, versionInfo) { const T = TEMPLATES; const purchaseLine = `${T.warningPrefix("W0019")} ${T.purchaseLicense}`; const installLine = `${T.warningPrefix("W0021")} ${T.installationInstructions}`; const warnings = [ [purchaseLine] ]; const pushToLastGroup = function() { const lastGroup = warnings[warnings.length - 1]; for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) { items[_key] = arguments[_key] } const notEmptyItems = items.filter(item => !!item); if (1 === lastGroup.length) { lastGroup.push("", ...notEmptyItems) } else { lastGroup.push(...notEmptyItems) } }; switch (warningType) { case "no-key": pushToLastGroup(T.keyNotFound); warnings.push([installLine]); break; case "invalid-key": pushToLastGroup(T.keyVerificationFailed()); warnings.push([installLine]); break; case "lcx-used": pushToLastGroup(T.keyVerificationFailed(), T.lcxUsedInsteadOfLcp); warnings.push([installLine]); break; case "old-devextreme-key": pushToLastGroup(T.keyVerificationFailed(), T.oldDevExtremeKey); warnings.push([installLine]); break; case "version-mismatch": { const incompatibleLine = `${T.warningPrefix("W0020")} ${T.keyVerificationFailed("incompatibleVersion",null===versionInfo||void 0===versionInfo?void 0:versionInfo.keyVersion,null===versionInfo||void 0===versionInfo?void 0:versionInfo.requiredVersion)}`; pushToLastGroup(T.keyVerificationFailed()); warnings.push([incompatibleLine]); break } } warnings.forEach(group => { console.warn(group.join("\n")) }) }