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