@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.
- 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 +143 -143
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansListPage.js +88 -88
- package/dist/billing/modules/plans/utils/planAction.d.ts +9 -0
- package/dist/billing/modules/plans/utils/planAction.js +4 -1
- package/dist/billing/modules/plans/utils/planAction.js.map +1 -1
- 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
|
@@ -13,8 +13,8 @@ import { useTr as u } from "../../../shared/hooks/useTr.js";
|
|
|
13
13
|
import { usePlanMutations as d, usePlans as f } from "../hooks/usePlans.js";
|
|
14
14
|
import { getDisplayPrice as p, useDefaultBillingCurrency as m } from "../../../hooks/useDefaultBillingCurrency.js";
|
|
15
15
|
import { useMemo as h, useState as g } from "react";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { IllustratedEmptyState as _, PagePurpose as v } from "@burdenoff/fe-libs/ui";
|
|
17
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
18
18
|
// src/billing/modules/plans/pages/PlansListPage.tsx
|
|
19
19
|
function x(e) {
|
|
20
20
|
let t = /* @__PURE__ */ new Map();
|
|
@@ -31,7 +31,7 @@ function x(e) {
|
|
|
31
31
|
}
|
|
32
32
|
var S = () => {
|
|
33
33
|
let i = u(), a = e(), o = r(), { plans: c, isLoading: l, error: p, refetch: m } = f(), { togglePlan: h, isToggling: x } = d(), [S, T] = g("grid"), [E, D] = g(!1), [O, k] = g("all");
|
|
34
|
-
if (!o.canViewPlans) return /* @__PURE__ */
|
|
34
|
+
if (!o.canViewPlans) return /* @__PURE__ */ y(t, { message: i("billing.plans.noViewPermission", "You don't have permission to view pricing plans.") });
|
|
35
35
|
let A = c.filter((e) => !(!E && !e.isActive || O !== "all" && e.duration !== O)), j = async (e) => {
|
|
36
36
|
if (o.canManagePlans) try {
|
|
37
37
|
await h(e.id, !e.isActive), await m();
|
|
@@ -43,52 +43,52 @@ var S = () => {
|
|
|
43
43
|
}, N = (e) => {
|
|
44
44
|
a(`/plans/${e.id}`);
|
|
45
45
|
};
|
|
46
|
-
return l && c.length === 0 ? /* @__PURE__ */
|
|
46
|
+
return l && c.length === 0 ? /* @__PURE__ */ b("div", {
|
|
47
47
|
className: "space-y-6 p-6",
|
|
48
|
-
children: [/* @__PURE__ */
|
|
48
|
+
children: [/* @__PURE__ */ y("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ y("div", {
|
|
49
49
|
className: "grid grid-cols-1 md:grid-cols-3 gap-6",
|
|
50
50
|
children: [
|
|
51
51
|
1,
|
|
52
52
|
2,
|
|
53
53
|
3
|
|
54
|
-
].map((e) => /* @__PURE__ */
|
|
54
|
+
].map((e) => /* @__PURE__ */ b("div", {
|
|
55
55
|
className: "border border-border-subtle rounded-lg p-6 space-y-4",
|
|
56
56
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ y("div", { className: "h-6 w-24 bg-bg-sunken animate-pulse rounded" }),
|
|
58
|
+
/* @__PURE__ */ y("div", { className: "h-8 w-32 bg-bg-sunken animate-pulse rounded" }),
|
|
59
|
+
/* @__PURE__ */ y("div", {
|
|
60
60
|
className: "space-y-2",
|
|
61
61
|
children: [
|
|
62
62
|
1,
|
|
63
63
|
2,
|
|
64
64
|
3,
|
|
65
65
|
4
|
|
66
|
-
].map((e) => /* @__PURE__ */
|
|
66
|
+
].map((e) => /* @__PURE__ */ y("div", { className: "h-4 w-full bg-bg-sunken animate-pulse rounded" }, e))
|
|
67
67
|
})
|
|
68
68
|
]
|
|
69
69
|
}, e))
|
|
70
70
|
})]
|
|
71
|
-
}) : p ? s(p) ? /* @__PURE__ */
|
|
71
|
+
}) : p ? s(p) ? /* @__PURE__ */ y("div", {
|
|
72
72
|
className: "p-6",
|
|
73
|
-
children: /* @__PURE__ */
|
|
73
|
+
children: /* @__PURE__ */ y(n, {
|
|
74
74
|
title: i("billing.plans.serverUnavailable", "Server Unavailable"),
|
|
75
75
|
message: i("billing.plans.serverUnavailableMessage", "Unable to load pricing plans. The server might be down or experiencing issues."),
|
|
76
76
|
onRetry: () => m(),
|
|
77
77
|
showRetry: !0
|
|
78
78
|
})
|
|
79
|
-
}) : /* @__PURE__ */
|
|
79
|
+
}) : /* @__PURE__ */ y("div", {
|
|
80
80
|
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
81
|
-
children: /* @__PURE__ */
|
|
81
|
+
children: /* @__PURE__ */ b("div", {
|
|
82
82
|
className: "text-center space-y-4",
|
|
83
83
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ y("div", {
|
|
85
85
|
className: "size-12 mx-auto rounded-full bg-status-error-bg-subtle flex items-center justify-center",
|
|
86
|
-
children: /* @__PURE__ */
|
|
86
|
+
children: /* @__PURE__ */ y("svg", {
|
|
87
87
|
className: "size-6 text-status-error-text",
|
|
88
88
|
fill: "none",
|
|
89
89
|
viewBox: "0 0 24 24",
|
|
90
90
|
stroke: "currentColor",
|
|
91
|
-
children: /* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ y("path", {
|
|
92
92
|
strokeLinecap: "round",
|
|
93
93
|
strokeLinejoin: "round",
|
|
94
94
|
strokeWidth: 2,
|
|
@@ -96,15 +96,15 @@ var S = () => {
|
|
|
96
96
|
})
|
|
97
97
|
})
|
|
98
98
|
}),
|
|
99
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ y("h2", {
|
|
100
100
|
className: "text-lg font-semibold text-text-primary",
|
|
101
101
|
children: i("billing.plans.failedToLoad", "Failed to load plans")
|
|
102
102
|
}),
|
|
103
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ y("p", {
|
|
104
104
|
className: "text-sm text-text-muted",
|
|
105
105
|
children: p.message
|
|
106
106
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ y("button", {
|
|
108
108
|
type: "button",
|
|
109
109
|
onClick: () => m(),
|
|
110
110
|
className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors",
|
|
@@ -112,34 +112,34 @@ var S = () => {
|
|
|
112
112
|
})
|
|
113
113
|
]
|
|
114
114
|
})
|
|
115
|
-
}) : /* @__PURE__ */
|
|
115
|
+
}) : /* @__PURE__ */ b("div", {
|
|
116
116
|
className: "space-y-6 p-6",
|
|
117
117
|
children: [
|
|
118
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ b("div", {
|
|
119
119
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
120
|
-
children: [/* @__PURE__ */
|
|
121
|
-
/* @__PURE__ */
|
|
120
|
+
children: [/* @__PURE__ */ b("div", { children: [
|
|
121
|
+
/* @__PURE__ */ y("h1", {
|
|
122
122
|
className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
|
|
123
123
|
children: i("billing.plans.title", "Pricing Plans")
|
|
124
124
|
}),
|
|
125
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ y("p", {
|
|
126
126
|
className: "text-sm text-text-muted mt-1",
|
|
127
127
|
children: i("billing.plans.subtitle", "Choose the plan that best fits your needs")
|
|
128
128
|
}),
|
|
129
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ y(v, {
|
|
130
130
|
className: "mt-3",
|
|
131
131
|
children: i("billing.plans.listPurpose", "Manage the full catalog of pricing plans for this product — including inactive ones. Create new tiers, edit the quotas and price each plan grants, and activate or deactivate plans to control what customers can subscribe to.")
|
|
132
132
|
})
|
|
133
|
-
] }), o.canManagePlans && /* @__PURE__ */
|
|
133
|
+
] }), o.canManagePlans && /* @__PURE__ */ b("button", {
|
|
134
134
|
type: "button",
|
|
135
135
|
onClick: () => a("/plans/new"),
|
|
136
136
|
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors",
|
|
137
|
-
children: [/* @__PURE__ */
|
|
137
|
+
children: [/* @__PURE__ */ y("svg", {
|
|
138
138
|
className: "size-4",
|
|
139
139
|
fill: "none",
|
|
140
140
|
viewBox: "0 0 24 24",
|
|
141
141
|
stroke: "currentColor",
|
|
142
|
-
children: /* @__PURE__ */
|
|
142
|
+
children: /* @__PURE__ */ y("path", {
|
|
143
143
|
strokeLinecap: "round",
|
|
144
144
|
strokeLinejoin: "round",
|
|
145
145
|
strokeWidth: 2,
|
|
@@ -148,25 +148,25 @@ var S = () => {
|
|
|
148
148
|
}), i("billing.plans.createPlan", "Create Plan")]
|
|
149
149
|
})]
|
|
150
150
|
}),
|
|
151
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ b("div", {
|
|
152
152
|
className: "flex flex-wrap items-center gap-4 pb-4 border-b border-border-subtle",
|
|
153
153
|
children: [
|
|
154
|
-
/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ b("div", {
|
|
155
155
|
className: "inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken/50",
|
|
156
156
|
children: [
|
|
157
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ y("button", {
|
|
158
158
|
type: "button",
|
|
159
159
|
onClick: () => k("all"),
|
|
160
160
|
className: `px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${O === "all" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-muted hover:text-text-primary"}`,
|
|
161
161
|
children: i("billing.plans.all", "All")
|
|
162
162
|
}),
|
|
163
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ y("button", {
|
|
164
164
|
type: "button",
|
|
165
165
|
onClick: () => k("monthly"),
|
|
166
166
|
className: `px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${O === "monthly" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-muted hover:text-text-primary"}`,
|
|
167
167
|
children: i("billing.plans.monthly", "Monthly")
|
|
168
168
|
}),
|
|
169
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ y("button", {
|
|
170
170
|
type: "button",
|
|
171
171
|
onClick: () => k("yearly"),
|
|
172
172
|
className: `px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${O === "yearly" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-muted hover:text-text-primary"}`,
|
|
@@ -174,48 +174,48 @@ var S = () => {
|
|
|
174
174
|
})
|
|
175
175
|
]
|
|
176
176
|
}),
|
|
177
|
-
o.canManagePlans && /* @__PURE__ */
|
|
177
|
+
o.canManagePlans && /* @__PURE__ */ b("label", {
|
|
178
178
|
className: "flex items-center gap-2 text-sm cursor-pointer",
|
|
179
|
-
children: [/* @__PURE__ */
|
|
179
|
+
children: [/* @__PURE__ */ y("input", {
|
|
180
180
|
type: "checkbox",
|
|
181
181
|
checked: E,
|
|
182
182
|
onChange: (e) => D(e.target.checked),
|
|
183
183
|
className: "size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]"
|
|
184
|
-
}), /* @__PURE__ */
|
|
184
|
+
}), /* @__PURE__ */ y("span", {
|
|
185
185
|
className: "text-text-muted",
|
|
186
186
|
children: i("billing.plans.showInactive", "Show inactive plans")
|
|
187
187
|
})]
|
|
188
188
|
}),
|
|
189
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ b("div", {
|
|
190
190
|
className: "ml-auto inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken/50",
|
|
191
|
-
children: [/* @__PURE__ */
|
|
191
|
+
children: [/* @__PURE__ */ y("button", {
|
|
192
192
|
type: "button",
|
|
193
193
|
onClick: () => T("grid"),
|
|
194
194
|
className: `p-1.5 rounded-md transition-colors ${S === "grid" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-muted hover:text-text-primary"}`,
|
|
195
195
|
title: i("billing.plans.gridView", "Grid view"),
|
|
196
|
-
children: /* @__PURE__ */
|
|
196
|
+
children: /* @__PURE__ */ y("svg", {
|
|
197
197
|
className: "size-4",
|
|
198
198
|
fill: "none",
|
|
199
199
|
viewBox: "0 0 24 24",
|
|
200
200
|
stroke: "currentColor",
|
|
201
|
-
children: /* @__PURE__ */
|
|
201
|
+
children: /* @__PURE__ */ y("path", {
|
|
202
202
|
strokeLinecap: "round",
|
|
203
203
|
strokeLinejoin: "round",
|
|
204
204
|
strokeWidth: 2,
|
|
205
205
|
d: "M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"
|
|
206
206
|
})
|
|
207
207
|
})
|
|
208
|
-
}), /* @__PURE__ */
|
|
208
|
+
}), /* @__PURE__ */ y("button", {
|
|
209
209
|
type: "button",
|
|
210
210
|
onClick: () => T("list"),
|
|
211
211
|
className: `p-1.5 rounded-md transition-colors ${S === "list" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-muted hover:text-text-primary"}`,
|
|
212
212
|
title: i("billing.plans.listView", "List view"),
|
|
213
|
-
children: /* @__PURE__ */
|
|
213
|
+
children: /* @__PURE__ */ y("svg", {
|
|
214
214
|
className: "size-4",
|
|
215
215
|
fill: "none",
|
|
216
216
|
viewBox: "0 0 24 24",
|
|
217
217
|
stroke: "currentColor",
|
|
218
|
-
children: /* @__PURE__ */
|
|
218
|
+
children: /* @__PURE__ */ y("path", {
|
|
219
219
|
strokeLinecap: "round",
|
|
220
220
|
strokeLinejoin: "round",
|
|
221
221
|
strokeWidth: 2,
|
|
@@ -226,19 +226,19 @@ var S = () => {
|
|
|
226
226
|
})
|
|
227
227
|
]
|
|
228
228
|
}),
|
|
229
|
-
A.length === 0 ? /* @__PURE__ */ _
|
|
229
|
+
A.length === 0 ? /* @__PURE__ */ y(_, {
|
|
230
230
|
illustration: "empty-data",
|
|
231
231
|
title: i("billing.plans.noPlansFound", "No plans found"),
|
|
232
232
|
description: E ? i("billing.plans.noPlansFiltered", "No plans match your current filters.") : i("billing.plans.noActivePlans", "There are no active plans available."),
|
|
233
|
-
action: o.canManagePlans ? /* @__PURE__ */
|
|
233
|
+
action: o.canManagePlans ? /* @__PURE__ */ y("button", {
|
|
234
234
|
type: "button",
|
|
235
235
|
onClick: () => a("/plans/new"),
|
|
236
236
|
className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors",
|
|
237
237
|
children: i("billing.plans.createFirstPlan", "Create your first plan")
|
|
238
238
|
}) : void 0
|
|
239
|
-
}) : S === "grid" ? /* @__PURE__ */
|
|
239
|
+
}) : S === "grid" ? /* @__PURE__ */ y("div", {
|
|
240
240
|
className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",
|
|
241
|
-
children: A.map((e) => /* @__PURE__ */
|
|
241
|
+
children: A.map((e) => /* @__PURE__ */ y(C, {
|
|
242
242
|
plan: e,
|
|
243
243
|
onSelect: M,
|
|
244
244
|
onView: N,
|
|
@@ -247,9 +247,9 @@ var S = () => {
|
|
|
247
247
|
canManage: o.canManagePlans,
|
|
248
248
|
isToggling: x
|
|
249
249
|
}, e.id))
|
|
250
|
-
}) : /* @__PURE__ */
|
|
250
|
+
}) : /* @__PURE__ */ y("div", {
|
|
251
251
|
className: "space-y-3",
|
|
252
|
-
children: A.map((e) => /* @__PURE__ */
|
|
252
|
+
children: A.map((e) => /* @__PURE__ */ y(w, {
|
|
253
253
|
plan: e,
|
|
254
254
|
onSelect: M,
|
|
255
255
|
onView: N,
|
|
@@ -262,27 +262,27 @@ var S = () => {
|
|
|
262
262
|
]
|
|
263
263
|
});
|
|
264
264
|
}, C = ({ plan: e, onSelect: t, onView: n, onToggle: r, canSelect: s, canManage: c, isToggling: d }) => {
|
|
265
|
-
let f = u(), g = m(),
|
|
266
|
-
return /* @__PURE__ */
|
|
265
|
+
let f = u(), g = m(), _ = h(() => x(e.features || []), [e.features]);
|
|
266
|
+
return /* @__PURE__ */ b("div", {
|
|
267
267
|
className: `relative border rounded-card p-6 flex flex-col h-full transition-[box-shadow,transform] duration-200 ease-[var(--motion-easing-out)] ${e.isActive ? "border-border-seam bg-bg-surface shadow-[var(--shadow-pop)] hover:shadow-[var(--shadow-elevation-2)] [@media(hover:none)]:" : "border-dashed border-text-muted/30 bg-bg-sunken/30 shadow-elevation-1"}`,
|
|
268
268
|
children: [
|
|
269
|
-
!e.isActive && /* @__PURE__ */
|
|
269
|
+
!e.isActive && /* @__PURE__ */ y("span", {
|
|
270
270
|
className: "absolute top-4 right-4 px-2 py-1 text-xs font-medium bg-bg-sunken text-text-muted rounded",
|
|
271
271
|
children: f("billing.common.inactive", "Inactive")
|
|
272
272
|
}),
|
|
273
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ b("div", {
|
|
274
274
|
className: "mb-4",
|
|
275
|
-
children: [/* @__PURE__ */
|
|
275
|
+
children: [/* @__PURE__ */ y("h3", {
|
|
276
276
|
className: "text-xl font-bold text-text-primary",
|
|
277
277
|
children: e.name
|
|
278
|
-
}), /* @__PURE__ */
|
|
278
|
+
}), /* @__PURE__ */ y("span", {
|
|
279
279
|
className: "text-sm text-text-muted",
|
|
280
280
|
children: o(e.duration)
|
|
281
281
|
})]
|
|
282
282
|
}),
|
|
283
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ b("div", {
|
|
284
284
|
className: "flex items-baseline gap-1 mb-1",
|
|
285
|
-
children: [/* @__PURE__ */
|
|
285
|
+
children: [/* @__PURE__ */ y("span", {
|
|
286
286
|
className: "text-3xl font-bold text-text-primary",
|
|
287
287
|
children: (() => {
|
|
288
288
|
let t = e.pricingModel === l.PER_SEAT && e.pricePerSeat ? {
|
|
@@ -294,64 +294,64 @@ var S = () => {
|
|
|
294
294
|
}, { price: n, currency: r } = p(t.price, t.currency, e.currencyPrices, g);
|
|
295
295
|
return i(n, r);
|
|
296
296
|
})()
|
|
297
|
-
}), /* @__PURE__ */
|
|
297
|
+
}), /* @__PURE__ */ b("span", {
|
|
298
298
|
className: "text-text-muted",
|
|
299
299
|
children: ["/ ", a(e.duration)]
|
|
300
300
|
})]
|
|
301
301
|
}),
|
|
302
|
-
e.pricingModel === l.PER_SEAT && /* @__PURE__ */
|
|
302
|
+
e.pricingModel === l.PER_SEAT && /* @__PURE__ */ b("p", {
|
|
303
303
|
className: "text-xs text-text-muted mb-4",
|
|
304
304
|
children: [f("billing.plans.perSeat", "per seat"), e.minSeats ? ` · ${f("billing.plans.minSeats", "min {{count}} seat{{plural}}", {
|
|
305
305
|
count: e.minSeats,
|
|
306
306
|
plural: e.minSeats === 1 ? "" : "s"
|
|
307
307
|
})}` : ""]
|
|
308
308
|
}),
|
|
309
|
-
e.pricingModel !== l.PER_SEAT && /* @__PURE__ */
|
|
310
|
-
|
|
309
|
+
e.pricingModel !== l.PER_SEAT && /* @__PURE__ */ y("div", { className: "mb-6" }),
|
|
310
|
+
_.length > 0 && /* @__PURE__ */ b("ul", {
|
|
311
311
|
className: "space-y-2 mb-6",
|
|
312
|
-
children: [
|
|
312
|
+
children: [_.slice(0, 5).map((e) => /* @__PURE__ */ b("li", {
|
|
313
313
|
className: "flex items-center justify-between text-sm",
|
|
314
|
-
children: [/* @__PURE__ */
|
|
314
|
+
children: [/* @__PURE__ */ b("div", {
|
|
315
315
|
className: "flex items-center gap-2",
|
|
316
|
-
children: [/* @__PURE__ */
|
|
316
|
+
children: [/* @__PURE__ */ y("svg", {
|
|
317
317
|
className: "size-5 text-status-success-text shrink-0",
|
|
318
318
|
fill: "none",
|
|
319
319
|
viewBox: "0 0 24 24",
|
|
320
320
|
stroke: "currentColor",
|
|
321
|
-
children: /* @__PURE__ */
|
|
321
|
+
children: /* @__PURE__ */ y("path", {
|
|
322
322
|
strokeLinecap: "round",
|
|
323
323
|
strokeLinejoin: "round",
|
|
324
324
|
strokeWidth: 2,
|
|
325
325
|
d: "M5 13l4 4L19 7"
|
|
326
326
|
})
|
|
327
|
-
}), /* @__PURE__ */
|
|
327
|
+
}), /* @__PURE__ */ y("span", {
|
|
328
328
|
className: "text-text-primary",
|
|
329
329
|
children: e.name
|
|
330
330
|
})]
|
|
331
|
-
}), /* @__PURE__ */
|
|
331
|
+
}), /* @__PURE__ */ y("span", {
|
|
332
332
|
className: "font-medium text-text-primary",
|
|
333
333
|
children: e.totalValue.toLocaleString()
|
|
334
334
|
})]
|
|
335
|
-
}, e.quotaId)),
|
|
335
|
+
}, e.quotaId)), _.length > 5 && /* @__PURE__ */ y("li", {
|
|
336
336
|
className: "text-sm text-text-muted pl-7",
|
|
337
|
-
children: f("billing.plans.moreQuotas", "+{{count}} more quotas", { count:
|
|
337
|
+
children: f("billing.plans.moreQuotas", "+{{count}} more quotas", { count: _.length - 5 })
|
|
338
338
|
})]
|
|
339
339
|
}),
|
|
340
|
-
/* @__PURE__ */
|
|
340
|
+
/* @__PURE__ */ b("div", {
|
|
341
341
|
className: "space-y-2 pt-4 border-t border-border-subtle mt-auto",
|
|
342
|
-
children: [s && e.isActive && /* @__PURE__ */
|
|
342
|
+
children: [s && e.isActive && /* @__PURE__ */ y("button", {
|
|
343
343
|
type: "button",
|
|
344
344
|
onClick: () => t(e),
|
|
345
345
|
className: "w-full px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors",
|
|
346
346
|
children: f("billing.plans.selectPlan", "Select Plan")
|
|
347
|
-
}), /* @__PURE__ */
|
|
347
|
+
}), /* @__PURE__ */ b("div", {
|
|
348
348
|
className: "flex gap-2",
|
|
349
|
-
children: [/* @__PURE__ */
|
|
349
|
+
children: [/* @__PURE__ */ y("button", {
|
|
350
350
|
type: "button",
|
|
351
351
|
onClick: () => n(e),
|
|
352
352
|
className: "flex-1 px-4 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors",
|
|
353
353
|
children: f("billing.plans.viewDetails", "View Details")
|
|
354
|
-
}), c && /* @__PURE__ */
|
|
354
|
+
}), c && /* @__PURE__ */ y("button", {
|
|
355
355
|
type: "button",
|
|
356
356
|
onClick: () => r(e),
|
|
357
357
|
disabled: d,
|
|
@@ -364,21 +364,21 @@ var S = () => {
|
|
|
364
364
|
});
|
|
365
365
|
}, w = ({ plan: e, onSelect: t, onView: n, onToggle: r, canSelect: o, canManage: s, isToggling: c }) => {
|
|
366
366
|
let l = u(), d = m(), f = h(() => x(e.features || []), [e.features]);
|
|
367
|
-
return /* @__PURE__ */
|
|
367
|
+
return /* @__PURE__ */ b("div", {
|
|
368
368
|
className: `flex items-center gap-4 p-4 border rounded-card shadow-[var(--shadow-elevation-1)] transition-all duration-200 hover:border-border-strong hover:shadow-[var(--shadow-elevation-2)] ${e.isActive ? "border-border-subtle bg-bg-surface" : "border-dashed border-text-muted/30 bg-bg-sunken/30"}`,
|
|
369
369
|
children: [
|
|
370
|
-
/* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ b("div", {
|
|
371
371
|
className: "flex-1 min-w-0",
|
|
372
|
-
children: [/* @__PURE__ */
|
|
372
|
+
children: [/* @__PURE__ */ b("div", {
|
|
373
373
|
className: "flex items-center gap-2",
|
|
374
|
-
children: [/* @__PURE__ */
|
|
374
|
+
children: [/* @__PURE__ */ y("h3", {
|
|
375
375
|
className: "font-semibold text-text-primary truncate",
|
|
376
376
|
children: e.name
|
|
377
|
-
}), !e.isActive && /* @__PURE__ */
|
|
377
|
+
}), !e.isActive && /* @__PURE__ */ y("span", {
|
|
378
378
|
className: "px-2 py-0.5 text-xs font-medium bg-bg-sunken text-text-muted rounded",
|
|
379
379
|
children: l("billing.common.inactive", "Inactive")
|
|
380
380
|
})]
|
|
381
|
-
}), /* @__PURE__ */
|
|
381
|
+
}), /* @__PURE__ */ y("p", {
|
|
382
382
|
className: "text-sm text-text-muted",
|
|
383
383
|
children: l("billing.plans.quotasIncludedCount", "{{count}} quota{{plural}} included", {
|
|
384
384
|
count: f.length,
|
|
@@ -386,35 +386,35 @@ var S = () => {
|
|
|
386
386
|
})
|
|
387
387
|
})]
|
|
388
388
|
}),
|
|
389
|
-
/* @__PURE__ */
|
|
389
|
+
/* @__PURE__ */ b("div", {
|
|
390
390
|
className: "text-right",
|
|
391
|
-
children: [/* @__PURE__ */
|
|
391
|
+
children: [/* @__PURE__ */ y("div", {
|
|
392
392
|
className: "font-semibold text-text-primary",
|
|
393
393
|
children: (() => {
|
|
394
394
|
let { price: t, currency: n } = p(e.price, e.currency, e.currencyPrices, d);
|
|
395
395
|
return i(t, n);
|
|
396
396
|
})()
|
|
397
|
-
}), /* @__PURE__ */
|
|
397
|
+
}), /* @__PURE__ */ b("div", {
|
|
398
398
|
className: "text-sm text-text-muted",
|
|
399
399
|
children: ["per ", a(e.duration)]
|
|
400
400
|
})]
|
|
401
401
|
}),
|
|
402
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ b("div", {
|
|
403
403
|
className: "flex items-center gap-2",
|
|
404
404
|
children: [
|
|
405
|
-
o && e.isActive && /* @__PURE__ */
|
|
405
|
+
o && e.isActive && /* @__PURE__ */ y("button", {
|
|
406
406
|
type: "button",
|
|
407
407
|
onClick: () => t(e),
|
|
408
408
|
className: "px-3 py-1.5 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors",
|
|
409
409
|
children: l("billing.common.select", "Select")
|
|
410
410
|
}),
|
|
411
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ y("button", {
|
|
412
412
|
type: "button",
|
|
413
413
|
onClick: () => n(e),
|
|
414
414
|
className: "px-3 py-1.5 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors",
|
|
415
415
|
children: l("billing.common.view", "View")
|
|
416
416
|
}),
|
|
417
|
-
s && /* @__PURE__ */
|
|
417
|
+
s && /* @__PURE__ */ y("button", {
|
|
418
418
|
type: "button",
|
|
419
419
|
onClick: () => r(e),
|
|
420
420
|
disabled: c,
|
|
@@ -12,5 +12,14 @@ export type PlanAction = {
|
|
|
12
12
|
* What a plan card should offer given the account's active subscriptions:
|
|
13
13
|
* mark the plan already held, send a subscriber to Change plan (never a second
|
|
14
14
|
* checkout), and only start a checkout when there is no active subscription.
|
|
15
|
+
*
|
|
16
|
+
* Pass only the subscriptions to THIS product's plans. A subscription to another
|
|
17
|
+
* product's plan is not one a plan card here may change, so it must not be in the list.
|
|
15
18
|
*/
|
|
16
19
|
export declare function resolvePlanAction(planId: string, activeSubscriptions: ReadonlyArray<Pick<BillingSubscription, 'id' | 'planId'>>): PlanAction;
|
|
20
|
+
/**
|
|
21
|
+
* The active subscriptions a plan card may act on: active ones on this product's plans only.
|
|
22
|
+
* A subscription to another product's plan (or to a plan this page does not list, such as a
|
|
23
|
+
* free one) is left out, so the card falls back to a normal checkout instead of changing it.
|
|
24
|
+
*/
|
|
25
|
+
export declare function activeProductSubscriptions<T extends Pick<BillingSubscription, 'id' | 'planId' | 'status'>>(subscriptions: ReadonlyArray<T>, productPlanIds: ReadonlySet<string>): T[];
|
|
@@ -11,6 +11,9 @@ function e(e, t) {
|
|
|
11
11
|
subscriptionId: r.id
|
|
12
12
|
} : { kind: "subscribe" };
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
function t(e, t) {
|
|
15
|
+
return e.filter((e) => String(e.status).toLowerCase() === "active" && t.has(e.planId));
|
|
16
|
+
}
|
|
17
|
+
export { t as activeProductSubscriptions, e as resolvePlanAction };
|
|
15
18
|
|
|
16
19
|
//# sourceMappingURL=planAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planAction.js","names":["resolvePlanAction","held","activeSubscriptions","s","planId","first"],"sources":["../../../../../src/billing/modules/plans/utils/planAction.ts"],"sourcesContent":["import type { BillingSubscription } from '../../../shared/types';\n\nexport type PlanAction =\n | { kind: 'current'; subscriptionId: string }\n | { kind: 'change'; subscriptionId: string }\n | { kind: 'subscribe' };\n\n/**\n * What a plan card should offer given the account's active subscriptions:\n * mark the plan already held, send a subscriber to Change plan (never a second\n * checkout), and only start a checkout when there is no active subscription.\n */\nexport function resolvePlanAction(\n planId: string,\n activeSubscriptions: ReadonlyArray<Pick<BillingSubscription, 'id' | 'planId'>>\n): PlanAction {\n const held = activeSubscriptions.find((s) => s.planId === planId);\n if (held) return { kind: 'current', subscriptionId: held.id };\n const first = activeSubscriptions[0];\n if (first) return { kind: 'change', subscriptionId: first.id };\n return { kind: 'subscribe' };\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"planAction.js","names":["resolvePlanAction","held","activeSubscriptions","s","planId","first","activeProductSubscriptions","subscriptions","sub","productPlanIds"],"sources":["../../../../../src/billing/modules/plans/utils/planAction.ts"],"sourcesContent":["import type { BillingSubscription } from '../../../shared/types';\n\nexport type PlanAction =\n | { kind: 'current'; subscriptionId: string }\n | { kind: 'change'; subscriptionId: string }\n | { kind: 'subscribe' };\n\n/**\n * What a plan card should offer given the account's active subscriptions:\n * mark the plan already held, send a subscriber to Change plan (never a second\n * checkout), and only start a checkout when there is no active subscription.\n *\n * Pass only the subscriptions to THIS product's plans. A subscription to another\n * product's plan is not one a plan card here may change, so it must not be in the list.\n */\nexport function resolvePlanAction(\n planId: string,\n activeSubscriptions: ReadonlyArray<Pick<BillingSubscription, 'id' | 'planId'>>\n): PlanAction {\n const held = activeSubscriptions.find((s) => s.planId === planId);\n if (held) return { kind: 'current', subscriptionId: held.id };\n const first = activeSubscriptions[0];\n if (first) return { kind: 'change', subscriptionId: first.id };\n return { kind: 'subscribe' };\n}\n\n/**\n * The active subscriptions a plan card may act on: active ones on this product's plans only.\n * A subscription to another product's plan (or to a plan this page does not list, such as a\n * free one) is left out, so the card falls back to a normal checkout instead of changing it.\n */\nexport function activeProductSubscriptions<\n T extends Pick<BillingSubscription, 'id' | 'planId' | 'status'>,\n>(subscriptions: ReadonlyArray<T>, productPlanIds: ReadonlySet<string>): T[] {\n return subscriptions.filter(\n (sub) => String(sub.status).toLowerCase() === 'active' && productPlanIds.has(sub.planId)\n );\n}\n"],"mappings":";AAeA,SAAgBA,EACd,GACA,GACY;CACZ,IAAMC,IAAOC,EAAoB,MAAM,MAAMC,EAAE,WAAWC,CAAM;CAChE,IAAIH,GAAM,OAAO;EAAE,MAAM;EAAW,gBAAgBA,EAAK;CAAG;CAC5D,IAAMI,IAAQH,EAAoB;CAElC,OADIG,IAAc;EAAE,MAAM;EAAU,gBAAgBA,EAAM;CAAG,IACtD,EAAE,MAAM,YAAY;AAC7B;AAOA,SAAgBC,EAEd,GAAiC,GAA0C;CAC3E,OAAOC,EAAc,QAClB,MAAQ,OAAOC,EAAI,MAAM,CAAC,CAAC,YAAY,MAAM,YAAYC,EAAe,IAAID,EAAI,MAAM,CACzF;AACF"}
|