@burdenoff/microfe-billing 2026.1113.1 → 2026.1113.3

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 (109) hide show
  1. package/dist/billing/BillingRoot.js +83 -77
  2. package/dist/billing/BillingRoot.js.map +1 -1
  3. package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +78 -78
  4. package/dist/billing/modules/addons/pages/AddonCreatePage.js +70 -70
  5. package/dist/billing/modules/addons/pages/AddonDetailPage.js +72 -72
  6. package/dist/billing/modules/addons/pages/AddonEditPage.js +79 -79
  7. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +224 -224
  8. package/dist/billing/modules/addons/pages/AddonsListPage.js +186 -186
  9. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +168 -168
  10. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
  11. package/dist/billing/modules/analytics/pages/AnalyticsPage.js +88 -88
  12. package/dist/billing/modules/billing/hooks/index.js +5 -5
  13. package/dist/billing/modules/billing/hooks/useInvoices.js +39 -20
  14. package/dist/billing/modules/billing/hooks/useInvoices.js.map +1 -1
  15. package/dist/billing/modules/billing/index.js +14 -14
  16. package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +92 -92
  17. package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +160 -160
  18. package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
  19. package/dist/billing/modules/billing/pages/InvoicesListPage.js +100 -100
  20. package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +105 -105
  21. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +37 -37
  22. package/dist/billing/modules/billing/pages/RefundIssueLogsPage.js +41 -41
  23. package/dist/billing/modules/billing/pages/RefundsPage.js +334 -334
  24. package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
  25. package/dist/billing/modules/billing/pages/TransactionsPage.js +174 -174
  26. package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
  27. package/dist/billing/modules/billing/pages/UserRefundsPage.js +24 -24
  28. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
  29. package/dist/billing/modules/checkout/components/OrderSummary.js +71 -71
  30. package/dist/billing/modules/checkout/pages/CheckoutPage.js +646 -625
  31. package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
  32. package/dist/billing/modules/checkout/utils/checkoutOptions.d.ts +23 -0
  33. package/dist/billing/modules/checkout/utils/checkoutOptions.js +8 -0
  34. package/dist/billing/modules/checkout/utils/checkoutOptions.js.map +1 -0
  35. package/dist/billing/modules/coupons/pages/CouponDetailPage.js +112 -112
  36. package/dist/billing/modules/coupons/pages/CouponsListPage.js +118 -118
  37. package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
  38. package/dist/billing/modules/coupons/pages/CreateCouponPage.js +119 -119
  39. package/dist/billing/modules/coupons/pages/EditCouponPage.js +82 -82
  40. package/dist/billing/modules/credits/pages/AdminCreditsPage.js +30 -30
  41. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +77 -77
  42. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +144 -144
  43. package/dist/billing/modules/credits/pages/CreditsPage.js +67 -67
  44. package/dist/billing/modules/dashboard/pages/OverviewPage.js +594 -442
  45. package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
  46. package/dist/billing/modules/dashboard/utils/overviewSummary.d.ts +46 -0
  47. package/dist/billing/modules/dashboard/utils/overviewSummary.js +37 -0
  48. package/dist/billing/modules/dashboard/utils/overviewSummary.js.map +1 -0
  49. package/dist/billing/modules/discounts/pages/DiscountsListPage.js +199 -199
  50. package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
  51. package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.js +64 -64
  52. package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +122 -122
  53. package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -1
  54. package/dist/billing/modules/earnings/pages/EarningsPage.js +102 -102
  55. package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
  56. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +178 -178
  57. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
  58. package/dist/billing/modules/earnings/pages/PayoutsPage.js +107 -107
  59. package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
  60. package/dist/billing/modules/plans/pages/PlanAssignFreePage.js +54 -54
  61. package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +94 -94
  62. package/dist/billing/modules/plans/pages/PlanCreatePage.js +73 -73
  63. package/dist/billing/modules/plans/pages/PlanDetailPage.js +96 -96
  64. package/dist/billing/modules/plans/pages/PlanEditPage.js +16 -16
  65. package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
  66. package/dist/billing/modules/plans/pages/PlansBrowsePage.js +143 -143
  67. package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
  68. package/dist/billing/modules/plans/pages/PlansListPage.js +88 -88
  69. package/dist/billing/modules/plans/utils/planAction.d.ts +9 -0
  70. package/dist/billing/modules/plans/utils/planAction.js +4 -1
  71. package/dist/billing/modules/plans/utils/planAction.js.map +1 -1
  72. package/dist/billing/modules/promotions/pages/CreatePromotionPage.js +60 -60
  73. package/dist/billing/modules/promotions/pages/PromotionsListPage.js +37 -37
  74. package/dist/billing/modules/quota/pages/QuotaAssignFreePage.js +62 -62
  75. package/dist/billing/modules/quota/pages/QuotaPage.js +1 -1
  76. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +69 -69
  77. package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +76 -76
  78. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +80 -80
  79. package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +95 -95
  80. package/dist/billing/modules/settings/pages/SettingsPage.js +134 -134
  81. package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
  82. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +62 -62
  83. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
  84. package/dist/billing/modules/subscriptions/components/ManageSeatsModal.js +36 -36
  85. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +534 -410
  86. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
  87. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +111 -111
  88. package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +166 -160
  89. package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
  90. package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.d.ts +30 -0
  91. package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.js +20 -0
  92. package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.js.map +1 -0
  93. package/dist/billing/modules/subscriptions/utils/upgradeAccess.d.ts +10 -0
  94. package/dist/billing/modules/subscriptions/utils/upgradeAccess.js +7 -0
  95. package/dist/billing/modules/subscriptions/utils/upgradeAccess.js.map +1 -0
  96. package/dist/billing/modules/usage/pages/UsagePage.js +722 -591
  97. package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
  98. package/dist/billing/modules/usage/utils/usageHealth.d.ts +63 -0
  99. package/dist/billing/modules/usage/utils/usageHealth.js +43 -0
  100. package/dist/billing/modules/usage/utils/usageHealth.js.map +1 -0
  101. package/dist/billing/shared/components/EmptyState.js +3 -3
  102. package/dist/billing/shared/components/MoneyActionDialog.js +12 -12
  103. package/dist/billing/shared/ui/MetricCard.js +13 -13
  104. package/dist/billing/shared/utils/format.js +16 -4
  105. package/dist/billing/shared/utils/format.js.map +1 -1
  106. package/dist/billing/shared/utils/index.js +8 -8
  107. package/dist/generated/global-operations.js +294 -286
  108. package/dist/generated/global-operations.js.map +1 -1
  109. package/package.json +2 -2
