@nice2dev/licensing 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.mjs CHANGED
@@ -1,6 +1,16 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
+ import { useNiceTranslation, clickOnActivationKey } from "@nice2dev/ui-core";
2
3
  import { useState, useCallback, useEffect, useContext, createContext } from "react";
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-CTwbg2ls.js";
4
+ import { c as checkFeatureAccess, k as getAllPlans, M as isBuiltInEntry, C as CheckMark, L as LicenseValidator, E as normalizeLicenseKey, y as hasFeature, D as maskLicenseKey, N as ChevronMark, r as getMissingFeatures } from "./marks-C_PSZQ9M.js";
5
+ const TIER_NAMES = {
6
+ trial: "Trial",
7
+ personal: "Personal",
8
+ team: "Team",
9
+ enterprise: "Enterprise",
10
+ site: "Site License",
11
+ oem: "OEM"
12
+ };
13
+ const TIER_ORDER = ["trial", "personal", "team", "enterprise", "site", "oem"];
4
14
  const LicenseContext = /* @__PURE__ */ createContext(null);
5
15
  function LicenseProvider({
6
16
  serverUrl = "https://license.nice2dev.com/api/v1",
@@ -14,6 +24,7 @@ function LicenseProvider({
14
24
  children
15
25
  }) {
16
26
  var _a;
27
+ const { t } = useNiceTranslation();
17
28
  const [state, setState] = useState({
18
29
  license: null,
19
30
  validation: null,
@@ -67,7 +78,7 @@ function LicenseProvider({
67
78
  }
68
79
  return result;
69
80
  } catch (error) {
70
- const errorMessage = error instanceof Error ? error.message : "Unknown error";
81
+ const errorMessage = error instanceof Error ? error.message : t("licensing.unknownError", "Unknown error");
71
82
  setState((s) => ({
72
83
  ...s,
73
84
  loading: false,
@@ -87,7 +98,7 @@ function LicenseProvider({
87
98
  };
88
99
  }
89
100
  },
90
- [validator, onLicenseChange]
101
+ [validator, onLicenseChange, t]
91
102
  );
92
103
  const activate = useCallback(
93
104
  async (key) => {
@@ -205,6 +216,7 @@ function FeatureGate({
205
216
  return /* @__PURE__ */ jsx(Fragment, { children: fallback });
206
217
  }
207
218
  function LicenseStatus({ detailed = false, style, className }) {
219
+ const { t } = useNiceTranslation();
208
220
  const { license, validation, loading, error } = useLicense();
209
221
  const baseStyle = {
210
222
  padding: "8px 12px",
@@ -221,7 +233,7 @@ function LicenseStatus({ detailed = false, style, className }) {
221
233
  {
222
234
  style: { ...baseStyle, backgroundColor: "#f0f0f0", color: "#666" },
223
235
  className,
224
- children: /* @__PURE__ */ jsx("span", { children: "Checking license..." })
236
+ children: /* @__PURE__ */ jsx("span", { children: t("licensing.checkingLicense", "Checking license...") })
225
237
  }
226
238
  );
227
239
  }
@@ -233,7 +245,7 @@ function LicenseStatus({ detailed = false, style, className }) {
233
245
  className,
234
246
  children: [
235
247
  /* @__PURE__ */ jsx("span", { style: { fontWeight: 700 }, "aria-hidden": "true", children: "!" }),
236
- /* @__PURE__ */ jsx("span", { children: error || "No license" })
248
+ /* @__PURE__ */ jsx("span", { children: error || t("licensing.noLicense", "No license") })
237
249
  ]
238
250
  }
239
251
  );
@@ -259,11 +271,11 @@ function LicenseStatus({ detailed = false, style, className }) {
259
271
  return /* @__PURE__ */ jsxs("div", { style: { ...baseStyle, backgroundColor: bgColor, color: textColor }, className, children: [
260
272
  /* @__PURE__ */ jsx(CheckMark, {}),
261
273
  /* @__PURE__ */ jsx("span", { style: { fontWeight: 600 }, children: license.tier.charAt(0).toUpperCase() + license.tier.slice(1) }),
262
- (validation == null ? void 0 : validation.inGracePeriod) && /* @__PURE__ */ jsx("span", { style: { color: "#dc2626", fontSize: "12px" }, children: "(Grace period)" }),
263
- detailed && (validation == null ? void 0 : validation.daysRemaining) !== void 0 && validation.daysRemaining > 0 && /* @__PURE__ */ jsxs("span", { style: { fontSize: "12px", opacity: 0.8 }, children: [
264
- validation.daysRemaining,
265
- " days remaining"
266
- ] }),
274
+ (validation == null ? void 0 : validation.inGracePeriod) && /* @__PURE__ */ jsx("span", { style: { color: "#dc2626", fontSize: "12px" }, children: t("licensing.gracePeriod", "(Grace period)") }),
275
+ detailed && (validation == null ? void 0 : validation.daysRemaining) !== void 0 && validation.daysRemaining > 0 && /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", opacity: 0.8 }, children: t("licensing.daysRemaining", "{daysRemaining} days remaining").replace(
276
+ "{daysRemaining}",
277
+ String(validation.daysRemaining)
278
+ ) }),
267
279
  detailed && /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", opacity: 0.6 }, children: maskLicenseKey(license.key) })
268
280
  ] });
269
281
  }
@@ -273,6 +285,7 @@ function LicenseActivator({
273
285
  style,
274
286
  className
275
287
  }) {
288
+ const { t } = useNiceTranslation();
276
289
  const { activate, loading } = useLicense();
277
290
  const [key, setKey] = useState("");
278
291
  const [localError, setLocalError] = useState(null);
@@ -290,7 +303,7 @@ function LicenseActivator({
290
303
  setKey("");
291
304
  onActivated == null ? void 0 : onActivated(result.license);
292
305
  } else {
293
- setLocalError(result.errorMessage || "Activation failed");
306
+ setLocalError(result.errorMessage || t("licensing.activationFailed", "Activation failed"));
294
307
  onError == null ? void 0 : onError(result.errorMessage || "Activation failed");
295
308
  }
296
309
  } finally {
@@ -327,7 +340,7 @@ function LicenseActivator({
327
340
  cursor: isActivating || loading ? "not-allowed" : "pointer"
328
341
  };
329
342
  return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, style: containerStyle, className, children: [
330
- /* @__PURE__ */ jsx("label", { style: { fontWeight: 500, color: "#374151" }, children: "Enter License Key" }),
343
+ /* @__PURE__ */ jsx("label", { style: { fontWeight: 500, color: "#374151" }, children: t("licensing.enterLicenseKey", "Enter License Key") }),
331
344
  /* @__PURE__ */ jsx(
332
345
  "input",
333
346
  {
@@ -340,7 +353,7 @@ function LicenseActivator({
340
353
  }
341
354
  ),
342
355
  localError && /* @__PURE__ */ jsx("div", { style: { color: "#dc2626", fontSize: "13px" }, children: localError }),
343
- /* @__PURE__ */ jsx("button", { type: "submit", style: buttonStyle, disabled: isActivating || loading || !key.trim(), children: isActivating ? "Activating..." : "Activate License" })
356
+ /* @__PURE__ */ jsx("button", { type: "submit", style: buttonStyle, disabled: isActivating || loading || !key.trim(), children: isActivating ? t("licensing.activating", "Activating...") : t("licensing.activateLicense", "Activate License") })
344
357
  ] });
345
358
  }
346
359
  function UpgradePrompt({
@@ -350,6 +363,7 @@ function UpgradePrompt({
350
363
  style,
351
364
  compact = false
352
365
  }) {
366
+ const { t } = useNiceTranslation();
353
367
  const { license } = useLicense();
354
368
  const missingFeatures = getMissingFeatures(license, targetTier);
355
369
  const handleUpgrade = () => {
@@ -383,19 +397,18 @@ function UpgradePrompt({
383
397
  marginTop: "12px"
384
398
  };
385
399
  return /* @__PURE__ */ jsxs("div", { style: containerStyle, children: [
386
- /* @__PURE__ */ jsxs("div", { style: titleStyle, children: [
387
- "Upgrade to ",
388
- targetTier.charAt(0).toUpperCase() + targetTier.slice(1)
389
- ] }),
400
+ /* @__PURE__ */ jsx("div", { style: titleStyle, children: t("licensing.upgradeTo", "Upgrade to {targetTier}").replace(
401
+ "{targetTier}",
402
+ t(`licensing.tier.${targetTier}`, TIER_NAMES[targetTier] ?? targetTier)
403
+ ) }),
390
404
  !compact && missingFeatures.length > 0 && /* @__PURE__ */ jsxs("ul", { style: { margin: "8px 0", paddingLeft: "20px", color: "#374151", fontSize: "14px" }, children: [
391
- missingFeatures.slice(0, 3).map((f) => /* @__PURE__ */ jsx("li", { children: f.name }, f.id)),
392
- missingFeatures.length > 3 && /* @__PURE__ */ jsxs("li", { children: [
393
- "+",
394
- missingFeatures.length - 3,
395
- " more features"
396
- ] })
405
+ missingFeatures.slice(0, 3).map((f) => /* @__PURE__ */ jsx("li", { children: isBuiltInEntry(f) ? t(`licensing.feature.${f.id}`, f.name) : f.name }, f.id)),
406
+ missingFeatures.length > 3 && /* @__PURE__ */ jsx("li", { children: t("licensing.moreFeatures", "+{missingFeatures} more features").replace(
407
+ "{missingFeatures}",
408
+ String(missingFeatures.length - 3)
409
+ ) })
397
410
  ] }),
398
- /* @__PURE__ */ jsx("button", { onClick: handleUpgrade, style: buttonStyle, children: "Upgrade Now" })
411
+ /* @__PURE__ */ jsx("button", { onClick: handleUpgrade, style: buttonStyle, children: t("licensing.upgradeNow", "Upgrade Now") })
399
412
  ] });
400
413
  }
401
414
  function LicenseComparison({
@@ -404,18 +417,21 @@ function LicenseComparison({
404
417
  onSelect,
405
418
  showPrices = true
406
419
  }) {
420
+ const { t } = useNiceTranslation();
407
421
  const { license } = useLicense();
408
422
  const tier = currentTier || (license == null ? void 0 : license.tier);
409
423
  const plans = customPlans || getAllPlans().filter((p) => p.priceMonthly > 0 || p.id === "trial");
410
424
  const formatPrice = (cents) => {
411
425
  if (cents === 0) {
412
- return "Free";
426
+ return t("licensing.free", "Free");
413
427
  }
414
428
  return `$${(cents / 100).toFixed(0)}`;
415
429
  };
416
430
  return /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "16px", flexWrap: "wrap", justifyContent: "center" }, children: plans.map((plan) => {
417
431
  const isCurrent = plan.id === tier;
418
432
  const isRecommended = plan.recommended;
433
+ const builtIn = isBuiltInEntry(plan);
434
+ const planText = (field, text) => builtIn ? t(`licensing.plan.${plan.id}.${field}`, text) : text;
419
435
  return /* @__PURE__ */ jsxs(
420
436
  "div",
421
437
  {
@@ -444,19 +460,19 @@ function LicenseComparison({
444
460
  fontSize: "12px",
445
461
  fontWeight: 600
446
462
  },
447
- children: "Recommended"
463
+ children: t("licensing.recommended", "Recommended")
448
464
  }
449
465
  ),
450
- /* @__PURE__ */ jsx("h3", { style: { margin: "0 0 4px", fontSize: "20px", color: "#111" }, children: plan.name }),
451
- /* @__PURE__ */ jsx("p", { style: { margin: "0 0 16px", fontSize: "14px", color: "#6b7280" }, children: plan.description }),
466
+ /* @__PURE__ */ jsx("h3", { style: { margin: "0 0 4px", fontSize: "20px", color: "#111" }, children: planText("name", plan.name) }),
467
+ /* @__PURE__ */ jsx("p", { style: { margin: "0 0 16px", fontSize: "14px", color: "#6b7280" }, children: planText("description", plan.description) }),
452
468
  showPrices && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "16px" }, children: [
453
469
  /* @__PURE__ */ jsx("span", { style: { fontSize: "32px", fontWeight: 700, color: "#111" }, children: formatPrice(plan.priceMonthly) }),
454
- plan.priceMonthly > 0 && /* @__PURE__ */ jsx("span", { style: { fontSize: "14px", color: "#6b7280" }, children: "/month" })
470
+ plan.priceMonthly > 0 && /* @__PURE__ */ jsx("span", { style: { fontSize: "14px", color: "#6b7280" }, children: t("licensing.perMonth", "/month") })
455
471
  ] }),
456
472
  /* @__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: [
457
473
  /* @__PURE__ */ jsx(CheckMark, {}),
458
474
  " ",
459
- h
475
+ planText(`highlight${i}`, h)
460
476
  ] }, i)) }),
461
477
  /* @__PURE__ */ jsx(
462
478
  "button",
@@ -474,7 +490,7 @@ function LicenseComparison({
474
490
  borderRadius: "6px",
475
491
  cursor: isCurrent ? "default" : "pointer"
476
492
  },
477
- children: isCurrent ? "Current Plan" : "Select"
493
+ children: isCurrent ? t("licensing.currentPlan", "Current Plan") : t("licensing.select", "Select")
478
494
  }
479
495
  )
480
496
  ]
@@ -524,6 +540,7 @@ function LicensePortal({
524
540
  style,
525
541
  className
526
542
  }) {
543
+ const { t } = useNiceTranslation();
527
544
  const {
528
545
  license,
529
546
  validation: _validation,
@@ -548,11 +565,11 @@ function LicensePortal({
548
565
  onDeactivate == null ? void 0 : onDeactivate();
549
566
  };
550
567
  const tabLabels = {
551
- overview: "Overview",
552
- activation: "Activation",
553
- seats: "Seats",
554
- features: "Features",
555
- plans: "Plans"
568
+ overview: t("licensing.overview", "Overview"),
569
+ activation: t("licensing.activation", "Activation"),
570
+ seats: t("licensing.seats", "Seats"),
571
+ features: t("licensing.features", "Features"),
572
+ plans: t("licensing.plans", "Plans")
556
573
  };
557
574
  const containerStyle = {
558
575
  border: "1px solid #e5e7eb",
@@ -580,21 +597,21 @@ function LicensePortal({
580
597
  return /* @__PURE__ */ jsxs("div", { style: containerStyle, className, children: [
581
598
  /* @__PURE__ */ jsx("div", { style: tabBarStyle, children: tabs.map((tab) => /* @__PURE__ */ jsx("button", { style: getTabStyle(tab), onClick: () => setActiveTab(tab), children: tabLabels[tab] }, tab)) }),
582
599
  /* @__PURE__ */ jsxs("div", { style: panelStyle, children: [
583
- loading && /* @__PURE__ */ jsx("p", { style: { color: "#6b7280" }, children: "Loading license information..." }),
600
+ loading && /* @__PURE__ */ jsx("p", { style: { color: "#6b7280" }, children: t("licensing.loadingLicenseInformation", "Loading license information...") }),
584
601
  !loading && activeTab === "overview" && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
585
602
  /* @__PURE__ */ jsx(LicenseStatus, { detailed: true }),
586
603
  license && /* @__PURE__ */ jsxs(Fragment, { children: [
587
604
  /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "12px" }, children: [
588
605
  /* @__PURE__ */ jsxs("div", { children: [
589
- /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "#6b7280" }, children: "Licensee" }),
606
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "#6b7280" }, children: t("licensing.licensee", "Licensee") }),
590
607
  /* @__PURE__ */ jsx("p", { style: { margin: "2px 0 0", fontWeight: 500 }, children: license.licensee })
591
608
  ] }),
592
609
  /* @__PURE__ */ jsxs("div", { children: [
593
- /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "#6b7280" }, children: "Email" }),
610
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "#6b7280" }, children: t("licensing.email", "Email") }),
594
611
  /* @__PURE__ */ jsx("p", { style: { margin: "2px 0 0", fontWeight: 500 }, children: license.email })
595
612
  ] }),
596
613
  /* @__PURE__ */ jsxs("div", { children: [
597
- /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "#6b7280" }, children: "Seats" }),
614
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "#6b7280" }, children: t("licensing.seats", "Seats") }),
598
615
  /* @__PURE__ */ jsxs("p", { style: { margin: "2px 0 0", fontWeight: 500 }, children: [
599
616
  license.activeSeats,
600
617
  " / ",
@@ -602,8 +619,8 @@ function LicensePortal({
602
619
  ] })
603
620
  ] }),
604
621
  /* @__PURE__ */ jsxs("div", { children: [
605
- /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "#6b7280" }, children: "Expires" }),
606
- /* @__PURE__ */ jsx("p", { style: { margin: "2px 0 0", fontWeight: 500 }, children: license.expiresAt ? new Date(license.expiresAt).toLocaleDateString() : "Perpetual" })
622
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "#6b7280" }, children: t("licensing.expires", "Expires") }),
623
+ /* @__PURE__ */ jsx("p", { style: { margin: "2px 0 0", fontWeight: 500 }, children: license.expiresAt ? new Date(license.expiresAt).toLocaleDateString() : t("licensing.perpetual", "Perpetual") })
607
624
  ] })
608
625
  ] }),
