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