@burdenoff/microfe-billing 2026.604.2 → 2026.609.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,61 +2,71 @@ import { useBilling as e } from "../../../providers/BillingProvider.js";
2
2
  import { useBillingEventEmitter as t } from "../../../hooks/useBillingEventEmitter.js";
3
3
  import { useBillingAccountSelection as n } from "../../../hooks/useBillingAccountSelection.js";
4
4
  import { PricingModel as r } from "../../../shared/types/graphql.js";
5
- import { formatCurrency as i, formatDate as a, formatPercentage as o, formatPlanDuration as s, formatSubscriptionStatus as ee } from "../../../shared/utils/format.js";
6
- import { getQuotaProgressColor as c, getStatusBadgeClasses as te, getSubscriptionStatusColor as ne } from "../../../shared/utils/status.js";
7
- import { useBillingPermissions as l } from "../../../hooks/useBillingPermissions.js";
8
- import { useGetDefaultBillingAccountDashboardQuery as u } from "../../../../generated/global-operations.js";
9
- import { useBillingNavigate as re } from "../../../hooks/useBillingNavigate.js";
10
- import { withBillingAccountId as d } from "../../../shared/utils/navigation.js";
11
- import { WorkspaceQuotaAssignmentModal as ie } from "../../checkout/components/WorkspaceQuotaAssignmentModal.js";
12
- import { useSubscription as f, useSubscriptionMutations as p } from "../hooks/useSubscriptions.js";
5
+ import { formatBytes as i, formatCurrency as a, formatDate as o, formatPercentage as s, formatPlanDuration as c, formatSubscriptionStatus as l } from "../../../shared/utils/format.js";
6
+ import { getQuotaProgressColor as u, getStatusBadgeClasses as d, getSubscriptionStatusColor as f } from "../../../shared/utils/status.js";
7
+ import { useBillingPermissions as ee } from "../../../hooks/useBillingPermissions.js";
8
+ import { useGetDefaultBillingAccountDashboardQuery as p } from "../../../../generated/global-operations.js";
9
+ import { useBillingNavigate as te } from "../../../hooks/useBillingNavigate.js";
10
+ import { withBillingAccountId as m } from "../../../shared/utils/navigation.js";
11
+ import { useWorkspaceQuotaOverview as ne } from "../../usage/hooks/useUsage.js";
12
+ import { WorkspaceQuotaAssignmentModal as re } from "../../checkout/components/WorkspaceQuotaAssignmentModal.js";
13
+ import { useSubscription as h, useSubscriptionMutations as g } from "../hooks/useSubscriptions.js";
13
14
  import "../hooks/index.js";
14
- import { ManageSeatsModal as m } from "../components/ManageSeatsModal.js";
15
- import { useState as h } from "react";
16
- import { useParams as g } from "react-router-dom";
17
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
18
- import { useI18n as ae } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
15
+ import { ManageSeatsModal as ie } from "../components/ManageSeatsModal.js";
16
+ import { useState as _ } from "react";
17
+ import { useParams as ae } from "react-router-dom";
18
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
19
+ import { useI18n as b } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
19
20
  //#region src/billing/modules/subscriptions/pages/SubscriptionDetailPage.tsx
