@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
@@ -11,14 +11,15 @@ import "../hooks/index.js";
11
11
  import { useState as c } from "react";
12
12
  import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
13
13
  import { useI18n as f } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
14
+ import { PagePurpose as p } from "@burdenoff/fe-libs/ui";
14
15
  //#region src/billing/modules/plans/pages/PlanCreatePage.tsx
15
- var p = () => {
16
- let { t: p } = f(), m = (e, t) => {
17
- let n = p(e);
16
+ var m = () => {
17
+ let { t: m } = f(), h = (e, t) => {
18
+ let n = m(e);
18
19
  return n === e ? t : n;
19
- }, h = a(), g = i(), { quotas: _, isLoading: v } = s({ onlyActive: !0 }), { createPlan: y, isCreating: b } = o(), [x, S] = c(""), [C, w] = c(""), [T, E] = c("USD"), [D, O] = c(r.MONTHLY), [k, A] = c(""), [j, M] = c(!0), [N, P] = c([]), [F, I] = c([]), [L, R] = c(null), [z, B] = c(!1);
20
- if (!g.canManagePlans) return /* @__PURE__ */ u(e, { message: m("billing.plans.noCreatePermission", "You don't have permission to create plans.") });
21
- if (v) return /* @__PURE__ */ d("div", {
20
+ }, g = a(), _ = i(), { quotas: v, isLoading: y } = s({ onlyActive: !0 }), { createPlan: b, isCreating: x } = o(), [S, C] = c(""), [w, T] = c(""), [E, D] = c("USD"), [O, k] = c(r.MONTHLY), [A, j] = c(""), [M, N] = c(!0), [P, F] = c([]), [I, L] = c([]), [R, z] = c(null), [B, V] = c(!1);
21
+ if (!_.canManagePlans) return /* @__PURE__ */ u(e, { message: h("billing.plans.noCreatePermission", "You don't have permission to create plans.") });
22
+ if (y) return /* @__PURE__ */ d("div", {
22
23
  className: "space-y-6 p-6",
23
24
  children: [/* @__PURE__ */ u("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ u("div", {
24
25
  className: "max-w-2xl space-y-4",
@@ -31,356 +32,360 @@ var p = () => {
31
32
  ].map((e) => /* @__PURE__ */ u("div", { className: "h-16 bg-bg-sunken animate-pulse rounded" }, e))
32
33
  })]
33
34
  });
34
- let V = () => {
35
- P([{
35
+ let H = () => {
36
+ F([{
36
37
  quotaId: "",
37
38
  quantity: 1
38
- }, ...N]);
39
- }, H = (e) => {
40
- P(N.filter((t, n) => n !== e));
41
- }, U = (e, t, n) => {
42
- let r = [...N];
43
- t === "quotaId" ? r[e].quotaId = n : r[e].quantity = Number(n), P(r);
39
+ }, ...P]);
40
+ }, U = (e) => {
41
+ F(P.filter((t, n) => n !== e));
42
+ }, W = (e, t, n) => {
43
+ let r = [...P];
44
+ t === "quotaId" ? r[e].quotaId = n : r[e].quantity = Number(n), F(r);
44
45
  };
45
46
  return /* @__PURE__ */ d("div", {
46
47
  className: "space-y-6 p-6",
47
- children: [/* @__PURE__ */ u(t, {
48
- title: m("billing.plans.createNewPlan", "Create New Plan"),
49
- description: m("billing.plans.createNewPlanDesc", "Set up a new pricing plan with quotas")
50
- }), /* @__PURE__ */ d("form", {
51
- onSubmit: async (e) => {
52
- if (e.preventDefault(), R(null), B(!1), !x.trim()) {
53
- R("Plan name is required");
54
- return;
55
- }
56
- if (!C || isNaN(Number(C)) || Number(C) < 0) {
57
- R("Valid price is required");
58
- return;
59
- }
60
- if (!k.trim()) {
61
- R("Product ID is required");
62
- return;
63
- }
64
- if (N.length === 0) {
65
- R("At least one quota is required");
66
- return;
67
- }
68
- if (N.filter((e) => e.quotaId === "").length > 0) {
69
- R("Please select a quota for all allocations");
70
- return;
71
- }
72
- let t = {
73
- name: x.trim(),
74
- price: Number(C),
75
- currency: T,
76
- duration: D,
77
- productId: k.trim(),
78
- isPurchasable: j,
79
- quotas: N.map((e) => ({
80
- quotaId: e.quotaId,
81
- quantity: e.quantity
82
- })),
83
- ...F.length > 0 ? { currencyPriceOverrides: F } : {}
84
- };
85
- try {
86
- await y(t), B(!0), setTimeout(() => h("/plans"), 1500);
87
- } catch (e) {
88
- R(e instanceof Error ? e.message : "Failed to create plan");
89
- }
90
- },
91
- className: "space-y-6",
92
- children: [
93
- L && /* @__PURE__ */ u("div", {
94
- className: "p-4 bg-status-error-bg-subtle border border-border-subtle rounded-lg",
95
- children: /* @__PURE__ */ u("p", {
96
- className: "text-sm text-status-error-text",
97
- children: L
98
- })
99
- }),
100
- z && /* @__PURE__ */ u("div", {
101
- className: "p-4 bg-status-success-bg-subtle border border-border-subtle rounded-lg",
102
- children: /* @__PURE__ */ u("p", {
103
- className: "text-sm text-status-success-text",
104
- children: m("billing.plans.createSuccess", "Plan created successfully! Redirecting...")
105
- })
106
- }),
107
- /* @__PURE__ */ d("div", {
108
- className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
109
- children: [/* @__PURE__ */ d("div", {
110
- className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)] h-fit",
111
- children: [/* @__PURE__ */ u("div", {
112
- className: "p-4 border-b border-border-subtle bg-bg-sunken/30",
113
- children: /* @__PURE__ */ u("h2", {
114
- className: "font-semibold text-text-primary",
115
- children: m("billing.plans.basicInfo", "Basic Information")
116
- })
117
- }), /* @__PURE__ */ d("div", {
118
- className: "p-4 space-y-4",
119
- children: [
120
- /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
121
- htmlFor: "name",
122
- className: "block text-sm font-medium text-text-primary mb-1",
123
- children: [m("billing.plans.planNameLabel", "Plan Name"), " *"]
124
- }), /* @__PURE__ */ u("input", {
125
- id: "name",
126
- type: "text",
127
- value: x,
128
- onChange: (e) => S(e.target.value),
129
- 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)]",
130
- placeholder: m("billing.plans.planNamePlaceholder", "e.g., Pro Plan"),
131
- required: !0
132
- })] }),
133
- /* @__PURE__ */ d("div", { children: [
134
- /* @__PURE__ */ d("label", {
135
- htmlFor: "productId",
48
+ children: [
49
+ /* @__PURE__ */ u(t, {
50
+ title: h("billing.plans.createNewPlan", "Create New Plan"),
51
+ description: h("billing.plans.createNewPlanDesc", "Set up a new pricing plan with quotas")
52
+ }),
53
+ /* @__PURE__ */ u(p, { children: h("billing.plans.createPurpose", "Define a new subscription tier customers can buy — its price and billing period, optional per-currency and per-seat pricing, and the quotas it includes. Once active, it appears on the Plans page for purchase.") }),
54
+ /* @__PURE__ */ d("form", {
55
+ onSubmit: async (e) => {
56
+ if (e.preventDefault(), z(null), V(!1), !S.trim()) {
57
+ z("Plan name is required");
58
+ return;
59
+ }
60
+ if (!w || isNaN(Number(w)) || Number(w) < 0) {
61
+ z("Valid price is required");
62
+ return;
63
+ }
64
+ if (!A.trim()) {
65
+ z("Product ID is required");
66
+ return;
67
+ }
68
+ if (P.length === 0) {
69
+ z("At least one quota is required");
70
+ return;
71
+ }
72
+ if (P.filter((e) => e.quotaId === "").length > 0) {
73
+ z("Please select a quota for all allocations");
74
+ return;
75
+ }
76
+ let t = {
77
+ name: S.trim(),
78
+ price: Number(w),
79
+ currency: E,
80
+ duration: O,
81
+ productId: A.trim(),
82
+ isPurchasable: M,
83
+ quotas: P.map((e) => ({
84
+ quotaId: e.quotaId,
85
+ quantity: e.quantity
86
+ })),
87
+ ...I.length > 0 ? { currencyPriceOverrides: I } : {}
88
+ };
89
+ try {
90
+ await b(t), V(!0), setTimeout(() => g("/plans"), 1500);
91
+ } catch (e) {
92
+ z(e instanceof Error ? e.message : "Failed to create plan");
93
+ }
94
+ },
95
+ className: "space-y-6",
96
+ children: [
97
+ R && /* @__PURE__ */ u("div", {
98
+ className: "p-4 bg-status-error-bg-subtle border border-border-subtle rounded-lg",
99
+ children: /* @__PURE__ */ u("p", {
100
+ className: "text-sm text-status-error-text",
101
+ children: R
102
+ })
103
+ }),
104
+ B && /* @__PURE__ */ u("div", {
105
+ className: "p-4 bg-status-success-bg-subtle border border-border-subtle rounded-lg",
106
+ children: /* @__PURE__ */ u("p", {
107
+ className: "text-sm text-status-success-text",
108
+ children: h("billing.plans.createSuccess", "Plan created successfully! Redirecting...")
109
+ })
110
+ }),
111
+ /* @__PURE__ */ d("div", {
112
+ className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
113
+ children: [/* @__PURE__ */ d("div", {
114
+ className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)] h-fit",
115
+ children: [/* @__PURE__ */ u("div", {
116
+ className: "p-4 border-b border-border-subtle bg-bg-sunken/30",
117
+ children: /* @__PURE__ */ u("h2", {
118
+ className: "font-semibold text-text-primary",
119
+ children: h("billing.plans.basicInfo", "Basic Information")
120
+ })
121
+ }), /* @__PURE__ */ d("div", {
122
+ className: "p-4 space-y-4",
123
+ children: [
124
+ /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
125
+ htmlFor: "name",
136
126
  className: "block text-sm font-medium text-text-primary mb-1",
137
- children: [m("billing.plans.productId", "Product ID"), " *"]
138
- }),
139
- /* @__PURE__ */ u("input", {
140
- id: "productId",
127
+ children: [h("billing.plans.planNameLabel", "Plan Name"), " *"]
128
+ }), /* @__PURE__ */ u("input", {
129
+ id: "name",
141
130
  type: "text",
142
- value: k,
143
- onChange: (e) => A(e.target.value),
131
+ value: S,
132
+ onChange: (e) => C(e.target.value),
144
133
  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)]",
145
- placeholder: m("billing.plans.productIdPlaceholder", "e.g., prod_abc123"),
134
+ placeholder: h("billing.plans.planNamePlaceholder", "e.g., Pro Plan"),
146
135
  required: !0
136
+ })] }),
137
+ /* @__PURE__ */ d("div", { children: [
138
+ /* @__PURE__ */ d("label", {
139
+ htmlFor: "productId",
140
+ className: "block text-sm font-medium text-text-primary mb-1",
141
+ children: [h("billing.plans.productId", "Product ID"), " *"]
142
+ }),
143
+ /* @__PURE__ */ u("input", {
144
+ id: "productId",
145
+ type: "text",
146
+ value: A,
147
+ onChange: (e) => j(e.target.value),
148
+ 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)]",
149
+ placeholder: h("billing.plans.productIdPlaceholder", "e.g., prod_abc123"),
150
+ required: !0
151
+ }),
152
+ /* @__PURE__ */ u("p", {
153
+ className: "text-xs text-text-muted mt-1",
154
+ children: h("billing.plans.productIdDesc", "The product this plan belongs to")
155
+ })
156
+ ] }),
157
+ /* @__PURE__ */ d("div", {
158
+ className: "grid grid-cols-2 gap-4",
159
+ children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
160
+ htmlFor: "price",
161
+ className: "block text-sm font-medium text-text-primary mb-1",
162
+ children: [h("billing.plans.priceLabel", "Price"), " *"]
163
+ }), /* @__PURE__ */ u("input", {
164
+ id: "price",
165
+ type: "number",
166
+ step: "0.01",
167
+ min: "0",
168
+ value: w,
169
+ onChange: (e) => T(e.target.value),
170
+ 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)]",
171
+ placeholder: "49.99",
172
+ required: !0
173
+ })] }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
174
+ htmlFor: "currency",
175
+ className: "block text-sm font-medium text-text-primary mb-1",
176
+ children: [h("billing.plans.currencyLabel", "Currency"), " *"]
177
+ }), /* @__PURE__ */ d("select", {
178
+ id: "currency",
179
+ value: E,
180
+ onChange: (e) => D(e.target.value),
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)]",
182
+ children: [
183
+ /* @__PURE__ */ u("option", {
184
+ value: "USD",
185
+ children: "USD ($)"
186
+ }),
187
+ /* @__PURE__ */ u("option", {
188
+ value: "EUR",
189
+ children: "EUR"
190
+ }),
191
+ /* @__PURE__ */ u("option", {
192
+ value: "GBP",
193
+ children: "GBP"
194
+ }),
195
+ /* @__PURE__ */ u("option", {
196
+ value: "INR",
197
+ children: "INR"
198
+ }),
199
+ /* @__PURE__ */ u("option", {
200
+ value: "AUD",
201
+ children: "AUD"
202
+ }),
203
+ /* @__PURE__ */ u("option", {
204
+ value: "CAD",
205
+ children: "CAD"
206
+ }),
207
+ /* @__PURE__ */ u("option", {
208
+ value: "JPY",
209
+ children: "JPY"
210
+ }),
211
+ /* @__PURE__ */ u("option", {
212
+ value: "SGD",
213
+ children: "SGD"
214
+ })
215
+ ]
216
+ })] })]
147
217
  }),
148
- /* @__PURE__ */ u("p", {
149
- className: "text-xs text-text-muted mt-1",
150
- children: m("billing.plans.productIdDesc", "The product this plan belongs to")
151
- })
152
- ] }),
153
- /* @__PURE__ */ d("div", {
154
- className: "grid grid-cols-2 gap-4",
155
- children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
156
- htmlFor: "price",
218
+ /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
219
+ htmlFor: "duration",
157
220
  className: "block text-sm font-medium text-text-primary mb-1",
158
- children: [m("billing.plans.priceLabel", "Price"), " *"]
159
- }), /* @__PURE__ */ u("input", {
160
- id: "price",
161
- type: "number",
162
- step: "0.01",
163
- min: "0",
164
- value: C,
165
- onChange: (e) => w(e.target.value),
166
- 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)]",
167
- placeholder: "49.99",
168
- required: !0
169
- })] }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
170
- htmlFor: "currency",
171
- className: "block text-sm font-medium text-text-primary mb-1",
172
- children: [m("billing.plans.currencyLabel", "Currency"), " *"]
221
+ children: [h("billing.plans.billingPeriodLabel", "Billing Period"), " *"]
173
222
  }), /* @__PURE__ */ d("select", {
174
- id: "currency",
175
- value: T,
176
- onChange: (e) => E(e.target.value),
223
+ id: "duration",
224
+ value: O,
225
+ onChange: (e) => k(e.target.value),
177
226
  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
- children: [
179
- /* @__PURE__ */ u("option", {
180
- value: "USD",
181
- children: "USD ($)"
182
- }),
183
- /* @__PURE__ */ u("option", {
184
- value: "EUR",
185
- children: "EUR"
186
- }),
187
- /* @__PURE__ */ u("option", {
188
- value: "GBP",
189
- children: "GBP"
190
- }),
191
- /* @__PURE__ */ u("option", {
192
- value: "INR",
193
- children: "INR"
194
- }),
195
- /* @__PURE__ */ u("option", {
196
- value: "AUD",
197
- children: "AUD"
198
- }),
199
- /* @__PURE__ */ u("option", {
200
- value: "CAD",
201
- children: "CAD"
202
- }),
203
- /* @__PURE__ */ u("option", {
204
- value: "JPY",
205
- children: "JPY"
206
- }),
207
- /* @__PURE__ */ u("option", {
208
- value: "SGD",
209
- children: "SGD"
210
- })
211
- ]
212
- })] })]
213
- }),
214
- /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
215
- htmlFor: "duration",
216
- className: "block text-sm font-medium text-text-primary mb-1",
217
- children: [m("billing.plans.billingPeriodLabel", "Billing Period"), " *"]
218
- }), /* @__PURE__ */ d("select", {
219
- id: "duration",
220
- value: D,
221
- onChange: (e) => O(e.target.value),
222
- 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)]",
223
- children: [/* @__PURE__ */ u("option", {
224
- value: r.MONTHLY,
225
- children: "Monthly"
226
- }), /* @__PURE__ */ u("option", {
227
- value: r.YEARLY,
228
- children: "Yearly"
229
- })]
230
- })] }),
231
- /* @__PURE__ */ d("div", {
232
- className: "flex items-start justify-between gap-4 pt-1",
233
- children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
234
- className: "text-sm font-medium text-text-primary",
235
- children: m("billing.plans.isPurchasableLabel", "Publicly purchasable")
236
- }), /* @__PURE__ */ u("p", {
237
- className: "text-xs text-text-muted mt-0.5",
238
- children: j ? m("billing.plans.isPurchasableOn", "Visible on pricing page — users can subscribe directly.") : m("billing.plans.isPurchasableOff", "Internal / custom plan — hidden from pricing page, assign via API only.")
239
- })] }), /* @__PURE__ */ u("button", {
240
- type: "button",
241
- role: "switch",
242
- "aria-checked": j,
243
- onClick: () => M((e) => !e),
244
- 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 ${j ? "bg-action-primary-bg" : "bg-text-muted/30"}`,
245
- children: /* @__PURE__ */ u("span", { className: `inline-block h-5 w-5 transform rounded-full bg-bg-surface shadow transition-transform ${j ? "translate-x-5" : "translate-x-0"}` })
246
- })]
247
- })
248
- ]
249
- })]
250
- }), /* @__PURE__ */ d("div", {
251
- className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)] h-fit",
252
- children: [/* @__PURE__ */ d("div", {
253
- className: "p-4 border-b border-border-subtle bg-bg-sunken/30 flex items-center justify-between",
254
- children: [/* @__PURE__ */ d("h2", {
255
- className: "font-semibold text-text-primary",
256
- children: [m("billing.plans.quotaAllocations", "Quota Allocations"), " *"]
257
- }), /* @__PURE__ */ u("button", {
258
- type: "button",
259
- onClick: V,
260
- disabled: _.length === 0,
261
- className: "px-3 py-1 text-sm font-medium text-text-link hover:bg-[var(--color-accent-soft)] rounded-md transition-colors disabled:opacity-50",
262
- children: "+ Add Quota"
263
- })]
264
- }), /* @__PURE__ */ u("div", {
265
- className: "p-4 space-y-3",
266
- children: _.length === 0 ? /* @__PURE__ */ u("p", {
267
- className: "text-sm text-text-muted",
268
- children: m("billing.plans.noQuotasAvailable", "No quotas available. Please create quotas first.")
269
- }) : N.length === 0 ? /* @__PURE__ */ u("p", {
270
- className: "text-sm text-text-muted",
271
- children: m("billing.plans.noQuotasAllocated", "No quotas allocated. Click \"Add Quota\" to add one.")
272
- }) : N.map((e, t) => {
273
- let n = _.find((t) => t.id === e.quotaId), r = n?.limits, i = r?.value ?? 0, a = r?.type ?? "unknown", o = i * e.quantity;
274
- return /* @__PURE__ */ d("div", {
275
- className: "p-3 border border-border-subtle rounded-lg bg-bg-sunken/20 space-y-3",
276
- children: [/* @__PURE__ */ d("div", {
277
- className: "flex items-center gap-3",
278
- children: [/* @__PURE__ */ d("select", {
279
- value: e.quotaId,
280
- onChange: (e) => U(t, "quotaId", e.target.value),
281
- 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"}`,
282
- children: [/* @__PURE__ */ u("option", {
283
- value: "",
284
- disabled: !0,
285
- children: m("billing.plans.selectQuota", "Select a quota...")
286
- }), _.map((e) => /* @__PURE__ */ u("option", {
287
- value: e.id,
288
- children: e.name
289
- }, e.id))]
290
- }), /* @__PURE__ */ u("button", {
227
+ children: [/* @__PURE__ */ u("option", {
228
+ value: r.MONTHLY,
229
+ children: "Monthly"
230
+ }), /* @__PURE__ */ u("option", {
231
+ value: r.YEARLY,
232
+ children: "Yearly"
233
+ })]
234
+ })] }),
235
+ /* @__PURE__ */ d("div", {
236
+ className: "flex items-start justify-between gap-4 pt-1",
237
+ children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
238
+ className: "text-sm font-medium text-text-primary",
239
+ children: h("billing.plans.isPurchasableLabel", "Publicly purchasable")
240
+ }), /* @__PURE__ */ u("p", {
241
+ className: "text-xs text-text-muted mt-0.5",
242
+ children: M ? h("billing.plans.isPurchasableOn", "Visible on pricing page — users can subscribe directly.") : h("billing.plans.isPurchasableOff", "Internal / custom plan — hidden from pricing page, assign via API only.")
243
+ })] }), /* @__PURE__ */ u("button", {
291
244
  type: "button",
292
- onClick: () => H(t),
293
- className: "p-2 text-status-error-text hover:bg-status-error-bg-subtle rounded-md transition-colors",
294
- title: "Remove quota",
295
- children: /* @__PURE__ */ u("svg", {
296
- className: "size-5",
297
- fill: "none",
298
- viewBox: "0 0 24 24",
299
- stroke: "currentColor",
300
- children: /* @__PURE__ */ u("path", {
301
- strokeLinecap: "round",
302
- strokeLinejoin: "round",
303
- strokeWidth: 2,
304
- 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"
305
- })
306
- })
245
+ role: "switch",
246
+ "aria-checked": M,
247
+ onClick: () => N((e) => !e),
248
+ 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 ${M ? "bg-action-primary-bg" : "bg-text-muted/30"}`,
249
+ children: /* @__PURE__ */ u("span", { className: `inline-block h-5 w-5 transform rounded-full bg-bg-surface shadow transition-transform ${M ? "translate-x-5" : "translate-x-0"}` })
307
250
  })]
308
- }), n && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", {
309
- className: "flex items-center justify-between text-sm",
310
- children: /* @__PURE__ */ d("div", {
311
- className: "text-text-muted",
312
- children: [
313
- /* @__PURE__ */ d("span", {
314
- className: "capitalize",
315
- children: ["Type: ", a]
316
- }),
317
- /* @__PURE__ */ u("span", {
318
- className: "mx-2",
319
- children: ""
320
- }),
321
- /* @__PURE__ */ d("span", { children: [
322
- "Value per unit:",
323
- " ",
324
- /* @__PURE__ */ u("span", {
325
- className: "font-medium text-text-primary",
326
- children: i.toLocaleString()
327
- })
328
- ] })
329
- ]
330
- })
331
- }), /* @__PURE__ */ d("div", {
332
- className: "flex items-center gap-4",
251
+ })
252
+ ]
253
+ })]
254
+ }), /* @__PURE__ */ d("div", {
255
+ className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)] h-fit",
256
+ children: [/* @__PURE__ */ d("div", {
257
+ className: "p-4 border-b border-border-subtle bg-bg-sunken/30 flex items-center justify-between",
258
+ children: [/* @__PURE__ */ d("h2", {
259
+ className: "font-semibold text-text-primary",
260
+ children: [h("billing.plans.quotaAllocations", "Quota Allocations"), " *"]
261
+ }), /* @__PURE__ */ u("button", {
262
+ type: "button",
263
+ onClick: H,
264
+ disabled: v.length === 0,
265
+ className: "px-3 py-1 text-sm font-medium text-text-link hover:bg-[var(--color-accent-soft)] rounded-md transition-colors disabled:opacity-50",
266
+ children: "+ Add Quota"
267
+ })]
268
+ }), /* @__PURE__ */ u("div", {
269
+ className: "p-4 space-y-3",
270
+ children: v.length === 0 ? /* @__PURE__ */ u("p", {
271
+ className: "text-sm text-text-muted",
272
+ children: h("billing.plans.noQuotasAvailable", "No quotas available. Please create quotas first.")
273
+ }) : P.length === 0 ? /* @__PURE__ */ u("p", {
274
+ className: "text-sm text-text-muted",
275
+ children: h("billing.plans.noQuotasAllocated", "No quotas allocated. Click \"Add Quota\" to add one.")
276
+ }) : P.map((e, t) => {
277
+ let n = v.find((t) => t.id === e.quotaId), r = n?.limits, i = r?.value ?? 0, a = r?.type ?? "unknown", o = i * e.quantity;
278
+ return /* @__PURE__ */ d("div", {
279
+ className: "p-3 border border-border-subtle rounded-lg bg-bg-sunken/20 space-y-3",
333
280
  children: [/* @__PURE__ */ d("div", {
334
- className: "flex items-center gap-2",
335
- children: [/* @__PURE__ */ d("label", {
336
- className: "text-sm text-text-muted",
337
- children: [m("billing.plans.quantity", "Quantity"), ":"]
338
- }), /* @__PURE__ */ u("input", {
339
- type: "number",
340
- min: "1",
341
- value: e.quantity,
342
- onChange: (e) => U(t, "quantity", e.target.value),
343
- 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"
281
+ className: "flex items-center gap-3",
282
+ children: [/* @__PURE__ */ d("select", {
283
+ value: e.quotaId,
284
+ onChange: (e) => W(t, "quotaId", e.target.value),
285
+ 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"}`,
286
+ children: [/* @__PURE__ */ u("option", {
287
+ value: "",
288
+ disabled: !0,
289
+ children: h("billing.plans.selectQuota", "Select a quota...")
290
+ }), v.map((e) => /* @__PURE__ */ u("option", {
291
+ value: e.id,
292
+ children: e.name
293
+ }, e.id))]
294
+ }), /* @__PURE__ */ u("button", {
295
+ type: "button",
296
+ onClick: () => U(t),
297
+ className: "p-2 text-status-error-text hover:bg-status-error-bg-subtle rounded-md transition-colors",
298
+ title: "Remove quota",
299
+ children: /* @__PURE__ */ u("svg", {
300
+ className: "size-5",
301
+ fill: "none",
302
+ viewBox: "0 0 24 24",
303
+ stroke: "currentColor",
304
+ children: /* @__PURE__ */ u("path", {
305
+ strokeLinecap: "round",
306
+ strokeLinejoin: "round",
307
+ strokeWidth: 2,
308
+ 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"
309
+ })
310
+ })
344
311
  })]