609
626
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "8px" }, children: [
@@ -620,7 +637,7 @@ function LicensePortal({
620
637
  backgroundColor: "#fff",
621
638
  cursor: refreshing ? "not-allowed" : "pointer"
622
639
  },
623
- children: refreshing ? "Refreshing..." : "Refresh"
640
+ children: refreshing ? t("licensing.refreshing", "Refreshing...") : t("licensing.refresh", "Refresh")
624
641
  }
625
642
  ),
626
643
  /* @__PURE__ */ jsx(
@@ -636,26 +653,33 @@ function LicensePortal({
636
653
  backgroundColor: "#fff",
637
654
  cursor: "pointer"
638
655
  },
639
- children: "Deactivate"
656
+ children: t("licensing.deactivate", "Deactivate")
640
657
  }
641
658
  )
642
659
  ] })
643
660
  ] }),
644
- !license && !error && /* @__PURE__ */ jsx("p", { style: { color: "#6b7280" }, children: "No active license. Go to the Activation tab to enter your license key." }),
661
+ !license && !error && /* @__PURE__ */ jsx("p", { style: { color: "#6b7280" }, children: t(
662
+ "licensing.noActiveLicenseGoTo",
663
+ "No active license. Go to the Activation tab to enter your license key."
664
+ ) }),
645
665
  error && /* @__PURE__ */ jsx("p", { style: { color: "#dc2626" }, children: error })
