tokmon 0.22.1 → 0.22.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.
|
@@ -324,7 +324,7 @@ function computeDashLayout(groups, stats, cols, budget, focusId, layoutPref) {
|
|
|
324
324
|
}
|
|
325
325
|
return chooseLayout(content, budget, groups.length, single, cols, heights);
|
|
326
326
|
}
|
|
327
|
-
var DashboardView = memo2(function DashboardView2({ groups, stats, cols, budget, focusId, layout, page = 0, privacyMode
|
|
327
|
+
var DashboardView = memo2(function DashboardView2({ groups, stats, cols, budget, focusId, layout, page = 0, privacyMode = false }) {
|
|
328
328
|
if (groups.length === 0) {
|
|
329
329
|
return /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
330
330
|
"No providers enabled ",
|
|
@@ -339,7 +339,7 @@ var DashboardView = memo2(function DashboardView2({ groups, stats, cols, budget,
|
|
|
339
339
|
const pg = pageCount > 1 ? (page % pageCount + pageCount) % pageCount : 0;
|
|
340
340
|
const visible = pageCount > 1 ? groups.slice(pg * cardsPerPage, pg * cardsPerPage + cardsPerPage) : groups;
|
|
341
341
|
return /* @__PURE__ */ jsxs2(Box2, { height: budget, flexDirection: "column", overflow: "hidden", children: [
|
|
342
|
-
/* @__PURE__ */ jsx2(Box2, { width: content, flexWrap: "wrap", columnGap: GAP, rowGap: 1, alignItems: "flex-start", children: visible.map((g) => /* @__PURE__ */ jsx2(Box2, { flexShrink: 0, children: /* @__PURE__ */ jsx2(ProviderCard, { provider: g.provider, accounts: g.accounts, stats, width: cardW, variant, privacyMode
|
|
342
|
+
/* @__PURE__ */ jsx2(Box2, { width: content, flexWrap: "wrap", columnGap: GAP, rowGap: 1, alignItems: "flex-start", children: visible.map((g) => /* @__PURE__ */ jsx2(Box2, { flexShrink: 0, children: /* @__PURE__ */ jsx2(ProviderCard, { provider: g.provider, accounts: g.accounts, stats, width: cardW, variant, privacyMode }) }, g.provider)) }),
|
|
343
343
|
pageCount > 1 && /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
344
344
|
" ",
|
|
345
345
|
glyphs().middot,
|
|
@@ -355,7 +355,7 @@ var DashboardView = memo2(function DashboardView2({ groups, stats, cols, budget,
|
|
|
355
355
|
] })
|
|
356
356
|
] });
|
|
357
357
|
});
|
|
358
|
-
function ProviderCard({ provider, accounts, stats, width, variant }) {
|
|
358
|
+
function ProviderCard({ provider, accounts, stats, width, variant, privacyMode = false }) {
|
|
359
359
|
const meta = PROVIDERS[provider];
|
|
360
360
|
const items = accounts.map((a) => ({ account: a, s: stats.get(a.id) }));
|
|
361
361
|
const dashboards = items.map((i) => i.s?.dashboard).filter((d) => !!d);
|
|
@@ -408,13 +408,13 @@ function ProviderCard({ provider, accounts, stats, width, variant }) {
|
|
|
408
408
|
] })
|
|
409
409
|
] });
|
|
410
410
|
}
|
|
411
|
-
function CompactBilling({ items, privacyMode
|
|
411
|
+
function CompactBilling({ items, privacyMode }) {
|
|
412
412
|
const billing = items.map((i) => i.s?.billing).find(Boolean);
|
|
413
413
|
if (!billing) return /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
414
414
|
"Fetching",
|
|
415
415
|
glyphs().ellipsis
|
|
416
416
|
] });
|
|
417
|
-
if (billing.error) return /* @__PURE__ */ jsx2(Text2, { color: "red", children:
|
|
417
|
+
if (billing.error) return /* @__PURE__ */ jsx2(Text2, { color: "red", children: privacyMode ? redactEmail(billing.error) : billing.error });
|
|
418
418
|
const m = billing.metrics.find((x) => x.primary) ?? billing.metrics[0];
|
|
419
419
|
if (!m) return /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "No data" });
|
|
420
420
|
return /* @__PURE__ */ jsx2(Text2, { bold: true, color: "yellow", children: metricValueText(m) });
|
|
@@ -459,12 +459,12 @@ function KpiLine({ agg }) {
|
|
|
459
459
|
] })
|
|
460
460
|
] });
|
|
461
461
|
}
|
|
462
|
-
function accountTitle(account, billing,
|
|
462
|
+
function accountTitle(account, billing, privacyMode = false) {
|
|
463
463
|
const email = billing?.email;
|
|
464
464
|
const title = email && !account.name.includes("@") ? `${account.name} ${email}` : account.name;
|
|
465
|
-
return
|
|
465
|
+
return privacyMode ? redactEmail(title) : title;
|
|
466
466
|
}
|
|
467
|
-
function LimitsBlock({ items, inner, privacyMode
|
|
467
|
+
function LimitsBlock({ items, inner, privacyMode }) {
|
|
468
468
|
const showName = items.length > 1;
|
|
469
469
|
const labels = items.flatMap((i) => i.s?.billing?.metrics ?? []).map((m) => m.label.length);
|
|
470
470
|
const labelW = Math.min(Math.max(7, ...labels) + 1, 14);
|
|
@@ -477,12 +477,12 @@ function LimitsBlock({ items, inner, privacyMode: privacyMode2 }) {
|
|
|
477
477
|
glyphs().dot,
|
|
478
478
|
" "
|
|
479
479
|
] }),
|
|
480
|
-
/* @__PURE__ */ jsx2(Text2, { bold: true, children: truncateName(accountTitle(account, billing,
|
|
480
|
+
/* @__PURE__ */ jsx2(Text2, { bold: true, children: truncateName(accountTitle(account, billing, privacyMode), Math.max(22, inner - 2)) })
|
|
481
481
|
] }),
|
|
482
482
|
!billing ? /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
483
483
|
"Fetching",
|
|
484
484
|
glyphs().ellipsis
|
|
485
|
-
] }) : billing.error ? /* @__PURE__ */ jsx2(Text2, { color: "red", wrap: "truncate-end", children:
|
|
485
|
+
] }) : billing.error ? /* @__PURE__ */ jsx2(Text2, { color: "red", wrap: "truncate-end", children: privacyMode ? redactEmail(billing.error) : billing.error }) : billing.metrics.length === 0 ? /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "No data" }) : billing.metrics.map((m, i) => /* @__PURE__ */ jsx2(MetricRow, { m, color: account.color, barW, labelW }, `${m.label}${i}`))
|
|
486
486
|
] }, account.id);
|
|
487
487
|
}) });
|
|
488
488
|
}
|
|
@@ -1384,18 +1384,18 @@ function groupTodayCost(items) {
|
|
|
1384
1384
|
return sum + (d?.today.cost ?? 0);
|
|
1385
1385
|
}, 0);
|
|
1386
1386
|
}
|
|
1387
|
-
function headlineFor(group, items,
|
|
1387
|
+
function headlineFor(group, items, privacyMode = false) {
|
|
1388
1388
|
const meta = PROVIDERS[group.provider];
|
|
1389
1389
|
if (meta.hasUsage) return `${currency(groupTodayCost(items))} today`;
|
|
1390
1390
|
const billing = items.map((s) => s?.billing).find(Boolean);
|
|
1391
1391
|
if (!billing) return "no data";
|
|
1392
|
-
if (billing.error) return
|
|
1392
|
+
if (billing.error) return privacyMode ? redactEmail(billing.error) : billing.error;
|
|
1393
1393
|
const m = billing.metrics[0];
|
|
1394
1394
|
if (m) return metricValueText(m);
|
|
1395
1395
|
return billing.plan ?? "no data";
|
|
1396
1396
|
}
|
|
1397
1397
|
var STAGGER_FRAMES = 2;
|
|
1398
|
-
function LoadingView({ groups, stats, cols, rows, readyInput, privacyMode
|
|
1398
|
+
function LoadingView({ groups, stats, cols, rows, readyInput, privacyMode = false }) {
|
|
1399
1399
|
const resolveReady = readyInput ?? ((id) => statsReadyInput(stats.get(id)));
|
|
1400
1400
|
const sp = glyphs().spinner;
|
|
1401
1401
|
const [frame, setFrame] = useState2(0);
|
|
@@ -1463,7 +1463,7 @@ function LoadingView({ groups, stats, cols, rows, readyInput, privacyMode: priva
|
|
|
1463
1463
|
sp[frame % sp.length],
|
|
1464
1464
|
" "
|
|
1465
1465
|
] }),
|
|
1466
|
-
errored ? /* @__PURE__ */ jsx6(Text6, { color: "red", children: headlineFor(g, items,
|
|
1466
|
+
errored ? /* @__PURE__ */ jsx6(Text6, { color: "red", children: headlineFor(g, items, privacyMode) }) : ready ? /* @__PURE__ */ jsx6(Text6, { children: headlineFor(g, items, privacyMode) }) : /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1467
1467
|
"loading",
|
|
1468
1468
|
glyphs().ellipsis
|
|
1469
1469
|
] })
|
|
@@ -1492,8 +1492,8 @@ function LoadingView({ groups, stats, cols, rows, readyInput, privacyMode: priva
|
|
|
1492
1492
|
}
|
|
1493
1493
|
|
|
1494
1494
|
// src/ui/app-layout.logic.ts
|
|
1495
|
-
function deriveSlots(accounts,
|
|
1496
|
-
const label = (name) =>
|
|
1495
|
+
function deriveSlots(accounts, privacyMode = false) {
|
|
1496
|
+
const label = (name) => privacyMode ? redactEmail(name) : name;
|
|
1497
1497
|
return accounts.length > 1 ? [{ id: null, name: "All", color: "whiteBright" }, ...accounts.map((a) => ({ id: a.id, name: label(a.name), color: a.color }))] : accounts.map((a) => ({ id: a.id, name: label(a.name), color: a.color }));
|
|
1498
1498
|
}
|
|
1499
1499
|
function findActiveSlot(slots, activeAccountId) {
|
package/dist/cli.js
CHANGED
|
@@ -68,5 +68,5 @@ setGlyphs(resolveGlyphs({
|
|
|
68
68
|
}));
|
|
69
69
|
var daemon = await attachOrSpawn();
|
|
70
70
|
var mode = daemon.kind === "spawned" ? "connected" : "degraded";
|
|
71
|
-
var { bootstrapInk } = await import("./bootstrap-ink-
|
|
71
|
+
var { bootstrapInk } = await import("./bootstrap-ink-F7P7Q5J4.js");
|
|
72
72
|
await bootstrapInk({ interval, config, daemon, mode });
|
package/package.json
CHANGED