@burdenoff/microfe-billing 2026.1113.2 → 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.
- package/dist/billing/BillingRoot.js +83 -77
- package/dist/billing/BillingRoot.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +78 -78
- package/dist/billing/modules/addons/pages/AddonCreatePage.js +70 -70
- package/dist/billing/modules/addons/pages/AddonDetailPage.js +72 -72
- package/dist/billing/modules/addons/pages/AddonEditPage.js +79 -79
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +224 -224
- package/dist/billing/modules/addons/pages/AddonsListPage.js +186 -186
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +168 -168
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +88 -88
- package/dist/billing/modules/billing/hooks/index.js +5 -5
- package/dist/billing/modules/billing/hooks/useInvoices.js +39 -20
- package/dist/billing/modules/billing/hooks/useInvoices.js.map +1 -1
- package/dist/billing/modules/billing/index.js +14 -14
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +92 -92
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +160 -160
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +100 -100
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +105 -105
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +37 -37
- package/dist/billing/modules/billing/pages/RefundIssueLogsPage.js +41 -41
- package/dist/billing/modules/billing/pages/RefundsPage.js +334 -334
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/TransactionsPage.js +174 -174
- package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +24 -24
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/checkout/components/OrderSummary.js +71 -71
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +646 -625
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
- package/dist/billing/modules/checkout/utils/checkoutOptions.d.ts +23 -0
- package/dist/billing/modules/checkout/utils/checkoutOptions.js +8 -0
- package/dist/billing/modules/checkout/utils/checkoutOptions.js.map +1 -0
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js +112 -112
- package/dist/billing/modules/coupons/pages/CouponsListPage.js +118 -118
- package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js +119 -119
- package/dist/billing/modules/coupons/pages/EditCouponPage.js +82 -82
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js +30 -30
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +77 -77
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +144 -144
- package/dist/billing/modules/credits/pages/CreditsPage.js +67 -67
- package/dist/billing/modules/dashboard/pages/OverviewPage.js +594 -442
- package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
- package/dist/billing/modules/dashboard/utils/overviewSummary.d.ts +46 -0
- package/dist/billing/modules/dashboard/utils/overviewSummary.js +37 -0
- package/dist/billing/modules/dashboard/utils/overviewSummary.js.map +1 -0
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js +199 -199
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.js +64 -64
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +122 -122
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.js +102 -102
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +178 -178
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +107 -107
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.js +54 -54
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +94 -94
- package/dist/billing/modules/plans/pages/PlanCreatePage.js +73 -73
- package/dist/billing/modules/plans/pages/PlanDetailPage.js +96 -96
- package/dist/billing/modules/plans/pages/PlanEditPage.js +16 -16
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js +100 -100
- package/dist/billing/modules/plans/pages/PlansListPage.js +88 -88
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.js +60 -60
- package/dist/billing/modules/promotions/pages/PromotionsListPage.js +37 -37
- package/dist/billing/modules/quota/pages/QuotaAssignFreePage.js +62 -62
- package/dist/billing/modules/quota/pages/QuotaPage.js +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +69 -69
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +76 -76
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +80 -80
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +95 -95
- package/dist/billing/modules/settings/pages/SettingsPage.js +134 -134
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +62 -62
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.js +36 -36
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +534 -410
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +111 -111
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +166 -160
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.d.ts +30 -0
- package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.js +20 -0
- package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.js.map +1 -0
- package/dist/billing/modules/subscriptions/utils/upgradeAccess.d.ts +10 -0
- package/dist/billing/modules/subscriptions/utils/upgradeAccess.js +7 -0
- package/dist/billing/modules/subscriptions/utils/upgradeAccess.js.map +1 -0
- package/dist/billing/modules/usage/pages/UsagePage.js +722 -591
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- package/dist/billing/modules/usage/utils/usageHealth.d.ts +63 -0
- package/dist/billing/modules/usage/utils/usageHealth.js +43 -0
- package/dist/billing/modules/usage/utils/usageHealth.js.map +1 -0
- package/dist/billing/shared/components/EmptyState.js +3 -3
- package/dist/billing/shared/components/MoneyActionDialog.js +12 -12
- package/dist/billing/shared/ui/MetricCard.js +13 -13
- package/dist/billing/shared/utils/format.js +16 -4
- package/dist/billing/shared/utils/format.js.map +1 -1
- package/dist/billing/shared/utils/index.js +8 -8
- package/dist/generated/global-operations.js +294 -286
- package/dist/generated/global-operations.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,9 +5,9 @@ import { useBillingPermissions as r } from "../../../hooks/useBillingPermissions
|
|
|
5
5
|
import "../../../shared/components/index.js";
|
|
6
6
|
import { useCreatePromotionMutation as i } from "../../../../generated/global-operations.js";
|
|
7
7
|
import { useState as a } from "react";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { PagePurpose as o } from "@burdenoff/fe-libs/ui";
|
|
9
|
+
import { ArrowLeft as s, Gift as c, Info as l, Save as u } from "lucide-react";
|
|
10
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
11
|
// src/billing/modules/promotions/pages/CreatePromotionPage.tsx
|
|
12
12
|
var p = [
|
|
13
13
|
"vibecontrols",
|
|
@@ -26,7 +26,7 @@ var p = [
|
|
|
26
26
|
applicableProductIds: [],
|
|
27
27
|
applicablePlanIds: ""
|
|
28
28
|
});
|
|
29
|
-
if (!h.canManagePlans) return /* @__PURE__ */
|
|
29
|
+
if (!h.canManagePlans) return /* @__PURE__ */ d(e, { message: "You don't have permission to create promotions." });
|
|
30
30
|
let w = (e, t) => C((n) => ({
|
|
31
31
|
...n,
|
|
32
32
|
[e]: t
|
|
@@ -36,25 +36,25 @@ var p = [
|
|
|
36
36
|
let e = {};
|
|
37
37
|
return S.name.trim() || (e.name = "Name is required"), S.startsAt || (e.startsAt = "Start date is required"), S.expiresAt || (e.expiresAt = "End date is required"), S.expiresAt && S.expiresAt <= S.startsAt && (e.expiresAt = "End date must be after start date"), S.bonusMonths < 1 && (e.bonusMonths = "Must be at least 1"), b(e), Object.keys(e).length === 0;
|
|
38
38
|
};
|
|
39
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ f("div", {
|
|
40
40
|
className: "max-w-2xl mx-auto p-4 sm:p-6 space-y-6",
|
|
41
41
|
children: [
|
|
42
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ f("div", {
|
|
43
43
|
className: "flex items-center gap-4",
|
|
44
|
-
children: [/* @__PURE__ */
|
|
44
|
+
children: [/* @__PURE__ */ d("button", {
|
|
45
45
|
type: "button",
|
|
46
46
|
onClick: () => m("/promotions"),
|
|
47
47
|
"aria-label": "Back to promotions",
|
|
48
48
|
className: "p-2 rounded-button hover:bg-bg-sunken text-text-muted hover:text-text-primary transition-colors",
|
|
49
|
-
children: /* @__PURE__ */
|
|
50
|
-
}), /* @__PURE__ */
|
|
49
|
+
children: /* @__PURE__ */ d(s, { className: "size-5" })
|
|
50
|
+
}), /* @__PURE__ */ d(t, {
|
|
51
51
|
title: "Create Promotion",
|
|
52
52
|
description: "Offer bonus free renewal months to subscribers who sign up within the promotion window",
|
|
53
|
-
icon: /* @__PURE__ */
|
|
53
|
+
icon: /* @__PURE__ */ d(c, { className: "size-6" })
|
|
54
54
|
})]
|
|
55
55
|
}),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ d(o, { children: "Set up a time-bounded campaign that rewards new subscribers with bonus free renewal months. Define the bonus, the window during which it applies, an optional redemption cap and which products it covers — then activate it to start offering it." }),
|
|
57
|
+
/* @__PURE__ */ f("form", {
|
|
58
58
|
onSubmit: async (e) => {
|
|
59
59
|
if (e.preventDefault(), E()) {
|
|
60
60
|
v(!0);
|
|
@@ -82,34 +82,34 @@ var p = [
|
|
|
82
82
|
},
|
|
83
83
|
className: "space-y-5",
|
|
84
84
|
children: [
|
|
85
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ f("div", {
|
|
86
86
|
className: "bg-bg-surface border border-border-seam rounded-card p-5 space-y-4 shadow-[var(--shadow-elevation-1)]",
|
|
87
87
|
children: [
|
|
88
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ d("h3", {
|
|
89
89
|
className: "font-semibold text-text-primary",
|
|
90
90
|
children: "Promotion Details"
|
|
91
91
|
}),
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ f("div", { children: [
|
|
93
|
+
/* @__PURE__ */ d("label", {
|
|
94
94
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
95
95
|
children: "Name *"
|
|
96
96
|
}),
|
|
97
|
-
/* @__PURE__ */
|
|
97
|
+
/* @__PURE__ */ d("input", {
|
|
98
98
|
type: "text",
|
|
99
99
|
value: S.name,
|
|
100
100
|
onChange: (e) => w("name", e.target.value),
|
|
101
101
|
placeholder: "e.g. June Launch Offer",
|
|
102
102
|
className: `w-full px-3 py-2 rounded-input border ${y.name ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]`
|
|
103
103
|
}),
|
|
104
|
-
y.name && /* @__PURE__ */
|
|
104
|
+
y.name && /* @__PURE__ */ d("p", {
|
|
105
105
|
className: "text-xs text-status-error-text mt-1",
|
|
106
106
|
children: y.name
|
|
107
107
|
})
|
|
108
108
|
] }),
|
|
109
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
|
|
110
110
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
111
111
|
children: "Description"
|
|
112
|
-
}), /* @__PURE__ */
|
|
112
|
+
}), /* @__PURE__ */ d("textarea", {
|
|
113
113
|
value: S.description,
|
|
114
114
|
onChange: (e) => w("description", e.target.value),
|
|
115
115
|
placeholder: "Subscribe in June and get 2 extra months free!",
|
|
@@ -118,19 +118,19 @@ var p = [
|
|
|
118
118
|
})] })
|
|
119
119
|
]
|
|
120
120
|
}),
|
|
121
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ f("div", {
|
|
122
122
|
className: "bg-bg-surface border border-border-seam rounded-card p-5 space-y-4 shadow-[var(--shadow-elevation-1)]",
|
|
123
123
|
children: [
|
|
124
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ d("h3", {
|
|
125
125
|
className: "font-semibold text-text-primary",
|
|
126
126
|
children: "Bonus Configuration"
|
|
127
127
|
}),
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ f("div", { children: [
|
|
129
|
+
/* @__PURE__ */ d("label", {
|
|
130
130
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
131
131
|
children: "Bonus Months *"
|
|
132
132
|
}),
|
|
133
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ d("input", {
|
|
134
134
|
type: "number",
|
|
135
135
|
value: S.bonusMonths,
|
|
136
136
|
min: 1,
|
|
@@ -138,16 +138,16 @@ var p = [
|
|
|
138
138
|
onChange: (e) => w("bonusMonths", parseInt(e.target.value) || 1),
|
|
139
139
|
className: `w-32 px-3 py-2 rounded-input border ${y.bonusMonths ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]`
|
|
140
140
|
}),
|
|
141
|
-
y.bonusMonths && /* @__PURE__ */
|
|
141
|
+
y.bonusMonths && /* @__PURE__ */ d("p", {
|
|
142
142
|
className: "text-xs text-status-error-text mt-1",
|
|
143
143
|
children: y.bonusMonths
|
|
144
144
|
}),
|
|
145
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ f("div", {
|
|
146
146
|
className: "mt-2 flex items-start gap-2 p-3 bg-[var(--color-accent-soft)] rounded-lg text-sm text-text-muted",
|
|
147
|
-
children: [/* @__PURE__ */
|
|
147
|
+
children: [/* @__PURE__ */ d(l, { className: "size-4 shrink-0 mt-0.5 text-text-link" }), /* @__PURE__ */ f("span", { children: [
|
|
148
148
|
"Users who subscribe during this window get",
|
|
149
149
|
" ",
|
|
150
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ f("strong", {
|
|
151
151
|
className: "text-text-primary",
|
|
152
152
|
children: [
|
|
153
153
|
S.bonusMonths,
|
|
@@ -160,12 +160,12 @@ var p = [
|
|
|
160
160
|
] })]
|
|
161
161
|
})
|
|
162
162
|
] }),
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ f("div", { children: [
|
|
164
|
+
/* @__PURE__ */ d("label", {
|
|
165
165
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
166
166
|
children: "Max Redemptions"
|
|
167
167
|
}),
|
|
168
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ d("input", {
|
|
169
169
|
type: "number",
|
|
170
170
|
value: S.maxRedemptions,
|
|
171
171
|
min: 1,
|
|
@@ -173,118 +173,118 @@ var p = [
|
|
|
173
173
|
placeholder: "Unlimited",
|
|
174
174
|
className: "w-48 px-3 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)]"
|
|
175
175
|
}),
|
|
176
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ d("p", {
|
|
177
177
|
className: "text-xs text-text-muted mt-1",
|
|
178
178
|
children: "Leave empty for no cap"
|
|
179
179
|
})
|
|
180
180
|
] })
|
|
181
181
|
]
|
|
182
182
|
}),
|
|
183
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ f("div", {
|
|
184
184
|
className: "bg-bg-surface border border-border-seam rounded-card p-5 space-y-4 shadow-[var(--shadow-elevation-1)]",
|
|
185
185
|
children: [
|
|
186
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ d("h3", {
|
|
187
187
|
className: "font-semibold text-text-primary",
|
|
188
188
|
children: "Active Window"
|
|
189
189
|
}),
|
|
190
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ f("div", {
|
|
191
191
|
className: "grid grid-cols-2 gap-4",
|
|
192
|
-
children: [/* @__PURE__ */
|
|
193
|
-
/* @__PURE__ */
|
|
192
|
+
children: [/* @__PURE__ */ f("div", { children: [
|
|
193
|
+
/* @__PURE__ */ d("label", {
|
|
194
194
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
195
195
|
children: "Start Date *"
|
|
196
196
|
}),
|
|
197
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ d("input", {
|
|
198
198
|
type: "date",
|
|
199
199
|
value: S.startsAt,
|
|
200
200
|
onChange: (e) => w("startsAt", e.target.value),
|
|
201
201
|
className: `w-full px-3 py-2 rounded-input border ${y.startsAt ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]`
|
|
202
202
|
}),
|
|
203
|
-
y.startsAt && /* @__PURE__ */
|
|
203
|
+
y.startsAt && /* @__PURE__ */ d("p", {
|
|
204
204
|
className: "text-xs text-status-error-text mt-1",
|
|
205
205
|
children: y.startsAt
|
|
206
206
|
})
|
|
207
|
-
] }), /* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */
|
|
207
|
+
] }), /* @__PURE__ */ f("div", { children: [
|
|
208
|
+
/* @__PURE__ */ d("label", {
|
|
209
209
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
210
210
|
children: "End Date *"
|
|
211
211
|
}),
|
|
212
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ d("input", {
|
|
213
213
|
type: "date",
|
|
214
214
|
value: S.expiresAt,
|
|
215
215
|
onChange: (e) => w("expiresAt", e.target.value),
|
|
216
216
|
min: S.startsAt,
|
|
217
217
|
className: `w-full px-3 py-2 rounded-input border ${y.expiresAt ? "border-status-error-border" : "border-border-subtle"} bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]`
|
|
218
218
|
}),
|
|
219
|
-
y.expiresAt && /* @__PURE__ */
|
|
219
|
+
y.expiresAt && /* @__PURE__ */ d("p", {
|
|
220
220
|
className: "text-xs text-status-error-text mt-1",
|
|
221
221
|
children: y.expiresAt
|
|
222
222
|
})
|
|
223
223
|
] })]
|
|
224
224
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ d("p", {
|
|
226
226
|
className: "text-xs text-text-muted",
|
|
227
227
|
children: "Only purchases made between these dates will receive the bonus months"
|
|
228
228
|
})
|
|
229
229
|
]
|
|
230
230
|
}),
|
|
231
|
-
/* @__PURE__ */
|
|
231
|
+
/* @__PURE__ */ f("div", {
|
|
232
232
|
className: "bg-bg-surface border border-border-seam rounded-card p-5 space-y-4 shadow-[var(--shadow-elevation-1)]",
|
|
233
233
|
children: [
|
|
234
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ d("h3", {
|
|
235
235
|
className: "font-semibold text-text-primary",
|
|
236
236
|
children: "Scope"
|
|
237
237
|
}),
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ f("div", { children: [
|
|
239
|
+
/* @__PURE__ */ d("label", {
|
|
240
240
|
className: "block text-sm font-medium text-text-primary mb-2",
|
|
241
241
|
children: "Applicable Products"
|
|
242
242
|
}),
|
|
243
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ d("div", {
|
|
244
244
|
className: "flex flex-wrap gap-2",
|
|
245
|
-
children: p.map((e) => /* @__PURE__ */
|
|
245
|
+
children: p.map((e) => /* @__PURE__ */ d("button", {
|
|
246
246
|
type: "button",
|
|
247
247
|
onClick: () => T(e),
|
|
248
248
|
className: `px-3 py-1.5 rounded-lg border text-sm transition-colors ${S.applicableProductIds.includes(e) ? "border-action-primary-bg bg-[var(--color-accent-soft)] text-text-link font-medium" : "border-border-subtle hover:border-action-primary-bg/50"}`,
|
|
249
249
|
children: e
|
|
250
250
|
}, e))
|
|
251
251
|
}),
|
|
252
|
-
/* @__PURE__ */
|
|
252
|
+
/* @__PURE__ */ d("p", {
|
|
253
253
|
className: "text-xs text-text-muted mt-1",
|
|
254
254
|
children: S.applicableProductIds.length === 0 ? "No selection = applies to all products" : `Applies to: ${S.applicableProductIds.join(", ")}`
|
|
255
255
|
})
|
|
256
256
|
] }),
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ f("div", { children: [
|
|
258
|
+
/* @__PURE__ */ d("label", {
|
|
259
259
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
260
260
|
children: "Plan IDs (optional)"
|
|
261
261
|
}),
|
|
262
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ d("input", {
|
|
263
263
|
type: "text",
|
|
264
264
|
value: S.applicablePlanIds,
|
|
265
265
|
onChange: (e) => w("applicablePlanIds", e.target.value),
|
|
266
266
|
placeholder: "plan-vibecontrols-pro-monthly, plan-vibecontrols-pro-yearly",
|
|
267
267
|
className: "w-full px-3 py-2 rounded-input border border-border-subtle bg-bg-surface text-text-primary placeholder:text-text-muted text-sm focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
268
268
|
}),
|
|
269
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ d("p", {
|
|
270
270
|
className: "text-xs text-text-muted mt-1",
|
|
271
271
|
children: "Comma-separated. Leave empty to apply to all plans"
|
|
272
272
|
})
|
|
273
273
|
] })
|
|
274
274
|
]
|
|
275
275
|
}),
|
|
276
|
-
/* @__PURE__ */
|
|
276
|
+
/* @__PURE__ */ f("div", {
|
|
277
277
|
className: "flex gap-3 justify-end",
|
|
278
|
-
children: [/* @__PURE__ */
|
|
278
|
+
children: [/* @__PURE__ */ d("button", {
|
|
279
279
|
type: "button",
|
|
280
280
|
onClick: () => m("/promotions"),
|
|
281
281
|
className: "px-5 py-2 rounded-button border border-border-subtle text-text-primary hover:bg-bg-sunken text-sm font-medium transition-colors",
|
|
282
282
|
children: "Cancel"
|
|
283
|
-
}), /* @__PURE__ */
|
|
283
|
+
}), /* @__PURE__ */ f("button", {
|
|
284
284
|
type: "submit",
|
|
285
285
|
disabled: _,
|
|
286
286
|
className: "px-5 py-2 rounded-button bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover flex items-center gap-2 text-sm font-medium transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:opacity-50",
|
|
287
|
-
children: [_ ? /* @__PURE__ */
|
|
287
|
+
children: [_ ? /* @__PURE__ */ d("div", { className: "size-4 border-2 border-action-primary-text border-t-transparent rounded-full animate-spin" }) : /* @__PURE__ */ d(u, { className: "size-4" }), "Create Promotion"]
|
|
288
288
|
})]
|
|
289
289
|
})
|
|
290
290
|
]
|
|
@@ -5,13 +5,13 @@ import { useBillingPermissions as r } from "../../../hooks/useBillingPermissions
|
|
|
5
5
|
import "../../../shared/components/index.js";
|
|
6
6
|
import { useDeactivatePromotionMutation as i, useListPromotionsQuery as a, useUpdatePromotionMutation as o } from "../../../../generated/global-operations.js";
|
|
7
7
|
import { useState as s } from "react";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { IllustratedEmptyState as c, PagePurpose as l } from "@burdenoff/fe-libs/ui";
|
|
9
|
+
import { Calendar as u, Gift as d, Plus as f, Tag as p, ToggleLeft as m, ToggleRight as h, Users as g } from "lucide-react";
|
|
10
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
11
11
|
// src/billing/modules/promotions/pages/PromotionsListPage.tsx
|
|
12
12
|
var y = () => {
|
|
13
13
|
let y = n(), b = r(), [x, S] = s(!1), [C, w] = s(null), { data: T, loading: E, refetch: D } = a({ variables: { includeInactive: x } }), [O] = i(), [k] = o();
|
|
14
|
-
if (!b.canManagePlans) return /* @__PURE__ */
|
|
14
|
+
if (!b.canManagePlans) return /* @__PURE__ */ _(e, { message: "You don't have permission to manage promotions." });
|
|
15
15
|
let A = T?.listPromotions ?? [], j = async (e, t) => {
|
|
16
16
|
w(e);
|
|
17
17
|
try {
|
|
@@ -35,27 +35,27 @@ var y = () => {
|
|
|
35
35
|
text: "Inactive",
|
|
36
36
|
cls: "bg-bg-sunken text-text-muted"
|
|
37
37
|
};
|
|
38
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ v("div", {
|
|
39
39
|
className: "max-w-5xl mx-auto p-4 sm:p-6 space-y-6",
|
|
40
40
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ v("div", {
|
|
42
42
|
className: "flex items-center justify-between gap-4",
|
|
43
|
-
children: [/* @__PURE__ */
|
|
43
|
+
children: [/* @__PURE__ */ _(t, {
|
|
44
44
|
title: "Promotions",
|
|
45
45
|
description: "Time-bounded offers that grant bonus free renewal months to subscribers",
|
|
46
|
-
icon: /* @__PURE__ */
|
|
47
|
-
}), /* @__PURE__ */
|
|
46
|
+
icon: /* @__PURE__ */ _(d, { className: "size-6" })
|
|
47
|
+
}), /* @__PURE__ */ v("button", {
|
|
48
48
|
onClick: () => y("/promotions/create"),
|
|
49
49
|
className: "flex items-center gap-2 px-4 py-2 rounded-button bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover text-sm font-medium shrink-0 transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
50
|
-
children: [/* @__PURE__ */
|
|
50
|
+
children: [/* @__PURE__ */ _(f, { className: "size-4" }), "New Promotion"]
|
|
51
51
|
})]
|
|
52
52
|
}),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ _(l, { children: "Promotions are limited-time offers that reward subscribers with bonus free renewal months — great for launches or win-back campaigns. Set the bonus, the active window and an optional redemption cap, then activate or deactivate them as your campaign runs." }),
|
|
54
|
+
/* @__PURE__ */ _("div", {
|
|
55
55
|
className: "flex items-center gap-3",
|
|
56
|
-
children: /* @__PURE__ */
|
|
56
|
+
children: /* @__PURE__ */ v("label", {
|
|
57
57
|
className: "flex items-center gap-2 text-sm text-text-muted cursor-pointer select-none",
|
|
58
|
-
children: [/* @__PURE__ */
|
|
58
|
+
children: [/* @__PURE__ */ _("input", {
|
|
59
59
|
type: "checkbox",
|
|
60
60
|
checked: x,
|
|
61
61
|
onChange: (e) => S(e.target.checked),
|
|
@@ -63,49 +63,49 @@ var y = () => {
|
|
|
63
63
|
}), "Show inactive / expired"]
|
|
64
64
|
})
|
|
65
65
|
}),
|
|
66
|
-
E ? /* @__PURE__ */
|
|
66
|
+
E ? /* @__PURE__ */ _("div", {
|
|
67
67
|
className: "text-center py-16 text-text-muted",
|
|
68
68
|
children: "Loading promotions…"
|
|
69
|
-
}) : A.length === 0 ? /* @__PURE__ */
|
|
69
|
+
}) : A.length === 0 ? /* @__PURE__ */ _(c, {
|
|
70
70
|
illustration: "empty-data",
|
|
71
71
|
title: "No promotions yet",
|
|
72
72
|
description: "Create one to offer bonus months to early subscribers",
|
|
73
|
-
action: /* @__PURE__ */
|
|
73
|
+
action: /* @__PURE__ */ _("button", {
|
|
74
74
|
onClick: () => y("/promotions/create"),
|
|
75
75
|
className: "px-4 py-2 rounded-button bg-action-primary-bg text-action-primary-text text-sm font-medium transition-colors duration-200 hover:bg-action-primary-bgHover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
76
76
|
children: "Create Promotion"
|
|
77
77
|
})
|
|
78
|
-
}) : /* @__PURE__ */
|
|
78
|
+
}) : /* @__PURE__ */ _("div", {
|
|
79
79
|
className: "space-y-3",
|
|
80
80
|
children: A.map((e) => {
|
|
81
81
|
let { text: t, cls: n } = N(e), r = C === e.id;
|
|
82
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ v("div", {
|
|
83
83
|
className: "bg-bg-surface border border-border-seam rounded-card p-5 flex flex-col sm:flex-row sm:items-center gap-4 shadow-[var(--shadow-elevation-1)] transition-all duration-200 hover:border-border-strong hover:shadow-[var(--shadow-elevation-2)]",
|
|
84
|
-
children: [/* @__PURE__ */
|
|
84
|
+
children: [/* @__PURE__ */ v("div", {
|
|
85
85
|
className: "flex-1 min-w-0",
|
|
86
86
|
children: [
|
|
87
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ v("div", {
|
|
88
88
|
className: "flex items-center gap-2 mb-1",
|
|
89
|
-
children: [/* @__PURE__ */
|
|
89
|
+
children: [/* @__PURE__ */ _("span", {
|
|
90
90
|
className: "font-semibold text-text-primary truncate",
|
|
91
91
|
children: e.name
|
|
92
|
-
}), /* @__PURE__ */
|
|
92
|
+
}), /* @__PURE__ */ _("span", {
|
|
93
93
|
className: `text-xs font-medium px-2 py-0.5 rounded-full ${n}`,
|
|
94
94
|
children: t
|
|
95
95
|
})]
|
|
96
96
|
}),
|
|
97
|
-
e.description && /* @__PURE__ */
|
|
97
|
+
e.description && /* @__PURE__ */ _("p", {
|
|
98
98
|
className: "text-sm text-text-muted mb-2 line-clamp-1",
|
|
99
99
|
children: e.description
|
|
100
100
|
}),
|
|
101
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ v("div", {
|
|
102
102
|
className: "flex flex-wrap gap-x-4 gap-y-1 text-xs text-text-muted",
|
|
103
103
|
children: [
|
|
104
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ v("span", {
|
|
105
105
|
className: "flex items-center gap-1",
|
|
106
106
|
children: [
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ _(d, { className: "size-3" }),
|
|
108
|
+
/* @__PURE__ */ _("strong", {
|
|
109
109
|
className: "text-text-primary",
|
|
110
110
|
children: e.bonusMonths
|
|
111
111
|
}),
|
|
@@ -113,40 +113,40 @@ var y = () => {
|
|
|
113
113
|
e.bonusMonths === 1 ? "" : "s"
|
|
114
114
|
]
|
|
115
115
|
}),
|
|
116
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ v("span", {
|
|
117
117
|
className: "flex items-center gap-1",
|
|
118
118
|
children: [
|
|
119
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ _(u, { className: "size-3" }),
|
|
120
120
|
new Date(e.startsAt).toLocaleDateString(),
|
|
121
121
|
" –",
|
|
122
122
|
" ",
|
|
123
123
|
new Date(e.expiresAt).toLocaleDateString()
|
|
124
124
|
]
|
|
125
125
|
}),
|
|
126
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ v("span", {
|
|
127
127
|
className: "flex items-center gap-1",
|
|
128
128
|
children: [
|
|
129
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ _(g, { className: "size-3" }),
|
|
130
130
|
e.currentRedemptions,
|
|
131
131
|
e.maxRedemptions ? ` / ${e.maxRedemptions}` : "",
|
|
132
132
|
" redemptions"
|
|
133
133
|
]
|
|
134
134
|
}),
|
|
135
|
-
e.applicableProductIds.length > 0 && /* @__PURE__ */
|
|
135
|
+
e.applicableProductIds.length > 0 && /* @__PURE__ */ v("span", {
|
|
136
136
|
className: "flex items-center gap-1",
|
|
137
|
-
children: [/* @__PURE__ */
|
|
137
|
+
children: [/* @__PURE__ */ _(p, { className: "size-3" }), e.applicableProductIds.join(", ")]
|
|
138
138
|
})
|
|
139
139
|
]
|
|
140
140
|
})
|
|
141
141
|
]
|
|
142
|
-
}), /* @__PURE__ */
|
|
142
|
+
}), /* @__PURE__ */ _("div", {
|
|
143
143
|
className: "flex items-center gap-2 shrink-0",
|
|
144
|
-
children: /* @__PURE__ */
|
|
144
|
+
children: /* @__PURE__ */ _("button", {
|
|
145
145
|
onClick: () => j(e.id, e.isActive),
|
|
146
146
|
disabled: r,
|
|
147
147
|
title: e.isActive ? "Deactivate" : "Reactivate",
|
|
148
148
|
className: `p-2 rounded-button transition-colors ${e.isActive ? "text-status-success-text hover:bg-status-success-bg-subtle" : "text-text-muted hover:bg-bg-sunken"} disabled:opacity-50`,
|
|
149
|
-
children: e.isActive ? /* @__PURE__ */ h
|
|
149
|
+
children: e.isActive ? /* @__PURE__ */ _(h, { className: "size-5" }) : /* @__PURE__ */ _(m, { className: "size-5" })
|
|
150
150
|
})
|
|
151
151
|
})]
|
|
152
152
|
}, e.id);
|