@burdenoff/microfe-billing 2026.519.1 → 2026.520.1

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: [
@@ -373,7 +409,10 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
373
409
  className: "text-sm font-medium text-foreground mb-3",
374
410
  children: "Recent Usage"
375
411
  }),
376
- b ? /* @__PURE__ */ O("div", {
412
+ a.isCollectorBased ? /* @__PURE__ */ O("p", {
413
+ className: "text-sm text-muted-foreground text-center py-6",
414
+ children: "Usage is tracked via system metrics — individual event records are not available for this quota."
415
+ }) : b ? /* @__PURE__ */ O("div", {
377
416
  className: "space-y-2",
378
417
  children: [
379
418
  1,
@@ -406,11 +445,11 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
406
445
  })]
407
446
  }, e.id))
408
447
  }),
409
- (s.length > 1 || g) && /* @__PURE__ */ k("div", {
448
+ !a.isCollectorBased && (s.length > 1 || g) && /* @__PURE__ */ k("div", {
410
449
  className: "flex items-center justify-center gap-2 mt-4",
411
450
  children: [
412
451
  /* @__PURE__ */ O("button", {
413
- onClick: S,
452
+ onClick: w,
414
453
  disabled: s.length === 1,
415
454
  className: "px-3 py-1.5 text-sm border border-border rounded-md disabled:opacity-50",
416
455
  "aria-label": "Previous usage page",
@@ -421,7 +460,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
421
460
  children: ["Page ", d]
422
461
  }),
423
462
  /* @__PURE__ */ O("button", {
424
- onClick: x,
463
+ onClick: C,
425
464
  disabled: !g,
426
465
  className: "px-3 py-1.5 text-sm border border-border rounded-md disabled:opacity-50",
427
466
  "aria-label": "Next usage page",
@@ -442,49 +481,50 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
442
481
  ]
443
482
  })]
444
483
  });
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(() => {
484
+ }, F = () => {
485
+ let { t: n } = te(), r = (e, t) => {
486
+ let r = n(e);
487
+ return r === e ? t : r;
488
+ }, i = a(), [c, l] = f(() => {
450
489
  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({
490
+ }), [_, 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
491
  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) => ({
492
+ workspaceId: ce,
493
+ searchQuery: ae || void 0,
494
+ viewMode: P
495
+ }), 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
496
  ...e,
457
497
  aggregatedQuotas: e.aggregatedQuotas.filter(q)
458
498
  })).filter((e) => e.aggregatedQuotas.length > 0), [
459
499
  B,
460
- A,
500
+ j,
461
501
  q
462
- ]), X = d(() => A === "all" ? V : V.map((e) => ({
502
+ ]), X = d(() => j === "all" ? V : V.map((e) => ({
463
503
  ...e,
464
504
  aggregatedQuotas: e.aggregatedQuotas.filter(q)
465
505
  })).filter((e) => e.aggregatedQuotas.length > 0), [
466
506
  V,
467
- A,
507
+ j,
468
508
  q
469
- ]), Z = d(() => N === "active" ? {
509
+ ]), Z = d(() => P === "active" ? {
470
510
  active: Y,
471
511
  past: []
472
- } : N === "past" ? {
512
+ } : P === "past" ? {
473
513
  active: [],
474
514
  past: X
475
515
  } : {
476
516
  active: Y,
477
517
  past: X
478
518
  }, [
479
- N,
519
+ P,
480
520
  Y,
481
521
  X
482
- ]), Q = b !== "" || A !== "all", ue = F !== b, de = () => {
483
- E(""), j("all");
522
+ ]), Q = b !== "" || j !== "all", fe = ae !== b, pe = () => {
523
+ E(""), M("all");
484
524
  }, $ = (e) => {
485
- j((t) => t === e ? "all" : e);
525
+ M((t) => t === e ? "all" : e);
486
526
  };
487
- if (!r.canViewUsage) return /* @__PURE__ */ O("div", {
527
+ if (!i.canViewUsage) return /* @__PURE__ */ O("div", {
488
528
  className: "flex items-center justify-center h-full min-h-[400px]",
489
529
  children: /* @__PURE__ */ k("div", {
490
530
  className: "text-center space-y-2",
@@ -504,7 +544,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
504
544
  ]
505
545
  })
506
546
  });
507
- if ((ae || se) && !R) return /* @__PURE__ */ k("div", {
547
+ if ((oe || le) && !R) return /* @__PURE__ */ k("div", {
508
548
  className: "space-y-6 p-6",
509
549
  children: [
510
550
  /* @__PURE__ */ O("div", { className: "h-8 w-48 bg-muted animate-pulse rounded" }),
@@ -545,7 +585,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
545
585
  ]
546
586
  })
547
587
  });
548
- let fe = I.find((e) => e.id === L);
588
+ let me = I.find((e) => e.id === L);
549
589
  return /* @__PURE__ */ k("div", {
550
590
  className: "space-y-6 p-6",
551
591
  children: [
@@ -553,7 +593,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
553
593
  className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
554
594
  children: [/* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("h1", {
555
595
  className: "text-2xl font-bold text-foreground",
556
- children: n("billing.usage.title", "Usage")
596
+ children: r("billing.usage.title", "Usage")
557
597
  }), /* @__PURE__ */ O("p", {
558
598
  className: "text-sm text-muted-foreground mt-1",
559
599
  children: "Monitor your resource consumption and quota usage"
@@ -561,7 +601,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
561
601
  className: "flex items-center gap-3",
562
602
  children: [I.length > 1 && /* @__PURE__ */ O("select", {
563
603
  value: L || "",
564
- onChange: (e) => c(e.target.value),
604
+ onChange: (e) => l(e.target.value),
565
605
  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
606
  children: I.map((e) => /* @__PURE__ */ O("option", {
567
607
  value: e.id,
@@ -586,101 +626,101 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
586
626
  type: "text",
587
627
  value: b,
588
628
  onChange: (e) => E(e.target.value),
589
- placeholder: `Search ${N === "past" ? "past" : N === "all" ? "all" : "active"} quotas...`,
629
+ placeholder: `Search ${P === "past" ? "past" : P === "all" ? "all" : "active"} quotas...`,
590
630
  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
631
  }),
592
- (b || ue) && /* @__PURE__ */ O("button", {
632
+ (b || fe) && /* @__PURE__ */ O("button", {
593
633
  onClick: () => E(""),
594
634
  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" })
635
+ 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
636
  })
597
637
  ]
598
638
  }),
599
639
  /* @__PURE__ */ k("div", {
600
640
  className: "flex items-center bg-muted/50 rounded-lg p-1 border border-border",
601
641
  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"}`,
642
+ onClick: () => F("active"),
643
+ 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
644
  children: [/* @__PURE__ */ O(S, { className: "w-3.5 h-3.5" }), "Active"]
605
645
  }), /* @__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"]
646
+ onClick: () => F("past"),
647
+ disabled: H && P !== "past",
648
+ 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" : ""}`,
649
+ 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
650
  })]
611
651
  }),
612
652
  Q && /* @__PURE__ */ k("button", {
613
- onClick: de,
653
+ onClick: pe,
614
654
  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
655
  children: [/* @__PURE__ */ O(T, { className: "w-3 h-3" }), "Clear filters"]
616
656
  })
617
657
  ]
618
658
  }),
619
- fe && /* @__PURE__ */ k("div", {
659
+ me && /* @__PURE__ */ k("div", {
620
660
  className: "text-sm text-muted-foreground",
621
661
  children: [
622
662
  "Viewing usage for",
623
663
  " ",
624
664
  /* @__PURE__ */ O("span", {
625
665
  className: "font-medium text-foreground",
626
- children: fe.name
666
+ children: me.name
627
667
  })
628
668
  ]
629
669
  }),
630
670
  R && /* @__PURE__ */ k("div", {
631
671
  className: "grid grid-cols-2 sm:grid-cols-4 gap-4",
632
672
  children: [
633
- /* @__PURE__ */ O(M, {
673
+ /* @__PURE__ */ O(N, {
634
674
  label: "Total Quotas",
635
675
  value: R.totalQuotas,
636
676
  icon: /* @__PURE__ */ O(x, { className: "w-5 h-5" }),
637
677
  color: "blue",
638
- isActive: A === "all",
639
- onClick: () => j("all")
678
+ isActive: j === "all",
679
+ onClick: () => M("all")
640
680
  }),
641
- /* @__PURE__ */ O(M, {
681
+ /* @__PURE__ */ O(N, {
642
682
  label: "Healthy",
643
683
  value: R.healthyQuotas,
644
684
  icon: /* @__PURE__ */ O(h, { className: "w-5 h-5" }),
645
685
  color: "emerald",
646
- isActive: A === "healthy",
686
+ isActive: j === "healthy",
647
687
  onClick: () => $("healthy")
648
688
  }),
649
- /* @__PURE__ */ O(M, {
689
+ /* @__PURE__ */ O(N, {
650
690
  label: "Warning",
651
691
  value: R.warningQuotas,
652
692
  icon: /* @__PURE__ */ O(p, { className: "w-5 h-5" }),
653
693
  color: "amber",
654
- isActive: A === "warning",
694
+ isActive: j === "warning",
655
695
  onClick: () => $("warning")
656
696
  }),
657
- /* @__PURE__ */ O(M, {
697
+ /* @__PURE__ */ O(N, {
658
698
  label: "Critical / Exhausted",
659
699
  value: R.criticalQuotas + R.exhaustedQuotas,
660
700
  icon: /* @__PURE__ */ O(m, { className: "w-5 h-5" }),
661
701
  color: "red",
662
- isActive: A === "critical",
702
+ isActive: j === "critical",
663
703
  onClick: () => $("critical")
664
704
  })
665
705
  ]
666
706
  }),
667
- (Q || N !== "active") && /* @__PURE__ */ k("div", {
707
+ (Q || P !== "active") && /* @__PURE__ */ k("div", {
668
708
  className: "flex items-center gap-2 text-sm text-muted-foreground flex-wrap",
669
709
  children: [
670
710
  /* @__PURE__ */ k("span", { children: [
671
711
  "Showing",
672
712
  " ",
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),
713
+ 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
714
  " ",
675
715
  "quotas"
676
716
  ] }),
677
717
  /* @__PURE__ */ k("span", {
678
718
  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"]
719
+ children: [P === "active" ? "Active" : P === "past" ? "Past" : "All", " subscriptions"]
680
720
  }),
681
- A !== "all" && /* @__PURE__ */ O("span", {
721
+ j !== "all" && /* @__PURE__ */ O("span", {
682
722
  className: "px-2 py-0.5 bg-muted rounded text-xs capitalize",
683
- children: A === "critical" ? "Critical / Exhausted" : A
723
+ children: j === "critical" ? "Critical / Exhausted" : j
684
724
  }),
685
725
  b && /* @__PURE__ */ k("span", {
686
726
  className: "px-2 py-0.5 bg-muted rounded text-xs",
@@ -694,7 +734,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
694
734
  }),
695
735
  Z.active.length > 0 && /* @__PURE__ */ k("section", { children: [/* @__PURE__ */ k("h2", {
696
736
  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"]
737
+ children: [/* @__PURE__ */ O(S, { className: "w-5 h-5 text-primary" }), P === "all" ? "Active Subscription Quotas" : "Subscription Quotas"]
698
738
  }), /* @__PURE__ */ O("div", {
699
739
  className: "space-y-4",
700
740
  children: Z.active.map((e) => /* @__PURE__ */ O(re, {
@@ -712,13 +752,13 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
712
752
  className: "text-xs font-normal text-muted-foreground",
713
753
  children: "(Canceled / Expired / Upgraded)"
714
754
  }),
715
- le > 0 && /* @__PURE__ */ k("span", {
755
+ K > 0 && /* @__PURE__ */ k("span", {
716
756
  className: "text-xs font-normal px-2 py-0.5 bg-muted rounded-full",
717
757
  children: [
718
758
  Z.past.length,
719
759
  G ? "+" : "",
720
760
  " of ",
721
- le
761
+ K
722
762
  ]
723
763
  })
724
764
  ]
@@ -727,18 +767,18 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
727
767
  children: [Z.past.map((e) => /* @__PURE__ */ O(re, {
728
768
  subscription: e,
729
769
  onQuotaClick: v,
730
- defaultExpanded: N === "past"
770
+ defaultExpanded: P === "past"
731
771
  }, e.id)), G && /* @__PURE__ */ O("div", {
732
772
  className: "flex justify-center pt-2",
733
773
  children: /* @__PURE__ */ O("button", {
734
- onClick: ce,
735
- disabled: K,
774
+ onClick: ue,
775
+ disabled: de,
736
776
  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"] })
777
+ 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
778
  })
739
779
  })]
740
780
  })] }),
741
- N !== "past" && J.length > 0 && /* @__PURE__ */ k("section", { children: [/* @__PURE__ */ k("h2", {
781
+ P !== "past" && J.length > 0 && /* @__PURE__ */ k("section", { children: [/* @__PURE__ */ k("h2", {
742
782
  className: "text-lg font-semibold text-foreground mb-4 flex items-center gap-2",
743
783
  children: [
744
784
  /* @__PURE__ */ O(x, { className: `w-5 h-5 ${t.info.icon}` }),
@@ -753,7 +793,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
753
793
  showPlanColumn: !1,
754
794
  onQuotaClick: v
755
795
  })] }),
756
- N === "active" && B.length === 0 && z.length === 0 && !Q && /* @__PURE__ */ k("div", {
796
+ P === "active" && B.length === 0 && z.length === 0 && !Q && /* @__PURE__ */ k("div", {
757
797
  className: "flex flex-col items-center justify-center py-12 border border-dashed border-border rounded-lg",
758
798
  children: [
759
799
  /* @__PURE__ */ O("div", {
@@ -770,7 +810,7 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
770
810
  })
771
811
  ]
772
812
  }),
773
- N === "past" && V.length === 0 && !Q && !H && /* @__PURE__ */ k("div", {
813
+ P === "past" && V.length === 0 && !Q && !H && /* @__PURE__ */ k("div", {
774
814
  className: "flex flex-col items-center justify-center py-12 border border-dashed border-border rounded-lg",
775
815
  children: [
776
816
  /* @__PURE__ */ O("div", {
@@ -786,13 +826,13 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
786
826
  children: "You don't have any canceled, expired, or upgraded subscriptions yet."
787
827
  }),
788
828
  /* @__PURE__ */ O("button", {
789
- onClick: () => P("active"),
829
+ onClick: () => F("active"),
790
830
  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
831
  children: "View active subscriptions"
792
832
  })
793
833
  ]
794
834
  }),
795
- N === "past" && H && /* @__PURE__ */ O("div", {
835
+ P === "past" && H && /* @__PURE__ */ O("div", {
796
836
  className: "space-y-4",
797
837
  children: [
798
838
  1,
@@ -800,23 +840,23 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
800
840
  3
801
841
  ].map((e) => /* @__PURE__ */ O("div", { className: "h-24 bg-muted animate-pulse rounded-lg" }, e))
802
842
  }),
803
- Q && Z.active.length === 0 && Z.past.length === 0 && (N === "past" || J.length === 0) && /* @__PURE__ */ k("div", {
843
+ Q && Z.active.length === 0 && Z.past.length === 0 && (P === "past" || J.length === 0) && /* @__PURE__ */ k("div", {
804
844
  className: "flex flex-col items-center justify-center py-12 border border-dashed border-border rounded-lg",
805
845
  children: [
806
846
  /* @__PURE__ */ O("div", {
807
847
  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",
848
+ children: j !== "all" && !b ? /* @__PURE__ */ O(A, {
849
+ status: j === "healthy" ? "HEALTHY" : j === "warning" ? "WARNING" : "CRITICAL",
810
850
  className: "w-6 h-6"
811
851
  }) : /* @__PURE__ */ O(w, { className: "w-6 h-6 text-muted-foreground" })
812
852
  }),
813
853
  /* @__PURE__ */ O("h3", {
814
854
  className: "text-lg font-medium text-foreground",
815
- children: A !== "all" && !b ? `No ${A === "critical" ? "critical or exhausted" : A} quotas` : "No matching quotas"
855
+ children: j !== "all" && !b ? `No ${j === "critical" ? "critical or exhausted" : j} quotas` : "No matching quotas"
816
856
  }),
817
857
  /* @__PURE__ */ O("p", {
818
858
  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", {
859
+ children: j !== "all" && !b ? /* @__PURE__ */ k(D, { children: ["All your quotas are in a different status.", R && /* @__PURE__ */ k("span", {
820
860
  className: "block mt-1",
821
861
  children: [
822
862
  "You have ",
@@ -830,10 +870,10 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
830
870
  })] }) : /* @__PURE__ */ k(D, { children: [
831
871
  "No quotas match your current search or filter criteria in",
832
872
  " ",
833
- N === "past" ? "past" : N === "all" ? "any" : "active",
873
+ P === "past" ? "past" : P === "all" ? "any" : "active",
834
874
  " ",
835
875
  "subscriptions.",
836
- N === "active" && !A.includes("all") && /* @__PURE__ */ O("span", {
876
+ P === "active" && !j.includes("all") && /* @__PURE__ */ O("span", {
837
877
  className: "block mt-1",
838
878
  children: "Try switching to “Past” or “All” to search across more subscriptions."
839
879
  })
@@ -842,11 +882,11 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
842
882
  /* @__PURE__ */ k("div", {
843
883
  className: "flex gap-2 mt-4",
844
884
  children: [/* @__PURE__ */ O("button", {
845
- onClick: de,
885
+ onClick: pe,
846
886
  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"),
887
+ children: j === "all" ? "Clear filters" : "Show all quotas"
888
+ }), P === "active" && b && /* @__PURE__ */ O("button", {
889
+ onClick: () => F("all"),
850
890
  className: "px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",
851
891
  children: "Search all"
852
892
  })]
@@ -861,6 +901,6 @@ var te = ({ status: e, className: n = "w-4 h-4" }) => {
861
901
  });
862
902
  };
863
903
  //#endregion
864
- export { P as UsagePage };
904
+ export { F as UsagePage };
865
905
 
866
906
  //# sourceMappingURL=UsagePage.js.map