20
- var y = () => {
21
- let { t: o } = ae(), c = (e, t) => {
22
- let n = o(e);
21
+ function x(e, t) {
22
+ if (t?.displayName && typeof t.displayName == "string") return t.displayName;
23
+ if (t?.label && typeof t.label == "string") return t.label;
24
+ let n = e.split(".");
25
+ return (n.length > 1 ? n.slice(1) : n).map((e) => e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase())).join(" ");
26
+ }
27
+ function S(e) {
28
+ return e === "DAILY" ? "Resets daily" : e === "MONTHLY" ? "Resets monthly" : "";
29
+ }
30
+ var C = () => {
31
+ let { t: i } = b(), s = (e, t) => {
32
+ let n = i(e);
23
33
  return n === e ? t : n;
24
- }, { subscriptionId: y } = g(), w = re(), { emit: oe } = t(), { orgId: se } = e(), T = l(), { selectedAccountId: ce } = n({
25
- orgId: se,
34
+ }, { subscriptionId: u } = ae(), x = te(), { emit: S } = t(), { orgId: C } = e(), T = ee(), { selectedAccountId: ue } = n({
35
+ orgId: C,
26
36
  syncFromUrl: !0,
27
37
  urlParamName: "billingAccountId"
28
- }), { data: le } = u({ fetchPolicy: "cache-first" }), E = ce ?? le?.getDefaultBillingAccount?.id ?? void 0, { subscription: D, isLoading: ue, error: O, refetch: k } = f(y, E), { cancelSubscription: A, isCanceling: j, updateSubscriptionSeats: M, isUpdatingSeats: N } = p(), { workspaceId: P } = e(), [F, I] = h(!1), [L, R] = h(!1), [z, B] = h(!1), [V, H] = h(""), [U, W] = h(null), de = async () => {
38
+ }), { data: de } = p({ fetchPolicy: "cache-first" }), E = ue ?? de?.getDefaultBillingAccount?.id ?? void 0, { subscription: D, isLoading: fe, error: O, refetch: k } = h(u, E), { cancelSubscription: pe, isCanceling: A, updateSubscriptionSeats: me, isUpdatingSeats: he } = g(), { workspaceId: j } = e(), { overview: M, refetch: N } = ne(j ?? void 0), [P, F] = _(!1), [I, L] = _(!1), [ge, R] = _(!1), [z, B] = _(""), [V, H] = _(null), _e = async () => {
29
39
  if (D) {
30
- W(null);
40
+ H(null);
31
41
  try {
32
- await A({
42
+ await pe({
33
43
  billingAccountId: E ?? D.billingAccountId,
34
44
  subscriptionId: D.id,
35
- reason: V || "User requested cancellation"
36
- }), oe("billing.subscription.cancelled", {
45
+ reason: z || "User requested cancellation"
46
+ }), S("billing.subscription.cancelled", {
37
47
  route: "/billing/subscriptions",
38
48
  entityId: D.id,
39
49
  source: "subscription-detail",
40
- reason: V || "User requested cancellation"
41
- }), I(!1), H(""), await k();
50
+ reason: z || "User requested cancellation"
51
+ }), F(!1), B(""), await k();
42
52
  } catch (e) {
43
- W(e instanceof Error ? e.message : "Failed to cancel subscription");
53
+ H(e instanceof Error ? e.message : "Failed to cancel subscription");
44
54
  }
45
55
  }
46
56
  };
47
- if (!T.canViewSubscriptions) return /* @__PURE__ */ _("div", {
57
+ if (!T.canViewSubscriptions) return /* @__PURE__ */ v("div", {
48
58
  className: "flex items-center justify-center h-full min-h-[400px]",
49
- children: /* @__PURE__ */ v("div", {
59
+ children: /* @__PURE__ */ y("div", {
50
60
  className: "text-center space-y-2",
51
61
  children: [
52
- /* @__PURE__ */ _("div", {
62
+ /* @__PURE__ */ v("div", {
53
63
  className: "size-12 mx-auto rounded-full bg-muted flex items-center justify-center",
54
- children: /* @__PURE__ */ _("svg", {
64
+ children: /* @__PURE__ */ v("svg", {
55
65
  className: "size-6 text-muted-foreground",
56
66
  fill: "none",
57
67
  viewBox: "0 0 24 24",
58
68
  stroke: "currentColor",
59
- children: /* @__PURE__ */ _("path", {
69
+ children: /* @__PURE__ */ v("path", {
60
70
  strokeLinecap: "round",
61
71
  strokeLinejoin: "round",
62
72
  strokeWidth: 2,
@@ -64,46 +74,46 @@ var y = () => {
64
74
  })
65
75
  })
66
76
  }),
67
- /* @__PURE__ */ _("h2", {
77
+ /* @__PURE__ */ v("h2", {
68
78
  className: "text-lg font-semibold text-foreground",
69
79
  children: "Access Denied"
70
80
  }),
71
- /* @__PURE__ */ _("p", {
81
+ /* @__PURE__ */ v("p", {
72
82
  className: "text-sm text-muted-foreground max-w-sm",
73
83
  children: "You don't have permission to view this subscription."
74
84
  })
75
85
  ]
76
86
  })
77
87
  });
78
- if (ue) return /* @__PURE__ */ v("div", {
88
+ if (fe) return /* @__PURE__ */ y("div", {
79
89
  className: "space-y-6 p-6",
80
- children: [/* @__PURE__ */ v("div", {
90
+ children: [/* @__PURE__ */ y("div", {
81
91
  className: "flex items-center gap-4",
82
- children: [/* @__PURE__ */ _("div", { className: "size-10 bg-muted animate-pulse rounded" }), /* @__PURE__ */ _("div", { className: "h-8 w-48 bg-muted animate-pulse rounded" })]
83
- }), /* @__PURE__ */ _("div", {
92
+ children: [/* @__PURE__ */ v("div", { className: "size-10 bg-muted animate-pulse rounded" }), /* @__PURE__ */ v("div", { className: "h-8 w-48 bg-muted animate-pulse rounded" })]
93
+ }), /* @__PURE__ */ v("div", {
84
94
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
85
- children: /* @__PURE__ */ _("div", {
95
+ children: /* @__PURE__ */ v("div", {
86
96
  className: "lg:col-span-2 space-y-6",
87
- children: /* @__PURE__ */ v("div", {
97
+ children: /* @__PURE__ */ y("div", {
88
98
  className: "border border-border rounded-lg p-6 space-y-4",
89
- children: [/* @__PURE__ */ _("div", { className: "h-6 w-32 bg-muted animate-pulse rounded" }), /* @__PURE__ */ _("div", { className: "h-4 w-full bg-muted animate-pulse rounded" })]
99
+ children: [/* @__PURE__ */ v("div", { className: "h-6 w-32 bg-muted animate-pulse rounded" }), /* @__PURE__ */ v("div", { className: "h-4 w-full bg-muted animate-pulse rounded" })]
90
100
  })
91
101
  })
92
102
  })]
93
103
  });
94
- if (O || !D) return /* @__PURE__ */ _("div", {
104
+ if (O || !D) return /* @__PURE__ */ v("div", {
95
105
  className: "flex items-center justify-center h-full min-h-[400px]",
96
- children: /* @__PURE__ */ v("div", {
106
+ children: /* @__PURE__ */ y("div", {
97
107
  className: "text-center space-y-4",
98
108
  children: [
99
- /* @__PURE__ */ _("div", {
109
+ /* @__PURE__ */ v("div", {
100
110
  className: "size-12 mx-auto rounded-full bg-destructive/10 flex items-center justify-center",
101
- children: /* @__PURE__ */ _("svg", {
111
+ children: /* @__PURE__ */ v("svg", {
102
112
  className: "size-6 text-destructive",
103
113
  fill: "none",
104
114
  viewBox: "0 0 24 24",
105
115
  stroke: "currentColor",
106
- children: /* @__PURE__ */ _("path", {
116
+ children: /* @__PURE__ */ v("path", {
107
117
  strokeLinecap: "round",
108
118
  strokeLinejoin: "round",
109
119
  strokeWidth: 2,
@@ -111,239 +121,274 @@ var y = () => {
111
121
  })
112
122
  })
113
123
  }),
114
- /* @__PURE__ */ _("h2", {
124
+ /* @__PURE__ */ v("h2", {
115
125
  className: "text-lg font-semibold text-foreground",
116
- children: c("billing.subscriptions.notFound", "Subscription not found")
126
+ children: s("billing.subscriptions.notFound", "Subscription not found")
117
127
  }),
118
- /* @__PURE__ */ _("p", {
128
+ /* @__PURE__ */ v("p", {
119
129
  className: "text-sm text-muted-foreground",
120
130
  children: O?.message || "The subscription you are looking for does not exist."
121
131
  }),
122
- /* @__PURE__ */ _("button", {
132
+ /* @__PURE__ */ v("button", {
123
133
  type: "button",
124
- onClick: () => w(d("/subscriptions", E)),
134
+ onClick: () => x(m("/subscriptions", E)),
125
135
  className: "px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",
126
136
  children: "Back to Subscriptions"
127
137
  })
128
138
  ]
129
139
  })
130
140
  });
131
- let G = D.plan, K = D.quotas || [], q = D.addonSubscriptions || [], J = D.transactions || [], Y = D.history || [], fe = ne(D.status), X = D.status === "active", Z = new Date(D.endDate), pe = new Date(D.startDate), me = /* @__PURE__ */ new Date(), Q = Math.ceil((Z.getTime() - pe.getTime()) / (1e3 * 60 * 60 * 24)), $ = Math.max(0, Math.ceil((Z.getTime() - me.getTime()) / (1e3 * 60 * 60 * 24))), he = Math.round((Q - $) / Q * 100);
132
- return /* @__PURE__ */ v("div", {
141
+ let U = D.plan, W = D.quotas || [], G = D.addonSubscriptions || [], K = D.transactions || [], q = D.history || [], ve = f(D.status), J = D.status === "active", Y = M.filter((e) => e.assignment.subscriptionId === D.id && e.assignment.isActive), X = !!D.assignedWorkspaceId || Y.length > 0, Z = new Date(D.endDate), ye = new Date(D.startDate), be = /* @__PURE__ */ new Date(), Q = Math.ceil((Z.getTime() - ye.getTime()) / (1e3 * 60 * 60 * 24)), $ = Math.max(0, Math.ceil((Z.getTime() - be.getTime()) / (1e3 * 60 * 60 * 24))), xe = Math.round((Q - $) / Q * 100);
142
+ return /* @__PURE__ */ y("div", {
133
143
  className: "space-y-6 p-6",
134
144
  children: [
135
- /* @__PURE__ */ v("div", {
145
+ /* @__PURE__ */ y("div", {
136
146
  className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",
137
- children: [/* @__PURE__ */ v("div", {
147
+ children: [/* @__PURE__ */ y("div", {
138
148
  className: "flex items-start gap-4",
139
- children: [/* @__PURE__ */ _("button", {
149
+ children: [/* @__PURE__ */ v("button", {
140
150
  type: "button",
141
- onClick: () => w(d("/subscriptions", E)),
151
+ onClick: () => x(m("/subscriptions", E)),
142
152
  className: "p-2 -ml-2 text-muted-foreground hover:text-foreground hover:bg-muted rounded-md transition-colors",
143
- children: /* @__PURE__ */ _("svg", {
153
+ children: /* @__PURE__ */ v("svg", {
144
154
  className: "size-5",
145
155
  fill: "none",
146
156
  viewBox: "0 0 24 24",
147
157
  stroke: "currentColor",
148
- children: /* @__PURE__ */ _("path", {
158
+ children: /* @__PURE__ */ v("path", {
149
159
  strokeLinecap: "round",
150
160
  strokeLinejoin: "round",
151
161
  strokeWidth: 2,
152
162
  d: "M15 19l-7-7 7-7"
153
163
  })
154
164
  })
155
- }), /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ v("div", {
165
+ }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ y("div", {
156
166
  className: "flex items-center gap-3",
157
- children: [/* @__PURE__ */ _("h1", {
167
+ children: [/* @__PURE__ */ v("h1", {
158
168
  className: "text-2xl font-bold text-foreground",
159
- children: G?.name || "Subscription"
160
- }), /* @__PURE__ */ _("span", {
161
- className: `px-2 py-1 text-xs font-medium rounded ${te(fe)}`,
162
- children: ee(D.status)
169
+ children: U?.name || "Subscription"
170
+ }), /* @__PURE__ */ v("span", {
171
+ className: `px-2 py-1 text-xs font-medium rounded ${d(ve)}`,
172
+ children: l(D.status)
163
173
  })]
164
- }), /* @__PURE__ */ _("p", {
174
+ }), /* @__PURE__ */ v("p", {
165
175
  className: "text-sm text-muted-foreground mt-1",
166
- children: G?.pricingModel === r.PER_SEAT && G.pricePerSeat ? `${i(G.pricePerSeat, G.currency)} / seat / ${s(G.duration)} · ${D.seatCount ?? G.minSeats ?? 1} seats = ${i(G.pricePerSeat * (D.seatCount ?? G.minSeats ?? 1), G.currency)} / ${s(G.duration)}` : G ? `${i(G.price, G.currency)} / ${s(G.duration)}` : "Unknown plan"
176
+ children: U?.pricingModel === r.PER_SEAT && U.pricePerSeat ? `${a(U.pricePerSeat, U.currency)} / seat / ${c(U.duration)} · ${D.seatCount ?? U.minSeats ?? 1} seats = ${a(U.pricePerSeat * (D.seatCount ?? U.minSeats ?? 1), U.currency)} / ${c(U.duration)}` : U ? `${a(U.price, U.currency)} / ${c(U.duration)}` : "Unknown plan"
167
177
  })] })]
168
- }), /* @__PURE__ */ v("div", {
178
+ }), /* @__PURE__ */ y("div", {
169
179
  className: "flex items-center gap-2",
170
180
  children: [
171
- X && T.canUpdateSubscription && G?.pricingModel === r.PER_SEAT && /* @__PURE__ */ _("button", {
181
+ J && T.canUpdateSubscription && U?.pricingModel === r.PER_SEAT && /* @__PURE__ */ v("button", {
172
182
  type: "button",
173
- onClick: () => R(!0),
183
+ onClick: () => L(!0),
174
184
  className: "px-4 py-2 text-sm font-medium border border-border rounded-md hover:bg-accent text-foreground transition-colors",
175
185
  children: "Manage Seats"
176
186
  }),
177
- X && T.canUpdateSubscription && /* @__PURE__ */ _("button", {
187
+ J && T.canUpdateSubscription && /* @__PURE__ */ v("button", {
178
188
  type: "button",
179
- onClick: () => w(d(`/subscriptions/${D.id}/upgrade`, E ?? D.billingAccountId)),
189
+ onClick: () => x(m(`/subscriptions/${D.id}/upgrade`, E ?? D.billingAccountId)),
180
190
  className: "px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",
181
191
  children: "Change Plan"
182
192
  }),
183
- X && T.canCancelSubscription && !D.canceledAt && /* @__PURE__ */ _("button", {
193
+ J && T.canCancelSubscription && !D.canceledAt && /* @__PURE__ */ v("button", {
184
194
  type: "button",
185
- onClick: () => I(!0),
186
- disabled: j,
195
+ onClick: () => F(!0),
196
+ disabled: A,
187
197
  className: "px-4 py-2 text-sm font-medium border border-border text-destructive rounded-md hover:bg-destructive/10 transition-colors disabled:opacity-50",
188
- children: j ? "Canceling..." : "Cancel Subscription"
198
+ children: A ? "Canceling..." : "Cancel Subscription"
189
199
  }),
190
- D.canceledAt && /* @__PURE__ */ _("span", {
200
+ D.canceledAt && /* @__PURE__ */ v("span", {
191
201
  className: "px-4 py-2 text-sm font-medium text-status-warning-text bg-status-warning-bg-subtle rounded-md",
192
202
  children: "Cancellation Scheduled"
193
203
  })
194
204
  ]
195
205
  })]
196
206
  }),
197
- /* @__PURE__ */ v("div", {
207
+ /* @__PURE__ */ y("div", {
198
208
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
199
- children: [/* @__PURE__ */ v("div", {
209
+ children: [/* @__PURE__ */ y("div", {
200
210
  className: "lg:col-span-2 space-y-6",
201
211
  children: [
202
- X && /* @__PURE__ */ v("div", {
212
+ J && /* @__PURE__ */ y("div", {
203
213
  className: "border border-border rounded-lg bg-card p-6",
204
- children: [/* @__PURE__ */ v("div", {
214
+ children: [/* @__PURE__ */ y("div", {
205
215
  className: "flex items-center justify-between mb-4",
206
- children: [/* @__PURE__ */ _("h2", {
216
+ children: [/* @__PURE__ */ v("h2", {
207
217
  className: "text-lg font-semibold text-foreground",
208
218
  children: "Current Period"
209
- }), /* @__PURE__ */ v("span", {
219
+ }), /* @__PURE__ */ y("span", {
210
220
  className: "text-sm text-muted-foreground",
211
221
  children: [$, " days remaining"]
212
222
  })]
213
- }), /* @__PURE__ */ v("div", {
223
+ }), /* @__PURE__ */ y("div", {
214
224
  className: "space-y-2",
215
- children: [/* @__PURE__ */ _("div", {
225
+ children: [/* @__PURE__ */ v("div", {
216
226
  className: "h-2 rounded-full bg-muted overflow-hidden",
217
- children: /* @__PURE__ */ _("div", {
227
+ children: /* @__PURE__ */ v("div", {
218
228
  className: "h-full bg-primary transition-all duration-300",
219
- style: { width: `${he}%` }
229
+ style: { width: `${xe}%` }
220
230
  })
221
- }), /* @__PURE__ */ v("div", {
231
+ }), /* @__PURE__ */ y("div", {
222
232
  className: "flex items-center justify-between text-sm text-muted-foreground",
223
- children: [/* @__PURE__ */ _("span", { children: a(D.startDate, "short") }), /* @__PURE__ */ _("span", { children: a(D.endDate, "short") })]
233
+ children: [/* @__PURE__ */ v("span", { children: o(D.startDate, "short") }), /* @__PURE__ */ v("span", { children: o(D.endDate, "short") })]
224
234
  })]
225
235
  })]
226
236
  }),
227
- /* @__PURE__ */ v("div", {
237
+ /* @__PURE__ */ y("div", {
228
238
  className: "border border-border rounded-lg bg-card overflow-hidden",
229
- children: [/* @__PURE__ */ _("div", {
239
+ children: [/* @__PURE__ */ y("div", {
230
240
  className: "p-6 border-b border-border bg-muted/30",
231
- children: /* @__PURE__ */ v("h2", {
241
+ children: [/* @__PURE__ */ y("h2", {
232
242
  className: "text-lg font-semibold text-foreground",
233
- children: [
234
- "Quota Usage (",
235
- K.length,
236
- ")"
237
- ]
238
- })
239
- }), /* @__PURE__ */ _("div", {
243
+ children: ["Plan Quotas", W.length > 0 && /* @__PURE__ */ y("span", {
244
+ className: "ml-2 text-sm font-normal text-muted-foreground",
245
+ children: [
246
+ "(",
247
+ W.length,
248
+ ")"
249
+ ]
250
+ })]
251
+ }), /* @__PURE__ */ v("p", {
252
+ className: "text-sm text-muted-foreground mt-0.5",
253
+ children: "Limits included in your plan"
254
+ })]
255
+ }), /* @__PURE__ */ v("div", {
240
256
  className: "p-6",
241
- children: K.length === 0 ? /* @__PURE__ */ _("p", {
257
+ children: W.length === 0 ? /* @__PURE__ */ v("p", {
242
258
  className: "text-sm text-muted-foreground",
243
259
  children: "No quotas assigned to this subscription."
244
- }) : /* @__PURE__ */ _("div", {
245
- className: "space-y-4",
246
- children: K.map((e) => /* @__PURE__ */ _(b, { quota: e }, e.id))
260
+ }) : /* @__PURE__ */ v("div", {
261
+ className: "space-y-3",
262
+ children: W.map((e) => /* @__PURE__ */ v(oe, { quota: e }, e.id))
247
263
  })
248
264
  })]
249
265
  }),
250
- X && P && (() => {
251
- let e = D.assignedWorkspaceId ?? null;
252
- return /* @__PURE__ */ v("div", {
253
- className: "border border-border rounded-lg bg-card overflow-hidden",
254
- children: [
255
- /* @__PURE__ */ v("div", {
256
- className: "p-6 border-b border-border bg-muted/30 flex items-center justify-between",
257
- children: [/* @__PURE__ */ _("h2", {
258
- className: "text-lg font-semibold text-foreground",
259
- children: "Workspace Quota Assignment"
260
- }), !e && /* @__PURE__ */ _("button", {
261
- type: "button",
262
- onClick: () => B(!0),
263
- className: "px-3 py-1.5 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",
264
- children: "Assign to Workspace"
265
- })]
266
- }),
267
- /* @__PURE__ */ _("div", {
268
- className: "p-6",
269
- children: e ? /* @__PURE__ */ v("p", {
270
- className: "text-sm text-muted-foreground",
266
+ J && j && /* @__PURE__ */ y("div", {
267
+ className: "border border-border rounded-lg bg-card overflow-hidden",
268
+ children: [
269
+ /* @__PURE__ */ y("div", {
270
+ className: "p-6 border-b border-border bg-muted/30 flex items-center justify-between",
271
+ children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("h2", {
272
+ className: "text-lg font-semibold text-foreground",
273
+ children: "Workspace Quotas"
274
+ }), /* @__PURE__ */ v("p", {
275
+ className: "text-sm text-muted-foreground mt-0.5",
276
+ children: "Active limits for your workspace"
277
+ })] }), X ? /* @__PURE__ */ y("span", {
278
+ className: "flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full bg-status-success-bg-subtle text-status-success-text",
279
+ children: [/* @__PURE__ */ v("span", { className: "size-1.5 rounded-full bg-status-success-text inline-block" }), "Active"]
280
+ }) : /* @__PURE__ */ v("button", {
281
+ type: "button",
282
+ onClick: () => R(!0),
283
+ className: "px-3 py-1.5 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",
284
+ children: "Activate for Workspace"
285
+ })]
286
+ }),
287
+ /* @__PURE__ */ v("div", {
288
+ className: "p-6",
289
+ children: X ? Y.length > 0 ? /* @__PURE__ */ v("div", {
290
+ className: "space-y-3",
291
+ children: Y.map((e) => /* @__PURE__ */ v(se, { item: e }, e.assignment.id))
292
+ }) : /* @__PURE__ */ y("p", {
293
+ className: "text-sm text-muted-foreground",
294
+ children: [
295
+ "Quotas are activated on workspace",
296
+ " ",
297
+ /* @__PURE__ */ v("span", {
298
+ className: "font-mono text-xs text-foreground",
299
+ children: D.assignedWorkspaceId
300
+ }),
301
+ ". Usage data will appear here once quotas are consumed."
302
+ ]
303
+ }) : /* @__PURE__ */ y("div", {
304
+ className: "flex items-start gap-3",
305
+ children: [/* @__PURE__ */ v("div", {
306
+ className: "size-8 rounded-full bg-status-warning-bg-subtle flex items-center justify-center shrink-0 mt-0.5",
307
+ children: /* @__PURE__ */ v("svg", {
308
+ className: "size-4 text-status-warning-text",
309
+ fill: "none",
310
+ viewBox: "0 0 24 24",
311
+ stroke: "currentColor",
312
+ children: /* @__PURE__ */ v("path", {
313
+ strokeLinecap: "round",
314
+ strokeLinejoin: "round",
315
+ strokeWidth: 2,
316
+ d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
317
+ })
318
+ })
319
+ }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
320
+ className: "text-sm font-medium text-foreground",
321
+ children: "Workspace quotas not activated yet"
322
+ }), /* @__PURE__ */ y("p", {
323
+ className: "text-sm text-muted-foreground mt-0.5",
271
324
  children: [
272
- "Workspace quotas are active on workspace",
325
+ "Click",
273
326
  " ",
274
- /* @__PURE__ */ _("span", {
275
- className: "font-medium text-foreground font-mono text-xs",
276
- children: e
327
+ /* @__PURE__ */ v("button", {
328
+ type: "button",
329
+ onClick: () => R(!0),
330
+ className: "text-primary hover:underline font-medium",
331
+ children: "Activate for Workspace"
277
332
  }),
278
- "."
279
- ]
280
- }) : /* @__PURE__ */ v("p", {
281
- className: "text-sm text-muted-foreground",
282
- children: [
283
- "The workspace quotas included in this plan haven't been activated yet. Click",
284
333
  " ",
285
- /* @__PURE__ */ _("span", {
286
- className: "font-medium text-foreground",
287
- children: "Assign to Workspace"
288
- }),
289
- " to activate them."
334
+ "to enable the workspace-scoped limits included in this plan."
290
335
  ]
291
- })
292
- }),
293
- z && /* @__PURE__ */ _(ie, {
294
- billingAccountId: E ?? D.billingAccountId,
295
- subscriptionId: D.id,
296
- quotas: [],
297
- workspaces: [{
298
- id: P,
299
- name: "Current workspace"
300
- }],
301
- currentWorkspaceId: P,
302
- onAssigned: () => {
303
- B(!1), k();
304
- },
305
- onSkip: () => B(!1)
336
+ })] })]
306
337
  })
307
- ]
308
- });
309
- })(),
310
- q.length > 0 && /* @__PURE__ */ v("div", {
338
+ }),
339
+ ge && /* @__PURE__ */ v(re, {
340
+ billingAccountId: E ?? D.billingAccountId,
341
+ subscriptionId: D.id,
342
+ quotas: [],
343
+ workspaces: [{
344
+ id: j,
345
+ name: "Current workspace"
346
+ }],
347
+ currentWorkspaceId: j,
348
+ onAssigned: () => {
349
+ R(!1), k(), N();
350
+ },
351
+ onSkip: () => R(!1)
352
+ })
353
+ ]
354
+ }),
355
+ G.length > 0 && /* @__PURE__ */ y("div", {
311
356
  className: "border border-border rounded-lg bg-card overflow-hidden",
312
- children: [/* @__PURE__ */ _("div", {
357
+ children: [/* @__PURE__ */ v("div", {
313
358
  className: "p-6 border-b border-border bg-muted/30",
314
- children: /* @__PURE__ */ v("h2", {
359
+ children: /* @__PURE__ */ y("h2", {
315
360
  className: "text-lg font-semibold text-foreground",
316
361
  children: [
317
362
  "Addons (",
318
- q.length,
363
+ G.length,
319
364
  ")"
320
365
  ]
321
366
  })
322
- }), /* @__PURE__ */ _("div", {
367
+ }), /* @__PURE__ */ v("div", {
323
368
  className: "p-6",
324
- children: /* @__PURE__ */ _("div", {
369
+ children: /* @__PURE__ */ v("div", {
325
370
  className: "space-y-3",
326
- children: q.map((e) => /* @__PURE__ */ _(x, { addonSubscription: e }, e.id))
371
+ children: G.map((e) => /* @__PURE__ */ v(ce, { addonSubscription: e }, e.id))
327
372
  })
328
373
  })]
329
374
  }),
330
- J.length > 0 && /* @__PURE__ */ v("div", {
375
+ K.length > 0 && /* @__PURE__ */ y("div", {
331
376
  className: "border border-border rounded-lg bg-card overflow-hidden",
332
377
  children: [
333
- /* @__PURE__ */ _("div", {
378
+ /* @__PURE__ */ v("div", {
334
379
  className: "p-6 border-b border-border bg-muted/30",
335
- children: /* @__PURE__ */ _("h2", {
380
+ children: /* @__PURE__ */ v("h2", {
336
381
  className: "text-lg font-semibold text-foreground",
337
382
  children: "Recent Transactions"
338
383
  })
339
384
  }),
340
- /* @__PURE__ */ _("div", {
385
+ /* @__PURE__ */ v("div", {
341
386
  className: "divide-y divide-border",
342
- children: J.slice(0, 5).map((e) => /* @__PURE__ */ _(S, { transaction: e }, e.id))
387
+ children: K.slice(0, 5).map((e) => /* @__PURE__ */ v(w, { transaction: e }, e.id))
343
388
  }),
344
- J.length > 5 && /* @__PURE__ */ _("div", {
389
+ K.length > 5 && /* @__PURE__ */ v("div", {
345
390
  className: "p-4 text-center border-t border-border",
346
- children: /* @__PURE__ */ _("button", {
391
+ children: /* @__PURE__ */ v("button", {
347
392
  type: "button",
348
393
  className: "text-sm text-primary hover:underline",
349
394
  children: "View all transactions"
@@ -352,169 +397,169 @@ var y = () => {
352
397
  ]
353
398
  })
354
399
  ]
355
- }), /* @__PURE__ */ v("div", {
400
+ }), /* @__PURE__ */ y("div", {
356
401
  className: "space-y-6",
357
- children: [/* @__PURE__ */ v("div", {
402
+ children: [/* @__PURE__ */ y("div", {
358
403
  className: "border border-border rounded-lg bg-card overflow-hidden",
359
- children: [/* @__PURE__ */ _("div", {
404
+ children: [/* @__PURE__ */ v("div", {
360
405
  className: "p-6 border-b border-border bg-muted/30",
361
- children: /* @__PURE__ */ _("h2", {
406
+ children: /* @__PURE__ */ v("h2", {
362
407
  className: "text-lg font-semibold text-foreground",
363
408
  children: "Details"
364
409
  })
365
- }), /* @__PURE__ */ v("div", {
410
+ }), /* @__PURE__ */ y("div", {
366
411
  className: "p-6 space-y-4",
367
412
  children: [
368
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
413
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
369
414
  className: "text-sm text-muted-foreground",
370
415
  children: "Subscription ID"
371
- }), /* @__PURE__ */ _("p", {
416
+ }), /* @__PURE__ */ v("p", {
372
417
  className: "font-mono text-sm text-foreground mt-0.5 break-all",
373
418
  children: D.id
374
419
  })] }),
375
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
420
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
376
421
  className: "text-sm text-muted-foreground",
377
422
  children: "Plan"
378
- }), /* @__PURE__ */ _("p", {
423
+ }), /* @__PURE__ */ v("p", {
379
424
  className: "text-sm text-foreground mt-0.5",
380
- children: G?.name || "Unknown"
425
+ children: U?.name || "Unknown"
381
426
  })] }),
382
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
427
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
383
428
  className: "text-sm text-muted-foreground",
384
429
  children: "Billing Account"
385
- }), /* @__PURE__ */ _("p", {
430
+ }), /* @__PURE__ */ v("p", {
386
431
  className: "text-sm text-foreground mt-0.5",
387
432
  children: D.billingAccount?.name || "Unknown"
388
433
  })] }),
389
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
434
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
390
435
  className: "text-sm text-muted-foreground",
391
436
  children: "Start Date"
392
- }), /* @__PURE__ */ _("p", {
437
+ }), /* @__PURE__ */ v("p", {
393
438
  className: "text-sm text-foreground mt-0.5",
394
- children: a(D.startDate)
439
+ children: o(D.startDate)
395
440
  })] }),
396
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
441
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
397
442
  className: "text-sm text-muted-foreground",
398
443
  children: "End Date"
399
- }), /* @__PURE__ */ _("p", {
444
+ }), /* @__PURE__ */ v("p", {
400
445
  className: "text-sm text-foreground mt-0.5",
401
- children: a(D.endDate)
446
+ children: o(D.endDate)
402
447
  })] }),
403
- D.nextBillingDate && /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
448
+ D.nextBillingDate && /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
404
449
  className: "text-sm text-muted-foreground",
405
450
  children: "Next Billing"
406
- }), /* @__PURE__ */ _("p", {
451
+ }), /* @__PURE__ */ v("p", {
407
452
  className: "text-sm text-foreground mt-0.5",
408
- children: a(D.nextBillingDate)
453
+ children: o(D.nextBillingDate)
409
454
  })] }),
410
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
455
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
411
456
  className: "text-sm text-muted-foreground",
412
457
  children: "Auto Renewal"
413
- }), /* @__PURE__ */ _("p", {
458
+ }), /* @__PURE__ */ v("p", {
414
459
  className: "text-sm text-foreground mt-0.5",
415
460
  children: D.autoRenewal ? "Enabled" : "Disabled"
416
461
  })] }),
417
- D.paymentGateway && /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
462
+ D.paymentGateway && /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
418
463
  className: "text-sm text-muted-foreground",
419
464
  children: "Payment Gateway"
420
- }), /* @__PURE__ */ _("p", {
465
+ }), /* @__PURE__ */ v("p", {
421
466
  className: "text-sm text-foreground mt-0.5 capitalize",
422
467
  children: D.paymentGateway
423
468
  })] })
424
469
  ]
425
470
  })]
426
- }), Y.length > 0 && /* @__PURE__ */ v("div", {
471
+ }), q.length > 0 && /* @__PURE__ */ y("div", {
427
472
  className: "border border-border rounded-lg bg-card overflow-hidden",
428
- children: [/* @__PURE__ */ _("div", {
473
+ children: [/* @__PURE__ */ v("div", {
429
474
  className: "p-6 border-b border-border bg-muted/30",
430
- children: /* @__PURE__ */ _("h2", {
475
+ children: /* @__PURE__ */ v("h2", {
431
476
  className: "text-lg font-semibold text-foreground",
432
477
  children: "History"
433
478
  })
434
- }), /* @__PURE__ */ _("div", {
479
+ }), /* @__PURE__ */ v("div", {
435
480
  className: "p-6",
436
- children: /* @__PURE__ */ _("div", {
481
+ children: /* @__PURE__ */ v("div", {
437
482
  className: "space-y-3",
438
- children: Y.slice(0, 5).map((e) => /* @__PURE__ */ _(C, { item: e }, e.id))
483
+ children: q.slice(0, 5).map((e) => /* @__PURE__ */ v(le, { item: e }, e.id))
439
484
  })
440
485
  })]
441
486
  })]
442
487
  })]
443
488
  }),
444
- L && D && /* @__PURE__ */ _(m, {
489
+ I && D && /* @__PURE__ */ v(ie, {
445
490
  subscription: D,
446
- onClose: () => R(!1),
491
+ onClose: () => L(!1),
447
492
  onConfirm: async (e) => {
448
- await M({
493
+ await me({
449
494
  subscriptionId: D.id,
450
495
  seatCount: e
451
496
  }), await k();
452
497
  },
453
- isLoading: N
498
+ isLoading: he
454
499
  }),
455
- F && /* @__PURE__ */ v("div", {
500
+ P && /* @__PURE__ */ y("div", {
456
501
  className: "fixed inset-0 z-50 flex items-center justify-center",
457
- children: [/* @__PURE__ */ _("div", {
502
+ children: [/* @__PURE__ */ v("div", {
458
503
  className: "absolute inset-0 bg-overlay-scrim",
459
- onClick: () => I(!1)
460
- }), /* @__PURE__ */ v("div", {
504
+ onClick: () => F(!1)
505
+ }), /* @__PURE__ */ y("div", {
461
506
  className: "relative bg-card border border-border rounded-lg shadow-lg w-full max-w-md mx-4 p-6",
462
507
  role: "dialog",
463
508
  "aria-modal": "true",
464
509
  "aria-labelledby": "cancel-subscription-title",
465
510
  children: [
466
- /* @__PURE__ */ _("h3", {
511
+ /* @__PURE__ */ v("h3", {
467
512
  id: "cancel-subscription-title",
468
513
  className: "text-lg font-semibold text-foreground mb-2",
469
514
  children: "Cancel Subscription"
470
515
  }),
471
- /* @__PURE__ */ v("p", {
516
+ /* @__PURE__ */ y("p", {
472
517
  className: "text-sm text-muted-foreground mb-4",
473
518
  children: [
474
519
  "Are you sure you want to cancel this subscription? Your subscription will remain active until",
475
520
  " ",
476
- /* @__PURE__ */ _("span", {
521
+ /* @__PURE__ */ v("span", {
477
522
  className: "font-medium text-foreground",
478
- children: a(D.endDate)
523
+ children: o(D.endDate)
479
524
  }),
480
525
  ", but will not renew automatically."
481
526
  ]
482
527
  }),
483
- /* @__PURE__ */ v("div", {
528
+ /* @__PURE__ */ y("div", {
484
529
  className: "mb-4",
485
- children: [/* @__PURE__ */ _("label", {
530
+ children: [/* @__PURE__ */ v("label", {
486
531
  className: "block text-sm font-medium text-foreground mb-1",
487
532
  children: "Reason for cancellation (optional)"
488
- }), /* @__PURE__ */ _("textarea", {
489
- value: V,
490
- onChange: (e) => H(e.target.value),
533
+ }), /* @__PURE__ */ v("textarea", {
534
+ value: z,
535
+ onChange: (e) => B(e.target.value),
491
536
  placeholder: "Please share why you're canceling...",
492
537
  className: "w-full px-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 focus:border-transparent resize-none",
493
538
  rows: 3
494
539
  })]
495
540
  }),
496
- U && /* @__PURE__ */ _("div", {
541
+ V && /* @__PURE__ */ v("div", {
497
542
  className: "mb-4 p-3 bg-destructive/10 border border-destructive/20 rounded-md",
498
- children: /* @__PURE__ */ _("p", {
543
+ children: /* @__PURE__ */ v("p", {
499
544
  className: "text-sm text-destructive",
500
- children: U
545
+ children: V
501
546
  })
502
547
  }),
503
- /* @__PURE__ */ v("div", {
548
+ /* @__PURE__ */ y("div", {
504
549
  className: "flex items-center justify-end gap-3",
505
- children: [/* @__PURE__ */ _("button", {
550
+ children: [/* @__PURE__ */ v("button", {
506
551
  type: "button",
507
552
  onClick: () => {
508
- I(!1), H(""), W(null);
553
+ F(!1), B(""), H(null);
509
554
  },
510
555
  className: "px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",
511
556
  children: "Keep Subscription"
512
- }), /* @__PURE__ */ _("button", {
557
+ }), /* @__PURE__ */ v("button", {
513
558
  type: "button",
514
- onClick: de,
515
- disabled: j,
559
+ onClick: _e,
560
+ disabled: A,
516
561
  className: "px-4 py-2 text-sm font-medium bg-destructive text-destructive-foreground rounded-md hover:bg-destructive/90 transition-colors disabled:opacity-50",
517
- children: j ? "Canceling..." : "Confirm Cancellation"
562
+ children: A ? "Canceling..." : "Confirm Cancellation"
518
563
  })]
519
564
  })
520
565
  ]
@@ -522,99 +567,155 @@ var y = () => {
522
567
  })
523
568
  ]
524
569
  });
525
- }, b = ({ quota: e }) => {
526
- let t = e.limits?.value || 0, n = e.currentUsageSum || 0, r = t > 0 ? Math.min(100, n / t * 100) : 0;
527
- return /* @__PURE__ */ v("div", {
528
- className: "p-4 rounded-lg bg-muted/30",
570
+ }, oe = ({ quota: e }) => {
571
+ let t = e.context, n = x(e.name, t), r = t?.description && typeof t.description == "string" ? t.description : null, a = e.limits?.value ?? 0, c = e.currentUsageSum ?? 0, l = a > 0 ? Math.min(100, c / a * 100) : 0, d = e.name.includes("bytes") || e.name.includes("storage"), f = e.quotaType === "POOLED";
572
+ return /* @__PURE__ */ y("div", {
573
+ className: "p-4 rounded-lg border border-border bg-card",
529
574
  children: [
530
- /* @__PURE__ */ v("div", {
531
- className: "flex items-center justify-between mb-2",
532
- children: [/* @__PURE__ */ _("span", {
533
- className: "font-medium text-foreground",
534
- children: e.name
535
- }), /* @__PURE__ */ v("span", {
536
- className: "text-sm text-muted-foreground",
575
+ /* @__PURE__ */ y("div", {
576
+ className: "flex items-start justify-between gap-4 mb-2",
577
+ children: [/* @__PURE__ */ y("div", {
578
+ className: "min-w-0",
579
+ children: [/* @__PURE__ */ v("p", {
580
+ className: "font-medium text-foreground truncate",
581
+ children: n
582
+ }), r && /* @__PURE__ */ v("p", {
583
+ className: "text-xs text-muted-foreground mt-0.5 line-clamp-2",
584
+ children: r
585
+ })]
586
+ }), /* @__PURE__ */ y("span", {
587
+ className: "text-sm font-medium text-foreground shrink-0 tabular-nums",
588
+ children: [
589
+ d ? i(c) : c.toLocaleString(),
590
+ " / ",
591
+ a > 0 ? d ? i(a) : a.toLocaleString() : "∞"
592
+ ]
593
+ })]
594
+ }),
595
+ a > 0 && /* @__PURE__ */ v("div", {
596
+ className: "h-1.5 rounded-full bg-muted overflow-hidden mb-2",
597
+ children: /* @__PURE__ */ v("div", {
598
+ className: `h-full transition-all duration-300 ${u(l)}`,
599
+ style: { width: `${l}%` }
600
+ })
601
+ }),
602
+ /* @__PURE__ */ y("div", {
603
+ className: "flex items-center justify-between text-xs text-muted-foreground",
604
+ children: [/* @__PURE__ */ v("span", {
605
+ className: "px-1.5 py-0.5 rounded bg-muted font-medium",
606
+ children: f ? "Shared" : "Per Workspace"
607
+ }), /* @__PURE__ */ y("div", {
608
+ className: "flex items-center gap-3",
609
+ children: [e.endtime && /* @__PURE__ */ y("span", { children: ["Expires ", o(e.endtime, "short")] }), a > 0 && /* @__PURE__ */ y("span", {
610
+ className: l >= 90 ? "text-status-error-text font-medium" : l >= 70 ? "text-status-warning-text font-medium" : "",
611
+ children: [s(l), " used"]
612
+ })]
613
+ })]
614
+ })
615
+ ]
616
+ });
617
+ }, se = ({ item: e }) => {
618
+ let { assignment: t, effectiveUsed: n, usagePercentage: r } = e, a = x(t.quotaName), c = !t.noLimit && t.limit !== null, l = t.limit ?? 0, d = t.quotaName.includes("bytes") || t.quotaName.includes("storage"), f = S(t.resetPeriod);
619
+ return /* @__PURE__ */ y("div", {
620
+ className: "p-4 rounded-lg border border-border bg-card",
621
+ children: [
622
+ /* @__PURE__ */ y("div", {
623
+ className: "flex items-start justify-between gap-4 mb-2",
624
+ children: [/* @__PURE__ */ y("div", {
625
+ className: "min-w-0",
626
+ children: [/* @__PURE__ */ v("p", {
627
+ className: "font-medium text-foreground truncate",
628
+ children: a
629
+ }), /* @__PURE__ */ y("p", {
630
+ className: "text-xs text-muted-foreground mt-0.5",
631
+ children: [t.quotaMode === "pooled" ? "Pooled across workspaces" : "Dedicated", f && ` · ${f}`]
632
+ })]
633
+ }), /* @__PURE__ */ y("span", {
634
+ className: "text-sm font-medium text-foreground shrink-0 tabular-nums",
537
635
  children: [
538
- n,
636
+ d ? i(n) : n.toLocaleString(),
539
637
  " / ",
540
- t > 0 ? t : "∞"
638
+ t.noLimit ? "∞" : c ? d ? i(l) : l.toLocaleString() : "∞"
541
639
  ]
542
640
  })]
543
641
  }),
544
- t > 0 && /* @__PURE__ */ _("div", {
545
- className: "h-2 rounded-full bg-muted overflow-hidden",
546
- children: /* @__PURE__ */ _("div", {
547
- className: `h-full transition-all duration-300 ${c(r)}`,
548
- style: { width: `${r}%` }
642
+ c && /* @__PURE__ */ v("div", {
643
+ className: "h-1.5 rounded-full bg-muted overflow-hidden mb-2",
644
+ children: /* @__PURE__ */ v("div", {
645
+ className: `h-full transition-all duration-300 ${u(r)}`,
646
+ style: { width: `${Math.min(100, r)}%` }
549
647
  })
550
648
  }),
551
- /* @__PURE__ */ v("div", {
552
- className: "flex items-center justify-between mt-2 text-xs text-muted-foreground",
553
- children: [/* @__PURE__ */ _("span", { children: e.quotaType }), /* @__PURE__ */ v("span", { children: [o(r), " used"] })]
649
+ /* @__PURE__ */ y("div", {
650
+ className: "flex items-center justify-between text-xs text-muted-foreground",
651
+ children: [/* @__PURE__ */ y("span", { children: ["Since ", o(t.createdAt, "short")] }), c && /* @__PURE__ */ y("span", {
652
+ className: r >= 90 ? "text-status-error-text font-medium" : r >= 70 ? "text-status-warning-text font-medium" : "",
653
+ children: [s(r), " used"]
654
+ })]
554
655
  })
555
656
  ]
556
657
  });
557
- }, x = ({ addonSubscription: e }) => {
658
+ }, ce = ({ addonSubscription: e }) => {
558
659
  let t = e.addon;
559
- return /* @__PURE__ */ v("div", {
660
+ return /* @__PURE__ */ y("div", {
560
661
  className: "flex items-center justify-between p-3 rounded-lg bg-muted/30",
561
- children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
662
+ children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
562
663
  className: "font-medium text-foreground",
563
664
  children: t?.name || "Unknown Addon"
564
- }), /* @__PURE__ */ v("p", {
665
+ }), /* @__PURE__ */ y("p", {
565
666
  className: "text-sm text-muted-foreground",
566
667
  children: ["Qty: ", e.quantity]
567
- })] }), t && /* @__PURE__ */ _("p", {
668
+ })] }), t && /* @__PURE__ */ v("p", {
568
669
  className: "text-sm font-medium text-foreground",
569
- children: i(t.price * e.quantity, t.currency)
670
+ children: a(t.price * e.quantity, t.currency)
570
671
  })]
571
672
  });
572
- }, S = ({ transaction: e }) => /* @__PURE__ */ v("div", {
673
+ }, w = ({ transaction: e }) => /* @__PURE__ */ y("div", {
573
674
  className: "flex items-center justify-between px-6 py-4",
574
- children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
675
+ children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
575
676
  className: "font-medium text-foreground capitalize",
576
677
  children: e.type
577
- }), /* @__PURE__ */ _("p", {
678
+ }), /* @__PURE__ */ v("p", {
578
679
  className: "text-sm text-muted-foreground",
579
- children: a(e.createdAt, "short")
580
- })] }), /* @__PURE__ */ v("div", {
680
+ children: o(e.createdAt, "short")
681
+ })] }), /* @__PURE__ */ y("div", {
581
682
  className: "text-right",
582
- children: [/* @__PURE__ */ v("p", {
683
+ children: [/* @__PURE__ */ y("p", {
583
684
  className: `font-medium ${e.type === "refund" ? "text-status-error-text" : "text-foreground"}`,
584
- children: [e.type === "refund" ? "-" : "", i(e.amount, e.currency)]
585
- }), /* @__PURE__ */ _("p", {
685
+ children: [e.type === "refund" ? "-" : "", a(e.amount, e.currency)]
686
+ }), /* @__PURE__ */ v("p", {
586
687
  className: "text-sm text-muted-foreground capitalize",
587
688
  children: e.status
588
689
  })]
589
690
  })]
590
- }), C = ({ item: e }) => /* @__PURE__ */ v("div", {
691
+ }), le = ({ item: e }) => /* @__PURE__ */ y("div", {
591
692
  className: "flex items-start gap-3",
592
- children: [/* @__PURE__ */ _("div", { className: "size-2 rounded-full bg-muted-foreground mt-2 shrink-0" }), /* @__PURE__ */ v("div", { children: [
593
- /* @__PURE__ */ v("p", {
693
+ children: [/* @__PURE__ */ v("div", { className: "size-2 rounded-full bg-muted-foreground mt-2 shrink-0" }), /* @__PURE__ */ y("div", { children: [
694
+ /* @__PURE__ */ y("p", {
594
695
  className: "text-sm text-foreground",
595
696
  children: [
596
- /* @__PURE__ */ _("span", {
697
+ /* @__PURE__ */ v("span", {
597
698
  className: "capitalize",
598
699
  children: e.fromStatus
599
700
  }),
600
701
  " → ",
601
- /* @__PURE__ */ _("span", {
702
+ /* @__PURE__ */ v("span", {
602
703
  className: "capitalize font-medium",
603
704
  children: e.toStatus
604
705
  })
605
706
  ]
606
707
  }),
607
- e.reason && /* @__PURE__ */ _("p", {
708
+ e.reason && /* @__PURE__ */ v("p", {
608
709
  className: "text-xs text-muted-foreground mt-0.5",
609
710
  children: e.reason
610
711
  }),
611
- /* @__PURE__ */ _("p", {
712
+ /* @__PURE__ */ v("p", {
612
713
  className: "text-xs text-muted-foreground mt-0.5",
613
- children: a(e.createdAt, "short")
714
+ children: o(e.createdAt, "short")
614
715
  })
615
716
  ] })]
616
717
  });
617
718
  //#endregion
618
- export { y as SubscriptionDetailPage };
719
+ export { C as SubscriptionDetailPage };
619
720
 
620
721
  //# sourceMappingURL=SubscriptionDetailPage.js.map