@nice2dev/licensing 1.1.7 → 1.1.10
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.
- package/CHANGELOG.md +146 -0
- package/dist/index.cjs +74 -71
- package/dist/index.mjs +33 -30
- package/dist/{FeatureGate-9rvyns7j.cjs → marks-KVqpGsfU.cjs} +55 -0
- package/dist/{FeatureGate-cIgJ8Gq2.js → marks-KzIFNheE.js} +63 -8
- package/dist/react.cjs +20 -21
- package/dist/react.mjs +11 -12
- package/package.json +3 -5
- package/dist/FeatureGate-9rvyns7j.cjs.map +0 -1
- package/dist/FeatureGate-Cs1zphXs.cjs +0 -1405
- package/dist/FeatureGate-Cs1zphXs.cjs.map +0 -1
- package/dist/FeatureGate-Da7fCJA5.js +0 -1406
- package/dist/FeatureGate-Da7fCJA5.js.map +0 -1
- package/dist/FeatureGate-cIgJ8Gq2.js.map +0 -1
- package/dist/__vite-browser-external-2Ng8QIWW.js.map +0 -1
- package/dist/__vite-browser-external-DES75WN9.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/react.cjs.map +0 -1
- package/dist/react.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as generateMachineId, a as generateFingerprint, v as validateKeyFormat$1, e as extractKeyMetadata, t as tierMeetsRequirement } from "./
|
|
2
|
-
import { L, c, b, d, f, h, i, j, k, l, m, n, o, p, q, r, s, u, w, x, y, z, A, B,
|
|
1
|
+
import { g as generateMachineId, C as CheckMark, a as generateFingerprint, R as RefreshMark, v as validateKeyFormat$1, e as extractKeyMetadata, t as tierMeetsRequirement } from "./marks-KzIFNheE.js";
|
|
2
|
+
import { L, c, b, d, f, h, i, j, k, l, m, n, o, p, q, r, s, u, w, x, y, z, A, B, D, E, F, G, H, I, J, K } from "./marks-KzIFNheE.js";
|
|
3
3
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
4
4
|
import React, { useState, useCallback, useEffect, useMemo } from "react";
|
|
5
5
|
const HEARTBEAT_INTERVAL_MS = 5 * 60 * 1e3;
|
|
@@ -1995,7 +1995,7 @@ const StepIndicator = ({ currentStep }) => {
|
|
|
1995
1995
|
"div",
|
|
1996
1996
|
{
|
|
1997
1997
|
className: `w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium ${index < currentIndex ? "bg-green-500 text-white" : index === currentIndex ? "bg-blue-500 text-white" : "bg-gray-200 text-gray-500"}`,
|
|
1998
|
-
children: index < currentIndex ? "
|
|
1998
|
+
children: index < currentIndex ? /* @__PURE__ */ jsx(CheckMark, { style: { margin: "0 0 0.15em" } }) : index + 1
|
|
1999
1999
|
}
|
|
2000
2000
|
),
|
|
2001
2001
|
/* @__PURE__ */ jsx("span", { className: "text-xs mt-1 text-gray-500", children: step.label })
|
|
@@ -2036,7 +2036,7 @@ const ActivationWizard = (props) => {
|
|
|
2036
2036
|
state.step !== "error" && /* @__PURE__ */ jsx(StepIndicator, { currentStep: state.step }),
|
|
2037
2037
|
state.step === "error" && state.error && /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
2038
2038
|
/* @__PURE__ */ jsxs("div", { className: "bg-red-50 border border-red-200 rounded-lg p-6 text-center", children: [
|
|
2039
|
-
/* @__PURE__ */ jsx("div", { className: "text-red-500 text-4xl mb-3", children: "
|
|
2039
|
+
/* @__PURE__ */ jsx("div", { className: "text-red-500 text-4xl mb-3 font-bold", "aria-hidden": "true", children: "!" }),
|
|
2040
2040
|
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-red-800", children: "Activation Failed" }),
|
|
2041
2041
|
/* @__PURE__ */ jsx("p", { className: "text-red-600 mt-2", children: state.error.message }),
|
|
2042
2042
|
state.error.supportRequired && config.supportEmail && /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 mt-4", children: [
|
|
@@ -2212,7 +2212,7 @@ const ActivationWizard = (props) => {
|
|
|
2212
2212
|
/* @__PURE__ */ jsx("p", { className: "text-gray-500 mt-2", children: "Please wait while we activate your license" })
|
|
2213
2213
|
] }),
|
|
2214
2214
|
state.step === "success" && state.activatedLicense && /* @__PURE__ */ jsxs("div", { className: "text-center space-y-6", children: [
|
|
2215
|
-
/* @__PURE__ */ jsx("div", { className: "text-green-500 text-6xl", children:
|
|
2215
|
+
/* @__PURE__ */ jsx("div", { className: "text-green-500 text-6xl", children: /* @__PURE__ */ jsx(CheckMark, {}) }),
|
|
2216
2216
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2217
2217
|
/* @__PURE__ */ jsx("h2", { className: "text-xl font-bold text-gray-900", children: "License Activated!" }),
|
|
2218
2218
|
/* @__PURE__ */ jsx("p", { className: "text-gray-600 mt-2", children: "Your license has been successfully activated on this machine." })
|
|
@@ -2639,15 +2639,12 @@ const LicenseTransfer = (props) => {
|
|
|
2639
2639
|
{
|
|
2640
2640
|
className: `mt-2 text-sm ${recipientValidation.valid ? "text-green-600" : "text-red-600"}`,
|
|
2641
2641
|
children: [
|
|
2642
|
-
recipientValidation.valid ? "
|
|
2642
|
+
recipientValidation.valid ? "Valid recipient" : "Invalid recipient",
|
|
2643
2643
|
recipientValidation.isExternal && /* @__PURE__ */ jsx("span", { className: "ml-2 text-orange-600", children: "(External organization)" })
|
|
2644
2644
|
]
|
|
2645
2645
|
}
|
|
2646
2646
|
),
|
|
2647
|
-
(_a = recipientValidation == null ? void 0 : recipientValidation.warnings) == null ? void 0 : _a.map((warning, i2) => /* @__PURE__ */
|
|
2648
|
-
"⚠ ",
|
|
2649
|
-
warning
|
|
2650
|
-
] }, i2))
|
|
2647
|
+
(_a = recipientValidation == null ? void 0 : recipientValidation.warnings) == null ? void 0 : _a.map((warning, i2) => /* @__PURE__ */ jsx("div", { className: "mt-1 text-sm text-orange-600", children: warning }, i2))
|
|
2651
2648
|
] }),
|
|
2652
2649
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2653
2650
|
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Recipient Name" }),
|
|
@@ -2733,7 +2730,7 @@ const LicenseTransfer = (props) => {
|
|
|
2733
2730
|
] })
|
|
2734
2731
|
] }),
|
|
2735
2732
|
/* @__PURE__ */ jsxs("div", { className: "p-4 bg-orange-50 border border-orange-200 rounded-lg", children: [
|
|
2736
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-orange-800 mb-2", children: "
|
|
2733
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-orange-800 mb-2", children: "Important" }),
|
|
2737
2734
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-orange-700", children: "Once the transfer is completed, this license will be deactivated from all your machines and the new owner will need to activate it." })
|
|
2738
2735
|
] }),
|
|
2739
2736
|
/* @__PURE__ */ jsxs("label", { className: "flex items-start gap-3 cursor-pointer", children: [
|
|
@@ -2774,7 +2771,7 @@ const LicenseTransfer = (props) => {
|
|
|
2774
2771
|
/* @__PURE__ */ jsx("p", { className: "text-gray-500", children: "Please wait while we process your transfer request" })
|
|
2775
2772
|
] }),
|
|
2776
2773
|
step === "complete" && transfer && /* @__PURE__ */ jsxs("div", { className: "text-center space-y-6", children: [
|
|
2777
|
-
/* @__PURE__ */ jsx("div", { className: "text-green-500 text-6xl", children:
|
|
2774
|
+
/* @__PURE__ */ jsx("div", { className: "text-green-500 text-6xl", children: /* @__PURE__ */ jsx(CheckMark, {}) }),
|
|
2778
2775
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2779
2776
|
/* @__PURE__ */ jsx("h2", { className: "text-xl font-bold", children: "Transfer Initiated" }),
|
|
2780
2777
|
/* @__PURE__ */ jsx("p", { className: "text-gray-600 mt-2", children: transfer.approvalRequired ? "Your transfer request has been submitted for approval." : "An email has been sent to the recipient with instructions to accept the transfer." })
|
|
@@ -3330,7 +3327,7 @@ const UsageAnalyticsDashboard = (props) => {
|
|
|
3330
3327
|
onClick: () => refresh(),
|
|
3331
3328
|
className: "p-2 text-gray-500 hover:text-gray-700 rounded-lg hover:bg-gray-100",
|
|
3332
3329
|
title: "Refresh",
|
|
3333
|
-
children:
|
|
3330
|
+
children: /* @__PURE__ */ jsx(RefreshMark, {})
|
|
3334
3331
|
}
|
|
3335
3332
|
),
|
|
3336
3333
|
/* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(
|
|
@@ -3613,10 +3610,10 @@ class BuildLicenseValidator {
|
|
|
3613
3610
|
const prefix = "[nice2dev/license]";
|
|
3614
3611
|
switch (type) {
|
|
3615
3612
|
case "warn":
|
|
3616
|
-
console.warn(`${prefix}
|
|
3613
|
+
console.warn(`${prefix} warning: ${message}`);
|
|
3617
3614
|
break;
|
|
3618
3615
|
case "error":
|
|
3619
|
-
console.error(`${prefix}
|
|
3616
|
+
console.error(`${prefix} error: ${message}`);
|
|
3620
3617
|
break;
|
|
3621
3618
|
default:
|
|
3622
3619
|
console.log(`${prefix} ${message}`);
|
|
@@ -3822,15 +3819,21 @@ class Nice2DevLicenseWebpackPlugin {
|
|
|
3822
3819
|
}
|
|
3823
3820
|
const result = await this.validator.validate();
|
|
3824
3821
|
this.validated = true;
|
|
3825
|
-
result.warnings.forEach((w2) => console.warn(`[nice2dev]
|
|
3822
|
+
result.warnings.forEach((w2) => console.warn(`[nice2dev] warning: ${w2}`));
|
|
3826
3823
|
if (result.errors.length > 0 && this.options.failOnInvalid !== false) {
|
|
3827
|
-
result.errors.forEach((e) => console.error(`[nice2dev]
|
|
3824
|
+
result.errors.forEach((e) => console.error(`[nice2dev] error: ${e}`));
|
|
3828
3825
|
throw new Error("License validation failed");
|
|
3829
3826
|
}
|
|
3830
3827
|
});
|
|
3831
3828
|
compiler.hooks.compilation.tap("Nice2DevLicensePlugin", (_compilation) => {
|
|
3832
3829
|
var _a, _b;
|
|
3833
|
-
const DefinePlugin = (
|
|
3830
|
+
const DefinePlugin = (_a = compiler.webpack) == null ? void 0 : _a.DefinePlugin;
|
|
3831
|
+
if (!DefinePlugin) {
|
|
3832
|
+
console.warn(
|
|
3833
|
+
"[Nice2DevLicensePlugin] compiler.webpack is missing (webpack < 5): license feature flags are not defined."
|
|
3834
|
+
);
|
|
3835
|
+
return;
|
|
3836
|
+
}
|
|
3834
3837
|
const license = this.validator.getLicenseInfo();
|
|
3835
3838
|
new DefinePlugin({
|
|
3836
3839
|
"process.env.NICE2DEV_LICENSE_VALID": JSON.stringify(
|
|
@@ -3940,7 +3943,7 @@ class CIOutputFormatter {
|
|
|
3940
3943
|
if (this.outputFormat === "json") {
|
|
3941
3944
|
return;
|
|
3942
3945
|
}
|
|
3943
|
-
console.log(
|
|
3946
|
+
console.log(`info: ${message}`);
|
|
3944
3947
|
}
|
|
3945
3948
|
success(message) {
|
|
3946
3949
|
if (this.outputFormat === "json") {
|
|
@@ -3954,7 +3957,7 @@ class CIOutputFormatter {
|
|
|
3954
3957
|
console.log(`##[section]${message}`);
|
|
3955
3958
|
break;
|
|
3956
3959
|
default:
|
|
3957
|
-
console.log(
|
|
3960
|
+
console.log(`ok: ${message}`);
|
|
3958
3961
|
}
|
|
3959
3962
|
}
|
|
3960
3963
|
warning(message) {
|
|
@@ -3972,7 +3975,7 @@ class CIOutputFormatter {
|
|
|
3972
3975
|
console.warn(`\x1B[33mWarning: ${message}\x1B[0m`);
|
|
3973
3976
|
break;
|
|
3974
3977
|
default:
|
|
3975
|
-
console.warn(
|
|
3978
|
+
console.warn(`warning: ${message}`);
|
|
3976
3979
|
}
|
|
3977
3980
|
}
|
|
3978
3981
|
error(message) {
|
|
@@ -3990,7 +3993,7 @@ class CIOutputFormatter {
|
|
|
3990
3993
|
console.error(`\x1B[31mError: ${message}\x1B[0m`);
|
|
3991
3994
|
break;
|
|
3992
3995
|
default:
|
|
3993
|
-
console.error(
|
|
3996
|
+
console.error(`error: ${message}`);
|
|
3994
3997
|
}
|
|
3995
3998
|
}
|
|
3996
3999
|
setOutput(name, value) {
|
|
@@ -4332,23 +4335,23 @@ export {
|
|
|
4332
4335
|
B as isFeatureLicensed,
|
|
4333
4336
|
isForkPR,
|
|
4334
4337
|
isModuleAccessible,
|
|
4335
|
-
|
|
4338
|
+
D as maskLicenseKey,
|
|
4336
4339
|
nice2devLicenseRollupPlugin,
|
|
4337
4340
|
nice2devLicenseVitePlugin,
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4341
|
+
E as normalizeLicenseKey,
|
|
4342
|
+
F as registerFeature,
|
|
4343
|
+
G as registerFeatures,
|
|
4344
|
+
H as registerPlan,
|
|
4345
|
+
I as registerPlans,
|
|
4343
4346
|
registerProtectedModule,
|
|
4344
4347
|
registerProtectedModules,
|
|
4345
4348
|
runCILicenseCheck,
|
|
4346
|
-
|
|
4349
|
+
J as storeFingerprint,
|
|
4347
4350
|
tierMeetsRequirement,
|
|
4348
4351
|
useActivationWizard,
|
|
4349
4352
|
useLicensePortal,
|
|
4350
4353
|
useLicenseTransfer,
|
|
4351
4354
|
useUsageAnalytics,
|
|
4352
4355
|
validateKeyFormat$1 as validateKeyFormat,
|
|
4353
|
-
|
|
4356
|
+
K as validateLicense
|
|
4354
4357
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
2
3
|
const SEGMENT_LENGTH = 4;
|
|
3
4
|
const NUM_SEGMENTS = 5;
|
|
4
5
|
const KEY_CHARS = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
|
|
@@ -1365,7 +1366,61 @@ function initializeDefaults() {
|
|
|
1365
1366
|
registerPlans(DEFAULT_PLANS);
|
|
1366
1367
|
}
|
|
1367
1368
|
initializeDefaults();
|
|
1369
|
+
const CheckMark = ({ style }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1370
|
+
"span",
|
|
1371
|
+
{
|
|
1372
|
+
"aria-hidden": "true",
|
|
1373
|
+
style: {
|
|
1374
|
+
display: "inline-block",
|
|
1375
|
+
width: "0.3em",
|
|
1376
|
+
height: "0.6em",
|
|
1377
|
+
margin: "0 0.35em 0.15em 0.1em",
|
|
1378
|
+
borderRight: "0.12em solid currentColor",
|
|
1379
|
+
borderBottom: "0.12em solid currentColor",
|
|
1380
|
+
transform: "rotate(45deg)",
|
|
1381
|
+
...style
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
);
|
|
1385
|
+
const RefreshMark = ({ style }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1386
|
+
"span",
|
|
1387
|
+
{
|
|
1388
|
+
"aria-hidden": "true",
|
|
1389
|
+
style: {
|
|
1390
|
+
display: "inline-block",
|
|
1391
|
+
width: "0.85em",
|
|
1392
|
+
height: "0.85em",
|
|
1393
|
+
borderRadius: "50%",
|
|
1394
|
+
border: "0.12em solid currentColor",
|
|
1395
|
+
borderTopColor: "transparent",
|
|
1396
|
+
transform: "rotate(-45deg)",
|
|
1397
|
+
...style
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
);
|
|
1401
|
+
const ChevronMark = ({
|
|
1402
|
+
direction,
|
|
1403
|
+
style
|
|
1404
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1405
|
+
"span",
|
|
1406
|
+
{
|
|
1407
|
+
"aria-hidden": "true",
|
|
1408
|
+
style: {
|
|
1409
|
+
display: "inline-block",
|
|
1410
|
+
width: "0.45em",
|
|
1411
|
+
height: "0.45em",
|
|
1412
|
+
margin: direction === "down" ? "0 0 0.2em" : "0.2em 0 0",
|
|
1413
|
+
borderRight: "0.12em solid currentColor",
|
|
1414
|
+
borderBottom: "0.12em solid currentColor",
|
|
1415
|
+
transform: direction === "down" ? "rotate(45deg)" : "rotate(-135deg)",
|
|
1416
|
+
...style
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
);
|
|
1420
|
+
exports.CheckMark = CheckMark;
|
|
1421
|
+
exports.ChevronMark = ChevronMark;
|
|
1368
1422
|
exports.LicenseValidator = LicenseValidator;
|
|
1423
|
+
exports.RefreshMark = RefreshMark;
|
|
1369
1424
|
exports.checkFeatureAccess = checkFeatureAccess;
|
|
1370
1425
|
exports.collectFingerprintData = collectFingerprintData;
|
|
1371
1426
|
exports.compareFingerprintsData = compareFingerprintsData;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
const SEGMENT_LENGTH = 4;
|
|
2
3
|
const NUM_SEGMENTS = 5;
|
|
3
4
|
const KEY_CHARS = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
|
|
@@ -1364,18 +1365,72 @@ function initializeDefaults() {
|
|
|
1364
1365
|
registerPlans(DEFAULT_PLANS);
|
|
1365
1366
|
}
|
|
1366
1367
|
initializeDefaults();
|
|
1368
|
+
const CheckMark = ({ style }) => /* @__PURE__ */ jsx(
|
|
1369
|
+
"span",
|
|
1370
|
+
{
|
|
1371
|
+
"aria-hidden": "true",
|
|
1372
|
+
style: {
|
|
1373
|
+
display: "inline-block",
|
|
1374
|
+
width: "0.3em",
|
|
1375
|
+
height: "0.6em",
|
|
1376
|
+
margin: "0 0.35em 0.15em 0.1em",
|
|
1377
|
+
borderRight: "0.12em solid currentColor",
|
|
1378
|
+
borderBottom: "0.12em solid currentColor",
|
|
1379
|
+
transform: "rotate(45deg)",
|
|
1380
|
+
...style
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
);
|
|
1384
|
+
const RefreshMark = ({ style }) => /* @__PURE__ */ jsx(
|
|
1385
|
+
"span",
|
|
1386
|
+
{
|
|
1387
|
+
"aria-hidden": "true",
|
|
1388
|
+
style: {
|
|
1389
|
+
display: "inline-block",
|
|
1390
|
+
width: "0.85em",
|
|
1391
|
+
height: "0.85em",
|
|
1392
|
+
borderRadius: "50%",
|
|
1393
|
+
border: "0.12em solid currentColor",
|
|
1394
|
+
borderTopColor: "transparent",
|
|
1395
|
+
transform: "rotate(-45deg)",
|
|
1396
|
+
...style
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
);
|
|
1400
|
+
const ChevronMark = ({
|
|
1401
|
+
direction,
|
|
1402
|
+
style
|
|
1403
|
+
}) => /* @__PURE__ */ jsx(
|
|
1404
|
+
"span",
|
|
1405
|
+
{
|
|
1406
|
+
"aria-hidden": "true",
|
|
1407
|
+
style: {
|
|
1408
|
+
display: "inline-block",
|
|
1409
|
+
width: "0.45em",
|
|
1410
|
+
height: "0.45em",
|
|
1411
|
+
margin: direction === "down" ? "0 0 0.2em" : "0.2em 0 0",
|
|
1412
|
+
borderRight: "0.12em solid currentColor",
|
|
1413
|
+
borderBottom: "0.12em solid currentColor",
|
|
1414
|
+
transform: direction === "down" ? "rotate(45deg)" : "rotate(-135deg)",
|
|
1415
|
+
...style
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
);
|
|
1367
1419
|
export {
|
|
1368
1420
|
initializeDefaults as A,
|
|
1369
1421
|
isFeatureLicensed as B,
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1422
|
+
CheckMark as C,
|
|
1423
|
+
maskLicenseKey as D,
|
|
1424
|
+
normalizeLicenseKey as E,
|
|
1425
|
+
registerFeature as F,
|
|
1426
|
+
registerFeatures as G,
|
|
1427
|
+
registerPlan as H,
|
|
1428
|
+
registerPlans as I,
|
|
1429
|
+
storeFingerprint as J,
|
|
1430
|
+
validateLicense as K,
|
|
1378
1431
|
LicenseValidator as L,
|
|
1432
|
+
ChevronMark as M,
|
|
1433
|
+
RefreshMark as R,
|
|
1379
1434
|
generateFingerprint as a,
|
|
1380
1435
|
collectFingerprintData as b,
|
|
1381
1436
|
checkFeatureAccess as c,
|
package/dist/react.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const
|
|
5
|
+
const marks = require("./marks-KVqpGsfU.cjs");
|
|
6
6
|
const LicenseContext = React.createContext(null);
|
|
7
7
|
function LicenseProvider({
|
|
8
8
|
serverUrl = "https://license.nice2dev.com/api/v1",
|
|
@@ -24,7 +24,7 @@ function LicenseProvider({
|
|
|
24
24
|
features: /* @__PURE__ */ new Set(),
|
|
25
25
|
fingerprint: null
|
|
26
26
|
});
|
|
27
|
-
const [validator] = React.useState(() => new
|
|
27
|
+
const [validator] = React.useState(() => new marks.LicenseValidator({ serverUrl, apiKey }));
|
|
28
28
|
const loadStoredKey = React.useCallback(() => {
|
|
29
29
|
if (typeof localStorage === "undefined") {
|
|
30
30
|
return null;
|
|
@@ -93,7 +93,7 @@ function LicenseProvider({
|
|
|
93
93
|
);
|
|
94
94
|
const activate = React.useCallback(
|
|
95
95
|
async (key) => {
|
|
96
|
-
const normalized =
|
|
96
|
+
const normalized = marks.normalizeLicenseKey(key);
|
|
97
97
|
if (!normalized) {
|
|
98
98
|
const result2 = {
|
|
99
99
|
valid: false,
|
|
@@ -137,7 +137,7 @@ function LicenseProvider({
|
|
|
137
137
|
}, [(_a = state.license) == null ? void 0 : _a.key, loadStoredKey, validateLicense]);
|
|
138
138
|
const checkFeature = React.useCallback(
|
|
139
139
|
(featureId) => {
|
|
140
|
-
return
|
|
140
|
+
return marks.hasFeature(state.license, featureId);
|
|
141
141
|
},
|
|
142
142
|
[state.license]
|
|
143
143
|
);
|
|
@@ -180,7 +180,7 @@ function useLicense() {
|
|
|
180
180
|
}
|
|
181
181
|
function useFeature(featureId) {
|
|
182
182
|
const { license, loading, error } = useLicense();
|
|
183
|
-
const allowed =
|
|
183
|
+
const allowed = marks.hasFeature(license, featureId);
|
|
184
184
|
return { allowed, loading, error };
|
|
185
185
|
}
|
|
186
186
|
function FeatureGate({
|
|
@@ -194,7 +194,7 @@ function FeatureGate({
|
|
|
194
194
|
if (loading) {
|
|
195
195
|
return null;
|
|
196
196
|
}
|
|
197
|
-
const result =
|
|
197
|
+
const result = marks.checkFeatureAccess(license, feature);
|
|
198
198
|
if (result.allowed) {
|
|
199
199
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
200
200
|
}
|
|
@@ -218,15 +218,12 @@ function LicenseStatus({ detailed = false, style, className }) {
|
|
|
218
218
|
...style
|
|
219
219
|
};
|
|
220
220
|
if (loading) {
|
|
221
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
221
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
222
222
|
"div",
|
|
223
223
|
{
|
|
224
224
|
style: { ...baseStyle, backgroundColor: "#f0f0f0", color: "#666" },
|
|
225
225
|
className,
|
|
226
|
-
children:
|
|
227
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "⏳" }),
|
|
228
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Checking license..." })
|
|
229
|
-
]
|
|
226
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Checking license..." })
|
|
230
227
|
}
|
|
231
228
|
);
|
|
232
229
|
}
|
|
@@ -237,7 +234,7 @@ function LicenseStatus({ detailed = false, style, className }) {
|
|
|
237
234
|
style: { ...baseStyle, backgroundColor: "#fee2e2", color: "#991b1b" },
|
|
238
235
|
className,
|
|
239
236
|
children: [
|
|
240
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "
|
|
237
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 700 }, "aria-hidden": "true", children: "!" }),
|
|
241
238
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: error || "No license" })
|
|
242
239
|
]
|
|
243
240
|
}
|
|
@@ -262,14 +259,14 @@ function LicenseStatus({ detailed = false, style, className }) {
|
|
|
262
259
|
const bgColor = tierColors[license.tier] || "#f0f0f0";
|
|
263
260
|
const textColor = tierTextColors[license.tier] || "#333";
|
|
264
261
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...baseStyle, backgroundColor: bgColor, color: textColor }, className, children: [
|
|
265
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
262
|
+
/* @__PURE__ */ jsxRuntime.jsx(marks.CheckMark, {}),
|
|
266
263
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 600 }, children: license.tier.charAt(0).toUpperCase() + license.tier.slice(1) }),
|
|
267
264
|
(validation == null ? void 0 : validation.inGracePeriod) && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#dc2626", fontSize: "12px" }, children: "(Grace period)" }),
|
|
268
265
|
detailed && (validation == null ? void 0 : validation.daysRemaining) !== void 0 && validation.daysRemaining > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "12px", opacity: 0.8 }, children: [
|
|
269
266
|
validation.daysRemaining,
|
|
270
267
|
" days remaining"
|
|
271
268
|
] }),
|
|
272
|
-
detailed && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "12px", opacity: 0.6 }, children:
|
|
269
|
+
detailed && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "12px", opacity: 0.6 }, children: marks.maskLicenseKey(license.key) })
|
|
273
270
|
] });
|
|
274
271
|
}
|
|
275
272
|
function LicenseActivator({
|
|
@@ -356,7 +353,7 @@ function UpgradePrompt({
|
|
|
356
353
|
compact = false
|
|
357
354
|
}) {
|
|
358
355
|
const { license } = useLicense();
|
|
359
|
-
const missingFeatures =
|
|
356
|
+
const missingFeatures = marks.getMissingFeatures(license, targetTier);
|
|
360
357
|
const handleUpgrade = () => {
|
|
361
358
|
onUpgrade == null ? void 0 : onUpgrade(targetTier);
|
|
362
359
|
if (!onUpgrade) {
|
|
@@ -389,7 +386,7 @@ function UpgradePrompt({
|
|
|
389
386
|
};
|
|
390
387
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: containerStyle, children: [
|
|
391
388
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: titleStyle, children: [
|
|
392
|
-
"
|
|
389
|
+
"Upgrade to ",
|
|
393
390
|
targetTier.charAt(0).toUpperCase() + targetTier.slice(1)
|
|
394
391
|
] }),
|
|
395
392
|
!compact && missingFeatures.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("ul", { style: { margin: "8px 0", paddingLeft: "20px", color: "#374151", fontSize: "14px" }, children: [
|
|
@@ -411,7 +408,7 @@ function LicenseComparison({
|
|
|
411
408
|
}) {
|
|
412
409
|
const { license } = useLicense();
|
|
413
410
|
const tier = currentTier || (license == null ? void 0 : license.tier);
|
|
414
|
-
const plans = customPlans ||
|
|
411
|
+
const plans = customPlans || marks.getAllPlans().filter((p) => p.priceMonthly > 0 || p.id === "trial");
|
|
415
412
|
const formatPrice = (cents) => {
|
|
416
413
|
if (cents === 0) {
|
|
417
414
|
return "Free";
|
|
@@ -459,7 +456,8 @@ function LicenseComparison({
|
|
|
459
456
|
plan.priceMonthly > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "14px", color: "#6b7280" }, children: "/month" })
|
|
460
457
|
] }),
|
|
461
458
|
/* @__PURE__ */ jsxRuntime.jsx("ul", { style: { listStyle: "none", padding: 0, margin: "0 0 16px" }, children: plan.highlights.map((h, i) => /* @__PURE__ */ jsxRuntime.jsxs("li", { style: { padding: "6px 0", fontSize: "14px", color: "#374151" }, children: [
|
|
462
|
-
|
|
459
|
+
/* @__PURE__ */ jsxRuntime.jsx(marks.CheckMark, {}),
|
|
460
|
+
" ",
|
|
463
461
|
h
|
|
464
462
|
] }, i)) }),
|
|
465
463
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -715,7 +713,8 @@ function LicensePortal({
|
|
|
715
713
|
fontSize: "14px"
|
|
716
714
|
},
|
|
717
715
|
children: [
|
|
718
|
-
|
|
716
|
+
/* @__PURE__ */ jsxRuntime.jsx(marks.CheckMark, {}),
|
|
717
|
+
" ",
|
|
719
718
|
f
|
|
720
719
|
]
|
|
721
720
|
},
|
|
@@ -849,7 +848,7 @@ function NiceLicenseManager({
|
|
|
849
848
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 500, fontSize: "14px", color: "#111" }, children: lic.licensee }),
|
|
850
849
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "12px", color: "#6b7280" }, children: lic.email })
|
|
851
850
|
] }),
|
|
852
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "12px", fontFamily: "monospace", color: "#6b7280" }, children:
|
|
851
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "12px", fontFamily: "monospace", color: "#6b7280" }, children: marks.maskLicenseKey(lic.key) }),
|
|
853
852
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
854
853
|
"div",
|
|
855
854
|
{
|
|
@@ -874,7 +873,7 @@ function NiceLicenseManager({
|
|
|
874
873
|
children: lic.tier
|
|
875
874
|
}
|
|
876
875
|
),
|
|
877
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "14px", color: "#6b7280", textAlign: "right" }, children: isExpanded ? "
|
|
876
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "14px", color: "#6b7280", textAlign: "right" }, children: /* @__PURE__ */ jsxRuntime.jsx(marks.ChevronMark, { direction: isExpanded ? "up" : "down" }) })
|
|
878
877
|
]
|
|
879
878
|
}
|
|
880
879
|
),
|
package/dist/react.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useState, useCallback, useEffect, useContext } from "react";
|
|
3
|
-
import { c as checkFeatureAccess, k as getAllPlans, L as LicenseValidator,
|
|
3
|
+
import { c as checkFeatureAccess, k as getAllPlans, C as CheckMark, L as LicenseValidator, E as normalizeLicenseKey, y as hasFeature, D as maskLicenseKey, M as ChevronMark, r as getMissingFeatures } from "./marks-KzIFNheE.js";
|
|
4
4
|
const LicenseContext = createContext(null);
|
|
5
5
|
function LicenseProvider({
|
|
6
6
|
serverUrl = "https://license.nice2dev.com/api/v1",
|
|
@@ -216,15 +216,12 @@ function LicenseStatus({ detailed = false, style, className }) {
|
|
|
216
216
|
...style
|
|
217
217
|
};
|
|
218
218
|
if (loading) {
|
|
219
|
-
return /* @__PURE__ */
|
|
219
|
+
return /* @__PURE__ */ jsx(
|
|
220
220
|
"div",
|
|
221
221
|
{
|
|
222
222
|
style: { ...baseStyle, backgroundColor: "#f0f0f0", color: "#666" },
|
|
223
223
|
className,
|
|
224
|
-
children:
|
|
225
|
-
/* @__PURE__ */ jsx("span", { children: "⏳" }),
|
|
226
|
-
/* @__PURE__ */ jsx("span", { children: "Checking license..." })
|
|
227
|
-
]
|
|
224
|
+
children: /* @__PURE__ */ jsx("span", { children: "Checking license..." })
|
|
228
225
|
}
|
|
229
226
|
);
|
|
230
227
|
}
|
|
@@ -235,7 +232,7 @@ function LicenseStatus({ detailed = false, style, className }) {
|
|
|
235
232
|
style: { ...baseStyle, backgroundColor: "#fee2e2", color: "#991b1b" },
|
|
236
233
|
className,
|
|
237
234
|
children: [
|
|
238
|
-
/* @__PURE__ */ jsx("span", { children: "
|
|
235
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: 700 }, "aria-hidden": "true", children: "!" }),
|
|
239
236
|
/* @__PURE__ */ jsx("span", { children: error || "No license" })
|
|
240
237
|
]
|
|
241
238
|
}
|
|
@@ -260,7 +257,7 @@ function LicenseStatus({ detailed = false, style, className }) {
|
|
|
260
257
|
const bgColor = tierColors[license.tier] || "#f0f0f0";
|
|
261
258
|
const textColor = tierTextColors[license.tier] || "#333";
|
|
262
259
|
return /* @__PURE__ */ jsxs("div", { style: { ...baseStyle, backgroundColor: bgColor, color: textColor }, className, children: [
|
|
263
|
-
/* @__PURE__ */ jsx(
|
|
260
|
+
/* @__PURE__ */ jsx(CheckMark, {}),
|
|
264
261
|
/* @__PURE__ */ jsx("span", { style: { fontWeight: 600 }, children: license.tier.charAt(0).toUpperCase() + license.tier.slice(1) }),
|
|
265
262
|
(validation == null ? void 0 : validation.inGracePeriod) && /* @__PURE__ */ jsx("span", { style: { color: "#dc2626", fontSize: "12px" }, children: "(Grace period)" }),
|
|
266
263
|
detailed && (validation == null ? void 0 : validation.daysRemaining) !== void 0 && validation.daysRemaining > 0 && /* @__PURE__ */ jsxs("span", { style: { fontSize: "12px", opacity: 0.8 }, children: [
|
|
@@ -387,7 +384,7 @@ function UpgradePrompt({
|
|
|
387
384
|
};
|
|
388
385
|
return /* @__PURE__ */ jsxs("div", { style: containerStyle, children: [
|
|
389
386
|
/* @__PURE__ */ jsxs("div", { style: titleStyle, children: [
|
|
390
|
-
"
|
|
387
|
+
"Upgrade to ",
|
|
391
388
|
targetTier.charAt(0).toUpperCase() + targetTier.slice(1)
|
|
392
389
|
] }),
|
|
393
390
|
!compact && missingFeatures.length > 0 && /* @__PURE__ */ jsxs("ul", { style: { margin: "8px 0", paddingLeft: "20px", color: "#374151", fontSize: "14px" }, children: [
|
|
@@ -457,7 +454,8 @@ function LicenseComparison({
|
|
|
457
454
|
plan.priceMonthly > 0 && /* @__PURE__ */ jsx("span", { style: { fontSize: "14px", color: "#6b7280" }, children: "/month" })
|
|
458
455
|
] }),
|
|
459
456
|
/* @__PURE__ */ jsx("ul", { style: { listStyle: "none", padding: 0, margin: "0 0 16px" }, children: plan.highlights.map((h, i) => /* @__PURE__ */ jsxs("li", { style: { padding: "6px 0", fontSize: "14px", color: "#374151" }, children: [
|
|
460
|
-
|
|
457
|
+
/* @__PURE__ */ jsx(CheckMark, {}),
|
|
458
|
+
" ",
|
|
461
459
|
h
|
|
462
460
|
] }, i)) }),
|
|
463
461
|
/* @__PURE__ */ jsx(
|
|
@@ -713,7 +711,8 @@ function LicensePortal({
|
|
|
713
711
|
fontSize: "14px"
|
|
714
712
|
},
|
|
715
713
|
children: [
|
|
716
|
-
|
|
714
|
+
/* @__PURE__ */ jsx(CheckMark, {}),
|
|
715
|
+
" ",
|
|
717
716
|
f
|
|
718
717
|
]
|
|
719
718
|
},
|
|
@@ -872,7 +871,7 @@ function NiceLicenseManager({
|
|
|
872
871
|
children: lic.tier
|
|
873
872
|
}
|
|
874
873
|
),
|
|
875
|
-
/* @__PURE__ */ jsx("div", { style: { fontSize: "14px", color: "#6b7280", textAlign: "right" }, children: isExpanded ? "
|
|
874
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "14px", color: "#6b7280", textAlign: "right" }, children: /* @__PURE__ */ jsx(ChevronMark, { direction: isExpanded ? "up" : "down" }) })
|
|
876
875
|
]
|
|
877
876
|
}
|
|
878
877
|
),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/licensing",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Nice2Dev Enterprise Licensing System
|
|
3
|
+
"version": "1.1.10",
|
|
4
|
+
"description": "Nice2Dev Enterprise Licensing System — license key generation, validation, hardware fingerprinting, seat management and feature gating",
|
|
5
5
|
"author": "NiceToDev <contact@nicetodev.com>",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
7
7
|
"homepage": "https://github.com/NiceToDev/NiceToDev.UI#readme",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"sideEffects": false,
|
|
39
39
|
"scripts": {
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
40
41
|
"build": "vite build",
|
|
41
42
|
"build:types": "tsc -p tsconfig.build.json",
|
|
42
43
|
"dev": "vite",
|
|
@@ -60,9 +61,6 @@
|
|
|
60
61
|
"react-dom": ">=17.0.0"
|
|
61
62
|
},
|
|
62
63
|
"peerDependenciesMeta": {
|
|
63
|
-
"react": {
|
|
64
|
-
"optional": true
|
|
65
|
-
},
|
|
66
64
|
"react-dom": {
|
|
67
65
|
"optional": true
|
|
68
66
|
}
|