@burdenoff/microfe-billing 2026.518.3 → 2026.519.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.
@@ -2,13 +2,13 @@ import { useBilling as e } from "../../../providers/BillingProvider.js";
2
2
  import { statusTokens as t } from "../../../shared/utils/tokens.js";
3
3
  import { formatDateTime as n, formatNumber as r, formatRelativeTime as i } from "../../../shared/utils/format.js";
4
4
  import { useBillingPermissions as a } from "../../../hooks/useBillingPermissions.js";
5
- import { useBillingAccountsForUsage as o, useEnhancedUsagePage as s, useQuotaUsageDetails as c } from "../hooks/useUsage.js";
6
- import { useCallback as l, useDeferredValue as u, useMemo as d, useState as f } from "react";
5
+ import { useBillingAccountsForUsage as o, useEnhancedUsagePage as s, useQuotaUsageDetails as c, useWorkspaceQuotaHistory as l } from "../hooks/useUsage.js";
6
+ import { useCallback as u, useDeferredValue as ee, useMemo as d, useState as f } from "react";
7
7
  import { AlertCircle as p, AlertTriangle as m, CheckCircle as h, ChevronDown as g, ChevronLeft as _, ChevronRight as v, Clock as y, Info as b, Layers as x, Package as S, RefreshCw as C, Search as w, X as T, XCircle as E } from "lucide-react";
8
8
  import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
9
- import { useI18n as ee } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
9
+ import { useI18n as te } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
10
10
  //#region src/billing/modules/usage/pages/UsagePage.tsx
11
- var te = ({ status: e, className: n = "w-4 h-4" }) => {
11
+ var A = ({ status: e, className: n = "w-4 h-4" }) => {
12
12
  switch (e) {
13
13
  case "EXHAUSTED": return /* @__PURE__ */ O(E, { className: `${n} ${t.error.icon}` });
14
14
  case "CRITICAL": return /* @__PURE__ */ O(m, { className: `${n} ${t.error.icon}` });
@@ -16,7 +16,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
16
16
  case "HEALTHY": return /* @__PURE__ */ O(h, { className: `${n} ${t.success.icon}` });
17
17
  default: return /* @__PURE__ */ O(b, { className: `${n} ${t.neutral.icon}` });
18
18
  }
19
- }, A = ({ status: e }) => /* @__PURE__ */ O("span", {
19
+ }, j = ({ status: e }) => /* @__PURE__ */ O("span", {
20
20
  className: `px-2 py-0.5 text-xs font-medium rounded ${{
21
21
  EXHAUSTED: `${t.error.bg} ${t.error.text}`,
22
22
  CRITICAL: `${t.error.bg} ${t.error.text}`,
@@ -25,7 +25,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
25
25
  INACTIVE: `${t.neutral.bg} ${t.neutral.text}`
26
26
  }[e]}`,
27
27
  children: e
28
- }), j = ({ percentage: e, status: n }) => {
28
+ }), M = ({ percentage: e, status: n }) => {
29
29
  let r = Math.min(100, Math.max(0, e));
30
30
  return /* @__PURE__ */ O("div", {
31
31
  className: "w-full bg-muted rounded-full h-2.5 overflow-hidden",
@@ -40,7 +40,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
40
40
  style: { width: `${r}%` }
41
41
  })
42
42
  });
43
- }, M = ({ label: e, value: n, icon: r, color: i, isActive: a, onClick: o }) => {
43
+ }, N = ({ label: e, value: n, icon: r, color: i, isActive: a, onClick: o }) => {
44
44
  let s = {
45
45
  blue: t.info,
46
46
  emerald: t.success,
@@ -83,7 +83,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
83
83
  children: n
84
84
  })]
85
85
  });
86
- }, N = ({ quota: e, planLabel: t, onClick: n }) => {
86
+ }, P = ({ quota: e, planLabel: t, onClick: n }) => {
87
87
  let i = e.totalLimit != null && e.totalLimit > 0 && !e.noLimit;
88
88
  return /* @__PURE__ */ k("tr", {
89
89
  onClick: n,
@@ -126,7 +126,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
126
126
  i ? r(e.totalLimit) : "∞",
127
127
  e.unit ? ` ${e.unit}` : ""
128
128
  ]
129
- }), /* @__PURE__ */ O(j, {
129
+ }), /* @__PURE__ */ O(M, {
130
130
  percentage: i ? e.usagePercentage : 0,
131
131
  status: e.status
132
132
  })]