@@ -6,13 +6,13 @@ import "../../../shared/components/index.js";
6
6
  import { useGetCouponLazyQuery as i, useUpdateCouponMutation as a } from "../../../../generated/global-operations.js";
7
7
  import { CouponStatus as o } from "../../../../generated/global-types.js";
8
8
  import { useEffect as s, useState as c } from "react";
9
- import { AlertCircle as l, ArrowLeft as u, CheckCircle as d, Save as f } from "lucide-react";
10
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
11
- import { useI18n as h } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
12
- import { PagePurpose as g } from "@burdenoff/fe-libs/ui";
9
+ import { PagePurpose as l } from "@burdenoff/fe-libs/ui";
10
+ import { AlertCircle as u, ArrowLeft as d, CheckCircle as f, Save as p } from "lucide-react";
11
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
12
+ import { useI18n as g } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
13
13
  // src/billing/modules/coupons/pages/EditCouponPage.tsx
14
14
  var _ = () => {
15
- let { t: _ } = h(), v = (e, t) => {
15
+ let { t: _ } = g(), v = (e, t) => {
16
16
  let n = _(e);
17
17
  return n === e ? t : n;
18
18
  }, y = n(), b = r(), x = window.location.pathname.split("/").slice(-2)[0], [S, { data: C, loading: w, error: T }] = i(), [E, { loading: D }] = a(), [O, k] = c({
@@ -37,7 +37,7 @@ var _ = () => {
37
37
  validUntil: e.validUntil ? new Date(e.validUntil).toISOString().split("T")[0] : ""
38
38
  });
39
39
  }
40
- }, [C]), !b.canManageDiscounts) return /* @__PURE__ */ p(e, { message: "You don't have permission to manage coupons." });
40
+ }, [C]), !b.canManageDiscounts) return /* @__PURE__ */ m(e, { message: "You don't have permission to manage coupons." });
41
41
  let I = (e, t) => {
42
42
  k((n) => ({
43
43
  ...n,
@@ -65,140 +65,140 @@ var _ = () => {
65
65
  }
66
66
  }
67
67
  };
68
- if (w) return /* @__PURE__ */ m("div", {
68
+ if (w) return /* @__PURE__ */ h("div", {
69
69
  className: "p-8",
70
- children: [/* @__PURE__ */ p(t, {
70
+ children: [/* @__PURE__ */ m(t, {
71
71
  title: v("billing.coupons.editTitle", "Edit Coupon"),
72
72
  description: "Loading coupon data...",
73
- actions: /* @__PURE__ */ m("button", {
73
+ actions: /* @__PURE__ */ h("button", {
74
74
  type: "button",
75
75
  onClick: () => y("/coupons"),
76
76
  className: "px-4 py-2 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken flex items-center gap-2",
77
- children: [/* @__PURE__ */ p(u, { className: "size-4" }), "Back"]
77
+ children: [/* @__PURE__ */ m(d, { className: "size-4" }), "Back"]
78
78
  })
79
- }), /* @__PURE__ */ p("div", {
79
+ }), /* @__PURE__ */ m("div", {
80
80
  className: "flex items-center justify-center h-64",
81
- children: /* @__PURE__ */ p("div", {
81
+ children: /* @__PURE__ */ m("div", {
82
82
  className: "text-text-muted",
83
83
  children: "Loading coupon…"
84
84
  })
85
85
  })]
86
86
  });
87
- if (T || !C?.getCoupon) return /* @__PURE__ */ m("div", {
87
+ if (T || !C?.getCoupon) return /* @__PURE__ */ h("div", {
88
88
  className: "p-8",
89
- children: [/* @__PURE__ */ p(t, {
89
+ children: [/* @__PURE__ */ m(t, {
90
90
  title: "Edit Coupon",
91
91
  description: "Coupon not found",
92
- actions: /* @__PURE__ */ m("button", {
92
+ actions: /* @__PURE__ */ h("button", {
93
93
  type: "button",
94
94
  onClick: () => y("/coupons"),
95
95
  className: "px-4 py-2 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken flex items-center gap-2",
96
- children: [/* @__PURE__ */ p(u, { className: "size-4" }), "Back"]
96
+ children: [/* @__PURE__ */ m(d, { className: "size-4" }), "Back"]
97
97
  })
98
- }), /* @__PURE__ */ p("div", {
98
+ }), /* @__PURE__ */ m("div", {
99
99
  className: "flex items-center justify-center h-64",
100
- children: /* @__PURE__ */ p("div", {
100
+ children: /* @__PURE__ */ m("div", {
101
101
  className: "text-status-error-text",
102
102
  children: T ? `Error: ${T.message}` : "Coupon not found"
103
103
  })
104
104
  })]
105
105
  });
106
106
  let z = C.getCoupon;
107
- return /* @__PURE__ */ m("div", {
107
+ return /* @__PURE__ */ h("div", {
108
108
  className: "p-8",
109
109
  children: [
110
- /* @__PURE__ */ p(t, {
110
+ /* @__PURE__ */ m(t, {
111
111
  title: "Edit Coupon",
112
112
  description: `Editing: ${z.code}`,
113
- actions: /* @__PURE__ */ m("button", {
113
+ actions: /* @__PURE__ */ h("button", {
114
114
  type: "button",
115
115
  onClick: () => y("/coupons"),
116
116
  className: "px-4 py-2 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken flex items-center gap-2",
117
- children: [/* @__PURE__ */ p(u, { className: "size-4" }), "Back to Coupons"]
117
+ children: [/* @__PURE__ */ m(d, { className: "size-4" }), "Back to Coupons"]
118
118
  })
119
119
  }),
120
- /* @__PURE__ */ p(g, {
120
+ /* @__PURE__ */ m(l, {
121
121
  className: "mt-2",
122
122
  children: "Update an existing coupon's discount, limits, expiry or applicable products. The code itself and its usage history are read-only; deactivate the coupon if you want to stop it being redeemed."
123
123
  }),
124
- /* @__PURE__ */ p("div", {
124
+ /* @__PURE__ */ m("div", {
125
125
  className: "max-w-3xl mx-auto mt-8",
126
- children: /* @__PURE__ */ m("form", {
126
+ children: /* @__PURE__ */ h("form", {
127
127
  onSubmit: R,
128
128
  className: "space-y-6",
129
129
  children: [
130
- /* @__PURE__ */ m("div", {
130
+ /* @__PURE__ */ h("div", {
131
131
  className: "bg-bg-sunken/30 border border-border-subtle rounded-lg p-6",
132
- children: [/* @__PURE__ */ p("h3", {
132
+ children: [/* @__PURE__ */ m("h3", {
133
133
  className: "text-lg font-semibold text-text-primary mb-4",
134
134
  children: "Coupon Details (Read-Only)"
135
- }), /* @__PURE__ */ m("div", {
135
+ }), /* @__PURE__ */ h("div", {
136
136
  className: "grid grid-cols-2 gap-4 text-sm",
137
137
  children: [
138
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
138
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("span", {
139
139
  className: "text-text-muted",
140
140
  children: "Code:"
141
- }), /* @__PURE__ */ p("span", {
141
+ }), /* @__PURE__ */ m("span", {
142
142
  className: "ml-2 font-mono font-medium text-text-primary",
143
143
  children: z.code
144
144
  })] }),
145
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
145
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("span", {
146
146
  className: "text-text-muted",
147
147
  children: "Type:"
148
- }), /* @__PURE__ */ p("span", {
148
+ }), /* @__PURE__ */ m("span", {
149
149
  className: "ml-2 text-text-primary capitalize",
150
150
  children: z.type.replace("_", " ").toLowerCase()
151
151
  })] }),
152
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
152
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("span", {
153
153
  className: "text-text-muted",
154
154
  children: "Value:"
155
- }), /* @__PURE__ */ p("span", {
155
+ }), /* @__PURE__ */ m("span", {
156
156
  className: "ml-2 text-text-primary",
157
157
  children: z.type === "PERCENTAGE" ? `${z.value}%` : `$${z.value}`
158
158
  })] }),
159
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
159
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("span", {
160
160
  className: "text-text-muted",
161
161
  children: "Scope:"
162
- }), /* @__PURE__ */ p("span", {
162
+ }), /* @__PURE__ */ m("span", {
163
163
  className: "ml-2 text-text-primary",
164
164
  children: z.scope
165
165
  })] }),
166
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
166
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("span", {
167
167
  className: "text-text-muted",
168
168
  children: "Current Uses:"
169
- }), /* @__PURE__ */ m("span", {
169
+ }), /* @__PURE__ */ h("span", {
170
170
  className: "ml-2 text-text-primary",
171
171
  children: [z.currentUses, z.maxTotalUses ? ` / ${z.maxTotalUses}` : ""]
172
172
  })] }),
173
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
173
+ /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("span", {
174
174
  className: "text-text-muted",
175
175
  children: "Created:"
176
- }), /* @__PURE__ */ p("span", {
176
+ }), /* @__PURE__ */ m("span", {
177
177
  className: "ml-2 text-text-primary",
178
178
  children: new Date(z.createdAt).toLocaleDateString()
179
179
  })] })
180
180
  ]
181
181
  })]
182
182
  }),
183
- /* @__PURE__ */ m("div", {
183
+ /* @__PURE__ */ h("div", {
184
184
  className: "bg-bg-surface border border-border-subtle rounded-lg p-6 space-y-6",
185
185
  children: [
186
- /* @__PURE__ */ p("h3", {
186
+ /* @__PURE__ */ m("h3", {
187
187
  className: "text-lg font-semibold text-text-primary",
188
188
  children: "Editable Fields"
189
189
  }),
190
- /* @__PURE__ */ m("div", {
190
+ /* @__PURE__ */ h("div", {
191
191
  className: "space-y-2",
192
192
  children: [
193
- /* @__PURE__ */ m("label", {
193
+ /* @__PURE__ */ h("label", {
194
194
  htmlFor: "name",
195
195
  className: "block text-sm font-medium text-text-primary",
196
- children: ["Name ", /* @__PURE__ */ p("span", {
196
+ children: ["Name ", /* @__PURE__ */ m("span", {
197
197
  className: "text-status-error-text",
198
198
  children: "*"
199
199
  })]
200
200
  }),
201
- /* @__PURE__ */ p("input", {
201
+ /* @__PURE__ */ m("input", {
202
202
  id: "name",
203
203
  type: "text",
204
204
  value: O.name,
@@ -206,19 +206,19 @@ var _ = () => {
206
206
  placeholder: "e.g., Welcome Discount",
207
207
  className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
208
208
  }),
209
- A.name && /* @__PURE__ */ p("p", {
209
+ A.name && /* @__PURE__ */ m("p", {
210
210
  className: "text-sm text-status-error-text",
211
211
  children: A.name
212
212
  })
213
213
  ]
214
214
  }),
215
- /* @__PURE__ */ m("div", {
215
+ /* @__PURE__ */ h("div", {
216
216
  className: "space-y-2",
217
- children: [/* @__PURE__ */ p("label", {
217
+ children: [/* @__PURE__ */ m("label", {
218
218
  htmlFor: "description",
219
219
  className: "block text-sm font-medium text-text-primary",
220
220
  children: "Description"
221
- }), /* @__PURE__ */ p("textarea", {
221
+ }), /* @__PURE__ */ m("textarea", {
222
222
  id: "description",
223
223
  value: O.description,
224
224
  onChange: (e) => I("description", e.target.value),
@@ -227,46 +227,46 @@ var _ = () => {
227
227
  className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] resize-none"
228
228
  })]
229
229
  }),
230
- /* @__PURE__ */ m("div", {
230
+ /* @__PURE__ */ h("div", {
231
231
  className: "space-y-2",
232
- children: [/* @__PURE__ */ p("label", {
232
+ children: [/* @__PURE__ */ m("label", {
233
233
  htmlFor: "status",
234
234
  className: "block text-sm font-medium text-text-primary",
235
235
  children: "Status"
236
- }), /* @__PURE__ */ m("select", {
236
+ }), /* @__PURE__ */ h("select", {
237
237
  id: "status",
238
238
  value: O.status,
239
239
  onChange: (e) => I("status", e.target.value),
240
240
  className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
241
241
  children: [
242
- /* @__PURE__ */ p("option", {
242
+ /* @__PURE__ */ m("option", {
243
243
  value: "ACTIVE",
244
244
  children: "Active"
245
245
  }),
246
- /* @__PURE__ */ p("option", {
246
+ /* @__PURE__ */ m("option", {
247
247
  value: "INACTIVE",
248
248
  children: "Inactive"
249
249
  }),
250
- /* @__PURE__ */ p("option", {
250
+ /* @__PURE__ */ m("option", {
251
251
  value: "EXPIRED",
252
252
  children: "Expired"
253
253
  }),
254
- /* @__PURE__ */ p("option", {
254
+ /* @__PURE__ */ m("option", {
255
255
  value: "DEPLETED",
256
256
  children: "Depleted"
257
257
  })
258
258
  ]
259
259
  })]
260
260
  }),
261
- /* @__PURE__ */ m("div", {
261
+ /* @__PURE__ */ h("div", {
262
262
  className: "space-y-2",
263
263
  children: [
264
- /* @__PURE__ */ p("label", {
264
+ /* @__PURE__ */ m("label", {
265
265
  htmlFor: "maxTotalUses",
266
266
  className: "block text-sm font-medium text-text-primary",
267
267
  children: "Maximum Total Uses"
268
268
  }),
269
- /* @__PURE__ */ p("input", {
269
+ /* @__PURE__ */ m("input", {
270
270
  id: "maxTotalUses",
271
271
  type: "number",
272
272
  min: "1",
@@ -275,11 +275,11 @@ var _ = () => {
275
275
  placeholder: "Leave empty for unlimited",
276
276
  className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
277
277
  }),
278
- A.maxTotalUses && /* @__PURE__ */ p("p", {
278
+ A.maxTotalUses && /* @__PURE__ */ m("p", {
279
279
  className: "text-sm text-status-error-text",
280
280
  children: A.maxTotalUses
281
281
  }),
282
- /* @__PURE__ */ m("p", {
282
+ /* @__PURE__ */ h("p", {
283
283
  className: "text-sm text-text-muted",
284
284
  children: [
285
285
  "Current uses: ",
@@ -289,15 +289,15 @@ var _ = () => {
289
289
  })
290
290
  ]
291
291
  }),
292
- /* @__PURE__ */ m("div", {
292
+ /* @__PURE__ */ h("div", {
293
293
  className: "space-y-2",
294
294
  children: [
295
- /* @__PURE__ */ p("label", {
295
+ /* @__PURE__ */ m("label", {
296
296
  htmlFor: "maxUsesPerUser",
297
297
  className: "block text-sm font-medium text-text-primary",
298
298
  children: "Maximum Uses Per User"
299
299
  }),
300
- /* @__PURE__ */ p("input", {
300
+ /* @__PURE__ */ m("input", {
301
301
  id: "maxUsesPerUser",
302
302
  type: "number",
303
303
  min: "1",
@@ -306,28 +306,28 @@ var _ = () => {
306
306
  placeholder: "e.g., 1",
307
307
  className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
308
308
  }),
309
- A.maxUsesPerUser && /* @__PURE__ */ p("p", {
309
+ A.maxUsesPerUser && /* @__PURE__ */ m("p", {
310
310
  className: "text-sm text-status-error-text",
311
311
  children: A.maxUsesPerUser
312
312
  })
313
313
  ]
314
314
  }),
315
- /* @__PURE__ */ m("div", {
315
+ /* @__PURE__ */ h("div", {
316
316
  className: "space-y-2",
317
317
  children: [
318
- /* @__PURE__ */ p("label", {
318
+ /* @__PURE__ */ m("label", {
319
319
  htmlFor: "validUntil",
320
320
  className: "block text-sm font-medium text-text-primary",
321
321
  children: "Valid Until"
322
322
  }),
323
- /* @__PURE__ */ p("input", {
323
+ /* @__PURE__ */ m("input", {
324
324
  id: "validUntil",
325
325
  type: "date",
326
326
  value: O.validUntil,
327
327
  onChange: (e) => I("validUntil", e.target.value),
328
328
  className: "w-full px-4 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
329
329
  }),
330
- /* @__PURE__ */ p("p", {
330
+ /* @__PURE__ */ m("p", {
331
331
  className: "text-sm text-text-muted",
332
332
  children: "Leave empty for no expiration"
333
333
  })
@@ -335,40 +335,40 @@ var _ = () => {
335
335
  })
336
336
  ]
337
337
  }),
338
- M && /* @__PURE__ */ m("div", {
338
+ M && /* @__PURE__ */ h("div", {
339
339
  className: "flex items-start gap-3 p-4 rounded-lg bg-status-error-bg-subtle border border-status-error-border",
340
- children: [/* @__PURE__ */ p(l, { className: "size-5 text-status-error-text mt-0.5" }), /* @__PURE__ */ m("div", {
340
+ children: [/* @__PURE__ */ m(u, { className: "size-5 text-status-error-text mt-0.5" }), /* @__PURE__ */ h("div", {
341
341
  className: "flex-1",
342
- children: [/* @__PURE__ */ p("p", {
342
+ children: [/* @__PURE__ */ m("p", {
343
343
  className: "text-sm font-medium text-status-error-text",
344
344
  children: "Error"
345
- }), /* @__PURE__ */ p("p", {
345
+ }), /* @__PURE__ */ m("p", {
346
346
  className: "text-sm text-status-error-text/90 mt-1",
347
347
  children: M
348
348
  })]
349
349
  })]
350
350
  }),
351
- P && /* @__PURE__ */ m("div", {
351
+ P && /* @__PURE__ */ h("div", {
352
352
  className: "flex items-start gap-3 p-4 rounded-lg bg-status-success-bg-subtle border border-status-success-bg-subtle",
353
- children: [/* @__PURE__ */ p(d, { className: "size-5 text-status-success-text mt-0.5" }), /* @__PURE__ */ m("div", {
353
+ children: [/* @__PURE__ */ m(f, { className: "size-5 text-status-success-text mt-0.5" }), /* @__PURE__ */ h("div", {
354
354
  className: "flex-1",
355
- children: [/* @__PURE__ */ p("p", {
355
+ children: [/* @__PURE__ */ m("p", {
356
356
  className: "text-sm font-medium text-status-success-text",
357
357
  children: "Success"
358
- }), /* @__PURE__ */ p("p", {
358
+ }), /* @__PURE__ */ m("p", {
359
359
  className: "text-sm text-status-success-text/90 mt-1",
360
360
  children: "Coupon updated successfully! Redirecting…"
361
361
  })]
362
362
  })]
363
363
  }),
364
- /* @__PURE__ */ m("div", {
364
+ /* @__PURE__ */ h("div", {
365
365
  className: "flex gap-4 pt-4 border-t border-border-subtle",
366
- children: [/* @__PURE__ */ m("button", {
366
+ children: [/* @__PURE__ */ h("button", {
367
367
  type: "submit",
368
368
  disabled: D || P,
369
369
  className: "px-6 py-2 rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",
370
- children: [/* @__PURE__ */ p(f, { className: "size-4" }), D ? "Updating..." : "Update Coupon"]
371
- }), /* @__PURE__ */ p("button", {
370
+ children: [/* @__PURE__ */ m(p, { className: "size-4" }), D ? "Updating..." : "Update Coupon"]
371
+ }), /* @__PURE__ */ m("button", {
372
372
  type: "button",
373
373
  onClick: () => y("/coupons"),
374
374
  className: "px-6 py-2 rounded-lg border border-border-subtle text-text-primary hover:bg-bg-sunken",
@@ -5,8 +5,8 @@ import { useBillingPermissions as r } from "../../../hooks/useBillingPermissions
5
5
  import "../../../shared/components/index.js";
6
6
  import { useCreditMutations as i, useCreditTransactions as a } from "../hooks/useCredits.js";
7
7
  import { useMemo as o, useState as s } from "react";
8
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
- import { EmphasisPanel as u, IllustratedEmptyState as d, PagePurpose as f } from "@burdenoff/fe-libs/ui";
8
+ import { EmphasisPanel as c, IllustratedEmptyState as l, PagePurpose as u } from "@burdenoff/fe-libs/ui";
9
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
10
  // src/billing/modules/credits/pages/AdminCreditsPage.tsx
11
11
  var p = () => {
12
12
  let p = r(), { grantCredits: m } = i(), { data: h, loading: g, refetch: _ } = n(), v = o(() => h?.getBillingAccountsByOrg || [], [h]), [y, b] = s(""), [x, S] = s(""), [C, w] = s(""), [T, E] = s(!1), [D, O] = s(null), [k, A] = s(null), j = y || v[0]?.id || "", { transactions: M, isLoading: N, refetch: P } = a({
@@ -15,35 +15,35 @@ var p = () => {
15
15
  page: 1,
16
16
  pageSize: 10
17
17
  });
18
- return p.canGrantCredits ? /* @__PURE__ */ l("div", {
18
+ return p.canGrantCredits ? /* @__PURE__ */ f("div", {
19
19
  className: "space-y-6 p-6",
20
20
  children: [
21
- /* @__PURE__ */ c(t, {
21
+ /* @__PURE__ */ d(t, {
22
22
  title: "Credit Grants",
23
23
  description: "Grant credits to billing accounts and review the latest credit ledger activity."
24
24
  }),
25
- /* @__PURE__ */ c(f, { children: "Give credits to a customer's billing account — for promotions, service recovery or manual adjustments — and immediately see them reflected in that account's credit ledger. Pick an account, enter an amount and a reason, and grant." }),
26
- /* @__PURE__ */ l("div", {
25
+ /* @__PURE__ */ d(u, { children: "Give credits to a customer's billing account — for promotions, service recovery or manual adjustments — and immediately see them reflected in that account's credit ledger. Pick an account, enter an amount and a reason, and grant." }),
26
+ /* @__PURE__ */ f("div", {
27
27
  className: "grid grid-cols-1 xl:grid-cols-[360px_minmax(0,1fr)] gap-6",
28
- children: [/* @__PURE__ */ l(u, {
28
+ children: [/* @__PURE__ */ f(c, {
29
29
  className: "p-6 space-y-4 h-fit",
30
30
  children: [
31
- /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
31
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
32
32
  className: "block text-sm font-medium text-text-primary mb-1",
33
33
  children: "Billing Account"
34
- }), /* @__PURE__ */ c("select", {
34
+ }), /* @__PURE__ */ d("select", {
35
35
  value: j,
36
36
  onChange: (e) => b(e.target.value),
37
37
  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)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
38
- children: v.map((e) => /* @__PURE__ */ c("option", {
38
+ children: v.map((e) => /* @__PURE__ */ d("option", {
39
39
  value: e.id,
40
40
  children: e.name
41
41
  }, e.id))
42
42
  })] }),
43
- /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
43
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
44
44
  className: "block text-sm font-medium text-text-primary mb-1",
45
45
  children: "Credits"
46
- }), /* @__PURE__ */ c("input", {
46
+ }), /* @__PURE__ */ d("input", {
47
47
  type: "number",
48
48
  min: "1",
49
49
  step: "1",
@@ -52,24 +52,24 @@ var p = () => {
52
52
  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)]",
53
53
  placeholder: "500"
54
54
  })] }),
55
- /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
55
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
56
56
  className: "block text-sm font-medium text-text-primary mb-1",
57
57
  children: "Reason"
58
- }), /* @__PURE__ */ c("textarea", {
58
+ }), /* @__PURE__ */ d("textarea", {
59
59
  value: C,
60
60
  onChange: (e) => w(e.target.value),
61
61
  className: "w-full min-h-24 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)]",
62
62
  placeholder: "Promotional credit grant, service recovery, manual adjustment..."
63
63
  })] }),
64
- D ? /* @__PURE__ */ c("p", {
64
+ D ? /* @__PURE__ */ d("p", {
65
65
  className: "text-sm text-status-success-text",
66
66
  children: D
67
67
  }) : null,
68
- k ? /* @__PURE__ */ c("p", {
68
+ k ? /* @__PURE__ */ d("p", {
69
69
  className: "text-sm text-status-error-text",
70
70
  children: k
71
71
  }) : null,
72
- /* @__PURE__ */ c("button", {
72
+ /* @__PURE__ */ d("button", {
73
73
  type: "button",
74
74
  onClick: async () => {
75
75
  if (!j) A("Select a billing account first.");
@@ -94,37 +94,37 @@ var p = () => {
94
94
  children: T ? "Granting Credits..." : "Grant Credits"
95
95
  })
96
96
  ]
97
- }), /* @__PURE__ */ l("div", {
97
+ }), /* @__PURE__ */ f("div", {
98
98
  className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)]",
99
- children: [/* @__PURE__ */ c("div", {
99
+ children: [/* @__PURE__ */ d("div", {
100
100
  className: "p-4 border-b border-border-subtle bg-bg-sunken/30",
101
- children: /* @__PURE__ */ c("h2", {
101
+ children: /* @__PURE__ */ d("h2", {
102
102
  className: "font-semibold text-text-primary",
103
103
  children: "Recent Credit Ledger"
104
104
  })
105
- }), N ? /* @__PURE__ */ c("div", {
105
+ }), N ? /* @__PURE__ */ d("div", {
106
106
  className: "p-6 text-sm text-text-muted",
107
107
  children: "Loading recent credit activity…"
108
- }) : M.length === 0 ? /* @__PURE__ */ c(d, {
108
+ }) : M.length === 0 ? /* @__PURE__ */ d(l, {
109
109
  illustration: "empty-data",
110
110
  title: "No recent credit activity",
111
111
  description: "Credit grants and other ledger entries for this account will show up here."
112
- }) : /* @__PURE__ */ c("div", {
112
+ }) : /* @__PURE__ */ d("div", {
113
113
  className: "divide-y divide-border-subtle",
114
- children: M.map((e) => /* @__PURE__ */ l("div", {
114
+ children: M.map((e) => /* @__PURE__ */ f("div", {
115
115
  className: "p-4 flex items-center justify-between gap-4",
116
- children: [/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("p", {
116
+ children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("p", {
117
117
  className: "text-sm font-medium text-text-primary",
118
118
  children: e.type
119
- }), /* @__PURE__ */ c("p", {
119
+ }), /* @__PURE__ */ d("p", {
120
120
  className: "text-xs text-text-muted",
121
121
  children: e.context?.reason || "No reason"
122
- })] }), /* @__PURE__ */ l("div", {
122
+ })] }), /* @__PURE__ */ f("div", {
123
123
  className: "text-right",
124
- children: [/* @__PURE__ */ l("p", {
124
+ children: [/* @__PURE__ */ f("p", {
125
125
  className: "text-sm font-semibold text-text-primary",
126
126
  children: [e.amount > 0 ? "+" : "", e.amount]
127
- }), /* @__PURE__ */ c("p", {
127
+ }), /* @__PURE__ */ d("p", {
128
128
  className: "text-xs text-text-muted",
129
129
  children: e.status
130
130
  })]
@@ -134,7 +134,7 @@ var p = () => {
134
134
  })]
135
135
  })
136
136
  ]
137
- }) : /* @__PURE__ */ c(e, { message: "You don't have permission to grant credits." });
137
+ }) : /* @__PURE__ */ d(e, { message: "You don't have permission to grant credits." });
138
138
  };
139
139
  export { p as AdminCreditsPage };
140
140