646
666
  ] }),
647
667
  !loading && activeTab === "activation" && /* @__PURE__ */ jsx(LicenseActivator, { onActivated: () => setActiveTab("overview") }),
648
668
  !loading && activeTab === "seats" && /* @__PURE__ */ jsx("div", { children: license ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
649
669
  /* @__PURE__ */ jsxs("div", { style: { fontSize: "14px", color: "#374151" }, children: [
650
670
  /* @__PURE__ */ jsx("strong", { children: license.activeSeats }),
651
- " of",
671
+ " ",
672
+ t("licensing.of", "of"),
652
673
  " ",
653
674
  /* @__PURE__ */ jsx("strong", { children: license.maxSeats ?? "∞" }),
654
- " seats in use",
675
+ " ",
676
+ t("licensing.seatsInUse", "seats in use"),
655
677
  license.floatingSeats != null && /* @__PURE__ */ jsxs("span", { children: [
656
- " (",
657
- license.floatingSeats,
658
- " floating)"
678
+ " ",
679
+ t("licensing.floating", "({floatingSeats} floating)").replace(
680
+ "{floatingSeats}",
681
+ String(license.floatingSeats)
682
+ )
659
683
  ] })
660
684
  ] }),
661
685
  /* @__PURE__ */ jsx(
@@ -681,13 +705,11 @@ function LicensePortal({
681
705
  )
682
706
  }
683
707
  ),
684
- /* @__PURE__ */ jsxs("div", { style: { fontSize: "12px", color: "#9ca3af" }, children: [
685
- "Machines bound: ",
686
- license.boundMachines.length,
687
- " / ",
688
- license.maxMachines
689
- ] })
690
- ] }) : /* @__PURE__ */ jsx("p", { style: { color: "#6b7280" }, children: "Activate a license to view seat information." }) }),
708
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "12px", color: "#9ca3af" }, children: t("licensing.machinesBound", "Machines bound: {boundMachines} / {maxMachines}").replace("{boundMachines}", String(license.boundMachines.length)).replace("{maxMachines}", String(license.maxMachines)) })
709
+ ] }) : /* @__PURE__ */ jsx("p", { style: { color: "#6b7280" }, children: t(
710
+ "licensing.activateALicenseToView",
711
+ "Activate a license to view seat information."
712
+ ) }) }),
691
713
  !loading && activeTab === "features" && /* @__PURE__ */ jsx("div", { children: license ? /* @__PURE__ */ jsxs(
692
714
  "ul",
693
715
  {
@@ -718,10 +740,13 @@ function LicensePortal({
718
740
  },
719
741
  f
720
742
  )),
721
- license.features.length === 0 && /* @__PURE__ */ jsx("li", { style: { color: "#6b7280", fontSize: "14px" }, children: "No explicit features — tier-based access applies." })
743
+ license.features.length === 0 && /* @__PURE__ */ jsx("li", { style: { color: "#6b7280", fontSize: "14px" }, children: t(
744
+ "licensing.noExplicitFeaturesTierBased",
745
+ "No explicit features — tier-based access applies."
746
+ ) })
722
747
  ]
723
748
  }
724
- ) : /* @__PURE__ */ jsx("p", { style: { color: "#6b7280" }, children: "Activate a license to view features." }) }),
749
+ ) : /* @__PURE__ */ jsx("p", { style: { color: "#6b7280" }, children: t("licensing.activateALicenseToView2", "Activate a license to view features.") }) }),
725
750
  !loading && activeTab === "plans" && /* @__PURE__ */ jsx(
726
751
  LicenseComparison,
727
752
  {
@@ -743,6 +768,7 @@ function NiceLicenseManager({
743
768
  style,
744
769
  className
745
770
  }) {
771
+ const { t } = useNiceTranslation();
746
772
  const [search, setSearch] = useState("");
747
773
  const [expandedKey, setExpandedKey] = useState(null);
748
774
  const handleSearch = (value) => {
@@ -778,7 +804,7 @@ function NiceLicenseManager({
778
804
  backgroundColor: "#f9fafb"
779
805
  },
780
806
  children: [
781
- /* @__PURE__ */ jsx("h3", { style: { margin: 0, fontSize: "16px", color: "#111" }, children: "License Manager" }),
807
+ /* @__PURE__ */ jsx("h3", { style: { margin: 0, fontSize: "16px", color: "#111" }, children: t("licensing.licenseManager", "License Manager") }),
782
808
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "8px" }, children: [
783
809
  /* @__PURE__ */ jsx(
784
810
  "input",
@@ -786,7 +812,7 @@ function NiceLicenseManager({
786
812
  type: "text",
787
813
  value: search,
788
814
  onChange: (e) => handleSearch(e.target.value),
789
- placeholder: "Search licenses...",
815
+ placeholder: t("licensing.searchLicenses", "Search licenses..."),
790
816
  style: {
791
817
  padding: "6px 12px",
792
818
  fontSize: "13px",
@@ -811,7 +837,7 @@ function NiceLicenseManager({
811
837
  borderRadius: "6px",
812
838
  cursor: "pointer"
813
839
  },
814
- children: "+ Generate"
840
+ children: t("licensing.generate", "+ Generate")
815
841
  }
816
842
  )
817
843
  ] })
@@ -819,7 +845,7 @@ function NiceLicenseManager({
819
845
  }
820
846
  ),
821
847
  /* @__PURE__ */ jsxs("div", { style: { maxHeight: "500px", overflow: "auto" }, children: [
822
- filtered.length === 0 && /* @__PURE__ */ jsx("p", { style: { padding: "20px", textAlign: "center", color: "#6b7280" }, children: search ? "No licenses match your search." : "No licenses found." }),
848
+ filtered.length === 0 && /* @__PURE__ */ jsx("p", { style: { padding: "20px", textAlign: "center", color: "#6b7280" }, children: search ? t("licensing.noLicensesMatchYourSearch", "No licenses match your search.") : t("licensing.noLicensesFound", "No licenses found.") }),
823
849
  filtered.map((lic) => {
824
850
  const isExpanded = expandedKey === lic.key;
825
851
  return /* @__PURE__ */ jsxs(
@@ -832,6 +858,10 @@ function NiceLicenseManager({
832
858
  /* @__PURE__ */ jsxs(
833
859
  "div",
834
860
  {
861
+ role: "button",
862
+ tabIndex: 0,
863
+ "aria-expanded": isExpanded,
864
+ onKeyDown: clickOnActivationKey,
835
865
  style: {
836
866
  display: "grid",
837
867
  gridTemplateColumns: "1fr 140px 100px 80px 60px",
@@ -887,15 +917,15 @@ function NiceLicenseManager({
887
917
  },
888
918
  children: [
889
919
  /* @__PURE__ */ jsxs("div", { children: [
890
- /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: "#9ca3af" }, children: "Issued" }),
920
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: "#9ca3af" }, children: t("licensing.issued", "Issued") }),
891
921
  /* @__PURE__ */ jsx("div", { style: { fontSize: "13px" }, children: new Date(lic.issuedAt).toLocaleDateString() })
892
922
  ] }),
893
923
  /* @__PURE__ */ jsxs("div", { children: [
894
- /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: "#9ca3af" }, children: "Expires" }),
895
- /* @__PURE__ */ jsx("div", { style: { fontSize: "13px" }, children: lic.expiresAt ? new Date(lic.expiresAt).toLocaleDateString() : "Perpetual" })
924
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: "#9ca3af" }, children: t("licensing.expires", "Expires") }),
925
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "13px" }, children: lic.expiresAt ? new Date(lic.expiresAt).toLocaleDateString() : t("licensing.perpetual", "Perpetual") })
896
926
  ] }),
897
927
  /* @__PURE__ */ jsxs("div", { children: [
898
- /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: "#9ca3af" }, children: "Seats" }),
928
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: "#9ca3af" }, children: t("licensing.seats", "Seats") }),
899
929
  /* @__PURE__ */ jsxs("div", { style: { fontSize: "13px" }, children: [
900
930
  lic.activeSeats,
901
931
  " / ",
@@ -903,11 +933,11 @@ function NiceLicenseManager({
903
933
  ] })
904
934
  ] }),
