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