345
- }), /* @__PURE__ */ d("div", {
346
- className: "flex items-center gap-2 text-sm",
347
- children: [/* @__PURE__ */ u("span", {
312
+ }), n && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", {
313
+ className: "flex items-center justify-between text-sm",
314
+ children: /* @__PURE__ */ d("div", {
348
315
  className: "text-text-muted",
349
- children: "="
350
- }), /* @__PURE__ */ d("span", {
351
- className: "font-semibold text-status-success-text",
352
- children: [o.toLocaleString(), " total"]
316
+ children: [
317
+ /* @__PURE__ */ d("span", {
318
+ className: "capitalize",
319
+ children: ["Type: ", a]
320
+ }),
321
+ /* @__PURE__ */ u("span", {
322
+ className: "mx-2",
323
+ children: "•"
324
+ }),
325
+ /* @__PURE__ */ d("span", { children: [
326
+ "Value per unit:",
327
+ " ",
328
+ /* @__PURE__ */ u("span", {
329
+ className: "font-medium text-text-primary",
330
+ children: i.toLocaleString()
331
+ })
332
+ ] })
333
+ ]
334
+ })
335
+ }), /* @__PURE__ */ d("div", {
336
+ className: "flex items-center gap-4",
337
+ children: [/* @__PURE__ */ d("div", {
338
+ className: "flex items-center gap-2",
339
+ children: [/* @__PURE__ */ d("label", {
340
+ className: "text-sm text-text-muted",
341
+ children: [h("billing.plans.quantity", "Quantity"), ":"]
342
+ }), /* @__PURE__ */ u("input", {
343
+ type: "number",
344
+ min: "1",
345
+ value: e.quantity,
346
+ onChange: (e) => W(t, "quantity", e.target.value),
347
+ 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
+ })]
349
+ }), /* @__PURE__ */ d("div", {
350
+ className: "flex items-center gap-2 text-sm",
351
+ children: [/* @__PURE__ */ u("span", {
352
+ className: "text-text-muted",
353
+ children: "="
354
+ }), /* @__PURE__ */ d("span", {
355
+ className: "font-semibold text-status-success-text",
356
+ children: [o.toLocaleString(), " total"]
357
+ })]
353
358
  })]
354
- })]
355
- })] })]
356
- }, t);
357
- })
359
+ })] })]
360
+ }, t);
361
+ })
362
+ })]
358
363
  })]