905
935
  /* @__PURE__ */ jsxs("div", { children: [
906
- /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: "#9ca3af" }, children: "Features" }),
907
- /* @__PURE__ */ jsxs("div", { style: { fontSize: "13px" }, children: [
908
- lic.features.length,
909
- " enabled"
910
- ] })
936
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "11px", color: "#9ca3af" }, children: t("licensing.features", "Features") }),
937
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "13px" }, children: t("licensing.enabled", "{features} enabled").replace(
938
+ "{features}",
939
+ String(lic.features.length)
940
+ ) })
911
941
  ] })
912
942
  ]
913
943
  }
@@ -928,7 +958,7 @@ function NiceLicenseManager({
928
958
  backgroundColor: "#fff",
929
959
  cursor: "pointer"
930
960
  },
931
- children: "Extend 1 Year"
961
+ children: t("licensing.extend1Year", "Extend 1 Year")
932
962
  }
933
963
  ),
934
964
  onAddSeats && lic.status !== "revoked" && /* @__PURE__ */ jsx(
@@ -946,10 +976,10 @@ function NiceLicenseManager({
946
976
  backgroundColor: "#fff",
947
977
  cursor: "pointer"
948
978
  },
949
- children: "+5 Seats"
979
+ children: t("licensing.n5Seats", "+5 Seats")
950
980
  }
951
981
  ),
