@burdenoff/microfe-billing 2026.625.4 → 2026.626.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.
Files changed (96) hide show
  1. package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +192 -187
  2. package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js.map +1 -1
  3. package/dist/billing/modules/addons/pages/AddonCreatePage.js +322 -317
  4. package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
  5. package/dist/billing/modules/addons/pages/AddonDetailPage.js +190 -185
  6. package/dist/billing/modules/addons/pages/AddonDetailPage.js.map +1 -1
  7. package/dist/billing/modules/addons/pages/AddonEditPage.js +297 -292
  8. package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
  9. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +60 -75
  10. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
  11. package/dist/billing/modules/addons/pages/AddonsListPage.js +86 -101
  12. package/dist/billing/modules/addons/pages/AddonsListPage.js.map +1 -1
  13. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +124 -121
  14. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
  15. package/dist/billing/modules/analytics/pages/AnalyticsPage.js +103 -111
  16. package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
  17. package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +196 -160
  18. package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
  19. package/dist/billing/modules/billing/pages/InvoicesListPage.js +58 -73
  20. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  21. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +65 -75
  22. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -1
  23. package/dist/billing/modules/billing/pages/RefundsPage.js +399 -399
  24. package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
  25. package/dist/billing/modules/billing/pages/TransactionsPage.js +49 -48
  26. package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
  27. package/dist/billing/modules/billing/pages/UserRefundsPage.js +144 -151
  28. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
  29. package/dist/billing/modules/checkout/pages/CheckoutPage.js +430 -425
  30. package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
  31. package/dist/billing/modules/coupons/pages/CouponDetailPage.js +121 -93
  32. package/dist/billing/modules/coupons/pages/CouponDetailPage.js.map +1 -1
  33. package/dist/billing/modules/coupons/pages/CouponsListPage.js +154 -152
  34. package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
  35. package/dist/billing/modules/coupons/pages/CreateCouponPage.js +467 -462
  36. package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
  37. package/dist/billing/modules/coupons/pages/EditCouponPage.js +294 -286
  38. package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
  39. package/dist/billing/modules/credits/pages/AdminCreditsPage.js +123 -117
  40. package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
  41. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +43 -42
  42. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js.map +1 -1
  43. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +192 -207
  44. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
  45. package/dist/billing/modules/credits/pages/CreditsPage.js +40 -56
  46. package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
  47. package/dist/billing/modules/dashboard/pages/OverviewPage.js +128 -121
  48. package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
  49. package/dist/billing/modules/discounts/pages/DiscountsListPage.js +165 -180
  50. package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
  51. package/dist/billing/modules/earnings/pages/EarningsPage.js +103 -100
  52. package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
  53. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +175 -175
  54. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
  55. package/dist/billing/modules/earnings/pages/PayoutsPage.js +96 -96
  56. package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
  57. package/dist/billing/modules/plans/pages/PlanAssignFreePage.js +42 -40
  58. package/dist/billing/modules/plans/pages/PlanAssignFreePage.js.map +1 -1
  59. package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +45 -38
  60. package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js.map +1 -1
  61. package/dist/billing/modules/plans/pages/PlanCreatePage.js +339 -334
  62. package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
  63. package/dist/billing/modules/plans/pages/PlanDetailPage.js +80 -74
  64. package/dist/billing/modules/plans/pages/PlanDetailPage.js.map +1 -1
  65. package/dist/billing/modules/plans/pages/PlanEditPage.js +342 -337
  66. package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
  67. package/dist/billing/modules/plans/pages/PlansBrowsePage.js +38 -53
  68. package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
  69. package/dist/billing/modules/plans/pages/PlansListPage.js +60 -75
  70. package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -1
  71. package/dist/billing/modules/promotions/pages/CreatePromotionPage.js +242 -237
  72. package/dist/billing/modules/promotions/pages/CreatePromotionPage.js.map +1 -1
  73. package/dist/billing/modules/promotions/pages/PromotionsListPage.js +29 -39
  74. package/dist/billing/modules/promotions/pages/PromotionsListPage.js.map +1 -1
  75. package/dist/billing/modules/quota/pages/QuotaPage.js +1 -0
  76. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +299 -294
  77. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
  78. package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +191 -186
  79. package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js.map +1 -1
  80. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +308 -303
  81. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
  82. package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +57 -78
  83. package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js.map +1 -1
  84. package/dist/billing/modules/settings/pages/SettingsPage.js +79 -78
  85. package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
  86. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +15 -13
  87. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
  88. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +338 -299
  89. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
  90. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +82 -103
  91. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
  92. package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +59 -54
  93. package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
  94. package/dist/billing/modules/usage/pages/UsagePage.js +172 -215
  95. package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
  96. package/package.json +2 -2
@@ -9,24 +9,25 @@ import { getPlanFeatureQuantity as o } from "../../../shared/utils/planFeatureQu
9
9
  import "../../../shared/utils/index.js";
10
10
  import { useBillingPermissions as s } from "../../../hooks/useBillingPermissions.js";