359
- })]
360
- }),
361
- /* @__PURE__ */ u(n, {
362
- overrides: F,
363
- onChange: I
364
- }),
365
- /* @__PURE__ */ d("div", {
366
- className: "flex items-center gap-3 pt-4",
367
- children: [/* @__PURE__ */ u("button", {
368
- type: "submit",
369
- disabled: b || _.length === 0,
370
- 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",
371
- children: b ? m("billing.plans.creating", "Creating...") : m("billing.plans.createPlanBtn", "Create Plan")
372
- }), /* @__PURE__ */ u("button", {
373
- type: "button",
374
- onClick: () => h("/plans"),
375
- className: "px-6 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors",
376
- children: "Cancel"
377
- })]
378
- })
379
- ]
380
- })]
364
+ }),
365
+ /* @__PURE__ */ u(n, {
366
+ overrides: I,
367
+ onChange: L
368
+ }),
369
+ /* @__PURE__ */ d("div", {
370
+ className: "flex items-center gap-3 pt-4",
371
+ children: [/* @__PURE__ */ u("button", {
372
+ type: "submit",
373
+ disabled: x || v.length === 0,
374
+ 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",
375
+ children: x ? h("billing.plans.creating", "Creating...") : h("billing.plans.createPlanBtn", "Create Plan")
376
+ }), /* @__PURE__ */ u("button", {
377
+ type: "button",
378
+ onClick: () => g("/plans"),
379
+ className: "px-6 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors",
380
+ children: "Cancel"
381
+ })]
382
+ })
383
+ ]
384
+ })
385
+ ]
381
386
  });
382
387
  };
383
388
  //#endregion
384
- export { p as PlanCreatePage };
389
+ export { m as PlanCreatePage };
385
390
 
386
391
  //# sourceMappingURL=PlanCreatePage.js.map