952
- onChangeTier && lic.status !== "revoked" && /* @__PURE__ */ jsxs(
982
+ onChangeTier && lic.status !== "revoked" && /* @__PURE__ */ jsx(
953
983
  "select",
954
984
  {
955
985
  onClick: (e) => e.stopPropagation(),
@@ -962,14 +992,7 @@ function NiceLicenseManager({
962
992
  borderRadius: "4px",
963
993
  cursor: "pointer"
964
994
  },
965
- children: [
966
- /* @__PURE__ */ jsx("option", { value: "trial", children: "Trial" }),
967
- /* @__PURE__ */ jsx("option", { value: "personal", children: "Personal" }),
968
- /* @__PURE__ */ jsx("option", { value: "team", children: "Team" }),
969
- /* @__PURE__ */ jsx("option", { value: "enterprise", children: "Enterprise" }),
970
- /* @__PURE__ */ jsx("option", { value: "site", children: "Site" }),
971
- /* @__PURE__ */ jsx("option", { value: "oem", children: "OEM" })
972
- ]
995
+ children: TIER_ORDER.map((tier) => /* @__PURE__ */ jsx("option", { value: tier, children: t(`licensing.tier.${tier}`, TIER_NAMES[tier]) }, tier))
973
996
  }
974
997
  ),
975
998
  onRevoke && lic.status !== "revoked" && /* @__PURE__ */ jsx(
@@ -988,7 +1011,7 @@ function NiceLicenseManager({
988
1011
  backgroundColor: "#fff",
989
1012
  cursor: "pointer"
990
1013
  },
991
- children: "Revoke"
1014
+ children: t("licensing.revoke", "Revoke")
992
1015
  }
993
1016
  )
994
1017
  ] })