11
11
  import { useBillingNavigate as c } from "../../../hooks/useBillingNavigate.js";
12
- import { usePlan as l, usePlanMutations as u } from "../hooks/usePlans.js";
13
- import { useQuotas as d } from "../hooks/useQuotas.js";
12
+ import { usePlan as l, usePlanMutations as ee } from "../hooks/usePlans.js";
13
+ import { useQuotas as u } from "../hooks/useQuotas.js";
14
14
  import "../hooks/index.js";
15
- import { useEffect as f, useState as p } from "react";
16
- import { useParams as m } from "react-router-dom";
17
- import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
18
- import { useI18n as v } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
15
+ import { useEffect as d, useState as f } from "react";
16
+ import { useParams as p } from "react-router-dom";
17
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
18
+ import { useI18n as _ } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
19
+ import { PagePurpose as v } from "@burdenoff/fe-libs/ui";
19
20
  //#region src/billing/modules/plans/pages/PlanEditPage.tsx
20
21
  var y = () => {
21
- let { t: y } = v(), b = (e, t) => {
22
+ let { t: y } = _(), b = (e, t) => {
22
23
  let n = y(e);
23
24
  return n === e ? t : n;
24
- }, { planId: x } = m(), S = c(), C = s(), { plan: w, isLoading: T, error: E, refetch: D } = l(x), { quotas: O, isLoading: k } = d({ onlyActive: !0 }), { updatePlan: ee, isUpdating: A } = u(), [j, M] = p(""), [N, P] = p(""), [F, I] = p("USD"), [L, R] = p(i.MONTHLY), [z, B] = p(!0), [V, H] = p(!0), [U, W] = p([]), [G, K] = p([]), [q, J] = p(null), [Y, X] = p(!1);
25
- if (f(() => {
25
+ }, { planId: x } = p(), S = c(), C = s(), { plan: w, isLoading: T, error: E, refetch: D } = l(x), { quotas: O, isLoading: k } = u({ onlyActive: !0 }), { updatePlan: A, isUpdating: j } = ee(), [M, N] = f(""), [P, F] = f(""), [I, L] = f("USD"), [R, z] = f(i.MONTHLY), [B, V] = f(!0), [H, U] = f(!0), [W, G] = f([]), [K, q] = f([]), [J, Y] = f(null), [X, Z] = f(!1);
26
+ if (d(() => {
26
27
  if (w) {
27
- if (M(w.name ?? ""), P(String(w.price ?? "")), I(w.currency ?? "USD"), R(w.duration ?? i.MONTHLY), B(w.isActive ?? !0), H(w.isPurchasable ?? !0), w.currencyPrices && typeof w.currencyPrices == "object") {
28
+ if (N(w.name ?? ""), F(String(w.price ?? "")), L(w.currency ?? "USD"), z(w.duration ?? i.MONTHLY), V(w.isActive ?? !0), U(w.isPurchasable ?? !0), w.currencyPrices && typeof w.currencyPrices == "object") {
28
29
  let e = w.currencyPrices;
29
- K(Object.entries(e).filter(([, e]) => typeof e == "number").map(([e, t]) => ({
30
+ q(Object.entries(e).filter(([, e]) => typeof e == "number").map(([e, t]) => ({
30
31
  currency: e,
31
32
  amount: t
32
33
  })));
@@ -41,13 +42,13 @@ var y = () => {
41
42
  quotaId: n,
42
43
  quantity: r
43
44
  });
44
- W(e);
45
+ G(e);
45
46
  }
46
47
  }
47
- }, [w]), !C.canManagePlans) return /* @__PURE__ */ g(e, { message: b("billing.plans.noEditPermission", "You don't have permission to edit plans.") });
48
- if (T || k) return /* @__PURE__ */ _("div", {
48
+ }, [w]), !C.canManagePlans) return /* @__PURE__ */ h(e, { message: b("billing.plans.noEditPermission", "You don't have permission to edit plans.") });
49
+ if (T || k) return /* @__PURE__ */ g("div", {
49
50
  className: "space-y-6 p-6",
50
- children: [/* @__PURE__ */ g("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ g("div", {
51
+ children: [/* @__PURE__ */ h("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ h("div", {
51
52
  className: "max-w-2xl space-y-4",
52
53
  children: [
53
54
  1,
@@ -55,26 +56,26 @@ var y = () => {
55
56
  3,
56
57
  4,
57
58
  5
58
- ].map((e) => /* @__PURE__ */ g("div", { className: "h-16 bg-bg-sunken animate-pulse rounded" }, e))
59
+ ].map((e) => /* @__PURE__ */ h("div", { className: "h-16 bg-bg-sunken animate-pulse rounded" }, e))
59
60
  })]
60
61
  });
61
- if (E && a(E)) return /* @__PURE__ */ g("div", {
62
+ if (E && a(E)) return /* @__PURE__ */ h("div", {
62
63
  className: "p-6",
63
- children: /* @__PURE__ */ g(n, {
64
+ children: /* @__PURE__ */ h(n, {
64
65
  title: b("billing.plans.serverUnavailable", "Server Unavailable"),
65
66
  message: b("billing.plans.serverUnavailableLoadPlan", "Unable to load plan. The server might be down or experiencing issues."),
66
67
  onRetry: () => D(),
67
68
  showRetry: !0
68
69
  })
69
70
  });
70
- if (!w) return /* @__PURE__ */ g("div", {
71
+ if (!w) return /* @__PURE__ */ h("div", {
71
72
  className: "flex items-center justify-center h-full min-h-[400px]",
72
- children: /* @__PURE__ */ _("div", {
73
+ children: /* @__PURE__ */ g("div", {
73
74
  className: "text-center space-y-4",
74
- children: [/* @__PURE__ */ g("h2", {
75
+ children: [/* @__PURE__ */ h("h2", {
75
76
  className: "text-lg font-semibold text-text-primary",
76
77
  children: b("billing.plans.planNotFound", "Plan not found")
77
- }), /* @__PURE__ */ g("button", {
78
+ }), /* @__PURE__ */ h("button", {
78
79
  type: "button",
79
80
  onClick: () => S("/plans"),
80
81
  className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover",
@@ -82,340 +83,344 @@ var y = () => {
82
83
  })]
83
84
  })
84
85
  });
85
- let Z = () => {
86
- W([{
86
+ let Q = () => {
87
+ G([{
87
88
  quotaId: "",
88
89
  quantity: 1
89
- }, ...U]);
90
- }, Q = (e) => {
91
- W(U.filter((t, n) => n !== e));
90
+ }, ...W]);
91
+ }, te = (e) => {
92
+ G(W.filter((t, n) => n !== e));
92
93
  }, $ = (e, t, n) => {
93
- let r = [...U];
94
- t === "quotaId" ? r[e].quotaId = n : r[e].quantity = Number(n), W(r);
94
+ let r = [...W];
95
+ t === "quotaId" ? r[e].quotaId = n : r[e].quantity = Number(n), G(r);
95
96
  };
96
- return /* @__PURE__ */ _("div", {
97
+ return /* @__PURE__ */ g("div", {
97
98
  className: "space-y-6 p-6",
98
- children: [/* @__PURE__ */ g(t, {
99
- title: `Edit Plan: ${w.name}`,
100
- description: b("billing.plans.editPlanDesc", "Update the plan details and quota allocations")
101
- }), /* @__PURE__ */ _("form", {
102
- onSubmit: async (e) => {
103
- if (e.preventDefault(), J(null), X(!1), !j.trim()) {
104
- J("Plan name is required");
105
- return;
106
- }
107
- if (!N || isNaN(Number(N)) || Number(N) < 0) {
108
- J("Valid price is required");
109
- return;
110
- }
111
- if (U.length === 0) {
112
- J("At least one quota is required");
113
- return;
114
- }
115
- if (U.filter((e) => e.quotaId === "").length > 0) {
116
- J("Please select a quota for all allocations");
117
- return;
118
- }
119
- let t = {
120
- id: x,
121
- name: j.trim(),
122
- price: Number(N),
123
- currency: F,
124
- duration: L,
125
- isActive: z,
126
- isPurchasable: V,
127
- quotas: U.map((e) => ({
128
- quotaId: e.quotaId,
129
- quantity: e.quantity
130
- })),
131
- ...G.length > 0 ? { currencyPriceOverrides: G } : {}
132
- };
133
- try {
134
- await ee(t), X(!0), setTimeout(() => S(`/plans/${x}`), 1500);
135
- } catch (e) {
136
- J(e instanceof Error ? e.message : "Failed to update plan");
137
- }
138
- },
139
- className: "space-y-6",
140
- children: [
141
- q && /* @__PURE__ */ g("div", {
142
- className: "p-4 bg-status-error-bg-subtle border border-border-subtle rounded-lg",
143
- children: /* @__PURE__ */ g("p", {
144
- className: "text-sm text-status-error-text",
145
- children: q
146
- })
147
- }),
148
- Y && /* @__PURE__ */ g("div", {
149
- className: "p-4 bg-status-success-bg-subtle border border-border-subtle rounded-lg",
150
- children: /* @__PURE__ */ g("p", {
151
- className: "text-sm text-status-success-text",
152
- children: b("billing.plans.updateSuccess", "Plan updated successfully! Redirecting...")
153
- })
154
- }),
155
- /* @__PURE__ */ _("div", {
156
- className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
157
- children: [/* @__PURE__ */ _("div", {
158
- className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)] h-fit",
99
+ children: [
100
+ /* @__PURE__ */ h(t, {
101
+ title: `Edit Plan: ${w.name}`,
102
+ description: b("billing.plans.editPlanDesc", "Update the plan details and quota allocations")
103
+ }),
104
+ /* @__PURE__ */ h(v, { children: b("billing.plans.editPurpose", "Update this plan's price, currency/seat pricing and the quotas it grants. Changes apply to new subscriptions; existing subscribers keep the terms they signed up with until they renew or change plans.") }),
105
+ /* @__PURE__ */ g("form", {
106
+ onSubmit: async (e) => {
107
+ if (e.preventDefault(), Y(null), Z(!1), !M.trim()) {
108
+ Y("Plan name is required");
109
+ return;
110
+ }
111
+ if (!P || isNaN(Number(P)) || Number(P) < 0) {
112
+ Y("Valid price is required");
113
+ return;
114
+ }
115
+ if (W.length === 0) {
116
+ Y("At least one quota is required");
117
+ return;
118
+ }
119
+ if (W.filter((e) => e.quotaId === "").length > 0) {
120
+ Y("Please select a quota for all allocations");
121
+ return;
122
+ }
123
+ let t = {
124
+ id: x,
125
+ name: M.trim(),
126
+ price: Number(P),
127
+ currency: I,
128
+ duration: R,
129
+ isActive: B,
130
+ isPurchasable: H,
131
+ quotas: W.map((e) => ({
132
+ quotaId: e.quotaId,
133
+ quantity: e.quantity
134
+ })),
135
+ ...K.length > 0 ? { currencyPriceOverrides: K } : {}
136
+ };
137
+ try {
138
+ await A(t), Z(!0), setTimeout(() => S(`/plans/${x}`), 1500);
139
+ } catch (e) {
140
+ Y(e instanceof Error ? e.message : "Failed to update plan");
141
+ }
142
+ },
143
+ className: "space-y-6",
144
+ children: [
145
+ J && /* @__PURE__ */ h("div", {
146
+ className: "p-4 bg-status-error-bg-subtle border border-border-subtle rounded-lg",
147
+ children: /* @__PURE__ */ h("p", {
148
+ className: "text-sm text-status-error-text",
149
+ children: J
150
+ })
151
+ }),
152
+ X && /* @__PURE__ */ h("div", {
153
+ className: "p-4 bg-status-success-bg-subtle border border-border-subtle rounded-lg",
154
+ children: /* @__PURE__ */ h("p", {
155
+ className: "text-sm text-status-success-text",
156
+ children: b("billing.plans.updateSuccess", "Plan updated successfully! Redirecting...")
157
+ })
158
+ }),
159
+ /* @__PURE__ */ g("div", {
160
+ className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
159
161
  children: [/* @__PURE__ */ g("div", {
160
- className: "p-4 border-b border-border-subtle bg-bg-sunken/30",
161
- children: /* @__PURE__ */ g("h2", {
162
- className: "font-semibold text-text-primary",
163
- children: b("billing.plans.basicInfo", "Basic Information")
164
- })
165
- }), /* @__PURE__ */ _("div", {
166
- className: "p-4 space-y-4",
167
- children: [
168
- /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ _("label", {
169
- htmlFor: "name",
170
- className: "block text-sm font-medium text-text-primary mb-1",
171
- children: [b("billing.plans.planNameLabel", "Plan Name"), " *"]
172
- }), /* @__PURE__ */ g("input", {
173
- id: "name",
174
- type: "text",
175
- value: j,
176
- onChange: (e) => M(e.target.value),
177
- className: "w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
178
- placeholder: b("billing.plans.planNamePlaceholder", "e.g., Pro Plan"),
179
- required: !0
180
- })] }),
181
- /* @__PURE__ */ _("div", {
182
- className: "grid grid-cols-2 gap-4",
183
- children: [/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ _("label", {
184
- htmlFor: "price",
162
+ className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)] h-fit",
163
+ children: [/* @__PURE__ */ h("div", {
164
+ className: "p-4 border-b border-border-subtle bg-bg-sunken/30",
165
+ children: /* @__PURE__ */ h("h2", {
166
+ className: "font-semibold text-text-primary",
167
+ children: b("billing.plans.basicInfo", "Basic Information")
168
+ })
169
+ }), /* @__PURE__ */ g("div", {
170
+ className: "p-4 space-y-4",
171
+ children: [
172
+ /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("label", {
173
+ htmlFor: "name",
185
174
  className: "block text-sm font-medium text-text-primary mb-1",
186
- children: [b("billing.plans.priceLabel", "Price"), " *"]
187
- }), /* @__PURE__ */ g("input", {
188
- id: "price",
189
- type: "number",
190
- step: "0.01",
191
- min: "0",
192
- value: N,
193
- onChange: (e) => P(e.target.value),
175
+ children: [b("billing.plans.planNameLabel", "Plan Name"), " *"]
176
+ }), /* @__PURE__ */ h("input", {
177
+ id: "name",
178
+ type: "text",
179
+ value: M,
180
+ onChange: (e) => N(e.target.value),
194
181
  className: "w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
195
- placeholder: "49.99",
182
+ placeholder: b("billing.plans.planNamePlaceholder", "e.g., Pro Plan"),
196
183
  required: !0
197
- })] }), /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ _("label", {
198
- htmlFor: "currency",
184
+ })] }),
185
+ /* @__PURE__ */ g("div", {
186
+ className: "grid grid-cols-2 gap-4",
187
+ children: [/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("label", {
188
+ htmlFor: "price",
189
+ className: "block text-sm font-medium text-text-primary mb-1",
190
+ children: [b("billing.plans.priceLabel", "Price"), " *"]
191
+ }), /* @__PURE__ */ h("input", {
192
+ id: "price",
193
+ type: "number",
194
+ step: "0.01",
195
+ min: "0",
196
+ value: P,
197
+ onChange: (e) => F(e.target.value),
198
+ className: "w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
199
+ placeholder: "49.99",
200
+ required: !0
201
+ })] }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("label", {
202
+ htmlFor: "currency",
203
+ className: "block text-sm font-medium text-text-primary mb-1",
204
+ children: [b("billing.plans.currencyLabel", "Currency"), " *"]
205
+ }), /* @__PURE__ */ g("select", {
206
+ id: "currency",
207
+ value: I,
208
+ onChange: (e) => L(e.target.value),
209
+ className: "w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
210
+ children: [
211
+ /* @__PURE__ */ h("option", {
212
+ value: "USD",
213
+ children: "USD ($)"
214
+ }),
215
+ /* @__PURE__ */ h("option", {
216
+ value: "EUR",
217
+ children: "EUR"
218
+ }),
219
+ /* @__PURE__ */ h("option", {
220
+ value: "GBP",
221
+ children: "GBP"
222
+ }),
223
+ /* @__PURE__ */ h("option", {
224
+ value: "INR",
225
+ children: "INR"
226
+ }),
227
+ /* @__PURE__ */ h("option", {
228
+ value: "AUD",
229
+ children: "AUD"
230
+ }),
231
+ /* @__PURE__ */ h("option", {
232
+ value: "CAD",
233
+ children: "CAD"
234
+ }),
235
+ /* @__PURE__ */ h("option", {
236
+ value: "JPY",
237
+ children: "JPY"
238
+ }),
239
+ /* @__PURE__ */ h("option", {
240
+ value: "SGD",
241
+ children: "SGD"
242
+ })
243
+ ]
244
+ })] })]
245
+ }),
246
+ /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("label", {
247
+ htmlFor: "duration",
199
248
  className: "block text-sm font-medium text-text-primary mb-1",
200
- children: [b("billing.plans.currencyLabel", "Currency"), " *"]
201
- }), /* @__PURE__ */ _("select", {
202
- id: "currency",
203
- value: F,
204
- onChange: (e) => I(e.target.value),
249
+ children: [b("billing.plans.billingPeriodLabel", "Billing Period"), " *"]
250
+ }), /* @__PURE__ */ g("select", {
251
+ id: "duration",
252
+ value: R,
253
+ onChange: (e) => z(e.target.value),
205
254
  className: "w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
206
- children: [
207
- /* @__PURE__ */ g("option", {
208
- value: "USD",
209
- children: "USD ($)"
210
- }),
211
- /* @__PURE__ */ g("option", {
212
- value: "EUR",
213
- children: "EUR"
214
- }),
215
- /* @__PURE__ */ g("option", {
216
- value: "GBP",
217
- children: "GBP"
218
- }),
219
- /* @__PURE__ */ g("option", {
220
- value: "INR",
221
- children: "INR"
222
- }),
223
- /* @__PURE__ */ g("option", {
224
- value: "AUD",
225
- children: "AUD"
226
- }),
227
- /* @__PURE__ */ g("option", {
228
- value: "CAD",
229
- children: "CAD"
230
- }),
231
- /* @__PURE__ */ g("option", {
232
- value: "JPY",
233
- children: "JPY"
234
- }),
235
- /* @__PURE__ */ g("option", {
236
- value: "SGD",
237
- children: "SGD"
238
- })
239
- ]
240
- })] })]
241
- }),
242
- /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ _("label", {
243
- htmlFor: "duration",
244
- className: "block text-sm font-medium text-text-primary mb-1",
245
- children: [b("billing.plans.billingPeriodLabel", "Billing Period"), " *"]
246
- }), /* @__PURE__ */ _("select", {
247
- id: "duration",
248
- value: L,
249
- onChange: (e) => R(e.target.value),
250
- className: "w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
251
- children: [/* @__PURE__ */ g("option", {
252
- value: i.MONTHLY,
253
- children: "Monthly"
254
- }), /* @__PURE__ */ g("option", {
255
- value: i.YEARLY,
256
- children: "Yearly"
257
- })]
258
- })] }),
259
- /* @__PURE__ */ _("div", {
260
- className: "flex items-center gap-3",
261
- children: [/* @__PURE__ */ g("input", {
262
- id: "isActive",
263
- type: "checkbox",
264
- checked: z,
265
- onChange: (e) => B(e.target.checked),
266
- className: "size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]"
267
- }), /* @__PURE__ */ g("label", {
268
- htmlFor: "isActive",
269
- className: "text-sm font-medium text-text-primary",
270
- children: b("billing.plans.planIsActive", "Plan is active")
271
- })]
272
- }),
273
- /* @__PURE__ */ _("div", {
274
- className: "flex items-start justify-between gap-4 pt-1",
275
- children: [/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("p", {
276
- className: "text-sm font-medium text-text-primary",
277
- children: b("billing.plans.isPurchasableLabel", "Publicly purchasable")
278
- }), /* @__PURE__ */ g("p", {
279
- className: "text-xs text-text-muted mt-0.5",
280
- children: V ? b("billing.plans.isPurchasableOn", "Visible on pricing page — users can subscribe directly.") : b("billing.plans.isPurchasableOff", "Internal / custom plan — hidden from pricing page, assign via API only.")
281
- })] }), /* @__PURE__ */ g("button", {
282
- type: "button",
283
- role: "switch",
284
- "aria-checked": V,
285
- onClick: () => H((e) => !e),
286
- className: `relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:ring-offset-2 ${V ? "bg-action-primary-bg" : "bg-text-muted/30"}`,
287
- children: /* @__PURE__ */ g("span", { className: `inline-block h-5 w-5 transform rounded-full bg-bg-surface shadow transition-transform ${V ? "translate-x-5" : "translate-x-0"}` })
288
- })]
289
- })
290
- ]
291
- })]
292
- }), /* @__PURE__ */ _("div", {
293
- className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)] h-fit",
294
- children: [/* @__PURE__ */ _("div", {
295
- className: "p-4 border-b border-border-subtle bg-bg-sunken/30 flex items-center justify-between",
296
- children: [/* @__PURE__ */ g("h2", {
297
- className: "font-semibold text-text-primary",
298
- children: b("billing.plans.quotaAllocations", "Quota Allocations")
299
- }), /* @__PURE__ */ g("button", {
300
- type: "button",
301
- onClick: Z,
302
- className: "px-3 py-1 text-sm font-medium text-text-link hover:bg-[var(--color-accent-soft)] rounded-md transition-colors",
303
- children: "+ Add Quota"
304
- })]
305
- }), /* @__PURE__ */ g("div", {
306
- className: "p-4 space-y-3",
307
- children: U.length === 0 ? /* @__PURE__ */ g("p", {
308
- className: "text-sm text-text-muted",
309
- children: b("billing.plans.noQuotasAllocated", "No quotas allocated. Click \"Add Quota\" to add one.")
310
- }) : U.map((e, t) => {
311
- let n = O.find((t) => t.id === e.quotaId), r = n?.limits, i = r?.value ?? 0, a = r?.type ?? "unknown", o = i * e.quantity;
312
- return /* @__PURE__ */ _("div", {
313
- className: "p-3 border border-border-subtle rounded-lg bg-bg-sunken/20 space-y-3",
314
- children: [/* @__PURE__ */ _("div", {
255
+ children: [/* @__PURE__ */ h("option", {
256
+ value: i.MONTHLY,
257
+ children: "Monthly"
258
+ }), /* @__PURE__ */ h("option", {
259
+ value: i.YEARLY,
260
+ children: "Yearly"
261
+ })]
262
+ })] }),
263
+ /* @__PURE__ */ g("div", {
315
264
  className: "flex items-center gap-3",
316
- children: [/* @__PURE__ */ _("select", {
317
- value: e.quotaId,
318
- onChange: (e) => $(t, "quotaId", e.target.value),
319
- className: `flex-1 px-3 py-2 border border-border-subtle rounded-input bg-bg-surface focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${e.quotaId === "" ? "text-text-muted" : "text-text-primary"}`,
320
- children: [/* @__PURE__ */ g("option", {
321
- value: "",
322
- disabled: !0,
323
- children: b("billing.plans.selectQuota", "Select a quota...")
324
- }), O.map((e) => /* @__PURE__ */ g("option", {
325
- value: e.id,
326
- children: e.name
327
- }, e.id))]
328
- }), /* @__PURE__ */ g("button", {
265
+ children: [/* @__PURE__ */ h("input", {
266
+ id: "isActive",
267
+ type: "checkbox",
268
+ checked: B,
269
+ onChange: (e) => V(e.target.checked),
270
+ className: "size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]"
271
+ }), /* @__PURE__ */ h("label", {
272
+ htmlFor: "isActive",
273
+ className: "text-sm font-medium text-text-primary",
274
+ children: b("billing.plans.planIsActive", "Plan is active")
275
+ })]
276
+ }),
277
+ /* @__PURE__ */ g("div", {
278
+ className: "flex items-start justify-between gap-4 pt-1",
279
+ children: [/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
280
+ className: "text-sm font-medium text-text-primary",
281
+ children: b("billing.plans.isPurchasableLabel", "Publicly purchasable")
282
+ }), /* @__PURE__ */ h("p", {
283
+ className: "text-xs text-text-muted mt-0.5",
284
+ children: H ? b("billing.plans.isPurchasableOn", "Visible on pricing page — users can subscribe directly.") : b("billing.plans.isPurchasableOff", "Internal / custom plan — hidden from pricing page, assign via API only.")
285
+ })] }), /* @__PURE__ */ h("button", {
329
286
  type: "button",
330
- onClick: () => Q(t),
331
- className: "p-2 text-status-error-text hover:bg-status-error-bg-subtle rounded-md transition-colors",
332
- title: "Remove quota",
333
- children: /* @__PURE__ */ g("svg", {
334
- className: "size-5",
335
- fill: "none",
336
- viewBox: "0 0 24 24",
337
- stroke: "currentColor",
338
- children: /* @__PURE__ */ g("path", {
339
- strokeLinecap: "round",
340
- strokeLinejoin: "round",
341
- strokeWidth: 2,
342
- d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
343
- })
344
- })
287
+ role: "switch",
288
+ "aria-checked": H,
289
+ onClick: () => U((e) => !e),
290
+ className: `relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:ring-offset-2 ${H ? "bg-action-primary-bg" : "bg-text-muted/30"}`,
291
+ children: /* @__PURE__ */ h("span", { className: `inline-block h-5 w-5 transform rounded-full bg-bg-surface shadow transition-transform ${H ? "translate-x-5" : "translate-x-0"}` })
345
292
  })]
346
- }), n && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", {
347
- className: "flex items-center justify-between text-sm",
348
- children: /* @__PURE__ */ _("div", {
349
- className: "text-text-muted",
350
- children: [
351
- /* @__PURE__ */ _("span", {
352
- className: "capitalize",
353
- children: ["Type: ", a]
354
- }),
355
- /* @__PURE__ */ g("span", {
356
- className: "mx-2",
357
- children: ""
358
- }),
359
- /* @__PURE__ */ _("span", { children: [
360
- "Value per unit:",
361
- " ",
362
- /* @__PURE__ */ g("span", {
363
- className: "font-medium text-text-primary",
364
- children: i.toLocaleString()
293
+ })
294
+ ]
295
+ })]
296
+ }), /* @__PURE__ */ g("div", {
297
+ className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)] h-fit",
298
+ children: [/* @__PURE__ */ g("div", {
299
+ className: "p-4 border-b border-border-subtle bg-bg-sunken/30 flex items-center justify-between",
300
+ children: [/* @__PURE__ */ h("h2", {
301
+ className: "font-semibold text-text-primary",
302
+ children: b("billing.plans.quotaAllocations", "Quota Allocations")
303
+ }), /* @__PURE__ */ h("button", {
304
+ type: "button",
305
+ onClick: Q,
306
+ className: "px-3 py-1 text-sm font-medium text-text-link hover:bg-[var(--color-accent-soft)] rounded-md transition-colors",
307
+ children: "+ Add Quota"
308
+ })]
309
+ }), /* @__PURE__ */ h("div", {
310
+ className: "p-4 space-y-3",
311
+ children: W.length === 0 ? /* @__PURE__ */ h("p", {
312
+ className: "text-sm text-text-muted",
313
+ children: b("billing.plans.noQuotasAllocated", "No quotas allocated. Click \"Add Quota\" to add one.")
314
+ }) : W.map((e, t) => {
315
+ let n = O.find((t) => t.id === e.quotaId), r = n?.limits, i = r?.value ?? 0, a = r?.type ?? "unknown", o = i * e.quantity;
316
+ return /* @__PURE__ */ g("div", {
317
+ className: "p-3 border border-border-subtle rounded-lg bg-bg-sunken/20 space-y-3",
318
+ children: [/* @__PURE__ */ g("div", {
319
+ className: "flex items-center gap-3",
320
+ children: [/* @__PURE__ */ g("select", {
321
+ value: e.quotaId,
322
+ onChange: (e) => $(t, "quotaId", e.target.value),
323
+ className: `flex-1 px-3 py-2 border border-border-subtle rounded-input bg-bg-surface focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${e.quotaId === "" ? "text-text-muted" : "text-text-primary"}`,
324
+ children: [/* @__PURE__ */ h("option", {
325
+ value: "",
326
+ disabled: !0,
327
+ children: b("billing.plans.selectQuota", "Select a quota...")
328
+ }), O.map((e) => /* @__PURE__ */ h("option", {
329
+ value: e.id,
330
+ children: e.name
331
+ }, e.id))]
332
+ }), /* @__PURE__ */ h("button", {
333
+ type: "button",
334
+ onClick: () => te(t),
335
+ className: "p-2 text-status-error-text hover:bg-status-error-bg-subtle rounded-md transition-colors",
336
+ title: "Remove quota",
337
+ children: /* @__PURE__ */ h("svg", {
338
+ className: "size-5",
339
+ fill: "none",
340
+ viewBox: "0 0 24 24",
341
+ stroke: "currentColor",
342
+ children: /* @__PURE__ */ h("path", {
343
+ strokeLinecap: "round",
344
+ strokeLinejoin: "round",
345
+ strokeWidth: 2,
346
+ d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
365
347
  })
366
- ] })
367
- ]
368
- })
369
- }), /* @__PURE__ */ _("div", {
370
- className: "flex items-center gap-4",
371
- children: [/* @__PURE__ */ _("div", {
372
- className: "flex items-center gap-2",
373
- children: [/* @__PURE__ */ _("label", {
374
- className: "text-sm text-text-muted",
375
- children: [b("billing.plans.quantity", "Quantity"), ":"]
376
- }), /* @__PURE__ */ g("input", {
377
- type: "number",
378
- min: "1",
379
- value: e.quantity,
380
- onChange: (e) => $(t, "quantity", e.target.value),
381
- className: "w-24 px-3 py-1.5 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-center"
348
+ })
382
349
  })]
383
- }), /* @__PURE__ */ _("div", {
384
- className: "flex items-center gap-2 text-sm",
385
- children: [/* @__PURE__ */ g("span", {
350
+ }), n && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
351
+ className: "flex items-center justify-between text-sm",
352
+ children: /* @__PURE__ */ g("div", {
386
353
  className: "text-text-muted",
387
- children: "="
388
- }), /* @__PURE__ */ _("span", {
389
- className: "font-semibold text-status-success-text",
390
- children: [o.toLocaleString(), " total"]
354
+ children: [
355
+ /* @__PURE__ */ g("span", {
356
+ className: "capitalize",
357
+ children: ["Type: ", a]
358
+ }),
359
+ /* @__PURE__ */ h("span", {
360
+ className: "mx-2",
361
+ children: "•"
362
+ }),
363
+ /* @__PURE__ */ g("span", { children: [
364
+ "Value per unit:",
365
+ " ",
366
+ /* @__PURE__ */ h("span", {
367
+ className: "font-medium text-text-primary",
368
+ children: i.toLocaleString()
369
+ })
370
+ ] })
371
+ ]
372
+ })
373
+ }), /* @__PURE__ */ g("div", {
374
+ className: "flex items-center gap-4",
375
+ children: [/* @__PURE__ */ g("div", {
376
+ className: "flex items-center gap-2",
377
+ children: [/* @__PURE__ */ g("label", {
378
+ className: "text-sm text-text-muted",
379
+ children: [b("billing.plans.quantity", "Quantity"), ":"]
380
+ }), /* @__PURE__ */ h("input", {
381
+ type: "number",
382
+ min: "1",
383
+ value: e.quantity,
384
+ onChange: (e) => $(t, "quantity", e.target.value),
385
+ className: "w-24 px-3 py-1.5 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-center"
386
+ })]
387
+ }), /* @__PURE__ */ g("div", {
388
+ className: "flex items-center gap-2 text-sm",
389
+ children: [/* @__PURE__ */ h("span", {
390
+ className: "text-text-muted",
391
+ children: "="
392
+ }), /* @__PURE__ */ g("span", {
393
+ className: "font-semibold text-status-success-text",
394
+ children: [o.toLocaleString(), " total"]
395
+ })]
391
396
  })]
392
- })]
393
- })] })]
394
- }, t);
395
- })
397
+ })] })]
398
+ }, t);
399
+ })
400
+ })]
396
401
  })]
397
- })]
398
- }),
399
- /* @__PURE__ */ g(r, {
400
- overrides: G,
401
- onChange: K
402
- }),
403
- /* @__PURE__ */ _("div", {
404
- className: "flex items-center gap-3 pt-4",
405
- children: [/* @__PURE__ */ g("button", {
406
- type: "submit",
407
- disabled: A,
408
- className: "px-6 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors disabled:opacity-50",
409
- children: A ? b("billing.plans.saving", "Saving...") : b("billing.plans.saveChanges", "Save Changes")
410
- }), /* @__PURE__ */ g("button", {
411
- type: "button",
412
- onClick: () => S(`/plans/${x}`),
413
- className: "px-6 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors",
414
- children: "Cancel"
415
- })]
416
- })
417
- ]
418
- })]
402
+ }),
403
+ /* @__PURE__ */ h(r, {
404
+ overrides: K,
405
+ onChange: q
406
+ }),
407
+ /* @__PURE__ */ g("div", {
408
+ className: "flex items-center gap-3 pt-4",
409
+ children: [/* @__PURE__ */ h("button", {
410
+ type: "submit",
411
+ disabled: j,
412
+ className: "px-6 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors disabled:opacity-50",
413
+ children: j ? b("billing.plans.saving", "Saving...") : b("billing.plans.saveChanges", "Save Changes")
414
+ }), /* @__PURE__ */ h("button", {
415
+ type: "button",
416
+ onClick: () => S(`/plans/${x}`),
417
+ className: "px-6 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors",
418
+ children: "Cancel"
419
+ })]
420
+ })
421
+ ]
422
+ })
423
+ ]
419
424
  });
420
425
  };
421
426
  //#endregion