@burdenoff/microfe-billing 2026.1113.1 → 2026.1113.2
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/modules/plans/pages/PlansBrowsePage.js +143 -143
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
- 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/package.json +1 -1
|
@@ -7,21 +7,21 @@ import { isServerError as o } from "../../../shared/utils/error.js";
|
|
|
7
7
|
import { getPlanFeatureQuantity as s } from "../../../shared/utils/planFeatureQuantity.js";
|
|
8
8
|
import { useDefaultBillingAccount as c } from "../../subscriptions/hooks/useSubscriptions.js";
|
|
9
9
|
import { useIsFluidgridsVariant as l } from "../../../hooks/useBillingVariant.js";
|
|
10
|
-
import {
|
|
10
|
+
import { activeProductSubscriptions as u, resolvePlanAction as d } from "../utils/planAction.js";
|
|
11
11
|
import "../../../shared/components/index.js";
|
|
12
|
-
import { usePlans as
|
|
12
|
+
import { usePlans as f } from "../hooks/usePlans.js";
|
|
13
13
|
import "../../../shared/utils/index.js";
|
|
14
|
-
import { PlanDuration as
|
|
15
|
-
import { getDisplayPrice as
|
|
16
|
-
import { FEATURED_QUOTA_LABELS as
|
|
17
|
-
import { enterpriseMailto as
|
|
18
|
-
import { useState as
|
|
19
|
-
import { ArrowRight as
|
|
20
|
-
import { jsx as
|
|
21
|
-
import { useI18n as
|
|
22
|
-
import { IllustratedEmptyState as
|
|
14
|
+
import { PlanDuration as p } from "../../../shared/types/graphql.js";
|
|
15
|
+
import { getDisplayPrice as m, useDefaultBillingCurrency as h } from "../../../hooks/useDefaultBillingCurrency.js";
|
|
16
|
+
import { FEATURED_QUOTA_LABELS as g, FEATURED_QUOTA_NAMES as _, formatFeaturedQuotaValue as v } from "../constants/featuredQuotas.js";
|
|
17
|
+
import { enterpriseMailto as y, getEnterpriseOffer as b } from "../constants/enterprise.js";
|
|
18
|
+
import { useState as x } from "react";
|
|
19
|
+
import { ArrowRight as S, Check as C, Sparkles as w } from "lucide-react";
|
|
20
|
+
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
21
|
+
import { useI18n as D } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
22
|
+
import { IllustratedEmptyState as O, PagePurpose as k } from "@burdenoff/fe-libs/ui";
|
|
23
23
|
// src/billing/modules/plans/pages/PlansBrowsePage.tsx
|
|
24
|
-
function
|
|
24
|
+
function A(e) {
|
|
25
25
|
let t = /* @__PURE__ */ new Map();
|
|
26
26
|
for (let n of e) {
|
|
27
27
|
if (!n.quota) continue;
|
|
@@ -34,115 +34,115 @@ function k(e) {
|
|
|
34
34
|
}
|
|
35
35
|
return Array.from(t.values());
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
let t =
|
|
39
|
-
return
|
|
37
|
+
function j(e) {
|
|
38
|
+
let t = A(e), n = new Map(t.map((e) => [e.name, e]));
|
|
39
|
+
return _.flatMap((e) => {
|
|
40
40
|
let t = n.get(e);
|
|
41
41
|
return t ? [t] : [];
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
var
|
|
45
|
-
let { t: r } =
|
|
44
|
+
var M = () => {
|
|
45
|
+
let { t: r } = D(), i = (e, t) => {
|
|
46
46
|
let n = r(e);
|
|
47
47
|
return n === e ? t : n;
|
|
48
|
-
}, a = e(),
|
|
49
|
-
let t = h(e);
|
|
50
|
-
t?.kind === "change" ? a(`/subscriptions/${t.subscriptionId}/upgrade`) : a(`/checkout/${e}`);
|
|
51
|
-
}, { productId: _, plansDocsUrl: v } = n(), x = y(_), { plans: S, isLoading: C, error: k, refetch: A } = d({
|
|
48
|
+
}, a = e(), { productId: s, plansDocsUrl: m } = n(), h = b(s), { plans: g, isLoading: _, error: v, refetch: y } = f({
|
|
52
49
|
includeFree: !1,
|
|
53
|
-
productId:
|
|
54
|
-
}),
|
|
55
|
-
|
|
50
|
+
productId: s ?? void 0
|
|
51
|
+
}), S = l(), { subscriptions: C } = c(), w = u(C, new Set(g.map((e) => e.id))), A = (e) => S ? d(e, w) : null, j = (e) => {
|
|
52
|
+
let t = A(e);
|
|
53
|
+
t?.kind === "change" ? a(`/subscriptions/${t.subscriptionId}/upgrade`) : a(`/checkout/${e}`);
|
|
54
|
+
}, [M, F] = x("grid"), [R, z] = x(p.MONTHLY), B = g.filter((e) => e.isActive && e.isPurchasable !== !1 && e.duration === R), V = B.length >= 2 ? 1 : -1;
|
|
55
|
+
return _ && g.length === 0 ? /* @__PURE__ */ E("div", {
|
|
56
56
|
className: "space-y-6 px-6 lg:px-8 py-6",
|
|
57
|
-
children: [/* @__PURE__ */
|
|
57
|
+
children: [/* @__PURE__ */ T("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded-card" }), /* @__PURE__ */ T("div", {
|
|
58
58
|
className: "grid grid-cols-1 md:grid-cols-3 gap-6",
|
|
59
59
|
children: [
|
|
60
60
|
1,
|
|
61
61
|
2,
|
|
62
62
|
3
|
|
63
|
-
].map((e) => /* @__PURE__ */
|
|
63
|
+
].map((e) => /* @__PURE__ */ E("div", {
|
|
64
64
|
className: "border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 p-5 space-y-4",
|
|
65
65
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ T("div", { className: "h-6 w-24 bg-bg-sunken animate-pulse rounded" }),
|
|
67
|
+
/* @__PURE__ */ T("div", { className: "h-8 w-32 bg-bg-sunken animate-pulse rounded" }),
|
|
68
|
+
/* @__PURE__ */ T("div", {
|
|
69
69
|
className: "space-y-2",
|
|
70
70
|
children: [
|
|
71
71
|
1,
|
|
72
72
|
2,
|
|
73
73
|
3
|
|
74
|
-
].map((e) => /* @__PURE__ */
|
|
74
|
+
].map((e) => /* @__PURE__ */ T("div", { className: "h-4 w-full bg-bg-sunken animate-pulse rounded" }, e))
|
|
75
75
|
})
|
|
76
76
|
]
|
|
77
77
|
}, e))
|
|
78
78
|
})]
|
|
79
|
-
}) :
|
|
79
|
+
}) : v && o(v) ? /* @__PURE__ */ T("div", {
|
|
80
80
|
className: "p-6",
|
|
81
|
-
children: /* @__PURE__ */
|
|
81
|
+
children: /* @__PURE__ */ T(t, {
|
|
82
82
|
title: i("billing.plans.serverUnavailable", "Server Unavailable"),
|
|
83
83
|
message: i("billing.plans.unableToLoadPlans", "Unable to load plans."),
|
|
84
|
-
onRetry: () =>
|
|
84
|
+
onRetry: () => y(),
|
|
85
85
|
showRetry: !0
|
|
86
86
|
})
|
|
87
|
-
}) : /* @__PURE__ */
|
|
87
|
+
}) : /* @__PURE__ */ E("div", {
|
|
88
88
|
className: "space-y-6 px-6 lg:px-8 py-6",
|
|
89
89
|
children: [
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ E("div", { children: [
|
|
91
|
+
/* @__PURE__ */ T("h1", {
|
|
92
92
|
className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
|
|
93
93
|
children: i("billing.plans.browsePlansTitle", "Plans")
|
|
94
94
|
}),
|
|
95
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ T("p", {
|
|
96
96
|
className: "text-sm text-text-secondary mt-1",
|
|
97
97
|
children: i("billing.plans.browsePlansSubtitle", "Choose a plan that fits your needs")
|
|
98
98
|
}),
|
|
99
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ T(k, {
|
|
100
100
|
className: "mt-3",
|
|
101
|
-
learnMoreHref:
|
|
101
|
+
learnMoreHref: m,
|
|
102
102
|
learnMoreLabel: i("billing.plans.learnMore", "Learn more"),
|
|
103
103
|
children: i("billing.plans.browsePurpose", "Compare what each plan includes — quotas, features and price — and subscribe to the one that fits your team. Switch between monthly and yearly billing to see the difference, or contact us for a custom Enterprise contract.")
|
|
104
104
|
})
|
|
105
105
|
] }),
|
|
106
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ E("div", {
|
|
107
107
|
className: "flex flex-wrap items-center gap-4 pb-4 border-b border-border-subtle",
|
|
108
|
-
children: [/* @__PURE__ */
|
|
108
|
+
children: [/* @__PURE__ */ T("div", {
|
|
109
109
|
className: "inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken",
|
|
110
|
-
children: [
|
|
110
|
+
children: [p.MONTHLY, p.YEARLY].map((e) => /* @__PURE__ */ T("button", {
|
|
111
111
|
type: "button",
|
|
112
|
-
onClick: () =>
|
|
113
|
-
className: `px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${
|
|
114
|
-
children: e ===
|
|
112
|
+
onClick: () => z(e),
|
|
113
|
+
className: `px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${R === e ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
|
|
114
|
+
children: e === p.MONTHLY ? "Monthly" : "Yearly"
|
|
115
115
|
}, e))
|
|
116
|
-
}), /* @__PURE__ */
|
|
116
|
+
}), /* @__PURE__ */ E("div", {
|
|
117
117
|
className: "ml-auto inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken",
|
|
118
|
-
children: [/* @__PURE__ */
|
|
118
|
+
children: [/* @__PURE__ */ T("button", {
|
|
119
119
|
type: "button",
|
|
120
|
-
onClick: () =>
|
|
121
|
-
className: `p-1.5 rounded-button transition-colors ${
|
|
120
|
+
onClick: () => F("grid"),
|
|
121
|
+
className: `p-1.5 rounded-button transition-colors ${M === "grid" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
|
|
122
122
|
title: "Grid view",
|
|
123
|
-
children: /* @__PURE__ */
|
|
123
|
+
children: /* @__PURE__ */ T("svg", {
|
|
124
124
|
className: "size-4",
|
|
125
125
|
fill: "none",
|
|
126
126
|
viewBox: "0 0 24 24",
|
|
127
127
|
stroke: "currentColor",
|
|
128
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ T("path", {
|
|
129
129
|
strokeLinecap: "round",
|
|
130
130
|
strokeLinejoin: "round",
|
|
131
131
|
strokeWidth: 2,
|
|
132
132
|
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"
|
|
133
133
|
})
|
|
134
134
|
})
|
|
135
|
-
}), /* @__PURE__ */
|
|
135
|
+
}), /* @__PURE__ */ T("button", {
|
|
136
136
|
type: "button",
|
|
137
|
-
onClick: () =>
|
|
138
|
-
className: `p-1.5 rounded-button transition-colors ${
|
|
137
|
+
onClick: () => F("list"),
|
|
138
|
+
className: `p-1.5 rounded-button transition-colors ${M === "list" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
|
|
139
139
|
title: "List view",
|
|
140
|
-
children: /* @__PURE__ */
|
|
140
|
+
children: /* @__PURE__ */ T("svg", {
|
|
141
141
|
className: "size-4",
|
|
142
142
|
fill: "none",
|
|
143
143
|
viewBox: "0 0 24 24",
|
|
144
144
|
stroke: "currentColor",
|
|
145
|
-
children: /* @__PURE__ */
|
|
145
|
+
children: /* @__PURE__ */ T("path", {
|
|
146
146
|
strokeLinecap: "round",
|
|
147
147
|
strokeLinejoin: "round",
|
|
148
148
|
strokeWidth: 2,
|
|
@@ -152,97 +152,97 @@ var j = () => {
|
|
|
152
152
|
})]
|
|
153
153
|
})]
|
|
154
154
|
}),
|
|
155
|
-
|
|
155
|
+
B.length === 0 ? /* @__PURE__ */ T(O, {
|
|
156
156
|
illustration: "empty-data",
|
|
157
157
|
title: i("billing.plans.noPlansAvailable", "No plans available"),
|
|
158
158
|
description: i("billing.plans.checkBackLater", "Check back later for new plans.")
|
|
159
|
-
}) :
|
|
159
|
+
}) : M === "grid" ? /* @__PURE__ */ E("div", {
|
|
160
160
|
className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 items-stretch",
|
|
161
|
-
children: [
|
|
161
|
+
children: [B.map((e, t) => /* @__PURE__ */ T(I, {
|
|
162
162
|
plan: e,
|
|
163
|
-
highlighted: t ===
|
|
163
|
+
highlighted: t === V,
|
|
164
164
|
onView: () => a(`/plans/${e.id}`),
|
|
165
|
-
onSubscribe: () =>
|
|
166
|
-
action:
|
|
167
|
-
}, e.id)), /* @__PURE__ */
|
|
168
|
-
}) : /* @__PURE__ */
|
|
165
|
+
onSubscribe: () => j(e.id),
|
|
166
|
+
action: A(e.id)
|
|
167
|
+
}, e.id)), /* @__PURE__ */ T(N, { offer: h })]
|
|
168
|
+
}) : /* @__PURE__ */ E("div", {
|
|
169
169
|
className: "space-y-3",
|
|
170
|
-
children: [
|
|
170
|
+
children: [B.map((e) => /* @__PURE__ */ T(L, {
|
|
171
171
|
plan: e,
|
|
172
172
|
onView: () => a(`/plans/${e.id}`),
|
|
173
|
-
onSubscribe: () =>
|
|
174
|
-
action:
|
|
175
|
-
}, e.id)), /* @__PURE__ */
|
|
173
|
+
onSubscribe: () => j(e.id),
|
|
174
|
+
action: A(e.id)
|
|
175
|
+
}, e.id)), /* @__PURE__ */ T(P, { offer: h })]
|
|
176
176
|
})
|
|
177
177
|
]
|
|
178
178
|
});
|
|
179
|
-
},
|
|
179
|
+
}, N = ({ offer: e }) => /* @__PURE__ */ E("div", {
|
|
180
180
|
className: "border border-border-strong bg-[var(--color-accent-soft)] rounded-card shadow-elevation-1 p-5 flex flex-col h-full",
|
|
181
181
|
children: [
|
|
182
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ E("div", {
|
|
183
183
|
className: "mb-4",
|
|
184
|
-
children: [/* @__PURE__ */
|
|
184
|
+
children: [/* @__PURE__ */ E("div", {
|
|
185
185
|
className: "flex items-center gap-2",
|
|
186
|
-
children: [/* @__PURE__ */
|
|
186
|
+
children: [/* @__PURE__ */ T("h3", {
|
|
187
187
|
className: "text-lg font-semibold text-text-primary",
|
|
188
188
|
children: "Enterprise"
|
|
189
|
-
}), /* @__PURE__ */
|
|
189
|
+
}), /* @__PURE__ */ T("span", {
|
|
190
190
|
className: "text-xs font-medium px-2 py-0.5 rounded-full bg-bg-surface text-text-link",
|
|
191
191
|
children: "Contact Us"
|
|
192
192
|
})]
|
|
193
|
-
}), /* @__PURE__ */
|
|
193
|
+
}), /* @__PURE__ */ T("span", {
|
|
194
194
|
className: "text-sm text-text-secondary",
|
|
195
195
|
children: "Custom contract"
|
|
196
196
|
})]
|
|
197
197
|
}),
|
|
198
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ T("div", {
|
|
199
199
|
className: "flex items-baseline gap-1 mb-4",
|
|
200
|
-
children: /* @__PURE__ */
|
|
200
|
+
children: /* @__PURE__ */ T("span", {
|
|
201
201
|
className: "text-2xl font-semibold text-text-primary",
|
|
202
202
|
children: "Custom pricing"
|
|
203
203
|
})
|
|
204
204
|
}),
|
|
205
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ T("ul", {
|
|
206
206
|
className: "space-y-2 mb-4 flex-1",
|
|
207
|
-
children: e.highlights.map((e) => /* @__PURE__ */
|
|
207
|
+
children: e.highlights.map((e) => /* @__PURE__ */ E("li", {
|
|
208
208
|
className: "flex items-center gap-2 text-sm",
|
|
209
|
-
children: [/* @__PURE__ */
|
|
209
|
+
children: [/* @__PURE__ */ T("svg", {
|
|
210
210
|
className: "size-4 text-status-success-text shrink-0",
|
|
211
211
|
fill: "none",
|
|
212
212
|
viewBox: "0 0 24 24",
|
|
213
213
|
stroke: "currentColor",
|
|
214
|
-
children: /* @__PURE__ */
|
|
214
|
+
children: /* @__PURE__ */ T("path", {
|
|
215
215
|
strokeLinecap: "round",
|
|
216
216
|
strokeLinejoin: "round",
|
|
217
217
|
strokeWidth: 2,
|
|
218
218
|
d: "M5 13l4 4L19 7"
|
|
219
219
|
})
|
|
220
|
-
}), /* @__PURE__ */
|
|
220
|
+
}), /* @__PURE__ */ T("span", {
|
|
221
221
|
className: "text-text-primary",
|
|
222
222
|
children: e
|
|
223
223
|
})]
|
|
224
224
|
}, e))
|
|
225
225
|
}),
|
|
226
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ T("div", {
|
|
227
227
|
className: "space-y-2 pt-4 border-t border-border-subtle mt-auto",
|
|
228
|
-
children: /* @__PURE__ */
|
|
229
|
-
href:
|
|
228
|
+
children: /* @__PURE__ */ T("a", {
|
|
229
|
+
href: y(e),
|
|
230
230
|
className: "block w-full px-4 py-2 text-sm font-medium text-center bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors duration-200",
|
|
231
231
|
children: "Contact Us"
|
|
232
232
|
})
|
|
233
233
|
})
|
|
234
234
|
]
|
|
235
|
-
}),
|
|
235
|
+
}), P = ({ offer: e }) => /* @__PURE__ */ E("div", {
|
|
236
236
|
className: "flex items-center gap-4 p-5 border border-border-strong rounded-card bg-[var(--color-accent-soft)] shadow-elevation-1 transition-all duration-200 hover:shadow-elevation-2",
|
|
237
237
|
children: [
|
|
238
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ T("div", {
|
|
239
239
|
className: "size-10 rounded-lg bg-bg-surface flex items-center justify-center shrink-0 shadow-elevation-1",
|
|
240
|
-
children: /* @__PURE__ */
|
|
240
|
+
children: /* @__PURE__ */ T("svg", {
|
|
241
241
|
className: "size-5 text-text-link",
|
|
242
242
|
fill: "none",
|
|
243
243
|
viewBox: "0 0 24 24",
|
|
244
244
|
stroke: "currentColor",
|
|
245
|
-
children: /* @__PURE__ */
|
|
245
|
+
children: /* @__PURE__ */ T("path", {
|
|
246
246
|
strokeLinecap: "round",
|
|
247
247
|
strokeLinejoin: "round",
|
|
248
248
|
strokeWidth: 2,
|
|
@@ -250,99 +250,99 @@ var j = () => {
|
|
|
250
250
|
})
|
|
251
251
|
})
|
|
252
252
|
}),
|
|
253
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ E("div", {
|
|
254
254
|
className: "flex-1 min-w-0",
|
|
255
|
-
children: [/* @__PURE__ */
|
|
255
|
+
children: [/* @__PURE__ */ E("div", {
|
|
256
256
|
className: "flex items-center gap-2",
|
|
257
|
-
children: [/* @__PURE__ */
|
|
257
|
+
children: [/* @__PURE__ */ T("h3", {
|
|
258
258
|
className: "font-semibold text-text-primary",
|
|
259
259
|
children: "Enterprise"
|
|
260
|
-
}), /* @__PURE__ */
|
|
260
|
+
}), /* @__PURE__ */ T("span", {
|
|
261
261
|
className: "text-xs font-medium px-2 py-0.5 rounded-full bg-bg-surface text-text-link shrink-0",
|
|
262
262
|
children: "Contact Us"
|
|
263
263
|
})]
|
|
264
|
-
}), /* @__PURE__ */
|
|
264
|
+
}), /* @__PURE__ */ T("p", {
|
|
265
265
|
className: "text-sm text-text-secondary",
|
|
266
266
|
children: e.summary
|
|
267
267
|
})]
|
|
268
268
|
}),
|
|
269
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ E("div", {
|
|
270
270
|
className: "text-right",
|
|
271
|
-
children: [/* @__PURE__ */
|
|
271
|
+
children: [/* @__PURE__ */ T("div", {
|
|
272
272
|
className: "font-semibold text-text-primary",
|
|
273
273
|
children: "Custom pricing"
|
|
274
|
-
}), /* @__PURE__ */
|
|
274
|
+
}), /* @__PURE__ */ T("div", {
|
|
275
275
|
className: "text-sm text-text-secondary",
|
|
276
276
|
children: "contract-based"
|
|
277
277
|
})]
|
|
278
278
|
}),
|
|
279
|
-
/* @__PURE__ */
|
|
280
|
-
href:
|
|
279
|
+
/* @__PURE__ */ T("a", {
|
|
280
|
+
href: y(e),
|
|
281
281
|
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 duration-200 shrink-0",
|
|
282
282
|
children: "Contact Us"
|
|
283
283
|
})
|
|
284
284
|
]
|
|
285
285
|
});
|
|
286
|
-
function
|
|
286
|
+
function F(e) {
|
|
287
287
|
return e?.kind === "current" ? "Current plan" : e?.kind === "change" ? "Change to this plan" : "Subscribe";
|
|
288
288
|
}
|
|
289
|
-
var
|
|
290
|
-
let c =
|
|
291
|
-
return /* @__PURE__ */
|
|
289
|
+
var I = ({ plan: e, highlighted: t = !1, onView: n, onSubscribe: o, action: s }) => {
|
|
290
|
+
let c = j(e.features || []), l = A(e.features || []).length - c.length, u = h(), { price: d, currency: f } = m(e.price, e.currency, e.currencyPrices, u);
|
|
291
|
+
return /* @__PURE__ */ E("div", {
|
|
292
292
|
className: `relative flex flex-col h-full rounded-card bg-bg-surface p-6 transition-[border-color,box-shadow] duration-200 ${t ? "border-2 border-action-primary-bg shadow-[var(--shadow-glow)]" : "border border-border-subtle shadow-elevation-1 hover:border-border-strong hover:shadow-elevation-2"}`,
|
|
293
293
|
children: [
|
|
294
|
-
s?.kind === "current" && /* @__PURE__ */
|
|
294
|
+
s?.kind === "current" && /* @__PURE__ */ T("span", {
|
|
295
295
|
className: "absolute -top-3 right-4 inline-flex items-center rounded-full bg-bg-sunken px-3 py-1 text-xs font-semibold text-text-primary border border-border-subtle",
|
|
296
296
|
children: "Current plan"
|
|
297
297
|
}),
|
|
298
|
-
t && /* @__PURE__ */
|
|
298
|
+
t && /* @__PURE__ */ E("span", {
|
|
299
299
|
className: "absolute -top-3 left-1/2 -translate-x-1/2 inline-flex items-center gap-1 rounded-full bg-action-primary-bg px-3 py-1 text-xs font-semibold text-action-primary-text shadow-elevation-2",
|
|
300
|
-
children: [/* @__PURE__ */ w
|
|
300
|
+
children: [/* @__PURE__ */ T(w, {
|
|
301
301
|
className: "size-3.5",
|
|
302
302
|
"aria-hidden": "true"
|
|
303
303
|
}), "Most popular"]
|
|
304
304
|
}),
|
|
305
|
-
/* @__PURE__ */
|
|
305
|
+
/* @__PURE__ */ E("div", {
|
|
306
306
|
className: "mb-4",
|
|
307
|
-
children: [/* @__PURE__ */
|
|
307
|
+
children: [/* @__PURE__ */ T("h3", {
|
|
308
308
|
className: "text-lg font-semibold text-text-primary",
|
|
309
309
|
children: e.name
|
|
310
|
-
}), /* @__PURE__ */
|
|
310
|
+
}), /* @__PURE__ */ T("span", {
|
|
311
311
|
className: "text-sm text-text-secondary",
|
|
312
312
|
children: a(e.duration)
|
|
313
313
|
})]
|
|
314
314
|
}),
|
|
315
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ E("div", {
|
|
316
316
|
className: "flex items-baseline gap-1.5 mb-5",
|
|
317
|
-
children: [/* @__PURE__ */
|
|
317
|
+
children: [/* @__PURE__ */ T("span", {
|
|
318
318
|
className: "text-4xl font-bold tabular-nums tracking-tight text-text-primary",
|
|
319
319
|
children: r(d, f)
|
|
320
|
-
}), /* @__PURE__ */
|
|
320
|
+
}), /* @__PURE__ */ E("span", {
|
|
321
321
|
className: "text-text-secondary text-sm",
|
|
322
322
|
children: ["/ ", i(e.duration)]
|
|
323
323
|
})]
|
|
324
324
|
}),
|
|
325
|
-
c.length > 0 && /* @__PURE__ */
|
|
325
|
+
c.length > 0 && /* @__PURE__ */ E("ul", {
|
|
326
326
|
className: "space-y-2.5 mb-5 flex-1",
|
|
327
|
-
children: [c.map((e) => /* @__PURE__ */
|
|
327
|
+
children: [c.map((e) => /* @__PURE__ */ E("li", {
|
|
328
328
|
className: "flex items-center justify-between gap-2 text-sm",
|
|
329
|
-
children: [/* @__PURE__ */
|
|
329
|
+
children: [/* @__PURE__ */ E("span", {
|
|
330
330
|
className: "flex items-center gap-2 min-w-0",
|
|
331
|
-
children: [/* @__PURE__ */
|
|
331
|
+
children: [/* @__PURE__ */ T("span", {
|
|
332
332
|
className: "flex size-5 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)]",
|
|
333
|
-
children: /* @__PURE__ */
|
|
333
|
+
children: /* @__PURE__ */ T(C, {
|
|
334
334
|
className: "size-3 text-action-primary-bg",
|
|
335
335
|
"aria-hidden": "true"
|
|
336
336
|
})
|
|
337
|
-
}), /* @__PURE__ */
|
|
337
|
+
}), /* @__PURE__ */ T("span", {
|
|
338
338
|
className: "truncate text-text-primary",
|
|
339
|
-
children:
|
|
339
|
+
children: g[e.name] ?? e.name
|
|
340
340
|
})]
|
|
341
|
-
}), /* @__PURE__ */
|
|
341
|
+
}), /* @__PURE__ */ T("span", {
|
|
342
342
|
className: "font-semibold text-text-primary tabular-nums shrink-0",
|
|
343
|
-
children:
|
|
343
|
+
children: v(e.name, e.totalValue)
|
|
344
344
|
})]
|
|
345
|
-
}, e.quotaId)), l > 0 && /* @__PURE__ */
|
|
345
|
+
}, e.quotaId)), l > 0 && /* @__PURE__ */ E("li", {
|
|
346
346
|
className: "text-sm text-text-secondary pl-7",
|
|
347
347
|
children: [
|
|
348
348
|
"+",
|
|
@@ -351,19 +351,19 @@ var F = ({ plan: e, highlighted: t = !1, onView: n, onSubscribe: o, action: s })
|
|
|
351
351
|
]
|
|
352
352
|
})]
|
|
353
353
|
}),
|
|
354
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ E("div", {
|
|
355
355
|
className: "space-y-2 pt-4 border-t border-border-subtle mt-auto",
|
|
356
|
-
children: [/* @__PURE__ */
|
|
356
|
+
children: [/* @__PURE__ */ E("button", {
|
|
357
357
|
type: "button",
|
|
358
358
|
onClick: o,
|
|
359
359
|
disabled: s?.kind === "current",
|
|
360
360
|
"aria-disabled": s?.kind === "current",
|
|
361
361
|
className: "group disabled:cursor-not-allowed disabled:opacity-60 inline-flex w-full items-center justify-center gap-2 rounded-button bg-action-primary-bg px-4 py-2.5 text-sm font-semibold text-action-primary-text shadow-elevation-1 transition-colors duration-200 hover:bg-action-primary-bgHover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
362
|
-
children: [
|
|
362
|
+
children: [F(s), /* @__PURE__ */ T(S, {
|
|
363
363
|
className: "size-4 transition-transform duration-200",
|
|
364
364
|
"aria-hidden": "true"
|
|
365
365
|
})]
|
|
366
|
-
}), /* @__PURE__ */
|
|
366
|
+
}), /* @__PURE__ */ T("button", {
|
|
367
367
|
type: "button",
|
|
368
368
|
onClick: n,
|
|
369
369
|
className: "w-full px-4 py-2 text-sm font-medium border border-border-subtle text-text-secondary rounded-button hover:bg-bg-sunken hover:text-text-primary hover:border-border-strong transition-colors duration-200",
|
|
@@ -372,19 +372,19 @@ var F = ({ plan: e, highlighted: t = !1, onView: n, onSubscribe: o, action: s })
|
|
|
372
372
|
})
|
|
373
373
|
]
|
|
374
374
|
});
|
|
375
|
-
},
|
|
376
|
-
let o =
|
|
377
|
-
return /* @__PURE__ */
|
|
375
|
+
}, L = ({ plan: e, onView: t, onSubscribe: n, action: a }) => {
|
|
376
|
+
let o = j(e.features || []), s = h();
|
|
377
|
+
return /* @__PURE__ */ E("div", {
|
|
378
378
|
className: "flex items-center gap-4 p-5 border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 transition-all duration-200 hover:border-border-strong hover:shadow-elevation-2",
|
|
379
379
|
children: [
|
|
380
|
-
/* @__PURE__ */
|
|
380
|
+
/* @__PURE__ */ T("div", {
|
|
381
381
|
className: "size-10 rounded-lg bg-[var(--color-accent-soft)] flex items-center justify-center shrink-0",
|
|
382
|
-
children: /* @__PURE__ */
|
|
382
|
+
children: /* @__PURE__ */ T("svg", {
|
|
383
383
|
className: "size-5 text-text-link",
|
|
384
384
|
fill: "none",
|
|
385
385
|
viewBox: "0 0 24 24",
|
|
386
386
|
stroke: "currentColor",
|
|
387
|
-
children: /* @__PURE__ */
|
|
387
|
+
children: /* @__PURE__ */ T("path", {
|
|
388
388
|
strokeLinecap: "round",
|
|
389
389
|
strokeLinejoin: "round",
|
|
390
390
|
strokeWidth: 2,
|
|
@@ -392,12 +392,12 @@ var F = ({ plan: e, highlighted: t = !1, onView: n, onSubscribe: o, action: s })
|
|
|
392
392
|
})
|
|
393
393
|
})
|
|
394
394
|
}),
|
|
395
|
-
/* @__PURE__ */
|
|
395
|
+
/* @__PURE__ */ E("div", {
|
|
396
396
|
className: "flex-1 min-w-0",
|
|
397
|
-
children: [/* @__PURE__ */
|
|
397
|
+
children: [/* @__PURE__ */ T("h3", {
|
|
398
398
|
className: "font-semibold text-text-primary truncate",
|
|
399
399
|
children: e.name
|
|
400
|
-
}), /* @__PURE__ */
|
|
400
|
+
}), /* @__PURE__ */ E("p", {
|
|
401
401
|
className: "text-sm text-text-secondary",
|
|
402
402
|
children: [
|
|
403
403
|
o.length,
|
|
@@ -407,28 +407,28 @@ var F = ({ plan: e, highlighted: t = !1, onView: n, onSubscribe: o, action: s })
|
|
|
407
407
|
]
|
|
408
408
|
})]
|
|
409
409
|
}),
|
|
410
|
-
/* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ E("div", {
|
|
411
411
|
className: "text-right",
|
|
412
|
-
children: [/* @__PURE__ */
|
|
412
|
+
children: [/* @__PURE__ */ T("div", {
|
|
413
413
|
className: "font-semibold text-text-primary",
|
|
414
414
|
children: (() => {
|
|
415
|
-
let { price: t, currency: n } =
|
|
415
|
+
let { price: t, currency: n } = m(e.price, e.currency, e.currencyPrices, s);
|
|
416
416
|
return r(t, n);
|
|
417
417
|
})()
|
|
418
|
-
}), /* @__PURE__ */
|
|
418
|
+
}), /* @__PURE__ */ E("div", {
|
|
419
419
|
className: "text-sm text-text-secondary",
|
|
420
420
|
children: ["per ", i(e.duration)]
|
|
421
421
|
})]
|
|
422
422
|
}),
|
|
423
|
-
/* @__PURE__ */
|
|
423
|
+
/* @__PURE__ */ E("div", {
|
|
424
424
|
className: "flex items-center gap-2",
|
|
425
|
-
children: [/* @__PURE__ */
|
|
425
|
+
children: [/* @__PURE__ */ T("button", {
|
|
426
426
|
type: "button",
|
|
427
427
|
onClick: n,
|
|
428
428
|
disabled: a?.kind === "current",
|
|
429
429
|
className: "disabled:cursor-not-allowed disabled:opacity-60 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 duration-200",
|
|
430
|
-
children:
|
|
431
|
-
}), /* @__PURE__ */
|
|
430
|
+
children: F(a)
|
|
431
|
+
}), /* @__PURE__ */ T("button", {
|
|
432
432
|
type: "button",
|
|
433
433
|
onClick: t,
|
|
434
434
|
className: "px-3 py-1.5 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken hover:border-border-strong transition-all duration-200",
|
|
@@ -438,6 +438,6 @@ var F = ({ plan: e, highlighted: t = !1, onView: n, onSubscribe: o, action: s })
|
|
|
438
438
|
]
|
|
439
439
|
});
|
|
440
440
|
};
|
|
441
|
-
export {
|
|
441
|
+
export { M as PlansBrowsePage };
|
|
442
442
|
|
|
443
443
|
//# sourceMappingURL=PlansBrowsePage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlansBrowsePage.js","names":["combineQuotas","quotaMap","feature","features","quotaId","limitValue","getPlanFeatureQuantity","existing","getFeaturedQuotas","all","byName","q","FEATURED_QUOTA_NAMES","name","PlansBrowsePage","useI18n","tr","translated","t","key","fallback","navigateTo","useBillingNavigate","isFluidgrids","useIsFluidgridsVariant","useDefaultBillingAccount","activeSubscriptions","subscriptions","sub","actionFor","resolvePlanAction","planId","openPlan","action","useBilling","enterpriseOffer","getEnterpriseOffer","productId","usePlans","viewMode","setViewMode","useState","billingInterval","setBillingInterval","PlanDuration","filteredPlans","plans","plan","recommendedIndex","isLoading","j","i","error","isServerError","ServerError","refetch","PagePurpose","plansDocsUrl","interval","IllustratedEmptyState","BrowsePlanCard","idx","EnterpriseCard","BrowsePlanRow","EnterpriseRow","offer","item","enterpriseMailto","planActionLabel","featuredQuotas","extraCount","displayCurrency","useDefaultBillingCurrency","getDisplayPrice","highlighted","Sparkles","formatPlanDurationLabel","formatCurrency","price","currency","formatPlanDuration","Check","FEATURED_QUOTA_LABELS","quota","formatFeaturedQuotaValue","onSubscribe","ArrowRight","onView"],"sources":["../../../../../src/billing/modules/plans/pages/PlansBrowsePage.tsx"],"sourcesContent":["/**\n * Plans Module - Plans Browse Page (User-facing)\n * Browse available plans and subscribe. No create/edit/toggle actions.\n */\n\nimport { useState, type FC } from 'react';\nimport { Check, ArrowRight, Sparkles } from 'lucide-react';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { usePlans } from '../hooks';\nimport { useDefaultBillingAccount } from '../../subscriptions/hooks/useSubscriptions';\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport { resolvePlanAction, type PlanAction } from '../utils/planAction';\nimport { ServerError } from '../../../shared/components';\nimport {\n formatCurrency,\n formatPlanDuration,\n formatPlanDurationLabel,\n getPlanFeatureQuantity,\n isServerError,\n} from '../../../shared/utils';\nimport { PlanDuration } from '../../../shared/types';\nimport type { Plan, PlanFeature } from '../../../shared/types';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PagePurpose, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport {\n useDefaultBillingCurrency,\n getDisplayPrice,\n} from '../../../hooks/useDefaultBillingCurrency';\nimport {\n FEATURED_QUOTA_NAMES,\n FEATURED_QUOTA_LABELS,\n formatFeaturedQuotaValue,\n} from '../constants/featuredQuotas';\nimport {\n enterpriseMailto,\n getEnterpriseOffer,\n type EnterpriseOffer,\n} from '../constants/enterprise';\n\ntype ViewMode = 'grid' | 'list';\n\ninterface CombinedQuota {\n quotaId: string;\n name: string;\n totalValue: number;\n}\n\nfunction combineQuotas(features: PlanFeature[]): CombinedQuota[] {\n const quotaMap = new Map<string, CombinedQuota>();\n for (const feature of features) {\n if (!feature.quota) continue;\n const quotaId = feature.quota.id;\n const limitValue = getPlanFeatureQuantity(feature);\n const existing = quotaMap.get(quotaId);\n if (existing) {\n existing.totalValue += limitValue;\n } else {\n quotaMap.set(quotaId, {\n quotaId,\n name: feature.quota.name ?? 'Unknown Quota',\n totalValue: limitValue,\n });\n }\n }\n return Array.from(quotaMap.values());\n}\n\n/** Returns only the featured quotas, in the canonical display order. */\nfunction getFeaturedQuotas(features: PlanFeature[]): CombinedQuota[] {\n const all = combineQuotas(features);\n const byName = new Map(all.map((q) => [q.name, q]));\n return FEATURED_QUOTA_NAMES.flatMap((name) => {\n const q = byName.get(name);\n return q ? [q] : [];\n });\n}\n\nexport const PlansBrowsePage: FC = () => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n const navigateTo = useBillingNavigate();\n // FluidGrids: mark the current plan and send subscribers to Change plan (BOFF-11860).\n const isFluidgrids = useIsFluidgridsVariant();\n const { subscriptions } = useDefaultBillingAccount();\n const activeSubscriptions = subscriptions.filter(\n (sub) => String(sub.status).toLowerCase() === 'active'\n );\n const actionFor = (planId: string): PlanAction | null =>\n isFluidgrids ? resolvePlanAction(planId, activeSubscriptions) : null;\n const openPlan = (planId: string) => {\n const action = actionFor(planId);\n if (action?.kind === 'change') {\n navigateTo(`/subscriptions/${action.subscriptionId}/upgrade`);\n return;\n }\n navigateTo(`/checkout/${planId}`);\n };\n const { productId, plansDocsUrl } = useBilling();\n const enterpriseOffer = getEnterpriseOffer(productId);\n const { plans, isLoading, error, refetch } = usePlans({\n includeFree: false,\n productId: productId ?? undefined,\n });\n\n const [viewMode, setViewMode] = useState<ViewMode>('grid');\n const [billingInterval, setBillingInterval] = useState<PlanDuration>(PlanDuration.MONTHLY);\n\n // Only show active, publicly purchasable plans to users\n const filteredPlans = plans.filter(\n (plan) => plan.isActive && plan.isPurchasable !== false && plan.duration === billingInterval\n );\n\n // Spotlight a recommended tier (the second plan when there are 2+, the common\n // \"mid / Pro\" sweet-spot) so the eye lands on a clear primary choice.\n const recommendedIndex = filteredPlans.length >= 2 ? 1 : -1;\n\n if (isLoading && plans.length === 0) {\n return (\n <div className=\"space-y-6 px-6 lg:px-8 py-6\">\n <div className=\"h-8 w-48 bg-bg-sunken animate-pulse rounded-card\" />\n <div className=\"grid grid-cols-1 md:grid-cols-3 gap-6\">\n {[1, 2, 3].map((i) => (\n <div\n key={i}\n className=\"border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 p-5 space-y-4\"\n >\n <div className=\"h-6 w-24 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"h-8 w-32 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"space-y-2\">\n {[1, 2, 3].map((j) => (\n <div key={j} className=\"h-4 w-full bg-bg-sunken animate-pulse rounded\" />\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n }\n\n if (error && isServerError(error)) {\n return (\n <div className=\"p-6\">\n <ServerError\n title={tr('billing.plans.serverUnavailable', 'Server Unavailable')}\n message={tr('billing.plans.unableToLoadPlans', 'Unable to load plans.')}\n onRetry={() => refetch()}\n showRetry\n />\n </div>\n );\n }\n\n return (\n <div className=\"space-y-6 px-6 lg:px-8 py-6\">\n {/* Header */}\n <div>\n <h1 className=\"text-2xl md:text-3xl font-semibold tracking-tight text-text-primary\">\n {tr('billing.plans.browsePlansTitle', 'Plans')}\n </h1>\n <p className=\"text-sm text-text-secondary mt-1\">\n {tr('billing.plans.browsePlansSubtitle', 'Choose a plan that fits your needs')}\n </p>\n <PagePurpose\n className=\"mt-3\"\n learnMoreHref={plansDocsUrl}\n learnMoreLabel={tr('billing.plans.learnMore', 'Learn more')}\n >\n {tr(\n 'billing.plans.browsePurpose',\n 'Compare what each plan includes — quotas, features and price — and subscribe to the one that fits your team. Switch between monthly and yearly billing to see the difference, or contact us for a custom Enterprise contract.'\n )}\n </PagePurpose>\n </div>\n\n {/* Filters */}\n <div className=\"flex flex-wrap items-center gap-4 pb-4 border-b border-border-subtle\">\n <div className=\"inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken\">\n {([PlanDuration.MONTHLY, PlanDuration.YEARLY] as const).map((interval) => (\n <button\n type=\"button\"\n key={interval}\n onClick={() => setBillingInterval(interval)}\n className={`px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${\n billingInterval === interval\n ? 'bg-bg-surface text-text-primary shadow-sm'\n : 'text-text-secondary hover:text-text-primary'\n }`}\n >\n {interval === PlanDuration.MONTHLY ? 'Monthly' : 'Yearly'}\n </button>\n ))}\n </div>\n\n <div className=\"ml-auto inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken\">\n <button\n type=\"button\"\n onClick={() => setViewMode('grid')}\n className={`p-1.5 rounded-button transition-colors ${\n viewMode === 'grid'\n ? 'bg-bg-surface text-text-primary shadow-sm'\n : 'text-text-secondary hover:text-text-primary'\n }`}\n title=\"Grid view\"\n >\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n 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\"\n />\n </svg>\n </button>\n <button\n type=\"button\"\n onClick={() => setViewMode('list')}\n className={`p-1.5 rounded-button transition-colors ${\n viewMode === 'list'\n ? 'bg-bg-surface text-text-primary shadow-sm'\n : 'text-text-secondary hover:text-text-primary'\n }`}\n title=\"List view\"\n >\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M4 6h16M4 12h16M4 18h16\"\n />\n </svg>\n </button>\n </div>\n </div>\n\n {/* Plans */}\n {filteredPlans.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr('billing.plans.noPlansAvailable', 'No plans available')}\n description={tr('billing.plans.checkBackLater', 'Check back later for new plans.')}\n />\n ) : viewMode === 'grid' ? (\n <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 items-stretch\">\n {filteredPlans.map((plan, idx) => (\n <BrowsePlanCard\n key={plan.id}\n plan={plan}\n highlighted={idx === recommendedIndex}\n onView={() => navigateTo(`/plans/${plan.id}`)}\n onSubscribe={() => openPlan(plan.id)}\n action={actionFor(plan.id)}\n />\n ))}\n <EnterpriseCard offer={enterpriseOffer} />\n </div>\n ) : (\n <div className=\"space-y-3\">\n {filteredPlans.map((plan) => (\n <BrowsePlanRow\n key={plan.id}\n plan={plan}\n onView={() => navigateTo(`/plans/${plan.id}`)}\n onSubscribe={() => openPlan(plan.id)}\n action={actionFor(plan.id)}\n />\n ))}\n <EnterpriseRow offer={enterpriseOffer} />\n </div>\n )}\n </div>\n );\n};\n\n// ============================================================================\n// Static Enterprise \"Contact Us\" card — no backend plan record\n// ============================================================================\n\nconst EnterpriseCard: FC<{ offer: EnterpriseOffer }> = ({ offer }) => (\n <div className=\"border border-border-strong bg-[var(--color-accent-soft)] rounded-card shadow-elevation-1 p-5 flex flex-col h-full\">\n <div className=\"mb-4\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"text-lg font-semibold text-text-primary\">Enterprise</h3>\n <span className=\"text-xs font-medium px-2 py-0.5 rounded-full bg-bg-surface text-text-link\">\n Contact Us\n </span>\n </div>\n <span className=\"text-sm text-text-secondary\">Custom contract</span>\n </div>\n\n <div className=\"flex items-baseline gap-1 mb-4\">\n <span className=\"text-2xl font-semibold text-text-primary\">Custom pricing</span>\n </div>\n\n <ul className=\"space-y-2 mb-4 flex-1\">\n {offer.highlights.map((item) => (\n <li key={item} className=\"flex items-center gap-2 text-sm\">\n <svg\n className=\"size-4 text-status-success-text shrink-0\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M5 13l4 4L19 7\" />\n </svg>\n <span className=\"text-text-primary\">{item}</span>\n </li>\n ))}\n </ul>\n\n <div className=\"space-y-2 pt-4 border-t border-border-subtle mt-auto\">\n <a\n href={enterpriseMailto(offer)}\n className=\"block w-full px-4 py-2 text-sm font-medium text-center bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors duration-200\"\n >\n Contact Us\n </a>\n </div>\n </div>\n);\n\nconst EnterpriseRow: FC<{ offer: EnterpriseOffer }> = ({ offer }) => (\n <div className=\"flex items-center gap-4 p-5 border border-border-strong rounded-card bg-[var(--color-accent-soft)] shadow-elevation-1 transition-all duration-200 hover:shadow-elevation-2\">\n <div className=\"size-10 rounded-lg bg-bg-surface flex items-center justify-center shrink-0 shadow-elevation-1\">\n <svg className=\"size-5 text-text-link\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-2 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4\"\n />\n </svg>\n </div>\n\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold text-text-primary\">Enterprise</h3>\n <span className=\"text-xs font-medium px-2 py-0.5 rounded-full bg-bg-surface text-text-link shrink-0\">\n Contact Us\n </span>\n </div>\n <p className=\"text-sm text-text-secondary\">{offer.summary}</p>\n </div>\n\n <div className=\"text-right\">\n <div className=\"font-semibold text-text-primary\">Custom pricing</div>\n <div className=\"text-sm text-text-secondary\">contract-based</div>\n </div>\n\n <a\n href={enterpriseMailto(offer)}\n 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 duration-200 shrink-0\"\n >\n Contact Us\n </a>\n </div>\n);\n\n// ============================================================================\n// Browse Plan Card (no edit/toggle)\n// ============================================================================\n\nfunction planActionLabel(action: PlanAction | null): string {\n if (action?.kind === 'current') return 'Current plan';\n if (action?.kind === 'change') return 'Change to this plan';\n return 'Subscribe';\n}\n\nconst BrowsePlanCard: FC<{\n plan: Plan;\n highlighted?: boolean;\n onView: () => void;\n onSubscribe: () => void;\n action: PlanAction | null;\n}> = ({ plan, highlighted = false, onView, onSubscribe, action }) => {\n const featuredQuotas = getFeaturedQuotas(plan.features || []);\n const allQuotas = combineQuotas(plan.features || []);\n const extraCount = allQuotas.length - featuredQuotas.length;\n const displayCurrency = useDefaultBillingCurrency();\n const { price, currency } = getDisplayPrice(\n plan.price,\n plan.currency,\n plan.currencyPrices as Record<string, number> | null,\n displayCurrency\n );\n\n return (\n <div\n className={`relative flex flex-col h-full rounded-card bg-bg-surface p-6 transition-[border-color,box-shadow] duration-200 ${\n highlighted\n ? 'border-2 border-action-primary-bg shadow-[var(--shadow-glow)]'\n : 'border border-border-subtle shadow-elevation-1 hover:border-border-strong hover:shadow-elevation-2'\n }`}\n >\n {action?.kind === 'current' && (\n <span className=\"absolute -top-3 right-4 inline-flex items-center rounded-full bg-bg-sunken px-3 py-1 text-xs font-semibold text-text-primary border border-border-subtle\">\n Current plan\n </span>\n )}\n {highlighted && (\n <span className=\"absolute -top-3 left-1/2 -translate-x-1/2 inline-flex items-center gap-1 rounded-full bg-action-primary-bg px-3 py-1 text-xs font-semibold text-action-primary-text shadow-elevation-2\">\n <Sparkles className=\"size-3.5\" aria-hidden=\"true\" />\n Most popular\n </span>\n )}\n\n <div className=\"mb-4\">\n <h3 className=\"text-lg font-semibold text-text-primary\">{plan.name}</h3>\n <span className=\"text-sm text-text-secondary\">\n {formatPlanDurationLabel(plan.duration)}\n </span>\n </div>\n\n <div className=\"flex items-baseline gap-1.5 mb-5\">\n <span className=\"text-4xl font-bold tabular-nums tracking-tight text-text-primary\">\n {formatCurrency(price, currency)}\n </span>\n <span className=\"text-text-secondary text-sm\">/ {formatPlanDuration(plan.duration)}</span>\n </div>\n\n {featuredQuotas.length > 0 && (\n <ul className=\"space-y-2.5 mb-5 flex-1\">\n {featuredQuotas.map((quota) => (\n <li key={quota.quotaId} className=\"flex items-center justify-between gap-2 text-sm\">\n <span className=\"flex items-center gap-2 min-w-0\">\n <span className=\"flex size-5 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)]\">\n <Check className=\"size-3 text-action-primary-bg\" aria-hidden=\"true\" />\n </span>\n <span className=\"truncate text-text-primary\">\n {FEATURED_QUOTA_LABELS[quota.name] ?? quota.name}\n </span>\n </span>\n <span className=\"font-semibold text-text-primary tabular-nums shrink-0\">\n {formatFeaturedQuotaValue(quota.name, quota.totalValue)}\n </span>\n </li>\n ))}\n {extraCount > 0 && (\n <li className=\"text-sm text-text-secondary pl-7\">+{extraCount} more — see details</li>\n )}\n </ul>\n )}\n\n <div className=\"space-y-2 pt-4 border-t border-border-subtle mt-auto\">\n <button\n type=\"button\"\n onClick={onSubscribe}\n disabled={action?.kind === 'current'}\n aria-disabled={action?.kind === 'current'}\n className=\"group disabled:cursor-not-allowed disabled:opacity-60 inline-flex w-full items-center justify-center gap-2 rounded-button bg-action-primary-bg px-4 py-2.5 text-sm font-semibold text-action-primary-text shadow-elevation-1 transition-colors duration-200 hover:bg-action-primary-bgHover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n {planActionLabel(action)}\n <ArrowRight className=\"size-4 transition-transform duration-200\" aria-hidden=\"true\" />\n </button>\n <button\n type=\"button\"\n onClick={onView}\n className=\"w-full px-4 py-2 text-sm font-medium border border-border-subtle text-text-secondary rounded-button hover:bg-bg-sunken hover:text-text-primary hover:border-border-strong transition-colors duration-200\"\n >\n View details\n </button>\n </div>\n </div>\n );\n};\n\n// ============================================================================\n// Browse Plan Row (no edit/toggle)\n// ============================================================================\n\nconst BrowsePlanRow: FC<{\n plan: Plan;\n onView: () => void;\n onSubscribe: () => void;\n action: PlanAction | null;\n}> = ({ plan, onView, onSubscribe, action }) => {\n const featuredQuotas = getFeaturedQuotas(plan.features || []);\n const displayCurrency = useDefaultBillingCurrency();\n\n return (\n <div className=\"flex items-center gap-4 p-5 border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 transition-all duration-200 hover:border-border-strong hover:shadow-elevation-2\">\n <div className=\"size-10 rounded-lg bg-[var(--color-accent-soft)] flex items-center justify-center shrink-0\">\n <svg\n className=\"size-5 text-text-link\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10\"\n />\n </svg>\n </div>\n\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"font-semibold text-text-primary truncate\">{plan.name}</h3>\n <p className=\"text-sm text-text-secondary\">\n {featuredQuotas.length} key feature{featuredQuotas.length !== 1 ? 's' : ''} included\n </p>\n </div>\n\n <div className=\"text-right\">\n <div className=\"font-semibold text-text-primary\">\n {(() => {\n const { price, currency } = getDisplayPrice(\n plan.price,\n plan.currency,\n plan.currencyPrices as Record<string, number> | null,\n displayCurrency\n );\n return formatCurrency(price, currency);\n })()}\n </div>\n <div className=\"text-sm text-text-secondary\">per {formatPlanDuration(plan.duration)}</div>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={onSubscribe}\n disabled={action?.kind === 'current'}\n className=\"disabled:cursor-not-allowed disabled:opacity-60 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 duration-200\"\n >\n {planActionLabel(action)}\n </button>\n <button\n type=\"button\"\n onClick={onView}\n className=\"px-3 py-1.5 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken hover:border-border-strong transition-all duration-200\"\n >\n View\n </button>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAASA,EAAc,GAA0C;CAC/D,IAAMC,oBAAW,IAAI,IAA2B;CAChD,KAAK,IAAMC,KAAWC,GAAU;EAC9B,IAAI,CAACD,EAAQ,OAAO;EACpB,IAAME,IAAUF,EAAQ,MAAM,IACxBG,IAAaC,EAAuBJ,CAAO,GAC3CK,IAAWN,EAAS,IAAIG,CAAO;EACrC,AAAIG,IACF,EAAS,cAAcF,IAEvBJ,EAAS,IAAIG,GAAS;GACpB;GACA,MAAMF,EAAQ,MAAM,QAAQ;GAC5B,YAAYG;EACd,CAAC;CAEL;CACA,OAAO,MAAM,KAAKJ,EAAS,OAAO,CAAC;AACrC;AAGA,SAASO,EAAkB,GAA0C;CACnE,IAAMC,IAAMT,EAAcG,CAAQ,GAC5BO,IAAS,IAAI,IAAID,EAAI,KAAK,MAAM,CAACE,EAAE,MAAMA,CAAC,CAAC,CAAC;CAClD,OAAOC,EAAqB,SAAS,MAAS;EAC5C,IAAMD,IAAID,EAAO,IAAIG,CAAI;EACzB,OAAOF,IAAI,CAACA,CAAC,IAAI,CAAC;CACpB,CAAC;AACH;AAEA,IAAaG,UAA4B;CACvC,IAAM,EAAE,SAAMC,EAAQ,GAChBC,KAAM,GAAa,MAA6B;EACpD,IAAMC,IAAaC,EAAEC,CAAG;EACxB,OAAOF,MAAeE,IAAMC,IAAWH;CACzC,GACMI,IAAaC,EAAmB,GAEhCC,IAAeC,EAAuB,GACtC,EAAE,qBAAkBC,EAAyB,GAC7CC,IAAsBC,EAAc,QACvC,MAAQ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AAkBC,EAA0B;CAElD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAAC,OAAD;KACE,WAAU;KACV,MAAK;KACL,SAAQ;KACR,QAAO;KAEP,UAAA,kBAAC,QAAD;MACE,eAAc;MACd,gBAAe;MACf,aAAa;MACb,GAAE;KACH,CAAA;IACE,CAAA;GACF,CAAA;GAEL,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,MAAD;KAAI,WAAU;KAA4C,UAAAzB,EAAK;IAAS,CAAA,GACxE,kBAAC,KAAD;KAAG,WAAU;KAAb,UAAA;MACGsB,EAAe;MAAO;MAAaA,EAAe,WAAW,IAAU,KAAN;MAAS;KAC1E;IACA,CAAA,CAAA;;GAEL,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,OAAD;KAAK,WAAU;KACL,iBAAA;MACN,IAAM,EAAE,UAAO,gBAAaI,EAC1B1B,EAAK,OACLA,EAAK,UACLA,EAAK,gBACLwB,CACF;MACA,OAAOM,EAAeC,GAAOC,CAAQ;KACvC,EAAA,CAAG;IACA,CAAA,GACL,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CAA6C,QAAKC,EAAmBjC,EAAK,QAAQ,CAAO;IACtF,CAAA,CAAA;;GAEL,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,UAAD;KACE,MAAK;KACL,SAASsC;KACT,UAAUpD,GAAQ,SAAS;KAC3B,WAAU;KAET,UAAAmC,EAAgBnC,CAAM;IACjB,CAAA,GACR,kBAAC,UAAD;KACE,MAAK;KACL,SAASsD;KACT,WAAU;KACX,UAAA;IAEO,CAAA,CACL;;EACF;;AAET"}
|
|
1
|
+
{"version":3,"file":"PlansBrowsePage.js","names":["combineQuotas","quotaMap","feature","features","quotaId","limitValue","getPlanFeatureQuantity","existing","getFeaturedQuotas","all","byName","q","FEATURED_QUOTA_NAMES","name","PlansBrowsePage","useI18n","tr","translated","t","key","fallback","navigateTo","useBillingNavigate","useBilling","enterpriseOffer","getEnterpriseOffer","productId","usePlans","isFluidgrids","useIsFluidgridsVariant","useDefaultBillingAccount","activeSubscriptions","activeProductSubscriptions","subscriptions","plans","plan","actionFor","resolvePlanAction","planId","openPlan","action","viewMode","setViewMode","useState","billingInterval","setBillingInterval","PlanDuration","filteredPlans","recommendedIndex","isLoading","j","i","error","isServerError","ServerError","refetch","PagePurpose","plansDocsUrl","interval","IllustratedEmptyState","BrowsePlanCard","idx","EnterpriseCard","BrowsePlanRow","EnterpriseRow","offer","item","enterpriseMailto","planActionLabel","featuredQuotas","extraCount","displayCurrency","useDefaultBillingCurrency","getDisplayPrice","highlighted","Sparkles","formatPlanDurationLabel","formatCurrency","price","currency","formatPlanDuration","Check","FEATURED_QUOTA_LABELS","quota","formatFeaturedQuotaValue","onSubscribe","ArrowRight","onView"],"sources":["../../../../../src/billing/modules/plans/pages/PlansBrowsePage.tsx"],"sourcesContent":["/**\n * Plans Module - Plans Browse Page (User-facing)\n * Browse available plans and subscribe. No create/edit/toggle actions.\n */\n\nimport { useState, type FC } from 'react';\nimport { Check, ArrowRight, Sparkles } from 'lucide-react';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { usePlans } from '../hooks';\nimport { useDefaultBillingAccount } from '../../subscriptions/hooks/useSubscriptions';\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport {\n activeProductSubscriptions,\n resolvePlanAction,\n type PlanAction,\n} from '../utils/planAction';\nimport { ServerError } from '../../../shared/components';\nimport {\n formatCurrency,\n formatPlanDuration,\n formatPlanDurationLabel,\n getPlanFeatureQuantity,\n isServerError,\n} from '../../../shared/utils';\nimport { PlanDuration } from '../../../shared/types';\nimport type { Plan, PlanFeature } from '../../../shared/types';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PagePurpose, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport {\n useDefaultBillingCurrency,\n getDisplayPrice,\n} from '../../../hooks/useDefaultBillingCurrency';\nimport {\n FEATURED_QUOTA_NAMES,\n FEATURED_QUOTA_LABELS,\n formatFeaturedQuotaValue,\n} from '../constants/featuredQuotas';\nimport {\n enterpriseMailto,\n getEnterpriseOffer,\n type EnterpriseOffer,\n} from '../constants/enterprise';\n\ntype ViewMode = 'grid' | 'list';\n\ninterface CombinedQuota {\n quotaId: string;\n name: string;\n totalValue: number;\n}\n\nfunction combineQuotas(features: PlanFeature[]): CombinedQuota[] {\n const quotaMap = new Map<string, CombinedQuota>();\n for (const feature of features) {\n if (!feature.quota) continue;\n const quotaId = feature.quota.id;\n const limitValue = getPlanFeatureQuantity(feature);\n const existing = quotaMap.get(quotaId);\n if (existing) {\n existing.totalValue += limitValue;\n } else {\n quotaMap.set(quotaId, {\n quotaId,\n name: feature.quota.name ?? 'Unknown Quota',\n totalValue: limitValue,\n });\n }\n }\n return Array.from(quotaMap.values());\n}\n\n/** Returns only the featured quotas, in the canonical display order. */\nfunction getFeaturedQuotas(features: PlanFeature[]): CombinedQuota[] {\n const all = combineQuotas(features);\n const byName = new Map(all.map((q) => [q.name, q]));\n return FEATURED_QUOTA_NAMES.flatMap((name) => {\n const q = byName.get(name);\n return q ? [q] : [];\n });\n}\n\nexport const PlansBrowsePage: FC = () => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n const navigateTo = useBillingNavigate();\n const { productId, plansDocsUrl } = useBilling();\n const enterpriseOffer = getEnterpriseOffer(productId);\n const { plans, isLoading, error, refetch } = usePlans({\n includeFree: false,\n productId: productId ?? undefined,\n });\n // FluidGrids: mark the current plan and send subscribers to Change plan (BOFF-11860).\n const isFluidgrids = useIsFluidgridsVariant();\n const { subscriptions } = useDefaultBillingAccount();\n // Only this product's subscriptions count: an account's subscription to another product's\n // plan is never the one a plan card here should change.\n const activeSubscriptions = activeProductSubscriptions(\n subscriptions,\n new Set(plans.map((plan) => plan.id))\n );\n const actionFor = (planId: string): PlanAction | null =>\n isFluidgrids ? resolvePlanAction(planId, activeSubscriptions) : null;\n const openPlan = (planId: string) => {\n const action = actionFor(planId);\n if (action?.kind === 'change') {\n navigateTo(`/subscriptions/${action.subscriptionId}/upgrade`);\n return;\n }\n navigateTo(`/checkout/${planId}`);\n };\n\n const [viewMode, setViewMode] = useState<ViewMode>('grid');\n const [billingInterval, setBillingInterval] = useState<PlanDuration>(PlanDuration.MONTHLY);\n\n // Only show active, publicly purchasable plans to users\n const filteredPlans = plans.filter(\n (plan) => plan.isActive && plan.isPurchasable !== false && plan.duration === billingInterval\n );\n\n // Spotlight a recommended tier (the second plan when there are 2+, the common\n // \"mid / Pro\" sweet-spot) so the eye lands on a clear primary choice.\n const recommendedIndex = filteredPlans.length >= 2 ? 1 : -1;\n\n if (isLoading && plans.length === 0) {\n return (\n <div className=\"space-y-6 px-6 lg:px-8 py-6\">\n <div className=\"h-8 w-48 bg-bg-sunken animate-pulse rounded-card\" />\n <div className=\"grid grid-cols-1 md:grid-cols-3 gap-6\">\n {[1, 2, 3].map((i) => (\n <div\n key={i}\n className=\"border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 p-5 space-y-4\"\n >\n <div className=\"h-6 w-24 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"h-8 w-32 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"space-y-2\">\n {[1, 2, 3].map((j) => (\n <div key={j} className=\"h-4 w-full bg-bg-sunken animate-pulse rounded\" />\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n }\n\n if (error && isServerError(error)) {\n return (\n <div className=\"p-6\">\n <ServerError\n title={tr('billing.plans.serverUnavailable', 'Server Unavailable')}\n message={tr('billing.plans.unableToLoadPlans', 'Unable to load plans.')}\n onRetry={() => refetch()}\n showRetry\n />\n </div>\n );\n }\n\n return (\n <div className=\"space-y-6 px-6 lg:px-8 py-6\">\n {/* Header */}\n <div>\n <h1 className=\"text-2xl md:text-3xl font-semibold tracking-tight text-text-primary\">\n {tr('billing.plans.browsePlansTitle', 'Plans')}\n </h1>\n <p className=\"text-sm text-text-secondary mt-1\">\n {tr('billing.plans.browsePlansSubtitle', 'Choose a plan that fits your needs')}\n </p>\n <PagePurpose\n className=\"mt-3\"\n learnMoreHref={plansDocsUrl}\n learnMoreLabel={tr('billing.plans.learnMore', 'Learn more')}\n >\n {tr(\n 'billing.plans.browsePurpose',\n 'Compare what each plan includes — quotas, features and price — and subscribe to the one that fits your team. Switch between monthly and yearly billing to see the difference, or contact us for a custom Enterprise contract.'\n )}\n </PagePurpose>\n </div>\n\n {/* Filters */}\n <div className=\"flex flex-wrap items-center gap-4 pb-4 border-b border-border-subtle\">\n <div className=\"inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken\">\n {([PlanDuration.MONTHLY, PlanDuration.YEARLY] as const).map((interval) => (\n <button\n type=\"button\"\n key={interval}\n onClick={() => setBillingInterval(interval)}\n className={`px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${\n billingInterval === interval\n ? 'bg-bg-surface text-text-primary shadow-sm'\n : 'text-text-secondary hover:text-text-primary'\n }`}\n >\n {interval === PlanDuration.MONTHLY ? 'Monthly' : 'Yearly'}\n </button>\n ))}\n </div>\n\n <div className=\"ml-auto inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken\">\n <button\n type=\"button\"\n onClick={() => setViewMode('grid')}\n className={`p-1.5 rounded-button transition-colors ${\n viewMode === 'grid'\n ? 'bg-bg-surface text-text-primary shadow-sm'\n : 'text-text-secondary hover:text-text-primary'\n }`}\n title=\"Grid view\"\n >\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n 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\"\n />\n </svg>\n </button>\n <button\n type=\"button\"\n onClick={() => setViewMode('list')}\n className={`p-1.5 rounded-button transition-colors ${\n viewMode === 'list'\n ? 'bg-bg-surface text-text-primary shadow-sm'\n : 'text-text-secondary hover:text-text-primary'\n }`}\n title=\"List view\"\n >\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M4 6h16M4 12h16M4 18h16\"\n />\n </svg>\n </button>\n </div>\n </div>\n\n {/* Plans */}\n {filteredPlans.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr('billing.plans.noPlansAvailable', 'No plans available')}\n description={tr('billing.plans.checkBackLater', 'Check back later for new plans.')}\n />\n ) : viewMode === 'grid' ? (\n <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 items-stretch\">\n {filteredPlans.map((plan, idx) => (\n <BrowsePlanCard\n key={plan.id}\n plan={plan}\n highlighted={idx === recommendedIndex}\n onView={() => navigateTo(`/plans/${plan.id}`)}\n onSubscribe={() => openPlan(plan.id)}\n action={actionFor(plan.id)}\n />\n ))}\n <EnterpriseCard offer={enterpriseOffer} />\n </div>\n ) : (\n <div className=\"space-y-3\">\n {filteredPlans.map((plan) => (\n <BrowsePlanRow\n key={plan.id}\n plan={plan}\n onView={() => navigateTo(`/plans/${plan.id}`)}\n onSubscribe={() => openPlan(plan.id)}\n action={actionFor(plan.id)}\n />\n ))}\n <EnterpriseRow offer={enterpriseOffer} />\n </div>\n )}\n </div>\n );\n};\n\n// ============================================================================\n// Static Enterprise \"Contact Us\" card — no backend plan record\n// ============================================================================\n\nconst EnterpriseCard: FC<{ offer: EnterpriseOffer }> = ({ offer }) => (\n <div className=\"border border-border-strong bg-[var(--color-accent-soft)] rounded-card shadow-elevation-1 p-5 flex flex-col h-full\">\n <div className=\"mb-4\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"text-lg font-semibold text-text-primary\">Enterprise</h3>\n <span className=\"text-xs font-medium px-2 py-0.5 rounded-full bg-bg-surface text-text-link\">\n Contact Us\n </span>\n </div>\n <span className=\"text-sm text-text-secondary\">Custom contract</span>\n </div>\n\n <div className=\"flex items-baseline gap-1 mb-4\">\n <span className=\"text-2xl font-semibold text-text-primary\">Custom pricing</span>\n </div>\n\n <ul className=\"space-y-2 mb-4 flex-1\">\n {offer.highlights.map((item) => (\n <li key={item} className=\"flex items-center gap-2 text-sm\">\n <svg\n className=\"size-4 text-status-success-text shrink-0\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M5 13l4 4L19 7\" />\n </svg>\n <span className=\"text-text-primary\">{item}</span>\n </li>\n ))}\n </ul>\n\n <div className=\"space-y-2 pt-4 border-t border-border-subtle mt-auto\">\n <a\n href={enterpriseMailto(offer)}\n className=\"block w-full px-4 py-2 text-sm font-medium text-center bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors duration-200\"\n >\n Contact Us\n </a>\n </div>\n </div>\n);\n\nconst EnterpriseRow: FC<{ offer: EnterpriseOffer }> = ({ offer }) => (\n <div className=\"flex items-center gap-4 p-5 border border-border-strong rounded-card bg-[var(--color-accent-soft)] shadow-elevation-1 transition-all duration-200 hover:shadow-elevation-2\">\n <div className=\"size-10 rounded-lg bg-bg-surface flex items-center justify-center shrink-0 shadow-elevation-1\">\n <svg className=\"size-5 text-text-link\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-2 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4\"\n />\n </svg>\n </div>\n\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold text-text-primary\">Enterprise</h3>\n <span className=\"text-xs font-medium px-2 py-0.5 rounded-full bg-bg-surface text-text-link shrink-0\">\n Contact Us\n </span>\n </div>\n <p className=\"text-sm text-text-secondary\">{offer.summary}</p>\n </div>\n\n <div className=\"text-right\">\n <div className=\"font-semibold text-text-primary\">Custom pricing</div>\n <div className=\"text-sm text-text-secondary\">contract-based</div>\n </div>\n\n <a\n href={enterpriseMailto(offer)}\n 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 duration-200 shrink-0\"\n >\n Contact Us\n </a>\n </div>\n);\n\n// ============================================================================\n// Browse Plan Card (no edit/toggle)\n// ============================================================================\n\nfunction planActionLabel(action: PlanAction | null): string {\n if (action?.kind === 'current') return 'Current plan';\n if (action?.kind === 'change') return 'Change to this plan';\n return 'Subscribe';\n}\n\nconst BrowsePlanCard: FC<{\n plan: Plan;\n highlighted?: boolean;\n onView: () => void;\n onSubscribe: () => void;\n action: PlanAction | null;\n}> = ({ plan, highlighted = false, onView, onSubscribe, action }) => {\n const featuredQuotas = getFeaturedQuotas(plan.features || []);\n const allQuotas = combineQuotas(plan.features || []);\n const extraCount = allQuotas.length - featuredQuotas.length;\n const displayCurrency = useDefaultBillingCurrency();\n const { price, currency } = getDisplayPrice(\n plan.price,\n plan.currency,\n plan.currencyPrices as Record<string, number> | null,\n displayCurrency\n );\n\n return (\n <div\n className={`relative flex flex-col h-full rounded-card bg-bg-surface p-6 transition-[border-color,box-shadow] duration-200 ${\n highlighted\n ? 'border-2 border-action-primary-bg shadow-[var(--shadow-glow)]'\n : 'border border-border-subtle shadow-elevation-1 hover:border-border-strong hover:shadow-elevation-2'\n }`}\n >\n {action?.kind === 'current' && (\n <span className=\"absolute -top-3 right-4 inline-flex items-center rounded-full bg-bg-sunken px-3 py-1 text-xs font-semibold text-text-primary border border-border-subtle\">\n Current plan\n </span>\n )}\n {highlighted && (\n <span className=\"absolute -top-3 left-1/2 -translate-x-1/2 inline-flex items-center gap-1 rounded-full bg-action-primary-bg px-3 py-1 text-xs font-semibold text-action-primary-text shadow-elevation-2\">\n <Sparkles className=\"size-3.5\" aria-hidden=\"true\" />\n Most popular\n </span>\n )}\n\n <div className=\"mb-4\">\n <h3 className=\"text-lg font-semibold text-text-primary\">{plan.name}</h3>\n <span className=\"text-sm text-text-secondary\">\n {formatPlanDurationLabel(plan.duration)}\n </span>\n </div>\n\n <div className=\"flex items-baseline gap-1.5 mb-5\">\n <span className=\"text-4xl font-bold tabular-nums tracking-tight text-text-primary\">\n {formatCurrency(price, currency)}\n </span>\n <span className=\"text-text-secondary text-sm\">/ {formatPlanDuration(plan.duration)}</span>\n </div>\n\n {featuredQuotas.length > 0 && (\n <ul className=\"space-y-2.5 mb-5 flex-1\">\n {featuredQuotas.map((quota) => (\n <li key={quota.quotaId} className=\"flex items-center justify-between gap-2 text-sm\">\n <span className=\"flex items-center gap-2 min-w-0\">\n <span className=\"flex size-5 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)]\">\n <Check className=\"size-3 text-action-primary-bg\" aria-hidden=\"true\" />\n </span>\n <span className=\"truncate text-text-primary\">\n {FEATURED_QUOTA_LABELS[quota.name] ?? quota.name}\n </span>\n </span>\n <span className=\"font-semibold text-text-primary tabular-nums shrink-0\">\n {formatFeaturedQuotaValue(quota.name, quota.totalValue)}\n </span>\n </li>\n ))}\n {extraCount > 0 && (\n <li className=\"text-sm text-text-secondary pl-7\">+{extraCount} more — see details</li>\n )}\n </ul>\n )}\n\n <div className=\"space-y-2 pt-4 border-t border-border-subtle mt-auto\">\n <button\n type=\"button\"\n onClick={onSubscribe}\n disabled={action?.kind === 'current'}\n aria-disabled={action?.kind === 'current'}\n className=\"group disabled:cursor-not-allowed disabled:opacity-60 inline-flex w-full items-center justify-center gap-2 rounded-button bg-action-primary-bg px-4 py-2.5 text-sm font-semibold text-action-primary-text shadow-elevation-1 transition-colors duration-200 hover:bg-action-primary-bgHover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n {planActionLabel(action)}\n <ArrowRight className=\"size-4 transition-transform duration-200\" aria-hidden=\"true\" />\n </button>\n <button\n type=\"button\"\n onClick={onView}\n className=\"w-full px-4 py-2 text-sm font-medium border border-border-subtle text-text-secondary rounded-button hover:bg-bg-sunken hover:text-text-primary hover:border-border-strong transition-colors duration-200\"\n >\n View details\n </button>\n </div>\n </div>\n );\n};\n\n// ============================================================================\n// Browse Plan Row (no edit/toggle)\n// ============================================================================\n\nconst BrowsePlanRow: FC<{\n plan: Plan;\n onView: () => void;\n onSubscribe: () => void;\n action: PlanAction | null;\n}> = ({ plan, onView, onSubscribe, action }) => {\n const featuredQuotas = getFeaturedQuotas(plan.features || []);\n const displayCurrency = useDefaultBillingCurrency();\n\n return (\n <div className=\"flex items-center gap-4 p-5 border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 transition-all duration-200 hover:border-border-strong hover:shadow-elevation-2\">\n <div className=\"size-10 rounded-lg bg-[var(--color-accent-soft)] flex items-center justify-center shrink-0\">\n <svg\n className=\"size-5 text-text-link\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10\"\n />\n </svg>\n </div>\n\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"font-semibold text-text-primary truncate\">{plan.name}</h3>\n <p className=\"text-sm text-text-secondary\">\n {featuredQuotas.length} key feature{featuredQuotas.length !== 1 ? 's' : ''} included\n </p>\n </div>\n\n <div className=\"text-right\">\n <div className=\"font-semibold text-text-primary\">\n {(() => {\n const { price, currency } = getDisplayPrice(\n plan.price,\n plan.currency,\n plan.currencyPrices as Record<string, number> | null,\n displayCurrency\n );\n return formatCurrency(price, currency);\n })()}\n </div>\n <div className=\"text-sm text-text-secondary\">per {formatPlanDuration(plan.duration)}</div>\n </div>\n\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={onSubscribe}\n disabled={action?.kind === 'current'}\n className=\"disabled:cursor-not-allowed disabled:opacity-60 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 duration-200\"\n >\n {planActionLabel(action)}\n </button>\n <button\n type=\"button\"\n onClick={onView}\n className=\"px-3 py-1.5 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken hover:border-border-strong transition-all duration-200\"\n >\n View\n </button>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoDA,SAASA,EAAc,GAA0C;CAC/D,IAAMC,oBAAW,IAAI,IAA2B;CAChD,KAAK,IAAMC,KAAWC,GAAU;EAC9B,IAAI,CAACD,EAAQ,OAAO;EACpB,IAAME,IAAUF,EAAQ,MAAM,IACxBG,IAAaC,EAAuBJ,CAAO,GAC3CK,IAAWN,EAAS,IAAIG,CAAO;EACrC,AAAIG,IACF,EAAS,cAAcF,IAEvBJ,EAAS,IAAIG,GAAS;GACpB;GACA,MAAMF,EAAQ,MAAM,QAAQ;GAC5B,YAAYG;EACd,CAAC;CAEL;CACA,OAAO,MAAM,KAAKJ,EAAS,OAAO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M,EAAeC,GAAOC,CAAQ;KACvC,EAAA,CAAG;IACA,CAAA,GACL,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CAA6C,QAAKC,EAAmB7C,EAAK,QAAQ,CAAO;IACtF,CAAA,CAAA;;GAEL,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,UAAD;KACE,MAAK;KACL,SAASkD;KACT,UAAU7C,GAAQ,SAAS;KAC3B,WAAU;KAET,UAAA4B,EAAgB5B,CAAM;IACjB,CAAA,GACR,kBAAC,UAAD;KACE,MAAK;KACL,SAAS+C;KACT,WAAU;KACX,UAAA;IAEO,CAAA,CACL;;EACF;;AAET"}
|
|
@@ -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"}
|