@@ -1010,13 +1033,13 @@ function NiceLicenseManager({
1010
1033
  color: "#6b7280"
1011
1034
  },
1012
1035
  children: [
1013
- filtered.length,
1014
- " license",
1015
- filtered.length !== 1 ? "s" : "",
1016
- search && ` matching "${search}"`,
1036
+ (filtered.length === 1 ? t("licensing.licenseCountOne", "{count} license") : t("licensing.licenseCountMany", "{count} licenses")).replace("{count}", String(filtered.length)),
1037
+ search && t("licensing.matching", ' matching "{search}"').replace("{search}", String(search)),
1017
1038
  " · ",
1018
- licenses.filter((l) => l.status === "valid").length,
1019
- " active"
1039
+ t("licensing.activeCount", "{count} active").replace(
1040
+ "{count}",
1041
+ String(licenses.filter((l) => l.status === "valid").length)
1042
+ )
1020
1043
  ]
1021
1044
  }
1022
1045
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice2dev/licensing",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
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",
@@ -58,6 +58,7 @@
58
58
  ],
59
59
  "peerDependencies": {
60
60
  "@nice2dev/icons": "^1.2.0",
61
+ "@nice2dev/ui-core": "^1.3.0",
61
62
  "react": ">=17.0.0",
62
63
  "react-dom": ">=17.0.0"
63
64
  },
@@ -67,12 +68,15 @@
67
68
  }
68
69
  },
69
70
  "devDependencies": {
70
- "@nice2dev/icons": "^1.2.1",
71
+ "@nice2dev/icons": "^1.3.0",
72
+ "@nice2dev/ui-core": "^1.3.0",
71
73
  "@stripe/stripe-js": "^9.15.0",
74
+ "@testing-library/react": "^16.3.3",
72
75
  "@types/node": "^22.10.0",
73
76
  "@types/react": "^19.2.18",
74
77
  "@types/react-dom": "^19.2.7",
75
78
  "@vitejs/plugin-react": "^4.7.0",
79
+ "jsdom": "^29.0.0",
76
80
  "react": "^19.2.8",
77
81
  "react-dom": "^19.2.8",
78
82
  "typescript": "^5.9.3",