@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/CHANGELOG.md +415 -0
- package/dist/index.cjs +362 -269
- package/dist/index.mjs +363 -270
- package/dist/marks-BxZztzfi.cjs +1466 -0
- package/dist/marks-C_PSZQ9M.js +1467 -0
- package/dist/react.cjs +113 -90
- package/dist/react.mjs +113 -90
- package/package.json +6 -2
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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-
|
|
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-
|
|
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-C_PSZQ9M.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-C_PSZQ9M.js";
|
|
3
3
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
4
|
+
import { useNiceTranslation, clickOnActivationKey } from "@nice2dev/ui-core";
|
|
4
5
|
import React, { useState, useCallback, useEffect, useMemo } from "react";
|
|
5
6
|
import { NtdArrowRight, NtdArrowUp, NtdArrowDown } from "@nice2dev/icons";
|
|
6
7
|
const HEARTBEAT_INTERVAL_MS = 5 * 60 * 1e3;
|
|
@@ -1263,9 +1264,10 @@ function useLicensePortal(config) {
|
|
|
1263
1264
|
invoices: [],
|
|
1264
1265
|
activeTab: "overview"
|
|
1265
1266
|
});
|
|
1267
|
+
const { apiBaseUrl, authToken, customerId } = config;
|
|
1266
1268
|
const service = React.useMemo(
|
|
1267
|
-
() => new LicensePortalService(
|
|
1268
|
-
[
|
|
1269
|
+
() => new LicensePortalService({ apiBaseUrl, authToken, customerId }),
|
|
1270
|
+
[apiBaseUrl, authToken, customerId]
|
|
1269
1271
|
);
|
|
1270
1272
|
const loadData = useCallback(async () => {
|
|
1271
1273
|
var _a;
|
|
@@ -1355,6 +1357,7 @@ function useLicensePortal(config) {
|
|
|
1355
1357
|
};
|
|
1356
1358
|
}
|
|
1357
1359
|
const LicenseStatusBadge = ({ status, size = "md" }) => {
|
|
1360
|
+
const { t } = useNiceTranslation();
|
|
1358
1361
|
const sizeClasses = {
|
|
1359
1362
|
sm: "px-2 py-0.5 text-xs",
|
|
1360
1363
|
md: "px-2.5 py-1 text-sm",
|
|
@@ -1376,12 +1379,13 @@ const LicenseStatusBadge = ({ status, size = "md" }) => {
|
|
|
1376
1379
|
style: { backgroundColor: getStatusColor(status) }
|
|
1377
1380
|
}
|
|
1378
1381
|
),
|
|
1379
|
-
status.charAt(0).toUpperCase() + status.slice(1)
|
|
1382
|
+
t(`licensePortal.status.${status}`, status.charAt(0).toUpperCase() + status.slice(1))
|
|
1380
1383
|
]
|
|
1381
1384
|
}
|
|
1382
1385
|
);
|
|
1383
1386
|
};
|
|
1384
1387
|
const LicenseTierBadge = ({ tier, size = "md" }) => {
|
|
1388
|
+
const { t } = useNiceTranslation();
|
|
1385
1389
|
const tierColors = {
|
|
1386
1390
|
trial: "#6b7280",
|
|
1387
1391
|
personal: "#3b82f6",
|
|
@@ -1404,16 +1408,20 @@ const LicenseTierBadge = ({ tier, size = "md" }) => {
|
|
|
1404
1408
|
color: tierColors[tier],
|
|
1405
1409
|
border: `1px solid ${tierColors[tier]}40`
|
|
1406
1410
|
},
|
|
1407
|
-
children: getTierLabel(tier)
|
|
1411
|
+
children: t(`licensing.tier.${tier}`, getTierLabel(tier))
|
|
1408
1412
|
}
|
|
1409
1413
|
);
|
|
1410
1414
|
};
|
|
1411
1415
|
const LicenseCard = ({ license, onSelect, onActivate, onDeactivate, selected }) => {
|
|
1416
|
+
const { t } = useNiceTranslation();
|
|
1412
1417
|
const daysRemaining = getDaysUntilExpiration(license.expiresAt);
|
|
1413
1418
|
const isExpiringSoon = daysRemaining !== null && daysRemaining <= 30 && daysRemaining > 0;
|
|
1414
1419
|
return /* @__PURE__ */ jsxs(
|
|
1415
1420
|
"div",
|
|
1416
1421
|
{
|
|
1422
|
+
role: onSelect ? "button" : void 0,
|
|
1423
|
+
tabIndex: onSelect ? 0 : void 0,
|
|
1424
|
+
onKeyDown: onSelect ? clickOnActivationKey : void 0,
|
|
1417
1425
|
className: `rounded-lg border p-4 transition-all cursor-pointer hover:shadow-md ${selected ? "border-blue-500 ring-2 ring-blue-200" : "border-gray-200"}`,
|
|
1418
1426
|
onClick: onSelect,
|
|
1419
1427
|
children: [
|
|
@@ -1426,7 +1434,7 @@ const LicenseCard = ({ license, onSelect, onActivate, onDeactivate, selected })
|
|
|
1426
1434
|
] })
|
|
1427
1435
|
] }),
|
|
1428
1436
|
/* @__PURE__ */ jsxs("div", { className: "text-right text-sm", children: [
|
|
1429
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Seats" }),
|
|
1437
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("licensePortal.seats", "Seats") }),
|
|
1430
1438
|
/* @__PURE__ */ jsxs("div", { className: "font-semibold", children: [
|
|
1431
1439
|
license.activeSeats,
|
|
1432
1440
|
"/",
|
|
@@ -1435,25 +1443,16 @@ const LicenseCard = ({ license, onSelect, onActivate, onDeactivate, selected })
|
|
|
1435
1443
|
] })
|
|
1436
1444
|
] }),
|
|
1437
1445
|
/* @__PURE__ */ jsxs("div", { className: "text-sm text-gray-600 mb-3", children: [
|
|
1438
|
-
/* @__PURE__ */
|
|
1439
|
-
"
|
|
1440
|
-
license.licensee
|
|
1441
|
-
|
|
1442
|
-
/* @__PURE__ */
|
|
1443
|
-
"Email: ",
|
|
1444
|
-
license.email
|
|
1445
|
-
] })
|
|
1446
|
+
/* @__PURE__ */ jsx("div", { children: t("licensePortal.licensee", "Licensee: {licensee}").replace(
|
|
1447
|
+
"{licensee}",
|
|
1448
|
+
String(license.licensee)
|
|
1449
|
+
) }),
|
|
1450
|
+
/* @__PURE__ */ jsx("div", { children: t("licensePortal.email", "Email: {email}").replace("{email}", String(license.email)) })
|
|
1446
1451
|
] }),
|
|
1447
|
-
license.expiresAt && /* @__PURE__ */ jsx("div", { className: `text-sm ${isExpiringSoon ? "text-orange-600" : "text-gray-500"}`, children: daysRemaining !== null && daysRemaining > 0 ? /* @__PURE__ */
|
|
1448
|
-
"
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
formatDate(license.expiresAt),
|
|
1452
|
-
")"
|
|
1453
|
-
] }) : daysRemaining === 0 ? /* @__PURE__ */ jsx("span", { className: "text-red-600", children: "Expires today" }) : /* @__PURE__ */ jsxs("span", { className: "text-red-600", children: [
|
|
1454
|
-
"Expired ",
|
|
1455
|
-
formatDate(license.expiresAt)
|
|
1456
|
-
] }) }),
|
|
1452
|
+
license.expiresAt && /* @__PURE__ */ jsx("div", { className: `text-sm ${isExpiringSoon ? "text-orange-600" : "text-gray-500"}`, children: daysRemaining !== null && daysRemaining > 0 ? /* @__PURE__ */ jsx(Fragment, { children: t("licensePortal.expiresInDays", "Expires in {daysRemaining} days ({expiresAt})").replace("{daysRemaining}", String(daysRemaining)).replace("{expiresAt}", String(formatDate(license.expiresAt))) }) : daysRemaining === 0 ? /* @__PURE__ */ jsx("span", { className: "text-red-600", children: t("licensePortal.expiresToday", "Expires today") }) : /* @__PURE__ */ jsx("span", { className: "text-red-600", children: t("licensePortal.expired", "Expired {expiresAt}").replace(
|
|
1453
|
+
"{expiresAt}",
|
|
1454
|
+
String(formatDate(license.expiresAt))
|
|
1455
|
+
) }) }),
|
|
1457
1456
|
(onActivate || onDeactivate) && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 mt-3 pt-3 border-t", children: [
|
|
1458
1457
|
onActivate && license.status === "valid" && /* @__PURE__ */ jsx(
|
|
1459
1458
|
"button",
|
|
@@ -1463,7 +1462,7 @@ const LicenseCard = ({ license, onSelect, onActivate, onDeactivate, selected })
|
|
|
1463
1462
|
e.stopPropagation();
|
|
1464
1463
|
onActivate();
|
|
1465
1464
|
},
|
|
1466
|
-
children: "Activate"
|
|
1465
|
+
children: t("licensePortal.activate", "Activate")
|
|
1467
1466
|
}
|
|
1468
1467
|
),
|
|
1469
1468
|
onDeactivate && /* @__PURE__ */ jsx(
|
|
@@ -1474,7 +1473,7 @@ const LicenseCard = ({ license, onSelect, onActivate, onDeactivate, selected })
|
|
|
1474
1473
|
e.stopPropagation();
|
|
1475
1474
|
onDeactivate();
|
|
1476
1475
|
},
|
|
1477
|
-
children: "Deactivate"
|
|
1476
|
+
children: t("licensePortal.deactivate", "Deactivate")
|
|
1478
1477
|
}
|
|
1479
1478
|
)
|
|
1480
1479
|
] })
|
|
@@ -1483,24 +1482,25 @@ const LicenseCard = ({ license, onSelect, onActivate, onDeactivate, selected })
|
|
|
1483
1482
|
);
|
|
1484
1483
|
};
|
|
1485
1484
|
const LicensePortal = (props) => {
|
|
1485
|
+
const { t } = useNiceTranslation();
|
|
1486
1486
|
const { className, style, ...config } = props;
|
|
1487
1487
|
const { state, activateLicense, deactivateLicense, selectLicense, setActiveTab, loadData } = useLicensePortal(config);
|
|
1488
1488
|
if (state.loading) {
|
|
1489
1489
|
return /* @__PURE__ */ jsx("div", { className: `nice-license-portal ${className || ""}`, style, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-8", children: [
|
|
1490
1490
|
/* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" }),
|
|
1491
|
-
/* @__PURE__ */ jsx("span", { className: "ml-3 text-gray-600", children: "Loading licenses..." })
|
|
1491
|
+
/* @__PURE__ */ jsx("span", { className: "ml-3 text-gray-600", children: t("licensePortal.loadingLicenses", "Loading licenses...") })
|
|
1492
1492
|
] }) });
|
|
1493
1493
|
}
|
|
1494
1494
|
if (state.error) {
|
|
1495
1495
|
return /* @__PURE__ */ jsx("div", { className: `nice-license-portal ${className || ""}`, style, children: /* @__PURE__ */ jsxs("div", { className: "p-4 bg-red-50 border border-red-200 rounded-lg", children: [
|
|
1496
|
-
/* @__PURE__ */ jsx("h3", { className: "text-red-800 font-semibold", children: "Error loading licenses" }),
|
|
1496
|
+
/* @__PURE__ */ jsx("h3", { className: "text-red-800 font-semibold", children: t("licensePortal.errorLoadingLicenses", "Error loading licenses") }),
|
|
1497
1497
|
/* @__PURE__ */ jsx("p", { className: "text-red-600 text-sm mt-1", children: state.error.message }),
|
|
1498
1498
|
/* @__PURE__ */ jsx(
|
|
1499
1499
|
"button",
|
|
1500
1500
|
{
|
|
1501
1501
|
className: "mt-3 px-4 py-2 bg-red-100 text-red-700 rounded hover:bg-red-200",
|
|
1502
1502
|
onClick: loadData,
|
|
1503
|
-
children: "Retry"
|
|
1503
|
+
children: t("licensePortal.retry", "Retry")
|
|
1504
1504
|
}
|
|
1505
1505
|
)
|
|
1506
1506
|
] }) });
|
|
@@ -1510,17 +1510,20 @@ const LicensePortal = (props) => {
|
|
|
1510
1510
|
return null;
|
|
1511
1511
|
}
|
|
1512
1512
|
const tabs = [
|
|
1513
|
-
{ id: "overview", label: "Overview" },
|
|
1514
|
-
{ id: "licenses", label: "Licenses" },
|
|
1515
|
-
{ id: "seats", label: "Seat Management" },
|
|
1516
|
-
...config.showBilling ? [{ id: "billing", label: "Billing" }] : [],
|
|
1517
|
-
...config.showAnalytics ? [{ id: "analytics", label: "Analytics" }] : [],
|
|
1518
|
-
{ id: "settings", label: "Settings" }
|
|
1513
|
+
{ id: "overview", label: t("licensePortal.overview", "Overview") },
|
|
1514
|
+
{ id: "licenses", label: t("licensePortal.licenses", "Licenses") },
|
|
1515
|
+
{ id: "seats", label: t("licensePortal.seatManagement", "Seat Management") },
|
|
1516
|
+
...config.showBilling ? [{ id: "billing", label: t("licensePortal.billing", "Billing") }] : [],
|
|
1517
|
+
...config.showAnalytics ? [{ id: "analytics", label: t("licensePortal.analytics", "Analytics") }] : [],
|
|
1518
|
+
{ id: "settings", label: t("licensePortal.settings", "Settings") }
|
|
1519
1519
|
];
|
|
1520
1520
|
return /* @__PURE__ */ jsxs("div", { className: `nice-license-portal ${className || ""}`, style, children: [
|
|
1521
1521
|
/* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
1522
|
-
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-gray-900", children: "License Portal" }),
|
|
1523
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-600", children:
|
|
1522
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-gray-900", children: t("licensePortal.licensePortal", "License Portal") }),
|
|
1523
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-600", children: t(
|
|
1524
|
+
"licensePortal.manageYourNice2devLicensesAnd",
|
|
1525
|
+
"Manage your Nice2Dev licenses and subscriptions"
|
|
1526
|
+
) })
|
|
1524
1527
|
] }),
|
|
1525
1528
|
/* @__PURE__ */ jsx("div", { className: "border-b border-gray-200 mb-6", children: /* @__PURE__ */ jsx("nav", { className: "flex gap-6", children: tabs.map((tab) => /* @__PURE__ */ jsx(
|
|
1526
1529
|
"button",
|
|
@@ -1534,15 +1537,15 @@ const LicensePortal = (props) => {
|
|
|
1534
1537
|
state.activeTab === "overview" && /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
1535
1538
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-4 gap-4", children: [
|
|
1536
1539
|
/* @__PURE__ */ jsxs("div", { className: "bg-white p-4 rounded-lg border border-gray-200", children: [
|
|
1537
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: "Total Licenses" }),
|
|
1540
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: t("licensePortal.totalLicenses", "Total Licenses") }),
|
|
1538
1541
|
/* @__PURE__ */ jsx("div", { className: "text-2xl font-bold", children: overview.totalLicenses })
|
|
1539
1542
|
] }),
|
|
1540
1543
|
/* @__PURE__ */ jsxs("div", { className: "bg-white p-4 rounded-lg border border-gray-200", children: [
|
|
1541
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: "Active" }),
|
|
1544
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: t("licensePortal.active", "Active") }),
|
|
1542
1545
|
/* @__PURE__ */ jsx("div", { className: "text-2xl font-bold text-green-600", children: overview.activeLicenses })
|
|
1543
1546
|
] }),
|
|
1544
1547
|
/* @__PURE__ */ jsxs("div", { className: "bg-white p-4 rounded-lg border border-gray-200", children: [
|
|
1545
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: "Seats Used" }),
|
|
1548
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: t("licensePortal.seatsUsed", "Seats Used") }),
|
|
1546
1549
|
/* @__PURE__ */ jsxs("div", { className: "text-2xl font-bold", children: [
|
|
1547
1550
|
overview.usedSeats,
|
|
1548
1551
|
"/",
|
|
@@ -1550,22 +1553,22 @@ const LicensePortal = (props) => {
|
|
|
1550
1553
|
] })
|
|
1551
1554
|
] }),
|
|
1552
1555
|
/* @__PURE__ */ jsxs("div", { className: "bg-white p-4 rounded-lg border border-gray-200", children: [
|
|
1553
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: "Expiring Soon" }),
|
|
1556
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: t("licensePortal.expiringSoon", "Expiring Soon") }),
|
|
1554
1557
|
/* @__PURE__ */ jsx("div", { className: "text-2xl font-bold text-orange-600", children: overview.expiringSoon.length })
|
|
1555
1558
|
] })
|
|
1556
1559
|
] }),
|
|
1557
1560
|
overview.expiringSoon.length > 0 && /* @__PURE__ */ jsxs("div", { className: "bg-orange-50 border border-orange-200 rounded-lg p-4", children: [
|
|
1558
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-orange-800 mb-2", children: "Licenses Expiring Soon" }),
|
|
1561
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-orange-800 mb-2", children: t("licensePortal.licensesExpiringSoon", "Licenses Expiring Soon") }),
|
|
1559
1562
|
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: overview.expiringSoon.map((license) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
1560
1563
|
/* @__PURE__ */ jsx("span", { className: "font-mono text-orange-700", children: license.key }),
|
|
1561
|
-
/* @__PURE__ */
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1564
|
+
/* @__PURE__ */ jsx("span", { className: "text-orange-600", children: t("licensePortal.daysRemainingCount", "{days} days remaining").replace(
|
|
1565
|
+
"{days}",
|
|
1566
|
+
String(getDaysUntilExpiration(license.expiresAt))
|
|
1567
|
+
) })
|
|
1565
1568
|
] }, license.key)) })
|
|
1566
1569
|
] }),
|
|
1567
1570
|
/* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg border border-gray-200", children: [
|
|
1568
|
-
/* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsx("h3", { className: "font-semibold", children: "Recent Activity" }) }),
|
|
1571
|
+
/* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsx("h3", { className: "font-semibold", children: t("licensePortal.recentActivity", "Recent Activity") }) }),
|
|
1569
1572
|
/* @__PURE__ */ jsxs("div", { className: "divide-y divide-gray-100", children: [
|
|
1570
1573
|
state.actionHistory.slice(0, 5).map((action) => /* @__PURE__ */ jsxs("div", { className: "p-4 flex items-center justify-between", children: [
|
|
1571
1574
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -1574,7 +1577,7 @@ const LicensePortal = (props) => {
|
|
|
1574
1577
|
] }),
|
|
1575
1578
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-gray-500", children: formatDate(action.timestamp) })
|
|
1576
1579
|
] }, action.id)),
|
|
1577
|
-
state.actionHistory.length === 0 && /* @__PURE__ */ jsx("div", { className: "p-4 text-gray-500 text-center", children: "No recent activity" })
|
|
1580
|
+
state.actionHistory.length === 0 && /* @__PURE__ */ jsx("div", { className: "p-4 text-gray-500 text-center", children: t("licensePortal.noRecentActivity", "No recent activity") })
|
|
1578
1581
|
] })
|
|
1579
1582
|
] })
|
|
1580
1583
|
] }),
|
|
@@ -1597,18 +1600,21 @@ const LicensePortal = (props) => {
|
|
|
1597
1600
|
license.key
|
|
1598
1601
|
);
|
|
1599
1602
|
}),
|
|
1600
|
-
overview.licenses.length === 0 && /* @__PURE__ */ jsx("div", { className: "col-span-full text-center py-8 text-gray-500", children:
|
|
1603
|
+
overview.licenses.length === 0 && /* @__PURE__ */ jsx("div", { className: "col-span-full text-center py-8 text-gray-500", children: t(
|
|
1604
|
+
"licensePortal.noLicensesFoundContactSupport",
|
|
1605
|
+
"No licenses found. Contact support to purchase a license."
|
|
1606
|
+
) })
|
|
1601
1607
|
] }),
|
|
1602
1608
|
state.activeTab === "billing" && config.showBilling && /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
1603
1609
|
state.subscription && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg border border-gray-200 p-6", children: [
|
|
1604
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold mb-4", children: "Current Subscription" }),
|
|
1610
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold mb-4", children: t("licensePortal.currentSubscription", "Current Subscription") }),
|
|
1605
1611
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1606
1612
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1607
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: "Plan" }),
|
|
1613
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: t("licensePortal.plan", "Plan") }),
|
|
1608
1614
|
/* @__PURE__ */ jsx("div", { className: "font-medium", children: state.subscription.plan })
|
|
1609
1615
|
] }),
|
|
1610
1616
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1611
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: "Status" }),
|
|
1617
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: t("licensePortal.status", "Status") }),
|
|
1612
1618
|
/* @__PURE__ */ jsx(
|
|
1613
1619
|
"div",
|
|
1614
1620
|
{
|
|
@@ -1618,7 +1624,7 @@ const LicensePortal = (props) => {
|
|
|
1618
1624
|
)
|
|
1619
1625
|
] }),
|
|
1620
1626
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1621
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: "Current Period" }),
|
|
1627
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: t("licensePortal.currentPeriod", "Current Period") }),
|
|
1622
1628
|
/* @__PURE__ */ jsxs("div", { className: "font-medium", children: [
|
|
1623
1629
|
formatDate(state.subscription.currentPeriodStart),
|
|
1624
1630
|
" -",
|
|
@@ -1627,13 +1633,13 @@ const LicensePortal = (props) => {
|
|
|
1627
1633
|
] })
|
|
1628
1634
|
] }),
|
|
1629
1635
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1630
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: "Seats" }),
|
|
1636
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: t("licensePortal.seats", "Seats") }),
|
|
1631
1637
|
/* @__PURE__ */ jsx("div", { className: "font-medium", children: state.subscription.seats })
|
|
1632
1638
|
] })
|
|
1633
1639
|
] })
|
|
1634
1640
|
] }),
|
|
1635
1641
|
/* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg border border-gray-200", children: [
|
|
1636
|
-
/* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsx("h3", { className: "font-semibold", children: "Invoices" }) }),
|
|
1642
|
+
/* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsx("h3", { className: "font-semibold", children: t("licensePortal.invoices", "Invoices") }) }),
|
|
1637
1643
|
/* @__PURE__ */ jsxs("div", { className: "divide-y divide-gray-100", children: [
|
|
1638
1644
|
state.invoices.map((invoice) => /* @__PURE__ */ jsxs("div", { className: "p-4 flex items-center justify-between", children: [
|
|
1639
1645
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -1660,20 +1666,23 @@ const LicensePortal = (props) => {
|
|
|
1660
1666
|
className: "text-blue-500 hover:text-blue-600",
|
|
1661
1667
|
target: "_blank",
|
|
1662
1668
|
rel: "noopener noreferrer",
|
|
1663
|
-
children: "Download"
|
|
1669
|
+
children: t("licensePortal.download", "Download")
|
|
1664
1670
|
}
|
|
1665
1671
|
)
|
|
1666
1672
|
] })
|
|
1667
1673
|
] }, invoice.id)),
|
|
1668
|
-
state.invoices.length === 0 && /* @__PURE__ */ jsx("div", { className: "p-4 text-gray-500 text-center", children: "No invoices" })
|
|
1674
|
+
state.invoices.length === 0 && /* @__PURE__ */ jsx("div", { className: "p-4 text-gray-500 text-center", children: t("licensePortal.noInvoices", "No invoices") })
|
|
1669
1675
|
] })
|
|
1670
1676
|
] })
|
|
1671
1677
|
] }),
|
|
1672
1678
|
state.activeTab === "seats" && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg border border-gray-200 p-6", children: [
|
|
1673
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold mb-4", children: "Seat Management" }),
|
|
1674
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-500 mb-4", children:
|
|
1679
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold mb-4", children: t("licensePortal.seatManagement", "Seat Management") }),
|
|
1680
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500 mb-4", children: t(
|
|
1681
|
+
"licensePortal.selectALicenseToManage",
|
|
1682
|
+
"Select a license to manage seat assignments."
|
|
1683
|
+
) })
|
|
1675
1684
|
] }),
|
|
1676
|
-
state.activeTab === "settings" && /* @__PURE__ */ jsx("div", { className: "bg-white rounded-lg border border-gray-200 p-6", children: /* @__PURE__ */ jsx("h3", { className: "font-semibold mb-4", children: "Portal Settings" }) })
|
|
1685
|
+
state.activeTab === "settings" && /* @__PURE__ */ jsx("div", { className: "bg-white rounded-lg border border-gray-200 p-6", children: /* @__PURE__ */ jsx("h3", { className: "font-semibold mb-4", children: t("licensePortal.portalSettings", "Portal Settings") }) })
|
|
1677
1686
|
] });
|
|
1678
1687
|
};
|
|
1679
1688
|
class ActivationService {
|
|
@@ -1691,6 +1700,7 @@ class ActivationService {
|
|
|
1691
1700
|
const error = await response.json().catch(() => ({}));
|
|
1692
1701
|
throw {
|
|
1693
1702
|
code: `HTTP_${response.status}`,
|
|
1703
|
+
// audit-allow: i18n — the service's fallback in the thrown ActivationError (API contract)
|
|
1694
1704
|
message: error.message || "Request failed",
|
|
1695
1705
|
retryable: response.status >= 500,
|
|
1696
1706
|
supportRequired: response.status === 403
|
|
@@ -1764,6 +1774,7 @@ async function getDefaultMachineName() {
|
|
|
1764
1774
|
return "Unknown Device";
|
|
1765
1775
|
}
|
|
1766
1776
|
function useActivationWizard(config) {
|
|
1777
|
+
const { t } = useNiceTranslation();
|
|
1767
1778
|
const [state, setState] = useState({
|
|
1768
1779
|
step: "enter-key",
|
|
1769
1780
|
licenseKey: "",
|
|
@@ -1793,7 +1804,10 @@ function useActivationWizard(config) {
|
|
|
1793
1804
|
...s2,
|
|
1794
1805
|
error: {
|
|
1795
1806
|
code: "INVALID_FORMAT",
|
|
1796
|
-
message:
|
|
1807
|
+
message: t(
|
|
1808
|
+
"activationWizard.licenseKeyFormatIsInvalid",
|
|
1809
|
+
"License key format is invalid. Expected format: XXXX-XXXX-XXXX-XXXX-XXXX"
|
|
1810
|
+
),
|
|
1797
1811
|
retryable: true
|
|
1798
1812
|
}
|
|
1799
1813
|
}));
|
|
@@ -1808,7 +1822,7 @@ function useActivationWizard(config) {
|
|
|
1808
1822
|
step: "error",
|
|
1809
1823
|
error: {
|
|
1810
1824
|
code: validation.errorCode || "VALIDATION_FAILED",
|
|
1811
|
-
message: validation.errorMessage || "License key validation failed",
|
|
1825
|
+
message: validation.errorMessage || t("activationWizard.licenseKeyValidationFailed", "License key validation failed"),
|
|
1812
1826
|
retryable: true
|
|
1813
1827
|
}
|
|
1814
1828
|
}));
|
|
@@ -1832,7 +1846,10 @@ function useActivationWizard(config) {
|
|
|
1832
1846
|
step: "error",
|
|
1833
1847
|
error: {
|
|
1834
1848
|
code: "HARDWARE_LIMIT",
|
|
1835
|
-
message: hwCheck.reason ||
|
|
1849
|
+
message: hwCheck.reason || t(
|
|
1850
|
+
"activationWizard.maximumHardwareActivationsReached",
|
|
1851
|
+
"Maximum hardware activations reached"
|
|
1852
|
+
),
|
|
1836
1853
|
retryable: false,
|
|
1837
1854
|
supportRequired: true
|
|
1838
1855
|
}
|
|
@@ -1847,7 +1864,7 @@ function useActivationWizard(config) {
|
|
|
1847
1864
|
error
|
|
1848
1865
|
}));
|
|
1849
1866
|
}
|
|
1850
|
-
}, [state.licenseKey, state.machineName, service]);
|
|
1867
|
+
}, [state.licenseKey, state.machineName, service, t]);
|
|
1851
1868
|
const acceptTermsAndActivate = useCallback(async () => {
|
|
1852
1869
|
var _a, _b;
|
|
1853
1870
|
if (!state.termsAccepted) {
|
|
@@ -1855,7 +1872,10 @@ function useActivationWizard(config) {
|
|
|
1855
1872
|
...s2,
|
|
1856
1873
|
error: {
|
|
1857
1874
|
code: "TERMS_NOT_ACCEPTED",
|
|
1858
|
-
message:
|
|
1875
|
+
message: t(
|
|
1876
|
+
"activationWizard.pleaseAcceptTheTermsOf",
|
|
1877
|
+
"Please accept the terms of service to continue"
|
|
1878
|
+
),
|
|
1859
1879
|
retryable: true
|
|
1860
1880
|
}
|
|
1861
1881
|
}));
|
|
@@ -1884,7 +1904,7 @@ function useActivationWizard(config) {
|
|
|
1884
1904
|
}));
|
|
1885
1905
|
(_b = config.onActivationError) == null ? void 0 : _b.call(config, activationError);
|
|
1886
1906
|
}
|
|
1887
|
-
}, [state, service, config]);
|
|
1907
|
+
}, [state, service, config, t]);
|
|
1888
1908
|
const startOfflineActivation = useCallback(async () => {
|
|
1889
1909
|
if (!config.allowOfflineActivation) {
|
|
1890
1910
|
return;
|
|
@@ -1973,13 +1993,14 @@ function useActivationWizard(config) {
|
|
|
1973
1993
|
};
|
|
1974
1994
|
}
|
|
1975
1995
|
const StepIndicator = ({ currentStep }) => {
|
|
1996
|
+
const { t } = useNiceTranslation();
|
|
1976
1997
|
const steps = [
|
|
1977
|
-
{ id: "enter-key", label: "Enter Key" },
|
|
1978
|
-
{ id: "validate", label: "Validate" },
|
|
1979
|
-
{ id: "hardware-check", label: "Hardware" },
|
|
1980
|
-
{ id: "terms", label: "Terms" },
|
|
1981
|
-
{ id: "activating", label: "Activate" },
|
|
1982
|
-
{ id: "success", label: "Done" }
|
|
1998
|
+
{ id: "enter-key", label: t("activationWizard.enterKey", "Enter Key") },
|
|
1999
|
+
{ id: "validate", label: t("activationWizard.validate", "Validate") },
|
|
2000
|
+
{ id: "hardware-check", label: t("activationWizard.hardware", "Hardware") },
|
|
2001
|
+
{ id: "terms", label: t("activationWizard.terms", "Terms") },
|
|
2002
|
+
{ id: "activating", label: t("activationWizard.activate", "Activate") },
|
|
2003
|
+
{ id: "success", label: t("activationWizard.done", "Done") }
|
|
1983
2004
|
];
|
|
1984
2005
|
const stepOrder = [
|
|
1985
2006
|
"enter-key",
|
|
@@ -2011,6 +2032,7 @@ const StepIndicator = ({ currentStep }) => {
|
|
|
2011
2032
|
};
|
|
2012
2033
|
const ActivationWizard = (props) => {
|
|
2013
2034
|
var _a;
|
|
2035
|
+
const { t } = useNiceTranslation();
|
|
2014
2036
|
const { className, style, ...config } = props;
|
|
2015
2037
|
const {
|
|
2016
2038
|
state,
|
|
@@ -2031,17 +2053,20 @@ const ActivationWizard = (props) => {
|
|
|
2031
2053
|
style,
|
|
2032
2054
|
children: [
|
|
2033
2055
|
/* @__PURE__ */ jsxs("div", { className: "text-center mb-6", children: [
|
|
2034
|
-
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-gray-900", children: "Activate License" }),
|
|
2035
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-600 mt-1", children:
|
|
2056
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-gray-900", children: t("activationWizard.activateLicense", "Activate License") }),
|
|
2057
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-600 mt-1", children: t(
|
|
2058
|
+
"activationWizard.followTheStepsToActivate",
|
|
2059
|
+
"Follow the steps to activate your Nice2Dev license"
|
|
2060
|
+
) })
|
|
2036
2061
|
] }),
|
|
2037
2062
|
state.step !== "error" && /* @__PURE__ */ jsx(StepIndicator, { currentStep: state.step }),
|
|
2038
2063
|
state.step === "error" && state.error && /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
2039
2064
|
/* @__PURE__ */ jsxs("div", { className: "bg-red-50 border border-red-200 rounded-lg p-6 text-center", children: [
|
|
2040
2065
|
/* @__PURE__ */ jsx("div", { className: "text-red-500 text-4xl mb-3 font-bold", "aria-hidden": "true", children: "!" }),
|
|
2041
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-red-800", children: "Activation Failed" }),
|
|
2066
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-red-800", children: t("activationWizard.activationFailed", "Activation Failed") }),
|
|
2042
2067
|
/* @__PURE__ */ jsx("p", { className: "text-red-600 mt-2", children: state.error.message }),
|
|
2043
2068
|
state.error.supportRequired && config.supportEmail && /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 mt-4", children: [
|
|
2044
|
-
"Please contact support at",
|
|
2069
|
+
t("activationWizard.pleaseContactSupportAt", "Please contact support at"),
|
|
2045
2070
|
" ",
|
|
2046
2071
|
/* @__PURE__ */ jsx("a", { href: `mailto:${config.supportEmail}`, className: "text-blue-500 hover:underline", children: config.supportEmail })
|
|
2047
2072
|
] })
|
|
@@ -2052,7 +2077,7 @@ const ActivationWizard = (props) => {
|
|
|
2052
2077
|
{
|
|
2053
2078
|
onClick: () => goBack(),
|
|
2054
2079
|
className: "px-6 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600",
|
|
2055
|
-
children: "Try Again"
|
|
2080
|
+
children: t("activationWizard.tryAgain", "Try Again")
|
|
2056
2081
|
}
|
|
2057
2082
|
),
|
|
2058
2083
|
/* @__PURE__ */ jsx(
|
|
@@ -2060,14 +2085,14 @@ const ActivationWizard = (props) => {
|
|
|
2060
2085
|
{
|
|
2061
2086
|
onClick: reset,
|
|
2062
2087
|
className: "px-6 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300",
|
|
2063
|
-
children: "Start Over"
|
|
2088
|
+
children: t("activationWizard.startOver", "Start Over")
|
|
2064
2089
|
}
|
|
2065
2090
|
)
|
|
2066
2091
|
] })
|
|
2067
2092
|
] }),
|
|
2068
2093
|
state.step === "enter-key" && /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
2069
2094
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2070
|
-
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "License Key" }),
|
|
2095
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: t("activationWizard.licenseKey", "License Key") }),
|
|
2071
2096
|
/* @__PURE__ */ jsx(
|
|
2072
2097
|
"input",
|
|
2073
2098
|
{
|
|
@@ -2079,17 +2104,20 @@ const ActivationWizard = (props) => {
|
|
|
2079
2104
|
maxLength: 29
|
|
2080
2105
|
}
|
|
2081
2106
|
),
|
|
2082
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 mt-2", children:
|
|
2107
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 mt-2", children: t(
|
|
2108
|
+
"activationWizard.enterTheLicenseKeyYou",
|
|
2109
|
+
"Enter the license key you received upon purchase"
|
|
2110
|
+
) })
|
|
2083
2111
|
] }),
|
|
2084
2112
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2085
|
-
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Machine Name (optional)" }),
|
|
2113
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: t("activationWizard.machineNameOptional", "Machine Name (optional)") }),
|
|
2086
2114
|
/* @__PURE__ */ jsx(
|
|
2087
2115
|
"input",
|
|
2088
2116
|
{
|
|
2089
2117
|
type: "text",
|
|
2090
2118
|
value: state.machineName,
|
|
2091
2119
|
onChange: (e) => setMachineName(e.target.value),
|
|
2092
|
-
placeholder: "My Work PC",
|
|
2120
|
+
placeholder: t("activationWizard.myWorkPc", "My Work PC"),
|
|
2093
2121
|
className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
|
2094
2122
|
}
|
|
2095
2123
|
)
|
|
@@ -2102,7 +2130,7 @@ const ActivationWizard = (props) => {
|
|
|
2102
2130
|
onClick: validateKey,
|
|
2103
2131
|
disabled: !state.licenseKey,
|
|
2104
2132
|
className: "flex-1 px-6 py-3 bg-blue-500 text-white rounded-lg hover:bg-blue-600 disabled:bg-gray-300 disabled:cursor-not-allowed",
|
|
2105
|
-
children: "Continue"
|
|
2133
|
+
children: t("activationWizard.continue", "Continue")
|
|
2106
2134
|
}
|
|
2107
2135
|
),
|
|
2108
2136
|
config.onCancel && /* @__PURE__ */ jsx(
|
|
@@ -2110,7 +2138,7 @@ const ActivationWizard = (props) => {
|
|
|
2110
2138
|
{
|
|
2111
2139
|
onClick: config.onCancel,
|
|
2112
2140
|
className: "px-6 py-3 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300",
|
|
2113
|
-
children: "Cancel"
|
|
2141
|
+
children: t("activationWizard.cancel", "Cancel")
|
|
2114
2142
|
}
|
|
2115
2143
|
)
|
|
2116
2144
|
] }),
|
|
@@ -2120,7 +2148,8 @@ const ActivationWizard = (props) => {
|
|
|
2120
2148
|
onClick: startOfflineActivation,
|
|
2121
2149
|
className: "w-full text-sm text-blue-500 hover:underline",
|
|
2122
2150
|
children: [
|
|
2123
|
-
"Activate offline
|
|
2151
|
+
t("activationWizard.activateOffline", "Activate offline"),
|
|
2152
|
+
" ",
|
|
2124
2153
|
/* @__PURE__ */ jsx(NtdArrowRight, { size: 14, style: { verticalAlign: "-2px" } })
|
|
2125
2154
|
]
|
|
2126
2155
|
}
|
|
@@ -2128,26 +2157,35 @@ const ActivationWizard = (props) => {
|
|
|
2128
2157
|
] }),
|
|
2129
2158
|
(state.step === "validate" || state.step === "hardware-check") && /* @__PURE__ */ jsxs("div", { className: "text-center py-8", children: [
|
|
2130
2159
|
/* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto" }),
|
|
2131
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mt-4", children: state.step === "validate" ? "Validating License..." : "Checking Hardware..." }),
|
|
2132
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-500 mt-2", children: state.step === "validate" ?
|
|
2160
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mt-4", children: state.step === "validate" ? t("activationWizard.validatingLicense", "Validating License...") : t("activationWizard.checkingHardware", "Checking Hardware...") }),
|
|
2161
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500 mt-2", children: state.step === "validate" ? t(
|
|
2162
|
+
"activationWizard.verifyingYourLicenseKeyWith",
|
|
2163
|
+
"Verifying your license key with the server"
|
|
2164
|
+
) : t(
|
|
2165
|
+
"activationWizard.collectingHardwareInformationForActivati",
|
|
2166
|
+
"Collecting hardware information for activation"
|
|
2167
|
+
) })
|
|
2133
2168
|
] }),
|
|
2134
2169
|
state.step === "terms" && /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
2135
2170
|
/* @__PURE__ */ jsxs("div", { className: "bg-gray-50 rounded-lg p-4", children: [
|
|
2136
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold mb-3", children: "License Details" }),
|
|
2171
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold mb-3", children: t("activationWizard.licenseDetails", "License Details") }),
|
|
2137
2172
|
((_a = state.validation) == null ? void 0 : _a.license) && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2 text-sm", children: [
|
|
2138
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Tier:" }),
|
|
2173
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("activationWizard.tier", "Tier:") }),
|
|
2139
2174
|
/* @__PURE__ */ jsx("div", { className: "font-medium capitalize", children: state.validation.license.tier }),
|
|
2140
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Licensee:" }),
|
|
2175
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("activationWizard.licensee", "Licensee:") }),
|
|
2141
2176
|
/* @__PURE__ */ jsx("div", { className: "font-medium", children: state.validation.license.licensee }),
|
|
2142
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Max Machines:" }),
|
|
2177
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("activationWizard.maxMachines", "Max Machines:") }),
|
|
2143
2178
|
/* @__PURE__ */ jsx("div", { className: "font-medium", children: state.validation.license.maxMachines }),
|
|
2144
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "This Machine:" }),
|
|
2179
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("activationWizard.thisMachine", "This Machine:") }),
|
|
2145
2180
|
/* @__PURE__ */ jsx("div", { className: "font-medium", children: state.machineName })
|
|
2146
2181
|
] })
|
|
2147
2182
|
] }),
|
|
2148
2183
|
/* @__PURE__ */ jsxs("div", { className: "border border-gray-200 rounded-lg p-4 max-h-48 overflow-y-auto text-sm text-gray-600", children: [
|
|
2149
|
-
/* @__PURE__ */ jsx("h4", { className: "font-semibold text-gray-800 mb-2", children: "Terms of Service" }),
|
|
2150
|
-
/* @__PURE__ */ jsx("p", { children:
|
|
2184
|
+
/* @__PURE__ */ jsx("h4", { className: "font-semibold text-gray-800 mb-2", children: t("activationWizard.termsOfService", "Terms of Service") }),
|
|
2185
|
+
/* @__PURE__ */ jsx("p", { children: t(
|
|
2186
|
+
"activationWizard.byActivatingThisLicenseYou",
|
|
2187
|
+
"By activating this license, you agree to the Nice2Dev Software License Agreement. This license grants you the right to use the software on the specified number of machines according to your license tier. Unauthorized redistribution, reverse engineering, or violation of these terms may result in license revocation."
|
|
2188
|
+
) })
|
|
2151
2189
|
] }),
|
|
2152
2190
|
/* @__PURE__ */ jsxs("label", { className: "flex items-start gap-3 cursor-pointer", children: [
|
|
2153
2191
|
/* @__PURE__ */ jsx(
|
|
@@ -2160,7 +2198,7 @@ const ActivationWizard = (props) => {
|
|
|
2160
2198
|
}
|
|
2161
2199
|
),
|
|
2162
2200
|
/* @__PURE__ */ jsxs("span", { className: "text-sm text-gray-700", children: [
|
|
2163
|
-
"I accept the",
|
|
2201
|
+
t("activationWizard.iAcceptThe", "I accept the"),
|
|
2164
2202
|
" ",
|
|
2165
2203
|
config.termsUrl ? /* @__PURE__ */ jsx(
|
|
2166
2204
|
"a",
|
|
@@ -2169,12 +2207,12 @@ const ActivationWizard = (props) => {
|
|
|
2169
2207
|
className: "text-blue-500 hover:underline",
|
|
2170
2208
|
target: "_blank",
|
|
2171
2209
|
rel: "noopener noreferrer",
|
|
2172
|
-
children: "Terms of Service"
|
|
2210
|
+
children: t("activationWizard.termsOfService", "Terms of Service")
|
|
2173
2211
|
}
|
|
2174
|
-
) : "Terms of Service",
|
|
2212
|
+
) : t("activationWizard.termsOfService", "Terms of Service"),
|
|
2175
2213
|
config.privacyUrl && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2176
2214
|
" ",
|
|
2177
|
-
"and",
|
|
2215
|
+
t("activationWizard.and", "and"),
|
|
2178
2216
|
" ",
|
|
2179
2217
|
/* @__PURE__ */ jsx(
|
|
2180
2218
|
"a",
|
|
@@ -2183,7 +2221,7 @@ const ActivationWizard = (props) => {
|
|
|
2183
2221
|
className: "text-blue-500 hover:underline",
|
|
2184
2222
|
target: "_blank",
|
|
2185
2223
|
rel: "noopener noreferrer",
|
|
2186
|
-
children: "Privacy Policy"
|
|
2224
|
+
children: t("activationWizard.privacyPolicy", "Privacy Policy")
|
|
2187
2225
|
}
|
|
2188
2226
|
)
|
|
2189
2227
|
] })
|
|
@@ -2196,7 +2234,7 @@ const ActivationWizard = (props) => {
|
|
|
2196
2234
|
{
|
|
2197
2235
|
onClick: goBack,
|
|
2198
2236
|
className: "px-6 py-3 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300",
|
|
2199
|
-
children: "Back"
|
|
2237
|
+
children: t("activationWizard.back", "Back")
|
|
2200
2238
|
}
|
|
2201
2239
|
),
|
|
2202
2240
|
/* @__PURE__ */ jsx(
|
|
@@ -2205,31 +2243,37 @@ const ActivationWizard = (props) => {
|
|
|
2205
2243
|
onClick: acceptTermsAndActivate,
|
|
2206
2244
|
disabled: !state.termsAccepted,
|
|
2207
2245
|
className: "flex-1 px-6 py-3 bg-blue-500 text-white rounded-lg hover:bg-blue-600 disabled:bg-gray-300 disabled:cursor-not-allowed",
|
|
2208
|
-
children: "Activate License"
|
|
2246
|
+
children: t("activationWizard.activateLicense", "Activate License")
|
|
2209
2247
|
}
|
|
2210
2248
|
)
|
|
2211
2249
|
] })
|
|
2212
2250
|
] }),
|
|
2213
2251
|
state.step === "activating" && /* @__PURE__ */ jsxs("div", { className: "text-center py-8", children: [
|
|
2214
2252
|
/* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto" }),
|
|
2215
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mt-4", children: "Activating License..." }),
|
|
2216
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-500 mt-2", children:
|
|
2253
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mt-4", children: t("activationWizard.activatingLicense", "Activating License...") }),
|
|
2254
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500 mt-2", children: t(
|
|
2255
|
+
"activationWizard.pleaseWaitWhileWeActivate",
|
|
2256
|
+
"Please wait while we activate your license"
|
|
2257
|
+
) })
|
|
2217
2258
|
] }),
|
|
2218
2259
|
state.step === "success" && state.activatedLicense && /* @__PURE__ */ jsxs("div", { className: "text-center space-y-6", children: [
|
|
2219
2260
|
/* @__PURE__ */ jsx("div", { className: "text-green-500 text-6xl", children: /* @__PURE__ */ jsx(CheckMark, {}) }),
|
|
2220
2261
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2221
|
-
/* @__PURE__ */ jsx("h2", { className: "text-xl font-bold text-gray-900", children: "License Activated!" }),
|
|
2222
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-600 mt-2", children:
|
|
2262
|
+
/* @__PURE__ */ jsx("h2", { className: "text-xl font-bold text-gray-900", children: t("activationWizard.licenseActivated", "License Activated!") }),
|
|
2263
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-600 mt-2", children: t(
|
|
2264
|
+
"activationWizard.yourLicenseHasBeenSuccessfully",
|
|
2265
|
+
"Your license has been successfully activated on this machine."
|
|
2266
|
+
) })
|
|
2223
2267
|
] }),
|
|
2224
2268
|
/* @__PURE__ */ jsx("div", { className: "bg-green-50 rounded-lg p-4 text-left", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2 text-sm", children: [
|
|
2225
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "License Key:" }),
|
|
2269
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("activationWizard.licenseKey2", "License Key:") }),
|
|
2226
2270
|
/* @__PURE__ */ jsx("div", { className: "font-mono", children: state.activatedLicense.key }),
|
|
2227
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Tier:" }),
|
|
2271
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("activationWizard.tier", "Tier:") }),
|
|
2228
2272
|
/* @__PURE__ */ jsx("div", { className: "capitalize", children: state.activatedLicense.tier }),
|
|
2229
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Machine:" }),
|
|
2273
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("activationWizard.machine", "Machine:") }),
|
|
2230
2274
|
/* @__PURE__ */ jsx("div", { children: state.machineName }),
|
|
2231
2275
|
state.activatedLicense.expiresAt && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2232
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Expires:" }),
|
|
2276
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("activationWizard.expires", "Expires:") }),
|
|
2233
2277
|
/* @__PURE__ */ jsx("div", { children: new Date(state.activatedLicense.expiresAt).toLocaleDateString() })
|
|
2234
2278
|
] })
|
|
2235
2279
|
] }) }),
|
|
@@ -2242,15 +2286,18 @@ const ActivationWizard = (props) => {
|
|
|
2242
2286
|
(_a2 = config.onCancel) == null ? void 0 : _a2.call(config);
|
|
2243
2287
|
},
|
|
2244
2288
|
className: "px-8 py-3 bg-blue-500 text-white rounded-lg hover:bg-blue-600",
|
|
2245
|
-
children: "Done"
|
|
2289
|
+
children: t("activationWizard.done", "Done")
|
|
2246
2290
|
}
|
|
2247
2291
|
)
|
|
2248
2292
|
] }),
|
|
2249
2293
|
state.offlineChallenge && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg p-6 max-w-md w-full", children: [
|
|
2250
|
-
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-4", children: "Offline Activation" }),
|
|
2294
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-4", children: t("activationWizard.offlineActivation", "Offline Activation") }),
|
|
2251
2295
|
/* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
2252
2296
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2253
|
-
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children:
|
|
2297
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t(
|
|
2298
|
+
"activationWizard.challengeCodeSendThisTo",
|
|
2299
|
+
"Challenge Code (send this to support):"
|
|
2300
|
+
) }),
|
|
2254
2301
|
/* @__PURE__ */ jsx(
|
|
2255
2302
|
"textarea",
|
|
2256
2303
|
{
|
|
@@ -2261,13 +2308,16 @@ const ActivationWizard = (props) => {
|
|
|
2261
2308
|
)
|
|
2262
2309
|
] }),
|
|
2263
2310
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2264
|
-
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Response Code (from support):" }),
|
|
2311
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("activationWizard.responseCodeFromSupport", "Response Code (from support):") }),
|
|
2265
2312
|
/* @__PURE__ */ jsx(
|
|
2266
2313
|
"textarea",
|
|
2267
2314
|
{
|
|
2268
2315
|
value: offlineResponse,
|
|
2269
2316
|
onChange: (e) => setOfflineResponse(e.target.value),
|
|
2270
|
-
placeholder:
|
|
2317
|
+
placeholder: t(
|
|
2318
|
+
"activationWizard.pasteTheResponseCodeHere",
|
|
2319
|
+
"Paste the response code here..."
|
|
2320
|
+
),
|
|
2271
2321
|
className: "w-full px-3 py-2 border border-gray-300 rounded font-mono text-xs h-20"
|
|
2272
2322
|
}
|
|
2273
2323
|
)
|
|
@@ -2280,7 +2330,7 @@ const ActivationWizard = (props) => {
|
|
|
2280
2330
|
},
|
|
2281
2331
|
disabled: !offlineResponse,
|
|
2282
2332
|
className: "flex-1 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:bg-gray-300",
|
|
2283
|
-
children: "Activate"
|
|
2333
|
+
children: t("activationWizard.activate", "Activate")
|
|
2284
2334
|
}
|
|
2285
2335
|
),
|
|
2286
2336
|
/* @__PURE__ */ jsx(
|
|
@@ -2290,7 +2340,7 @@ const ActivationWizard = (props) => {
|
|
|
2290
2340
|
setOfflineResponse("");
|
|
2291
2341
|
},
|
|
2292
2342
|
className: "px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",
|
|
2293
|
-
children: "Cancel"
|
|
2343
|
+
children: t("activationWizard.cancel", "Cancel")
|
|
2294
2344
|
}
|
|
2295
2345
|
)
|
|
2296
2346
|
] })
|
|
@@ -2315,6 +2365,7 @@ class LicenseTransferService {
|
|
|
2315
2365
|
const error = await response.json().catch(() => ({}));
|
|
2316
2366
|
throw {
|
|
2317
2367
|
code: `HTTP_${response.status}`,
|
|
2368
|
+
// audit-allow: i18n — the service's fallback in the thrown TransferError (API contract)
|
|
2318
2369
|
message: error.message || "Request failed"
|
|
2319
2370
|
};
|
|
2320
2371
|
}
|
|
@@ -2410,6 +2461,7 @@ const TRANSFER_REASONS = [
|
|
|
2410
2461
|
{ value: "other", label: "Other" }
|
|
2411
2462
|
];
|
|
2412
2463
|
function useLicenseTransfer(config) {
|
|
2464
|
+
const { t } = useNiceTranslation();
|
|
2413
2465
|
const [step, setStep] = useState("select-license");
|
|
2414
2466
|
const [licenses, setLicenses] = useState([]);
|
|
2415
2467
|
const [formData, setFormData] = useState({
|
|
@@ -2480,7 +2532,13 @@ function useLicenseTransfer(config) {
|
|
|
2480
2532
|
const initiateTransfer = useCallback(async () => {
|
|
2481
2533
|
var _a, _b;
|
|
2482
2534
|
if (!formData.confirmDeactivation) {
|
|
2483
|
-
setError({
|
|
2535
|
+
setError({
|
|
2536
|
+
code: "CONFIRMATION_REQUIRED",
|
|
2537
|
+
message: t(
|
|
2538
|
+
"licenseTransfer.pleaseConfirmLicenseDeactivation",
|
|
2539
|
+
"Please confirm license deactivation"
|
|
2540
|
+
)
|
|
2541
|
+
});
|
|
2484
2542
|
return;
|
|
2485
2543
|
}
|
|
2486
2544
|
setStep("processing");
|
|
@@ -2504,7 +2562,7 @@ function useLicenseTransfer(config) {
|
|
|
2504
2562
|
} finally {
|
|
2505
2563
|
setLoading(false);
|
|
2506
2564
|
}
|
|
2507
|
-
}, [formData, service, config]);
|
|
2565
|
+
}, [formData, service, config, t]);
|
|
2508
2566
|
const reset = useCallback(() => {
|
|
2509
2567
|
setStep("select-license");
|
|
2510
2568
|
setFormData({
|
|
@@ -2539,19 +2597,23 @@ function useLicenseTransfer(config) {
|
|
|
2539
2597
|
reset
|
|
2540
2598
|
};
|
|
2541
2599
|
}
|
|
2542
|
-
const TransferStatusBadge = ({ status }) =>
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
)
|
|
2600
|
+
const TransferStatusBadge = ({ status }) => {
|
|
2601
|
+
const { t } = useNiceTranslation();
|
|
2602
|
+
return /* @__PURE__ */ jsx(
|
|
2603
|
+
"span",
|
|
2604
|
+
{
|
|
2605
|
+
className: "inline-flex items-center px-2.5 py-1 rounded-full text-sm font-medium",
|
|
2606
|
+
style: {
|
|
2607
|
+
backgroundColor: `${getTransferStatusColor(status)}20`,
|
|
2608
|
+
color: getTransferStatusColor(status)
|
|
2609
|
+
},
|
|
2610
|
+
children: t(`licenseTransfer.status.${status}`, getTransferStatusLabel(status))
|
|
2611
|
+
}
|
|
2612
|
+
);
|
|
2613
|
+
};
|
|
2553
2614
|
const LicenseTransfer = (props) => {
|
|
2554
2615
|
var _a, _b;
|
|
2616
|
+
const { t } = useNiceTranslation();
|
|
2555
2617
|
const { className, style, ...config } = props;
|
|
2556
2618
|
const {
|
|
2557
2619
|
step,
|
|
@@ -2580,14 +2642,20 @@ const LicenseTransfer = (props) => {
|
|
|
2580
2642
|
className: `nice-license-transfer bg-white rounded-lg shadow-lg p-8 max-w-2xl mx-auto ${className || ""}`,
|
|
2581
2643
|
style,
|
|
2582
2644
|
children: [
|
|
2583
|
-
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-gray-900 mb-2", children: "Transfer License" }),
|
|
2584
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-600 mb-6", children:
|
|
2645
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-gray-900 mb-2", children: t("licenseTransfer.transferLicense", "Transfer License") }),
|
|
2646
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-600 mb-6", children: t(
|
|
2647
|
+
"licenseTransfer.transferALicenseToAnother",
|
|
2648
|
+
"Transfer a license to another user or organization"
|
|
2649
|
+
) }),
|
|
2585
2650
|
error && /* @__PURE__ */ jsx("div", { className: "mb-6 p-4 bg-red-50 border border-red-200 rounded-lg", children: /* @__PURE__ */ jsx("p", { className: "text-red-700", children: error.message }) }),
|
|
2586
2651
|
step === "select-license" && /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
2587
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: "Select a license to transfer" }),
|
|
2588
|
-
loading ? /* @__PURE__ */ jsx("div", { className: "text-center py-8", children: /* @__PURE__ */ jsx("div", { className: "animate-spin h-8 w-8 border-b-2 border-blue-500 rounded-full mx-auto" }) }) : licenses.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-center py-8 text-gray-500", children: "No transferable licenses found" }) : /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: licenses.map((license) => /* @__PURE__ */ jsxs(
|
|
2652
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: t("licenseTransfer.selectALicenseToTransfer", "Select a license to transfer") }),
|
|
2653
|
+
loading ? /* @__PURE__ */ jsx("div", { className: "text-center py-8", children: /* @__PURE__ */ jsx("div", { className: "animate-spin h-8 w-8 border-b-2 border-blue-500 rounded-full mx-auto" }) }) : licenses.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-center py-8 text-gray-500", children: t("licenseTransfer.noTransferableLicensesFound", "No transferable licenses found") }) : /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: licenses.map((license) => /* @__PURE__ */ jsxs(
|
|
2589
2654
|
"div",
|
|
2590
2655
|
{
|
|
2656
|
+
role: "button",
|
|
2657
|
+
tabIndex: 0,
|
|
2658
|
+
onKeyDown: clickOnActivationKey,
|
|
2591
2659
|
className: "p-4 border border-gray-200 rounded-lg hover:border-blue-500 cursor-pointer transition-colors",
|
|
2592
2660
|
onClick: () => selectLicense(license),
|
|
2593
2661
|
children: [
|
|
@@ -2598,12 +2666,7 @@ const LicenseTransfer = (props) => {
|
|
|
2598
2666
|
] }),
|
|
2599
2667
|
/* @__PURE__ */ jsx("span", { className: "px-2 py-1 bg-blue-100 text-blue-700 rounded text-sm capitalize", children: license.tier })
|
|
2600
2668
|
] }),
|
|
2601
|
-
/* @__PURE__ */
|
|
2602
|
-
license.activeSeats,
|
|
2603
|
-
"/",
|
|
2604
|
-
license.maxSeats ?? "∞",
|
|
2605
|
-
" seats used"
|
|
2606
|
-
] })
|
|
2669
|
+
/* @__PURE__ */ jsx("div", { className: "mt-2 text-sm text-gray-500", children: t("licenseTransfer.seatsUsed", "{activeSeats}/{maxSeats} seats used").replace("{activeSeats}", String(license.activeSeats)).replace("{maxSeats}", String(license.maxSeats ?? "∞")) })
|
|
2607
2670
|
]
|
|
2608
2671
|
},
|
|
2609
2672
|
license.key
|
|
@@ -2611,11 +2674,11 @@ const LicenseTransfer = (props) => {
|
|
|
2611
2674
|
] }),
|
|
2612
2675
|
step === "enter-recipient" && selectedLicense && /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
2613
2676
|
/* @__PURE__ */ jsxs("div", { className: "p-4 bg-gray-50 rounded-lg", children: [
|
|
2614
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: "Transferring license:" }),
|
|
2677
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: t("licenseTransfer.transferringLicense", "Transferring license:") }),
|
|
2615
2678
|
/* @__PURE__ */ jsx("div", { className: "font-mono", children: selectedLicense.key })
|
|
2616
2679
|
] }),
|
|
2617
2680
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2618
|
-
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Recipient Email" }),
|
|
2681
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: t("licenseTransfer.recipientEmail", "Recipient Email") }),
|
|
2619
2682
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
2620
2683
|
/* @__PURE__ */ jsx(
|
|
2621
2684
|
"input",
|
|
@@ -2624,7 +2687,7 @@ const LicenseTransfer = (props) => {
|
|
|
2624
2687
|
value: formData.recipientEmail,
|
|
2625
2688
|
onChange: (e) => setFormData((f2) => ({ ...f2, recipientEmail: e.target.value })),
|
|
2626
2689
|
onBlur: validateRecipient,
|
|
2627
|
-
placeholder: "recipient@company.com",
|
|
2690
|
+
placeholder: t("licenseTransfer.recipientCompanyCom", "recipient@company.com"),
|
|
2628
2691
|
className: "flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"
|
|
2629
2692
|
}
|
|
2630
2693
|
),
|
|
@@ -2634,7 +2697,7 @@ const LicenseTransfer = (props) => {
|
|
|
2634
2697
|
onClick: validateRecipient,
|
|
2635
2698
|
disabled: !formData.recipientEmail || loading,
|
|
2636
2699
|
className: "px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 disabled:opacity-50",
|
|
2637
|
-
children: "Validate"
|
|
2700
|
+
children: t("licenseTransfer.validate", "Validate")
|
|
2638
2701
|
}
|
|
2639
2702
|
)
|
|
2640
2703
|
] }),
|
|
@@ -2643,28 +2706,28 @@ const LicenseTransfer = (props) => {
|
|
|
2643
2706
|
{
|
|
2644
2707
|
className: `mt-2 text-sm ${recipientValidation.valid ? "text-green-600" : "text-red-600"}`,
|
|
2645
2708
|
children: [
|
|
2646
|
-
recipientValidation.valid ? "Valid recipient" : "Invalid recipient",
|
|
2647
|
-
recipientValidation.isExternal && /* @__PURE__ */ jsx("span", { className: "ml-2 text-orange-600", children: "(External organization)" })
|
|
2709
|
+
recipientValidation.valid ? t("licenseTransfer.validRecipient", "Valid recipient") : t("licenseTransfer.invalidRecipient", "Invalid recipient"),
|
|
2710
|
+
recipientValidation.isExternal && /* @__PURE__ */ jsx("span", { className: "ml-2 text-orange-600", children: t("licenseTransfer.externalOrganization", "(External organization)") })
|
|
2648
2711
|
]
|
|
2649
2712
|
}
|
|
2650
2713
|
),
|
|
2651
2714
|
(_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))
|
|
2652
2715
|
] }),
|
|
2653
2716
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2654
|
-
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Recipient Name" }),
|
|
2717
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: t("licenseTransfer.recipientName", "Recipient Name") }),
|
|
2655
2718
|
/* @__PURE__ */ jsx(
|
|
2656
2719
|
"input",
|
|
2657
2720
|
{
|
|
2658
2721
|
type: "text",
|
|
2659
2722
|
value: formData.recipientName,
|
|
2660
2723
|
onChange: (e) => setFormData((f2) => ({ ...f2, recipientName: e.target.value })),
|
|
2661
|
-
placeholder: "John Doe",
|
|
2724
|
+
placeholder: t("licenseTransfer.johnDoe", "John Doe"),
|
|
2662
2725
|
className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"
|
|
2663
2726
|
}
|
|
2664
2727
|
)
|
|
2665
2728
|
] }),
|
|
2666
2729
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2667
|
-
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Transfer Reason" }),
|
|
2730
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: t("licenseTransfer.transferReason", "Transfer Reason") }),
|
|
2668
2731
|
/* @__PURE__ */ jsx(
|
|
2669
2732
|
"select",
|
|
2670
2733
|
{
|
|
@@ -2674,18 +2737,21 @@ const LicenseTransfer = (props) => {
|
|
|
2674
2737
|
transferReason: e.target.value
|
|
2675
2738
|
})),
|
|
2676
2739
|
className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500",
|
|
2677
|
-
children: TRANSFER_REASONS.map((reason) => /* @__PURE__ */ jsx("option", { value: reason.value, children: reason.label }, reason.value))
|
|
2740
|
+
children: TRANSFER_REASONS.map((reason) => /* @__PURE__ */ jsx("option", { value: reason.value, children: t(`licenseTransfer.reason.${reason.value}`, reason.label) }, reason.value))
|
|
2678
2741
|
}
|
|
2679
2742
|
)
|
|
2680
2743
|
] }),
|
|
2681
2744
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2682
|
-
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Notes (optional)" }),
|
|
2745
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: t("licenseTransfer.notesOptional", "Notes (optional)") }),
|
|
2683
2746
|
/* @__PURE__ */ jsx(
|
|
2684
2747
|
"textarea",
|
|
2685
2748
|
{
|
|
2686
2749
|
value: formData.notes,
|
|
2687
2750
|
onChange: (e) => setFormData((f2) => ({ ...f2, notes: e.target.value })),
|
|
2688
|
-
placeholder:
|
|
2751
|
+
placeholder: t(
|
|
2752
|
+
"licenseTransfer.anyAdditionalInformation",
|
|
2753
|
+
"Any additional information..."
|
|
2754
|
+
),
|
|
2689
2755
|
rows: 3,
|
|
2690
2756
|
className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"
|
|
2691
2757
|
}
|
|
@@ -2697,7 +2763,7 @@ const LicenseTransfer = (props) => {
|
|
|
2697
2763
|
{
|
|
2698
2764
|
onClick: () => setStep("select-license"),
|
|
2699
2765
|
className: "px-6 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300",
|
|
2700
|
-
children: "Back"
|
|
2766
|
+
children: t("licenseTransfer.back", "Back")
|
|
2701
2767
|
}
|
|
2702
2768
|
),
|
|
2703
2769
|
/* @__PURE__ */ jsx(
|
|
@@ -2706,36 +2772,42 @@ const LicenseTransfer = (props) => {
|
|
|
2706
2772
|
onClick: proceedToReview,
|
|
2707
2773
|
disabled: !(recipientValidation == null ? void 0 : recipientValidation.valid) || !formData.recipientName,
|
|
2708
2774
|
className: "flex-1 px-6 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 disabled:bg-gray-300",
|
|
2709
|
-
children: "Review Transfer"
|
|
2775
|
+
children: t("licenseTransfer.reviewTransfer", "Review Transfer")
|
|
2710
2776
|
}
|
|
2711
2777
|
)
|
|
2712
2778
|
] })
|
|
2713
2779
|
] }),
|
|
2714
2780
|
step === "review" && selectedLicense && /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
2715
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: "Review Transfer Details" }),
|
|
2781
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: t("licenseTransfer.reviewTransferDetails", "Review Transfer Details") }),
|
|
2716
2782
|
/* @__PURE__ */ jsxs("div", { className: "bg-gray-50 rounded-lg p-4 space-y-3", children: [
|
|
2717
2783
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2 text-sm", children: [
|
|
2718
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "License Key:" }),
|
|
2784
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("licenseTransfer.licenseKey", "License Key:") }),
|
|
2719
2785
|
/* @__PURE__ */ jsx("div", { className: "font-mono", children: selectedLicense.key }),
|
|
2720
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Current Licensee:" }),
|
|
2786
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("licenseTransfer.currentLicensee", "Current Licensee:") }),
|
|
2721
2787
|
/* @__PURE__ */ jsx("div", { children: selectedLicense.licensee }),
|
|
2722
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Tier:" }),
|
|
2788
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("licenseTransfer.tier", "Tier:") }),
|
|
2723
2789
|
/* @__PURE__ */ jsx("div", { className: "capitalize", children: selectedLicense.tier }),
|
|
2724
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Transfer To:" }),
|
|
2790
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("licenseTransfer.transferTo", "Transfer To:") }),
|
|
2725
2791
|
/* @__PURE__ */ jsx("div", { children: formData.recipientName }),
|
|
2726
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Recipient Email:" }),
|
|
2792
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("licenseTransfer.recipientEmail2", "Recipient Email:") }),
|
|
2727
2793
|
/* @__PURE__ */ jsx("div", { children: formData.recipientEmail }),
|
|
2728
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Reason:" }),
|
|
2729
|
-
/* @__PURE__ */ jsx("div", { children: (
|
|
2794
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("licenseTransfer.reason", "Reason:") }),
|
|
2795
|
+
/* @__PURE__ */ jsx("div", { children: t(
|
|
2796
|
+
`licenseTransfer.reason.${formData.transferReason}`,
|
|
2797
|
+
((_b = TRANSFER_REASONS.find((r2) => r2.value === formData.transferReason)) == null ? void 0 : _b.label) ?? formData.transferReason
|
|
2798
|
+
) })
|
|
2730
2799
|
] }),
|
|
2731
2800
|
formData.notes && /* @__PURE__ */ jsxs("div", { className: "pt-3 border-t border-gray-200", children: [
|
|
2732
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500 mb-1", children: "Notes:" }),
|
|
2801
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500 mb-1", children: t("licenseTransfer.notes", "Notes:") }),
|
|
2733
2802
|
/* @__PURE__ */ jsx("div", { className: "text-sm", children: formData.notes })
|
|
2734
2803
|
] })
|
|
2735
2804
|
] }),
|
|
2736
2805
|
/* @__PURE__ */ jsxs("div", { className: "p-4 bg-orange-50 border border-orange-200 rounded-lg", children: [
|
|
2737
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-orange-800 mb-2", children: "Important" }),
|
|
2738
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-orange-700", children:
|
|
2806
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold text-orange-800 mb-2", children: t("licenseTransfer.important", "Important") }),
|
|
2807
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-orange-700", children: t(
|
|
2808
|
+
"licenseTransfer.onceTheTransferIsCompleted",
|
|
2809
|
+
"Once the transfer is completed, this license will be deactivated from all your machines and the new owner will need to activate it."
|
|
2810
|
+
) })
|
|
2739
2811
|
] }),
|
|
2740
2812
|
/* @__PURE__ */ jsxs("label", { className: "flex items-start gap-3 cursor-pointer", children: [
|
|
2741
2813
|
/* @__PURE__ */ jsx(
|
|
@@ -2747,7 +2819,10 @@ const LicenseTransfer = (props) => {
|
|
|
2747
2819
|
className: "mt-1 w-4 h-4 rounded border-gray-300 text-blue-500 focus:ring-blue-500"
|
|
2748
2820
|
}
|
|
2749
2821
|
),
|
|
2750
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-gray-700", children:
|
|
2822
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-gray-700", children: t(
|
|
2823
|
+
"licenseTransfer.iUnderstandThatThisLicense",
|
|
2824
|
+
"I understand that this license will be deactivated and transferred to the recipient. This action cannot be undone without admin intervention."
|
|
2825
|
+
) })
|
|
2751
2826
|
] }),
|
|
2752
2827
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
2753
2828
|
/* @__PURE__ */ jsx(
|
|
@@ -2755,7 +2830,7 @@ const LicenseTransfer = (props) => {
|
|
|
2755
2830
|
{
|
|
2756
2831
|
onClick: () => setStep("enter-recipient"),
|
|
2757
2832
|
className: "px-6 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300",
|
|
2758
|
-
children: "Back"
|
|
2833
|
+
children: t("licenseTransfer.back", "Back")
|
|
2759
2834
|
}
|
|
2760
2835
|
),
|
|
2761
2836
|
/* @__PURE__ */ jsx(
|
|
@@ -2764,28 +2839,37 @@ const LicenseTransfer = (props) => {
|
|
|
2764
2839
|
onClick: initiateTransfer,
|
|
2765
2840
|
disabled: !formData.confirmDeactivation || loading,
|
|
2766
2841
|
className: "flex-1 px-6 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 disabled:bg-gray-300",
|
|
2767
|
-
children: loading ? "Processing..." : "Initiate Transfer"
|
|
2842
|
+
children: loading ? t("licenseTransfer.processing", "Processing...") : t("licenseTransfer.initiateTransfer", "Initiate Transfer")
|
|
2768
2843
|
}
|
|
2769
2844
|
)
|
|
2770
2845
|
] })
|
|
2771
2846
|
] }),
|
|
2772
2847
|
step === "processing" && /* @__PURE__ */ jsxs("div", { className: "text-center py-12", children: [
|
|
2773
2848
|
/* @__PURE__ */ jsx("div", { className: "animate-spin h-12 w-12 border-b-2 border-blue-500 rounded-full mx-auto" }),
|
|
2774
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mt-4", children: "Processing Transfer..." }),
|
|
2775
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-500", children:
|
|
2849
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mt-4", children: t("licenseTransfer.processingTransfer", "Processing Transfer...") }),
|
|
2850
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500", children: t(
|
|
2851
|
+
"licenseTransfer.pleaseWaitWhileWeProcess",
|
|
2852
|
+
"Please wait while we process your transfer request"
|
|
2853
|
+
) })
|
|
2776
2854
|
] }),
|
|
2777
2855
|
step === "complete" && transfer && /* @__PURE__ */ jsxs("div", { className: "text-center space-y-6", children: [
|
|
2778
2856
|
/* @__PURE__ */ jsx("div", { className: "text-green-500 text-6xl", children: /* @__PURE__ */ jsx(CheckMark, {}) }),
|
|
2779
2857
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2780
|
-
/* @__PURE__ */ jsx("h2", { className: "text-xl font-bold", children: "Transfer Initiated" }),
|
|
2781
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-600 mt-2", children: transfer.approvalRequired ?
|
|
2858
|
+
/* @__PURE__ */ jsx("h2", { className: "text-xl font-bold", children: t("licenseTransfer.transferInitiated", "Transfer Initiated") }),
|
|
2859
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-600 mt-2", children: transfer.approvalRequired ? t(
|
|
2860
|
+
"licenseTransfer.yourTransferRequestHasBeen",
|
|
2861
|
+
"Your transfer request has been submitted for approval."
|
|
2862
|
+
) : t(
|
|
2863
|
+
"licenseTransfer.anEmailHasBeenSent",
|
|
2864
|
+
"An email has been sent to the recipient with instructions to accept the transfer."
|
|
2865
|
+
) })
|
|
2782
2866
|
] }),
|
|
2783
2867
|
/* @__PURE__ */ jsx("div", { className: "bg-gray-50 rounded-lg p-4 text-left", children: /* @__PURE__ */ jsxs("div", { className: "text-sm grid grid-cols-2 gap-2", children: [
|
|
2784
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Transfer ID:" }),
|
|
2868
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("licenseTransfer.transferId", "Transfer ID:") }),
|
|
2785
2869
|
/* @__PURE__ */ jsx("div", { className: "font-mono", children: transfer.id }),
|
|
2786
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Status:" }),
|
|
2870
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("licenseTransfer.status", "Status:") }),
|
|
2787
2871
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(TransferStatusBadge, { status: transfer.status }) }),
|
|
2788
|
-
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: "Expires:" }),
|
|
2872
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-500", children: t("licenseTransfer.expires", "Expires:") }),
|
|
2789
2873
|
/* @__PURE__ */ jsx("div", { children: new Date(transfer.expiresAt).toLocaleDateString() })
|
|
2790
2874
|
] }) }),
|
|
2791
2875
|
/* @__PURE__ */ jsx(
|
|
@@ -2793,7 +2877,7 @@ const LicenseTransfer = (props) => {
|
|
|
2793
2877
|
{
|
|
2794
2878
|
onClick: reset,
|
|
2795
2879
|
className: "px-8 py-3 bg-blue-500 text-white rounded-lg hover:bg-blue-600",
|
|
2796
|
-
children: "Done"
|
|
2880
|
+
children: t("licenseTransfer.done", "Done")
|
|
2797
2881
|
}
|
|
2798
2882
|
)
|
|
2799
2883
|
] })
|
|
@@ -3217,13 +3301,14 @@ const MetricCard = ({ title, value, change, suffix, loading }) => /* @__PURE__ *
|
|
|
3217
3301
|
] })
|
|
3218
3302
|
] });
|
|
3219
3303
|
const TimeRangeSelector = ({ value, onChange }) => {
|
|
3304
|
+
const { t } = useNiceTranslation();
|
|
3220
3305
|
const options = [
|
|
3221
|
-
{ value: "24h", label: "24 Hours" },
|
|
3222
|
-
{ value: "7d", label: "7 Days" },
|
|
3223
|
-
{ value: "30d", label: "30 Days" },
|
|
3224
|
-
{ value: "90d", label: "90 Days" },
|
|
3225
|
-
{ value: "1y", label: "1 Year" },
|
|
3226
|
-
{ value: "all", label: "All Time" }
|
|
3306
|
+
{ value: "24h", label: t("usageAnalyticsDashboard.n24Hours", "24 Hours") },
|
|
3307
|
+
{ value: "7d", label: t("usageAnalyticsDashboard.n7Days", "7 Days") },
|
|
3308
|
+
{ value: "30d", label: t("usageAnalyticsDashboard.n30Days", "30 Days") },
|
|
3309
|
+
{ value: "90d", label: t("usageAnalyticsDashboard.n90Days", "90 Days") },
|
|
3310
|
+
{ value: "1y", label: t("usageAnalyticsDashboard.n1Year", "1 Year") },
|
|
3311
|
+
{ value: "all", label: t("usageAnalyticsDashboard.allTime", "All Time") }
|
|
3227
3312
|
];
|
|
3228
3313
|
return /* @__PURE__ */ jsx("div", { className: "flex gap-1 bg-gray-100 rounded-lg p-1", children: options.map((opt) => /* @__PURE__ */ jsx(
|
|
3229
3314
|
"button",
|
|
@@ -3235,93 +3320,101 @@ const TimeRangeSelector = ({ value, onChange }) => {
|
|
|
3235
3320
|
opt.value
|
|
3236
3321
|
)) });
|
|
3237
3322
|
};
|
|
3238
|
-
const FeatureUsageTable = ({ data, loading }) =>
|
|
3239
|
-
|
|
3240
|
-
/* @__PURE__ */
|
|
3241
|
-
/* @__PURE__ */ jsx("
|
|
3242
|
-
|
|
3243
|
-
/* @__PURE__ */ jsx("
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3323
|
+
const FeatureUsageTable = ({ data, loading }) => {
|
|
3324
|
+
const { t } = useNiceTranslation();
|
|
3325
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg border border-gray-200 overflow-hidden", children: [
|
|
3326
|
+
/* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsx("h3", { className: "font-semibold", children: t("usageAnalyticsDashboard.featureUsage", "Feature Usage") }) }),
|
|
3327
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "w-full", children: [
|
|
3328
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
3329
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase", children: t("usageAnalyticsDashboard.feature", "Feature") }),
|
|
3330
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase", children: t("usageAnalyticsDashboard.totalUses", "Total Uses") }),
|
|
3331
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase", children: t("usageAnalyticsDashboard.users2", "Users") }),
|
|
3332
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase", children: t("usageAnalyticsDashboard.avgUser", "Avg/User") }),
|
|
3333
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase", children: t("usageAnalyticsDashboard.trend", "Trend") })
|
|
3334
|
+
] }) }),
|
|
3335
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-gray-100", children: loading ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 5, className: "px-4 py-8 text-center text-gray-500", children: t("usageAnalyticsDashboard.loading", "Loading...") }) }) : data.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 5, className: "px-4 py-8 text-center text-gray-500", children: t("usageAnalyticsDashboard.noDataAvailable", "No data available") }) }) : data.map((feature) => /* @__PURE__ */ jsxs("tr", { className: "hover:bg-gray-50", children: [
|
|
3336
|
+
/* @__PURE__ */ jsxs("td", { className: "px-4 py-3", children: [
|
|
3337
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: feature.featureName }),
|
|
3338
|
+
feature.category && /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500", children: feature.category })
|
|
3339
|
+
] }),
|
|
3340
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-right font-mono", children: feature.totalUses.toLocaleString() }),
|
|
3341
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-right font-mono", children: feature.uniqueUsers.toLocaleString() }),
|
|
3342
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-right font-mono", children: feature.avgUsesPerUser.toFixed(1) }),
|
|
3343
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-right", children: /* @__PURE__ */ jsxs(
|
|
3344
|
+
"span",
|
|
3345
|
+
{
|
|
3346
|
+
className: `inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${feature.trend > 0 ? "bg-green-100 text-green-800" : feature.trend < 0 ? "bg-red-100 text-red-800" : "bg-gray-100 text-gray-800"}`,
|
|
3347
|
+
children: [
|
|
3348
|
+
feature.trend > 0 ? "+" : "",
|
|
3349
|
+
feature.trend.toFixed(1),
|
|
3350
|
+
"%"
|
|
3351
|
+
]
|
|
3352
|
+
}
|
|
3353
|
+
) })
|
|
3354
|
+
] }, feature.featureId)) })
|
|
3355
|
+
] }) })
|
|
3356
|
+
] });
|
|
3357
|
+
};
|
|
3358
|
+
const TopUsersTable = ({ data, loading }) => {
|
|
3359
|
+
const { t } = useNiceTranslation();
|
|
3360
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg border border-gray-200 overflow-hidden", children: [
|
|
3361
|
+
/* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsx("h3", { className: "font-semibold", children: t("usageAnalyticsDashboard.topActiveUsers", "Top Active Users") }) }),
|
|
3362
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "w-full", children: [
|
|
3363
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
3364
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase", children: t("usageAnalyticsDashboard.user", "User") }),
|
|
3365
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase", children: t("usageAnalyticsDashboard.sessions", "Sessions") }),
|
|
3366
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase", children: t("usageAnalyticsDashboard.duration", "Duration") }),
|
|
3367
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase", children: t("usageAnalyticsDashboard.features", "Features") }),
|
|
3368
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase", children: t("usageAnalyticsDashboard.lastActive", "Last Active") })
|
|
3369
|
+
] }) }),
|
|
3370
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-gray-100", children: loading ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 5, className: "px-4 py-8 text-center text-gray-500", children: t("usageAnalyticsDashboard.loading", "Loading...") }) }) : data.map((user) => /* @__PURE__ */ jsxs("tr", { className: "hover:bg-gray-50", children: [
|
|
3371
|
+
/* @__PURE__ */ jsxs("td", { className: "px-4 py-3", children: [
|
|
3372
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: user.displayName || user.email }),
|
|
3373
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500 capitalize", children: user.tier })
|
|
3374
|
+
] }),
|
|
3375
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-right font-mono", children: user.sessionCount.toLocaleString() }),
|
|
3376
|
+
/* @__PURE__ */ jsxs("td", { className: "px-4 py-3 text-right font-mono", children: [
|
|
3377
|
+
Math.round(user.totalDuration / 60),
|
|
3378
|
+
"h"
|
|
3379
|
+
] }),
|
|
3380
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-right font-mono", children: user.featuresUsed }),
|
|
3381
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-sm text-gray-500", children: new Date(user.lastActive).toLocaleDateString() })
|
|
3382
|
+
] }, user.userId)) })
|
|
3383
|
+
] }) })
|
|
3384
|
+
] });
|
|
3385
|
+
};
|
|
3386
|
+
const LicenseUtilizationChart = ({ data, loading }) => {
|
|
3387
|
+
const { t } = useNiceTranslation();
|
|
3388
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg border border-gray-200", children: [
|
|
3389
|
+
/* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsx("h3", { className: "font-semibold", children: t("usageAnalyticsDashboard.licenseUtilization", "License Utilization") }) }),
|
|
3390
|
+
/* @__PURE__ */ jsx("div", { className: "p-4 space-y-4", children: loading ? /* @__PURE__ */ jsx("div", { className: "text-center text-gray-500", children: t("usageAnalyticsDashboard.loading", "Loading...") }) : data.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-center text-gray-500", children: t("usageAnalyticsDashboard.noLicenses", "No licenses") }) : data.map((license) => /* @__PURE__ */ jsxs("div", { children: [
|
|
3391
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm mb-1", children: [
|
|
3392
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium truncate max-w-[200px]", children: license.licensee }),
|
|
3393
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-500", children: t("usageAnalyticsDashboard.seats", "{usedSeats}/{totalSeats} seats").replace("{usedSeats}", String(license.usedSeats)).replace("{totalSeats}", String(license.totalSeats)) })
|
|
3252
3394
|
] }),
|
|
3253
|
-
/* @__PURE__ */ jsx("
|
|
3254
|
-
|
|
3255
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-right font-mono", children: feature.avgUsesPerUser.toFixed(1) }),
|
|
3256
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-right", children: /* @__PURE__ */ jsxs(
|
|
3257
|
-
"span",
|
|
3395
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 bg-gray-100 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
3396
|
+
"div",
|
|
3258
3397
|
{
|
|
3259
|
-
className: `
|
|
3260
|
-
|
|
3261
|
-
feature.trend > 0 ? "+" : "",
|
|
3262
|
-
feature.trend.toFixed(1),
|
|
3263
|
-
"%"
|
|
3264
|
-
]
|
|
3398
|
+
className: `h-full rounded-full ${license.utilizationPercent >= 90 ? "bg-red-500" : license.utilizationPercent >= 70 ? "bg-yellow-500" : "bg-green-500"}`,
|
|
3399
|
+
style: { width: `${license.utilizationPercent}%` }
|
|
3265
3400
|
}
|
|
3266
3401
|
) })
|
|
3267
|
-
] },
|
|
3268
|
-
] })
|
|
3269
|
-
|
|
3270
|
-
const TopUsersTable = ({ data, loading }) => /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg border border-gray-200 overflow-hidden", children: [
|
|
3271
|
-
/* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsx("h3", { className: "font-semibold", children: "Top Active Users" }) }),
|
|
3272
|
-
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "w-full", children: [
|
|
3273
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
3274
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase", children: "User" }),
|
|
3275
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase", children: "Sessions" }),
|
|
3276
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase", children: "Duration" }),
|
|
3277
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase", children: "Features" }),
|
|
3278
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase", children: "Last Active" })
|
|
3279
|
-
] }) }),
|
|
3280
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-gray-100", children: loading ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 5, className: "px-4 py-8 text-center text-gray-500", children: "Loading..." }) }) : data.map((user) => /* @__PURE__ */ jsxs("tr", { className: "hover:bg-gray-50", children: [
|
|
3281
|
-
/* @__PURE__ */ jsxs("td", { className: "px-4 py-3", children: [
|
|
3282
|
-
/* @__PURE__ */ jsx("div", { className: "font-medium", children: user.displayName || user.email }),
|
|
3283
|
-
/* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500 capitalize", children: user.tier })
|
|
3284
|
-
] }),
|
|
3285
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-right font-mono", children: user.sessionCount.toLocaleString() }),
|
|
3286
|
-
/* @__PURE__ */ jsxs("td", { className: "px-4 py-3 text-right font-mono", children: [
|
|
3287
|
-
Math.round(user.totalDuration / 60),
|
|
3288
|
-
"h"
|
|
3289
|
-
] }),
|
|
3290
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-right font-mono", children: user.featuresUsed }),
|
|
3291
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-sm text-gray-500", children: new Date(user.lastActive).toLocaleDateString() })
|
|
3292
|
-
] }, user.userId)) })
|
|
3293
|
-
] }) })
|
|
3294
|
-
] });
|
|
3295
|
-
const LicenseUtilizationChart = ({ data, loading }) => /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg border border-gray-200", children: [
|
|
3296
|
-
/* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsx("h3", { className: "font-semibold", children: "License Utilization" }) }),
|
|
3297
|
-
/* @__PURE__ */ jsx("div", { className: "p-4 space-y-4", children: loading ? /* @__PURE__ */ jsx("div", { className: "text-center text-gray-500", children: "Loading..." }) : data.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-center text-gray-500", children: "No licenses" }) : data.map((license) => /* @__PURE__ */ jsxs("div", { children: [
|
|
3298
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm mb-1", children: [
|
|
3299
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium truncate max-w-[200px]", children: license.licensee }),
|
|
3300
|
-
/* @__PURE__ */ jsxs("span", { className: "text-gray-500", children: [
|
|
3301
|
-
license.usedSeats,
|
|
3302
|
-
"/",
|
|
3303
|
-
license.totalSeats,
|
|
3304
|
-
" seats"
|
|
3305
|
-
] })
|
|
3306
|
-
] }),
|
|
3307
|
-
/* @__PURE__ */ jsx("div", { className: "h-2 bg-gray-100 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
3308
|
-
"div",
|
|
3309
|
-
{
|
|
3310
|
-
className: `h-full rounded-full ${license.utilizationPercent >= 90 ? "bg-red-500" : license.utilizationPercent >= 70 ? "bg-yellow-500" : "bg-green-500"}`,
|
|
3311
|
-
style: { width: `${license.utilizationPercent}%` }
|
|
3312
|
-
}
|
|
3313
|
-
) })
|
|
3314
|
-
] }, license.licenseKey)) })
|
|
3315
|
-
] });
|
|
3402
|
+
] }, license.licenseKey)) })
|
|
3403
|
+
] });
|
|
3404
|
+
};
|
|
3316
3405
|
const UsageAnalyticsDashboard = (props) => {
|
|
3317
3406
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
3407
|
+
const { t } = useNiceTranslation();
|
|
3318
3408
|
const { className, style, ...config } = props;
|
|
3319
3409
|
const { state, setTimeRange, refresh, exportData } = useUsageAnalytics(config);
|
|
3320
3410
|
return /* @__PURE__ */ jsxs("div", { className: `nice-usage-analytics ${className || ""}`, style, children: [
|
|
3321
3411
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-6", children: [
|
|
3322
3412
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
3323
|
-
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-gray-900", children: "Usage Analytics" }),
|
|
3324
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-600", children:
|
|
3413
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-gray-900", children: t("usageAnalyticsDashboard.usageAnalytics", "Usage Analytics") }),
|
|
3414
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-600", children: t(
|
|
3415
|
+
"usageAnalyticsDashboard.monitorLicenseUsageAndFeature",
|
|
3416
|
+
"Monitor license usage and feature adoption"
|
|
3417
|
+
) })
|
|
3325
3418
|
] }),
|
|
3326
3419
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
3327
3420
|
/* @__PURE__ */ jsx(TimeRangeSelector, { value: state.timeRange, onChange: setTimeRange }),
|
|
@@ -3330,7 +3423,7 @@ const UsageAnalyticsDashboard = (props) => {
|
|
|
3330
3423
|
{
|
|
3331
3424
|
onClick: () => refresh(),
|
|
3332
3425
|
className: "p-2 text-gray-500 hover:text-gray-700 rounded-lg hover:bg-gray-100",
|
|
3333
|
-
title: "Refresh",
|
|
3426
|
+
title: t("usageAnalyticsDashboard.refresh", "Refresh"),
|
|
3334
3427
|
children: /* @__PURE__ */ jsx(RefreshMark, {})
|
|
3335
3428
|
}
|
|
3336
3429
|
),
|
|
@@ -3339,7 +3432,7 @@ const UsageAnalyticsDashboard = (props) => {
|
|
|
3339
3432
|
{
|
|
3340
3433
|
className: "px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300",
|
|
3341
3434
|
onClick: () => exportData("csv"),
|
|
3342
|
-
children: "Export"
|
|
3435
|
+
children: t("usageAnalyticsDashboard.export", "Export")
|
|
3343
3436
|
}
|
|
3344
3437
|
) })
|
|
3345
3438
|
] })
|
|
@@ -3349,7 +3442,7 @@ const UsageAnalyticsDashboard = (props) => {
|
|
|
3349
3442
|
/* @__PURE__ */ jsx(
|
|
3350
3443
|
MetricCard,
|
|
3351
3444
|
{
|
|
3352
|
-
title: "Active Licenses",
|
|
3445
|
+
title: t("usageAnalyticsDashboard.activeLicenses", "Active Licenses"),
|
|
3353
3446
|
value: ((_a = state.overview) == null ? void 0 : _a.activeLicenses) ?? 0,
|
|
3354
3447
|
change: (_b = state.overview) == null ? void 0 : _b.activeLicensesChange,
|
|
3355
3448
|
loading: state.loading
|
|
@@ -3358,7 +3451,7 @@ const UsageAnalyticsDashboard = (props) => {
|
|
|
3358
3451
|
/* @__PURE__ */ jsx(
|
|
3359
3452
|
MetricCard,
|
|
3360
3453
|
{
|
|
3361
|
-
title: "Active Users",
|
|
3454
|
+
title: t("usageAnalyticsDashboard.activeUsers", "Active Users"),
|
|
3362
3455
|
value: ((_c = state.overview) == null ? void 0 : _c.activeUsers) ?? 0,
|
|
3363
3456
|
change: (_d = state.overview) == null ? void 0 : _d.activeUsersChange,
|
|
3364
3457
|
loading: state.loading
|
|
@@ -3367,7 +3460,7 @@ const UsageAnalyticsDashboard = (props) => {
|
|
|
3367
3460
|
/* @__PURE__ */ jsx(
|
|
3368
3461
|
MetricCard,
|
|
3369
3462
|
{
|
|
3370
|
-
title: "Feature Uses",
|
|
3463
|
+
title: t("usageAnalyticsDashboard.featureUses", "Feature Uses"),
|
|
3371
3464
|
value: ((_e = state.overview) == null ? void 0 : _e.featureUses) ?? 0,
|
|
3372
3465
|
change: (_f = state.overview) == null ? void 0 : _f.featureUsesChange,
|
|
3373
3466
|
loading: state.loading
|
|
@@ -3376,7 +3469,7 @@ const UsageAnalyticsDashboard = (props) => {
|
|
|
3376
3469
|
/* @__PURE__ */ jsx(
|
|
3377
3470
|
MetricCard,
|
|
3378
3471
|
{
|
|
3379
|
-
title: "Avg Session",
|
|
3472
|
+
title: t("usageAnalyticsDashboard.avgSession", "Avg Session"),
|
|
3380
3473
|
value: ((_h = (_g = state.overview) == null ? void 0 : _g.avgSessionDuration) == null ? void 0 : _h.toFixed(1)) ?? "0",
|
|
3381
3474
|
suffix: "min",
|
|
3382
3475
|
change: (_i = state.overview) == null ? void 0 : _i.avgSessionDurationChange,
|
|
@@ -3386,7 +3479,7 @@ const UsageAnalyticsDashboard = (props) => {
|
|
|
3386
3479
|
/* @__PURE__ */ jsx(
|
|
3387
3480
|
MetricCard,
|
|
3388
3481
|
{
|
|
3389
|
-
title: "Utilization",
|
|
3482
|
+
title: t("usageAnalyticsDashboard.utilization", "Utilization"),
|
|
3390
3483
|
value: `${((_k = (_j = state.overview) == null ? void 0 : _j.utilizationRate) == null ? void 0 : _k.toFixed(0)) ?? 0}%`,
|
|
3391
3484
|
change: (_l = state.overview) == null ? void 0 : _l.utilizationRateChange,
|
|
3392
3485
|
loading: state.loading
|
|
@@ -3399,14 +3492,14 @@ const UsageAnalyticsDashboard = (props) => {
|
|
|
3399
3492
|
] }),
|
|
3400
3493
|
/* @__PURE__ */ jsx("div", { className: "mb-6", children: /* @__PURE__ */ jsx(TopUsersTable, { data: state.topUsers, loading: state.loading }) }),
|
|
3401
3494
|
state.geoData.length > 0 && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg border border-gray-200 p-4", children: [
|
|
3402
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold mb-4", children: "Geographic Distribution" }),
|
|
3495
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold mb-4", children: t("usageAnalyticsDashboard.geographicDistribution", "Geographic Distribution") }),
|
|
3403
3496
|
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4", children: state.geoData.slice(0, 6).map((geo) => /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
3404
3497
|
/* @__PURE__ */ jsx("div", { className: "text-2xl mb-1", children: getCountryFlag(geo.countryCode) }),
|
|
3405
3498
|
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: geo.country }),
|
|
3406
|
-
/* @__PURE__ */
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3499
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500", children: t("usageAnalyticsDashboard.users", "{users} users").replace(
|
|
3500
|
+
"{users}",
|
|
3501
|
+
String(geo.users)
|
|
3502
|
+
) })
|
|
3410
3503
|
] }, geo.countryCode)) })
|
|
3411
3504
|
] })
|
|
3412
3505
|
] });
|