@@ -138,7 +138,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
138
138
  }),
139
139
  /* @__PURE__ */ O("td", {
140
140
  className: "px-4 py-3",
141
- children: /* @__PURE__ */ O(A, { status: e.status })
141
+ children: /* @__PURE__ */ O(j, { status: e.status })
142
142
  })
143
143
  ]
144
144
  });
@@ -170,7 +170,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
170
170
  children: "Status"
171
171
  })
172
172
  ]
173
- }) }), /* @__PURE__ */ O("tbody", { children: e.map((e) => /* @__PURE__ */ O(N, {
173
+ }) }), /* @__PURE__ */ O("tbody", { children: e.map((e) => /* @__PURE__ */ O(P, {
174
174
  quota: e,
175
175
  planLabel: n ? t : void 0,
176
176
  onClick: () => r(e)
@@ -234,10 +234,10 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
234
234
  ]
235
235
  });
236
236
  }, ie = ({ quota: a, onClose: o }) => {
237
- let [s, l] = f([null]), u = s[s.length - 1] ?? null, d = s.length, { workspaceId: p } = e(), m = a.quotaAssignments[0]?.id, { usages: h, hasNextPage: g, nextCursor: y, isLoading: b } = c(m, 10, u, p), x = () => {
238
- y && l((e) => [...e, y]);
239
- }, S = () => {
240
- s.length > 1 && l((e) => e.slice(0, -1));
237
+ let [s, u] = f([null]), ee = s[s.length - 1] ?? null, d = s.length, { workspaceId: p } = e(), m = a.quotaAssignments[0]?.id, { usages: h, hasNextPage: g, nextCursor: y, isLoading: b } = c(m, 10, ee, p), { snapshots: x, isLoading: S } = l(p, a.name, 24), C = () => {
238
+ y && u((e) => [...e, y]);
239
+ }, w = () => {
240
+ s.length > 1 && u((e) => e.slice(0, -1));
241
241
  };
242
242
  return /* @__PURE__ */ k("div", {
243
243
  className: "fixed inset-0 z-50 flex items-center justify-center",
@@ -254,7 +254,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
254
254
  className: "sticky top-0 bg-background border-b border-border p-4 flex items-center justify-between",
255
255
  children: [/* @__PURE__ */ k("div", {
256
256
  className: "flex items-center gap-3",
257
- children: [/* @__PURE__ */ O(te, {
257
+ children: [/* @__PURE__ */ O(A, {
258
258
  status: a.status,
259
259
  className: "w-5 h-5"
260
260
  }), /* @__PURE__ */ k("div", { children: [
@@ -297,9 +297,9 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
297
297
  children: [/* @__PURE__ */ O("span", {
298
298
  className: "text-sm text-muted-foreground",
299
299
  children: "Usage"
300
- }), /* @__PURE__ */ O(A, { status: a.status })]
300
+ }), /* @__PURE__ */ O(j, { status: a.status })]
301
301
  }),
302
- /* @__PURE__ */ O(j, {
302
+ /* @__PURE__ */ O(M, {
303
303
  percentage: a.usagePercentage,
304
304
  status: a.status
305
305
  }),
@@ -366,6 +366,42 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
366
366
  })]
367
367
  })]
368
368
  }),
369
+ (S || x.length > 0) && /* @__PURE__ */ k("div", {
370
+ className: "p-4 border-t border-border",
371
+ children: [/* @__PURE__ */ O("h3", {
372
+ className: "text-sm font-medium text-foreground mb-3",
373
+ children: "Live Value History"
374
+ }), S ? /* @__PURE__ */ O("div", {
375
+ className: "space-y-1.5",
376
+ children: [
377
+ 1,
378
+ 2,
379
+ 3
380
+ ].map((e) => /* @__PURE__ */ O("div", { className: "h-8 bg-muted animate-pulse rounded" }, e))
381
+ }) : /* @__PURE__ */ O("div", {
382
+ className: "space-y-1.5",
383
+ children: x.map((e) => /* @__PURE__ */ k("div", {
384
+ className: "flex items-center justify-between px-3 py-2 bg-muted/30 rounded-md",
385
+ children: [/* @__PURE__ */ O("span", {
386
+ className: "text-xs text-muted-foreground",
387
+ children: n(e.snapshotAt)
388
+ }), /* @__PURE__ */ k("span", {
389
+ className: "text-sm font-medium text-foreground tabular-nums",
390
+ children: [
391
+ r(e.value),
392
+ a.unit && /* @__PURE__ */ O("span", {
393
+ className: "text-xs text-muted-foreground ml-1",
394
+ children: a.unit
395
+ }),
396
+ !e.noLimit && e.limit != null && /* @__PURE__ */ k("span", {
397
+ className: "text-xs text-muted-foreground ml-1",
398
+ children: ["/ ", r(e.limit)]
399
+ })
400
+ ]
401
+ })]
402
+ }, e.id))
403
+ })]
404
+ }),
369
405
  /* @__PURE__ */ k("div", {
370
406
  className: "p-4",
371
407
  children: [
@@ -410,7 +446,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
410
446
  className: "flex items-center justify-center gap-2 mt-4",
411
447
  children: [
412
448
  /* @__PURE__ */ O("button", {
413
- onClick: S,
449
+ onClick: w,
414
450
  disabled: s.length === 1,
415
451
  className: "px-3 py-1.5 text-sm border border-border rounded-md disabled:opacity-50",
416
452
  "aria-label": "Previous usage page",
@@ -421,7 +457,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
421
457
  children: ["Page ", d]
422
458
  }),
423
459
  /* @__PURE__ */ O("button", {
424
- onClick: x,
460
+ onClick: C,
425
461
  disabled: !g,
426
462
  className: "px-3 py-1.5 text-sm border border-border rounded-md disabled:opacity-50",
427
463
  "aria-label": "Next usage page",
@@ -442,49 +478,50 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
442
478
  ]
443
479
  })]
444
480
  });
445
- }, P = () => {
446
- let { t: e } = ee(), n = (t, n) => {
447
- let r = e(t);
448
- return r === t ? n : r;
449
- }, r = a(), [i, c] = f(() => {
481
+ }, F = () => {
482
+ let { t: n } = te(), r = (e, t) => {
483
+ let r = n(e);
484
+ return r === e ? t : r;
485
+ }, i = a(), [c, l] = f(() => {
450
486
  if (!(typeof window > "u")) return new URLSearchParams(window.location.search).get("billingAccountId") || void 0;
451
- }), [_, v] = f(null), [b, E] = f(""), [A, j] = f("all"), [N, P] = f("active"), F = u(b), { billingAccounts: I, isLoading: ae } = o(), oe = (I.find((e) => e.isDefault) ?? I[0])?.id, L = i ?? oe, { dashboard: R, pooledQuotas: z, activeSubscriptions: B, pastSubscriptions: V, isLoading: se, isPastSubscriptionsLoading: H, error: U, refetch: W, loadMorePastSubscriptions: ce, hasMorePastSubscriptions: G, isLoadingMorePast: K, pastSubscriptionsCount: le } = s({
487
+ }), [_, v] = f(null), [b, E] = f(""), [j, M] = f("all"), [P, F] = f("active"), ae = ee(b), { billingAccounts: I, isLoading: oe } = o(), se = (I.find((e) => e.isDefault) ?? I[0])?.id, L = c ?? se, { workspaceId: ce } = e(), { dashboard: R, pooledQuotas: z, activeSubscriptions: B, pastSubscriptions: V, isLoading: le, isPastSubscriptionsLoading: H, error: U, refetch: W, loadMorePastSubscriptions: ue, hasMorePastSubscriptions: G, isLoadingMorePast: de, pastSubscriptionsCount: K } = s({
452
488
  billingAccountId: L,
453
- searchQuery: F || void 0,
454
- viewMode: N
455
- }), q = l((e) => A === "all" ? !0 : A === "healthy" ? e.status === "HEALTHY" : A === "warning" ? e.status === "WARNING" : A === "critical" ? e.status === "CRITICAL" || e.status === "EXHAUSTED" : !0, [A]), J = d(() => z.filter(q), [z, q]), Y = d(() => A === "all" ? B : B.map((e) => ({
489
+ workspaceId: ce,
490
+ searchQuery: ae || void 0,
491
+ viewMode: P
492
+ }), q = u((e) => j === "all" ? !0 : j === "healthy" ? e.status === "HEALTHY" : j === "warning" ? e.status === "WARNING" : j === "critical" ? e.status === "CRITICAL" || e.status === "EXHAUSTED" : !0, [j]), J = d(() => z.filter(q), [z, q]), Y = d(() => j === "all" ? B : B.map((e) => ({
456
493
  ...e,
457
494
  aggregatedQuotas: e.aggregatedQuotas.filter(q)
458
495
  })).filter((e) => e.aggregatedQuotas.length > 0), [
459
496
  B,
460
- A,
497
+ j,
461
498
  q
462
- ]), X = d(() => A === "all" ? V : V.map((e) => ({
499
+ ]), X = d(() => j === "all" ? V : V.map((e) => ({
463
500
  ...e,
464
501
  aggregatedQuotas: e.aggregatedQuotas.filter(q)
465
502
  })).filter((e) => e.aggregatedQuotas.length > 0), [
466
503
  V,
467
- A,
504
+ j,
468
505
  q
469
- ]), Z = d(() => N === "active" ? {
506
+ ]), Z = d(() => P === "active" ? {
470
507
  active: Y,
471
508
  past: []
472
- } : N === "past" ? {
509
+ } : P === "past" ? {
473
510
  active: [],
474
511
  past: X
475
512
  } : {
476
513
  active: Y,
477
514
  past: X
478
515
  }, [
479
- N,
516
+ P,
480
517
  Y,
481
518
  X
482
- ]), Q = b !== "" || A !== "all", ue = F !== b, de = () => {
483
- E(""), j("all");
519
+ ]), Q = b !== "" || j !== "all", fe = ae !== b, pe = () => {
520
+ E(""), M("all");
484
521
  }, $ = (e) => {
485
- j((t) => t === e ? "all" : e);
522
+ M((t) => t === e ? "all" : e);
486
523
  };
487
- if (!r.canViewUsage) return /* @__PURE__ */ O("div", {
524
+ if (!i.canViewUsage) return /* @__PURE__ */ O("div", {
488
525
  className: "flex items-center justify-center h-full min-h-[400px]",
489
526
  children: /* @__PURE__ */ k("div", {
490
527
  className: "text-center space-y-2",
@@ -504,7 +541,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
504
541
  ]
505
542
  })
506
543
  });
507
- if ((ae || se) && !R) return /* @__PURE__ */ k("div", {
544
+ if ((oe || le) && !R) return /* @__PURE__ */ k("div", {
508
545
  className: "space-y-6 p-6",
509
546
  children: [
510
547
  /* @__PURE__ */ O("div", { className: "h-8 w-48 bg-muted animate-pulse rounded" }),
@@ -545,7 +582,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
545
582
  ]
546
583
  })
547
584
  });
548
- let fe = I.find((e) => e.id === L);
585
+ let me = I.find((e) => e.id === L);
549
586
  return /* @__PURE__ */ k("div", {
550
587
  className: "space-y-6 p-6",
551
588
  children: [
@@ -553,7 +590,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
553
590
  className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
554
591
  children: [/* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("h1", {
555
592
  className: "text-2xl font-bold text-foreground",
556
- children: n("billing.usage.title", "Usage")
593
+ children: r("billing.usage.title", "Usage")
557
594
  }), /* @__PURE__ */ O("p", {
558
595
  className: "text-sm text-muted-foreground mt-1",
559
596
  children: "Monitor your resource consumption and quota usage"
@@ -561,7 +598,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
561
598
  className: "flex items-center gap-3",
562
599
  children: [I.length > 1 && /* @__PURE__ */ O("select", {
563
600
  value: L || "",
564
- onChange: (e) => c(e.target.value),
601
+ onChange: (e) => l(e.target.value),
565
602
  className: "px-3 py-2 text-sm border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary w-full sm:min-w-[200px]",
566
603
  children: I.map((e) => /* @__PURE__ */ O("option", {
567
604
  value: e.id,
@@ -586,101 +623,101 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
586
623
  type: "text",
587
624
  value: b,
588
625
  onChange: (e) => E(e.target.value),
589
- placeholder: `Search ${N === "past" ? "past" : N === "all" ? "all" : "active"} quotas...`,
626
+ placeholder: `Search ${P === "past" ? "past" : P === "all" ? "all" : "active"} quotas...`,
590
627
  className: "w-full pl-9 pr-3 py-2 text-sm border border-border rounded-md bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary"
591
628
  }),
592
- (b || ue) && /* @__PURE__ */ O("button", {
629
+ (b || fe) && /* @__PURE__ */ O("button", {
593
630
  onClick: () => E(""),
594
631
  className: "absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted/50",
595
- children: ue ? /* @__PURE__ */ O(C, { className: "w-3 h-3 text-muted-foreground animate-spin" }) : /* @__PURE__ */ O(T, { className: "w-3 h-3 text-muted-foreground" })
632
+ children: fe ? /* @__PURE__ */ O(C, { className: "w-3 h-3 text-muted-foreground animate-spin" }) : /* @__PURE__ */ O(T, { className: "w-3 h-3 text-muted-foreground" })
596
633
  })
597
634
  ]
598
635
  }),
599
636
  /* @__PURE__ */ k("div", {
600
637
  className: "flex items-center bg-muted/50 rounded-lg p-1 border border-border",
601
638
  children: [/* @__PURE__ */ k("button", {
602
- onClick: () => P("active"),
603
- className: `flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-all ${N === "active" ? "bg-background text-foreground shadow-sm font-medium" : "text-muted-foreground hover:text-foreground"}`,
639
+ onClick: () => F("active"),
640
+ className: `flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-all ${P === "active" ? "bg-background text-foreground shadow-sm font-medium" : "text-muted-foreground hover:text-foreground"}`,
604
641
  children: [/* @__PURE__ */ O(S, { className: "w-3.5 h-3.5" }), "Active"]
605
642
  }), /* @__PURE__ */ k("button", {
606
- onClick: () => P("past"),
607
- disabled: H && N !== "past",
608
- className: `flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-all ${N === "past" ? "bg-background text-foreground shadow-sm font-medium" : "text-muted-foreground hover:text-foreground"} ${H && N !== "past" ? "opacity-70" : ""}`,
609
- children: [H && N === "past" ? /* @__PURE__ */ O(C, { className: "w-3.5 h-3.5 animate-spin" }) : /* @__PURE__ */ O(y, { className: "w-3.5 h-3.5" }), "Past"]
643
+ onClick: () => F("past"),
644
+ disabled: H && P !== "past",
645
+ className: `flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-all ${P === "past" ? "bg-background text-foreground shadow-sm font-medium" : "text-muted-foreground hover:text-foreground"} ${H && P !== "past" ? "opacity-70" : ""}`,
646
+ children: [H && P === "past" ? /* @__PURE__ */ O(C, { className: "w-3.5 h-3.5 animate-spin" }) : /* @__PURE__ */ O(y, { className: "w-3.5 h-3.5" }), "Past"]
610
647
  })]
611
648
  }),
612
649
  Q && /* @__PURE__ */ k("button", {
613
- onClick: de,
650
+ onClick: pe,
614
651
  className: "flex items-center gap-1.5 px-3 py-1.5 text-sm text-muted-foreground hover:text-foreground border border-border rounded-md hover:bg-muted/50 transition-colors",
615
652
  children: [/* @__PURE__ */ O(T, { className: "w-3 h-3" }), "Clear filters"]
616
653
  })
617
654
  ]
618
655
  }),
619
- fe && /* @__PURE__ */ k("div", {
656
+ me && /* @__PURE__ */ k("div", {
620
657
  className: "text-sm text-muted-foreground",
621
658
  children: [
622
659
  "Viewing usage for",
623
660
  " ",
624
661
  /* @__PURE__ */ O("span", {
625
662
  className: "font-medium text-foreground",
626
- children: fe.name
663
+ children: me.name
627
664
  })
628
665
  ]
629
666
  }),
630
667
  R && /* @__PURE__ */ k("div", {
631
668
  className: "grid grid-cols-2 sm:grid-cols-4 gap-4",
632
669
  children: [
633
- /* @__PURE__ */ O(M, {
670
+ /* @__PURE__ */ O(N, {
634
671
  label: "Total Quotas",
635
672
  value: R.totalQuotas,
636
673
  icon: /* @__PURE__ */ O(x, { className: "w-5 h-5" }),
637
674
  color: "blue",
638
- isActive: A === "all",
639
- onClick: () => j("all")
675
+ isActive: j === "all",
676
+ onClick: () => M("all")
640
677
  }),
641
- /* @__PURE__ */ O(M, {
678
+ /* @__PURE__ */ O(N, {
642
679
  label: "Healthy",
643
680
  value: R.healthyQuotas,
644
681
  icon: /* @__PURE__ */ O(h, { className: "w-5 h-5" }),
645
682
  color: "emerald",
646
- isActive: A === "healthy",
683
+ isActive: j === "healthy",
647
684
  onClick: () => $("healthy")
648
685
  }),
649
- /* @__PURE__ */ O(M, {
686
+ /* @__PURE__ */ O(N, {
650
687
  label: "Warning",
651
688
  value: R.warningQuotas,
652
689
  icon: /* @__PURE__ */ O(p, { className: "w-5 h-5" }),
653
690
  color: "amber",
654
- isActive: A === "warning",
691
+ isActive: j === "warning",
655
692
  onClick: () => $("warning")
656
693
  }),
657
- /* @__PURE__ */ O(M, {
694
+ /* @__PURE__ */ O(N, {
658
695
  label: "Critical / Exhausted",
659
696
  value: R.criticalQuotas + R.exhaustedQuotas,
660
697
  icon: /* @__PURE__ */ O(m, { className: "w-5 h-5" }),
661
698
  color: "red",
662
- isActive: A === "critical",
699
+ isActive: j === "critical",
663
700
  onClick: () => $("critical")
664
701
  })
665
702
  ]
666
703
  }),
667
- (Q || N !== "active") && /* @__PURE__ */ k("div", {
704
+ (Q || P !== "active") && /* @__PURE__ */ k("div", {
668
705
  className: "flex items-center gap-2 text-sm text-muted-foreground flex-wrap",
669
706
  children: [
670
707
  /* @__PURE__ */ k("span", { children: [
671
708
  "Showing",
672
709
  " ",
673
- Z.active.reduce((e, t) => e + t.aggregatedQuotas.length, 0) + Z.past.reduce((e, t) => e + t.aggregatedQuotas.length, 0) + (N === "past" ? 0 : J.length),
710
+ Z.active.reduce((e, t) => e + t.aggregatedQuotas.length, 0) + Z.past.reduce((e, t) => e + t.aggregatedQuotas.length, 0) + (P === "past" ? 0 : J.length),
674
711
  " ",
675
712
  "quotas"
676
713
  ] }),
677
714
  /* @__PURE__ */ k("span", {
678
715
  className: "px-2 py-0.5 bg-primary/10 text-primary rounded text-xs capitalize",
679
- children: [N === "active" ? "Active" : N === "past" ? "Past" : "All", " subscriptions"]
716
+ children: [P === "active" ? "Active" : P === "past" ? "Past" : "All", " subscriptions"]
680
717
  }),
681
- A !== "all" && /* @__PURE__ */ O("span", {
718
+ j !== "all" && /* @__PURE__ */ O("span", {
682
719
  className: "px-2 py-0.5 bg-muted rounded text-xs capitalize",
683
- children: A === "critical" ? "Critical / Exhausted" : A
720
+ children: j === "critical" ? "Critical / Exhausted" : j
684
721
  }),
685
722
  b && /* @__PURE__ */ k("span", {
686
723
  className: "px-2 py-0.5 bg-muted rounded text-xs",
@@ -694,7 +731,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
694
731
  }),
695
732
  Z.active.length > 0 && /* @__PURE__ */ k("section", { children: [/* @__PURE__ */ k("h2", {
696
733
  className: "text-lg font-semibold text-foreground mb-4 flex items-center gap-2",
697
- children: [/* @__PURE__ */ O(S, { className: "w-5 h-5 text-primary" }), N === "all" ? "Active Subscription Quotas" : "Subscription Quotas"]
734
+ children: [/* @__PURE__ */ O(S, { className: "w-5 h-5 text-primary" }), P === "all" ? "Active Subscription Quotas" : "Subscription Quotas"]
698
735
  }), /* @__PURE__ */ O("div", {
699
736
  className: "space-y-4",
700
737
  children: Z.active.map((e) => /* @__PURE__ */ O(re, {
@@ -712,13 +749,13 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
712
749
  className: "text-xs font-normal text-muted-foreground",
713
750
  children: "(Canceled / Expired / Upgraded)"
714
751
  }),
715
- le > 0 && /* @__PURE__ */ k("span", {
752
+ K > 0 && /* @__PURE__ */ k("span", {
716
753
  className: "text-xs font-normal px-2 py-0.5 bg-muted rounded-full",
717
754
  children: [
718
755
  Z.past.length,
719
756
  G ? "+" : "",
720
757
  " of ",
721
- le
758
+ K
722
759
  ]
723
760
  })
724
761
  ]
@@ -727,18 +764,18 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
727
764
  children: [Z.past.map((e) => /* @__PURE__ */ O(re, {
728
765
  subscription: e,
729
766
  onQuotaClick: v,
730
- defaultExpanded: N === "past"
767
+ defaultExpanded: P === "past"
731
768
  }, e.id)), G && /* @__PURE__ */ O("div", {
732
769
  className: "flex justify-center pt-2",
733
770
  children: /* @__PURE__ */ O("button", {
734
- onClick: ce,
735
- disabled: K,
771
+ onClick: ue,
772
+ disabled: de,
736
773
  className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground border border-border rounded-md hover:bg-muted/50 transition-colors disabled:opacity-50",
737
- children: K ? /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(C, { className: "w-4 h-4 animate-spin" }), "Loading..."] }) : /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(g, { className: "w-4 h-4" }), "Load more past subscriptions"] })
774
+ children: de ? /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(C, { className: "w-4 h-4 animate-spin" }), "Loading..."] }) : /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(g, { className: "w-4 h-4" }), "Load more past subscriptions"] })
738
775
  })
739
776
  })]
740
777
  })] }),
741
- N !== "past" && J.length > 0 && /* @__PURE__ */ k("section", { children: [/* @__PURE__ */ k("h2", {
778
+ P !== "past" && J.length > 0 && /* @__PURE__ */ k("section", { children: [/* @__PURE__ */ k("h2", {
742
779
  className: "text-lg font-semibold text-foreground mb-4 flex items-center gap-2",
743
780
  children: [
744
781
  /* @__PURE__ */ O(x, { className: `w-5 h-5 ${t.info.icon}` }),
@@ -753,7 +790,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
753
790
  showPlanColumn: !1,
754
791
  onQuotaClick: v
755
792
  })] }),
756
- N === "active" && B.length === 0 && z.length === 0 && !Q && /* @__PURE__ */ k("div", {
793
+ P === "active" && B.length === 0 && z.length === 0 && !Q && /* @__PURE__ */ k("div", {
757
794
  className: "flex flex-col items-center justify-center py-12 border border-dashed border-border rounded-lg",
758
795
  children: [
759
796
  /* @__PURE__ */ O("div", {
@@ -770,7 +807,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
770
807
  })
771
808
  ]
772
809
  }),
773
- N === "past" && V.length === 0 && !Q && !H && /* @__PURE__ */ k("div", {
810
+ P === "past" && V.length === 0 && !Q && !H && /* @__PURE__ */ k("div", {
774
811
  className: "flex flex-col items-center justify-center py-12 border border-dashed border-border rounded-lg",
775
812
  children: [
776
813
  /* @__PURE__ */ O("div", {
@@ -786,13 +823,13 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
786
823
  children: "You don't have any canceled, expired, or upgraded subscriptions yet."
787
824
  }),
788
825
  /* @__PURE__ */ O("button", {
789
- onClick: () => P("active"),
826
+ onClick: () => F("active"),
790
827
  className: "mt-4 px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",
791
828
  children: "View active subscriptions"
792
829
  })
793
830
  ]
794
831
  }),
795
- N === "past" && H && /* @__PURE__ */ O("div", {
832
+ P === "past" && H && /* @__PURE__ */ O("div", {
796
833
  className: "space-y-4",
797
834
  children: [
798
835
  1,
@@ -800,23 +837,23 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
800
837
  3
801
838
  ].map((e) => /* @__PURE__ */ O("div", { className: "h-24 bg-muted animate-pulse rounded-lg" }, e))
802
839
  }),
803
- Q && Z.active.length === 0 && Z.past.length === 0 && (N === "past" || J.length === 0) && /* @__PURE__ */ k("div", {
840
+ Q && Z.active.length === 0 && Z.past.length === 0 && (P === "past" || J.length === 0) && /* @__PURE__ */ k("div", {
804
841
  className: "flex flex-col items-center justify-center py-12 border border-dashed border-border rounded-lg",
805
842
  children: [
806
843
  /* @__PURE__ */ O("div", {
807
844
  className: "w-12 h-12 rounded-full bg-muted flex items-center justify-center mb-4",
808
- children: A !== "all" && !b ? /* @__PURE__ */ O(te, {
809
- status: A === "healthy" ? "HEALTHY" : A === "warning" ? "WARNING" : "CRITICAL",
845
+ children: j !== "all" && !b ? /* @__PURE__ */ O(A, {
846
+ status: j === "healthy" ? "HEALTHY" : j === "warning" ? "WARNING" : "CRITICAL",
810
847
  className: "w-6 h-6"
811
848
  }) : /* @__PURE__ */ O(w, { className: "w-6 h-6 text-muted-foreground" })
812
849
  }),
813
850
  /* @__PURE__ */ O("h3", {
814
851
  className: "text-lg font-medium text-foreground",
815
- children: A !== "all" && !b ? `No ${A === "critical" ? "critical or exhausted" : A} quotas` : "No matching quotas"
852
+ children: j !== "all" && !b ? `No ${j === "critical" ? "critical or exhausted" : j} quotas` : "No matching quotas"
816
853
  }),
817
854
  /* @__PURE__ */ O("p", {
818
855
  className: "text-sm text-muted-foreground mt-1 text-center max-w-sm",
819
- children: A !== "all" && !b ? /* @__PURE__ */ k(D, { children: ["All your quotas are in a different status.", R && /* @__PURE__ */ k("span", {
856
+ children: j !== "all" && !b ? /* @__PURE__ */ k(D, { children: ["All your quotas are in a different status.", R && /* @__PURE__ */ k("span", {
820
857
  className: "block mt-1",
821
858
  children: [
822
859
  "You have ",
@@ -830,10 +867,10 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
830
867
  })] }) : /* @__PURE__ */ k(D, { children: [
831
868
  "No quotas match your current search or filter criteria in",
832
869
  " ",
833
- N === "past" ? "past" : N === "all" ? "any" : "active",
870
+ P === "past" ? "past" : P === "all" ? "any" : "active",
834
871
  " ",
835
872
  "subscriptions.",
836
- N === "active" && !A.includes("all") && /* @__PURE__ */ O("span", {
873
+ P === "active" && !j.includes("all") && /* @__PURE__ */ O("span", {
837
874
  className: "block mt-1",
838
875
  children: "Try switching to “Past” or “All” to search across more subscriptions."
839
876
  })
@@ -842,11 +879,11 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
842
879
  /* @__PURE__ */ k("div", {
843
880
  className: "flex gap-2 mt-4",
844
881
  children: [/* @__PURE__ */ O("button", {
845
- onClick: de,
882
+ onClick: pe,
846
883
  className: "px-4 py-2 text-sm font-medium border border-border rounded-md hover:bg-muted/50 transition-colors",
847
- children: A === "all" ? "Clear filters" : "Show all quotas"
848
- }), N === "active" && b && /* @__PURE__ */ O("button", {
849
- onClick: () => P("all"),
884
+ children: j === "all" ? "Clear filters" : "Show all quotas"
885
+ }), P === "active" && b && /* @__PURE__ */ O("button", {
886
+ onClick: () => F("all"),
850
887
  className: "px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",
851
888
  children: "Search all"
852
889
  })]
@@ -861,6 +898,6 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
861
898
  });
862
899
  };
863
900
  //#endregion
864
- export { P as UsagePage };
901
+ export { F as UsagePage };
865
902
 
866
903
  //# sourceMappingURL=UsagePage.js.map