@burdenoff/microfe-billing 2026.1112.2 → 2026.1112.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.
@@ -5,20 +5,23 @@ import "../hooks/index.js";
5
5
  import { formatCurrency as r, formatPlanDuration as i, formatPlanDurationLabel as a } from "../../../shared/utils/format.js";
6
6
  import { isServerError as o } from "../../../shared/utils/error.js";
7
7
  import { getPlanFeatureQuantity as s } from "../../../shared/utils/planFeatureQuantity.js";
8
+ import { useDefaultBillingAccount as c } from "../../subscriptions/hooks/useSubscriptions.js";
9
+ import { useIsFluidgridsVariant as l } from "../../../hooks/useBillingVariant.js";
10
+ import { resolvePlanAction as u } from "../utils/planAction.js";
8
11
  import "../../../shared/components/index.js";
12
+ import { usePlans as d } from "../hooks/usePlans.js";
9
13
  import "../../../shared/utils/index.js";
10
- import { PlanDuration as c } from "../../../shared/types/graphql.js";
11
- import { usePlans as l } from "../hooks/usePlans.js";
12
- import { getDisplayPrice as u, useDefaultBillingCurrency as d } from "../../../hooks/useDefaultBillingCurrency.js";
13
- import { FEATURED_QUOTA_LABELS as f, FEATURED_QUOTA_NAMES as p, formatFeaturedQuotaValue as m } from "../constants/featuredQuotas.js";
14
- import { enterpriseMailto as h, getEnterpriseOffer as g } from "../constants/enterprise.js";
15
- import { useState as _ } from "react";
16
- import { ArrowRight as v, Check as y, Sparkles as b } from "lucide-react";
17
- import { jsx as x, jsxs as S } from "react/jsx-runtime";
18
- import { useI18n as C } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
19
- import { IllustratedEmptyState as w, PagePurpose as T } from "@burdenoff/fe-libs/ui";
14
+ import { PlanDuration as f } from "../../../shared/types/graphql.js";
15
+ import { getDisplayPrice as p, useDefaultBillingCurrency as m } from "../../../hooks/useDefaultBillingCurrency.js";
16
+ import { FEATURED_QUOTA_LABELS as h, FEATURED_QUOTA_NAMES as g, formatFeaturedQuotaValue as _ } from "../constants/featuredQuotas.js";
17
+ import { enterpriseMailto as v, getEnterpriseOffer as y } from "../constants/enterprise.js";
18
+ import { useState as b } from "react";
19
+ import { ArrowRight as x, Check as S, Sparkles as C } from "lucide-react";
20
+ import { jsx as w, jsxs as T } from "react/jsx-runtime";
21
+ import { useI18n as E } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
22
+ import { IllustratedEmptyState as D, PagePurpose as O } from "@burdenoff/fe-libs/ui";
20
23
  // src/billing/modules/plans/pages/PlansBrowsePage.tsx
21
- function E(e) {
24
+ function k(e) {
22
25
  let t = /* @__PURE__ */ new Map();
23
26
  for (let n of e) {
24
27
  if (!n.quota) continue;
@@ -31,112 +34,115 @@ function E(e) {
31
34
  }
32
35
  return Array.from(t.values());
33
36
  }
34
- function D(e) {
35
- let t = E(e), n = new Map(t.map((e) => [e.name, e]));
36
- return p.flatMap((e) => {
37
+ function A(e) {
38
+ let t = k(e), n = new Map(t.map((e) => [e.name, e]));
39
+ return g.flatMap((e) => {
37
40
  let t = n.get(e);
38
41
  return t ? [t] : [];
39
42
  });
40
43
  }
41
- var O = () => {
42
- let { t: r } = C(), i = (e, t) => {
44
+ var j = () => {
45
+ let { t: r } = E(), i = (e, t) => {
43
46
  let n = r(e);
44
47
  return n === e ? t : n;
45
- }, a = e(), { productId: s, plansDocsUrl: u } = n(), d = g(s), { plans: f, isLoading: p, error: m, refetch: h } = l({
48
+ }, a = e(), s = l(), { subscriptions: p } = c(), m = p.filter((e) => String(e.status).toLowerCase() === "active"), h = (e) => s ? u(e, m) : null, g = (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({
46
52
  includeFree: !1,
47
- productId: s ?? void 0
48
- }), [v, y] = _("grid"), [b, E] = _(c.MONTHLY), D = f.filter((e) => e.isActive && e.isPurchasable !== !1 && e.duration === b), O = D.length >= 2 ? 1 : -1;
49
- return p && f.length === 0 ? /* @__PURE__ */ S("div", {
53
+ productId: _ ?? void 0
54
+ }), [j, P] = b("grid"), [L, R] = b(f.MONTHLY), z = S.filter((e) => e.isActive && e.isPurchasable !== !1 && e.duration === L), B = z.length >= 2 ? 1 : -1;
55
+ return C && S.length === 0 ? /* @__PURE__ */ T("div", {
50
56
  className: "space-y-6 px-6 lg:px-8 py-6",
51
- children: [/* @__PURE__ */ x("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded-card" }), /* @__PURE__ */ x("div", {
57
+ children: [/* @__PURE__ */ w("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded-card" }), /* @__PURE__ */ w("div", {
52
58
  className: "grid grid-cols-1 md:grid-cols-3 gap-6",
53
59
  children: [
54
60
  1,
55
61
  2,
56
62
  3
57
- ].map((e) => /* @__PURE__ */ S("div", {
63
+ ].map((e) => /* @__PURE__ */ T("div", {
58
64
  className: "border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 p-5 space-y-4",
59
65
  children: [
60
- /* @__PURE__ */ x("div", { className: "h-6 w-24 bg-bg-sunken animate-pulse rounded" }),
61
- /* @__PURE__ */ x("div", { className: "h-8 w-32 bg-bg-sunken animate-pulse rounded" }),
62
- /* @__PURE__ */ x("div", {
66
+ /* @__PURE__ */ w("div", { className: "h-6 w-24 bg-bg-sunken animate-pulse rounded" }),
67
+ /* @__PURE__ */ w("div", { className: "h-8 w-32 bg-bg-sunken animate-pulse rounded" }),
68
+ /* @__PURE__ */ w("div", {
63
69
  className: "space-y-2",
64
70
  children: [
65
71
  1,
66
72
  2,
67
73
  3
68
- ].map((e) => /* @__PURE__ */ x("div", { className: "h-4 w-full bg-bg-sunken animate-pulse rounded" }, e))
74
+ ].map((e) => /* @__PURE__ */ w("div", { className: "h-4 w-full bg-bg-sunken animate-pulse rounded" }, e))
69
75
  })
70
76
  ]
71
77
  }, e))
72
78
  })]
73
- }) : m && o(m) ? /* @__PURE__ */ x("div", {
79
+ }) : k && o(k) ? /* @__PURE__ */ w("div", {
74
80
  className: "p-6",
75
- children: /* @__PURE__ */ x(t, {
81
+ children: /* @__PURE__ */ w(t, {
76
82
  title: i("billing.plans.serverUnavailable", "Server Unavailable"),
77
83
  message: i("billing.plans.unableToLoadPlans", "Unable to load plans."),
78
- onRetry: () => h(),
84
+ onRetry: () => A(),
79
85
  showRetry: !0
80
86
  })
81
- }) : /* @__PURE__ */ S("div", {
87
+ }) : /* @__PURE__ */ T("div", {
82
88
  className: "space-y-6 px-6 lg:px-8 py-6",
83
89
  children: [
84
- /* @__PURE__ */ S("div", { children: [
85
- /* @__PURE__ */ x("h1", {
90
+ /* @__PURE__ */ T("div", { children: [
91
+ /* @__PURE__ */ w("h1", {
86
92
  className: "text-2xl md:text-3xl font-semibold tracking-tight text-text-primary",
87
93
  children: i("billing.plans.browsePlansTitle", "Plans")
88
94
  }),
89
- /* @__PURE__ */ x("p", {
95
+ /* @__PURE__ */ w("p", {
90
96
  className: "text-sm text-text-secondary mt-1",
91
97
  children: i("billing.plans.browsePlansSubtitle", "Choose a plan that fits your needs")
92
98
  }),
93
- /* @__PURE__ */ x(T, {
99
+ /* @__PURE__ */ w(O, {
94
100
  className: "mt-3",
95
- learnMoreHref: u,
101
+ learnMoreHref: v,
96
102
  learnMoreLabel: i("billing.plans.learnMore", "Learn more"),
97
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.")
98
104
  })
99
105
  ] }),
100
- /* @__PURE__ */ S("div", {
106
+ /* @__PURE__ */ T("div", {
101
107
  className: "flex flex-wrap items-center gap-4 pb-4 border-b border-border-subtle",
102
- children: [/* @__PURE__ */ x("div", {
108
+ children: [/* @__PURE__ */ w("div", {
103
109
  className: "inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken",
104
- children: [c.MONTHLY, c.YEARLY].map((e) => /* @__PURE__ */ x("button", {
110
+ children: [f.MONTHLY, f.YEARLY].map((e) => /* @__PURE__ */ w("button", {
105
111
  type: "button",
106
- onClick: () => E(e),
107
- className: `px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${b === e ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
108
- children: e === c.MONTHLY ? "Monthly" : "Yearly"
112
+ onClick: () => R(e),
113
+ className: `px-3 py-1.5 text-sm font-medium rounded-button transition-colors ${L === e ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
114
+ children: e === f.MONTHLY ? "Monthly" : "Yearly"
109
115
  }, e))
110
- }), /* @__PURE__ */ S("div", {
116
+ }), /* @__PURE__ */ T("div", {
111
117
  className: "ml-auto inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken",
112
- children: [/* @__PURE__ */ x("button", {
118
+ children: [/* @__PURE__ */ w("button", {
113
119
  type: "button",
114
- onClick: () => y("grid"),
115
- className: `p-1.5 rounded-button transition-colors ${v === "grid" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
120
+ onClick: () => P("grid"),
121
+ className: `p-1.5 rounded-button transition-colors ${j === "grid" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
116
122
  title: "Grid view",
117
- children: /* @__PURE__ */ x("svg", {
123
+ children: /* @__PURE__ */ w("svg", {
118
124
  className: "size-4",
119
125
  fill: "none",
120
126
  viewBox: "0 0 24 24",
121
127
  stroke: "currentColor",
122
- children: /* @__PURE__ */ x("path", {
128
+ children: /* @__PURE__ */ w("path", {
123
129
  strokeLinecap: "round",
124
130
  strokeLinejoin: "round",
125
131
  strokeWidth: 2,
126
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"
127
133
  })
128
134
  })
129
- }), /* @__PURE__ */ x("button", {
135
+ }), /* @__PURE__ */ w("button", {
130
136
  type: "button",
131
- onClick: () => y("list"),
132
- className: `p-1.5 rounded-button transition-colors ${v === "list" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
137
+ onClick: () => P("list"),
138
+ className: `p-1.5 rounded-button transition-colors ${j === "list" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
133
139
  title: "List view",
134
- children: /* @__PURE__ */ x("svg", {
140
+ children: /* @__PURE__ */ w("svg", {
135
141
  className: "size-4",
136
142
  fill: "none",
137
143
  viewBox: "0 0 24 24",
138
144
  stroke: "currentColor",
139
- children: /* @__PURE__ */ x("path", {
145
+ children: /* @__PURE__ */ w("path", {
140
146
  strokeLinecap: "round",
141
147
  strokeLinejoin: "round",
142
148
  strokeWidth: 2,
@@ -146,95 +152,97 @@ var O = () => {
146
152
  })]
147
153
  })]
148
154
  }),
149
- D.length === 0 ? /* @__PURE__ */ x(w, {
155
+ z.length === 0 ? /* @__PURE__ */ w(D, {
150
156
  illustration: "empty-data",
151
157
  title: i("billing.plans.noPlansAvailable", "No plans available"),
152
158
  description: i("billing.plans.checkBackLater", "Check back later for new plans.")
153
- }) : v === "grid" ? /* @__PURE__ */ S("div", {
159
+ }) : j === "grid" ? /* @__PURE__ */ T("div", {
154
160
  className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 items-stretch",
155
- children: [D.map((e, t) => /* @__PURE__ */ x(j, {
161
+ children: [z.map((e, t) => /* @__PURE__ */ w(F, {
156
162
  plan: e,
157
- highlighted: t === O,
163
+ highlighted: t === B,
158
164
  onView: () => a(`/plans/${e.id}`),
159
- onSubscribe: () => a(`/checkout/${e.id}`)
160
- }, e.id)), /* @__PURE__ */ x(k, { offer: d })]
161
- }) : /* @__PURE__ */ S("div", {
165
+ onSubscribe: () => g(e.id),
166
+ action: h(e.id)
167
+ }, e.id)), /* @__PURE__ */ w(M, { offer: x })]
168
+ }) : /* @__PURE__ */ T("div", {
162
169
  className: "space-y-3",
163
- children: [D.map((e) => /* @__PURE__ */ x(M, {
170
+ children: [z.map((e) => /* @__PURE__ */ w(I, {
164
171
  plan: e,
165
172
  onView: () => a(`/plans/${e.id}`),
166
- onSubscribe: () => a(`/checkout/${e.id}`)
167
- }, e.id)), /* @__PURE__ */ x(A, { offer: d })]
173
+ onSubscribe: () => g(e.id),
174
+ action: h(e.id)
175
+ }, e.id)), /* @__PURE__ */ w(N, { offer: x })]
168
176
  })
169
177
  ]
170
178
  });
171
- }, k = ({ offer: e }) => /* @__PURE__ */ S("div", {
179
+ }, M = ({ offer: e }) => /* @__PURE__ */ T("div", {
172
180
  className: "border border-border-strong bg-[var(--color-accent-soft)] rounded-card shadow-elevation-1 p-5 flex flex-col h-full",
173
181
  children: [
174
- /* @__PURE__ */ S("div", {
182
+ /* @__PURE__ */ T("div", {
175
183
  className: "mb-4",
176
- children: [/* @__PURE__ */ S("div", {
184
+ children: [/* @__PURE__ */ T("div", {
177
185
  className: "flex items-center gap-2",
178
- children: [/* @__PURE__ */ x("h3", {
186
+ children: [/* @__PURE__ */ w("h3", {
179
187
  className: "text-lg font-semibold text-text-primary",
180
188
  children: "Enterprise"
181
- }), /* @__PURE__ */ x("span", {
189
+ }), /* @__PURE__ */ w("span", {
182
190
  className: "text-xs font-medium px-2 py-0.5 rounded-full bg-bg-surface text-text-link",
183
191
  children: "Contact Us"
184
192
  })]
185
- }), /* @__PURE__ */ x("span", {
193
+ }), /* @__PURE__ */ w("span", {
186
194
  className: "text-sm text-text-secondary",
187
195
  children: "Custom contract"
188
196
  })]
189
197
  }),
190
- /* @__PURE__ */ x("div", {
198
+ /* @__PURE__ */ w("div", {
191
199
  className: "flex items-baseline gap-1 mb-4",
192
- children: /* @__PURE__ */ x("span", {
200
+ children: /* @__PURE__ */ w("span", {
193
201
  className: "text-2xl font-semibold text-text-primary",
194
202
  children: "Custom pricing"
195
203
  })
196
204
  }),
197
- /* @__PURE__ */ x("ul", {
205
+ /* @__PURE__ */ w("ul", {
198
206
  className: "space-y-2 mb-4 flex-1",
199
- children: e.highlights.map((e) => /* @__PURE__ */ S("li", {
207
+ children: e.highlights.map((e) => /* @__PURE__ */ T("li", {
200
208
  className: "flex items-center gap-2 text-sm",
201
- children: [/* @__PURE__ */ x("svg", {
209
+ children: [/* @__PURE__ */ w("svg", {
202
210
  className: "size-4 text-status-success-text shrink-0",
203
211
  fill: "none",
204
212
  viewBox: "0 0 24 24",
205
213
  stroke: "currentColor",
206
- children: /* @__PURE__ */ x("path", {
214
+ children: /* @__PURE__ */ w("path", {
207
215
  strokeLinecap: "round",
208
216
  strokeLinejoin: "round",
209
217
  strokeWidth: 2,
210
218
  d: "M5 13l4 4L19 7"
211
219
  })
212
- }), /* @__PURE__ */ x("span", {
220
+ }), /* @__PURE__ */ w("span", {
213
221
  className: "text-text-primary",
214
222
  children: e
215
223
  })]
216
224
  }, e))
217
225
  }),
218
- /* @__PURE__ */ x("div", {
226
+ /* @__PURE__ */ w("div", {
219
227
  className: "space-y-2 pt-4 border-t border-border-subtle mt-auto",
220
- children: /* @__PURE__ */ x("a", {
221
- href: h(e),
228
+ children: /* @__PURE__ */ w("a", {
229
+ href: v(e),
222
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",
223
231
  children: "Contact Us"
224
232
  })
225
233
  })
226
234
  ]
227
- }), A = ({ offer: e }) => /* @__PURE__ */ S("div", {
235
+ }), N = ({ offer: e }) => /* @__PURE__ */ T("div", {
228
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",
229
237
  children: [
230
- /* @__PURE__ */ x("div", {
238
+ /* @__PURE__ */ w("div", {
231
239
  className: "size-10 rounded-lg bg-bg-surface flex items-center justify-center shrink-0 shadow-elevation-1",
232
- children: /* @__PURE__ */ x("svg", {
240
+ children: /* @__PURE__ */ w("svg", {
233
241
  className: "size-5 text-text-link",
234
242
  fill: "none",
235
243
  viewBox: "0 0 24 24",
236
244
  stroke: "currentColor",
237
- children: /* @__PURE__ */ x("path", {
245
+ children: /* @__PURE__ */ w("path", {
238
246
  strokeLinecap: "round",
239
247
  strokeLinejoin: "round",
240
248
  strokeWidth: 2,
@@ -242,110 +250,120 @@ var O = () => {
242
250
  })
243
251
  })
244
252
  }),
245
- /* @__PURE__ */ S("div", {
253
+ /* @__PURE__ */ T("div", {
246
254
  className: "flex-1 min-w-0",
247
- children: [/* @__PURE__ */ S("div", {
255
+ children: [/* @__PURE__ */ T("div", {
248
256
  className: "flex items-center gap-2",
249
- children: [/* @__PURE__ */ x("h3", {
257
+ children: [/* @__PURE__ */ w("h3", {
250
258
  className: "font-semibold text-text-primary",
251
259
  children: "Enterprise"
252
- }), /* @__PURE__ */ x("span", {
260
+ }), /* @__PURE__ */ w("span", {
253
261
  className: "text-xs font-medium px-2 py-0.5 rounded-full bg-bg-surface text-text-link shrink-0",
254
262
  children: "Contact Us"
255
263
  })]
256
- }), /* @__PURE__ */ x("p", {
264
+ }), /* @__PURE__ */ w("p", {
257
265
  className: "text-sm text-text-secondary",
258
266
  children: e.summary
259
267
  })]
260
268
  }),
261
- /* @__PURE__ */ S("div", {
269
+ /* @__PURE__ */ T("div", {
262
270
  className: "text-right",
263
- children: [/* @__PURE__ */ x("div", {
271
+ children: [/* @__PURE__ */ w("div", {
264
272
  className: "font-semibold text-text-primary",
265
273
  children: "Custom pricing"
266
- }), /* @__PURE__ */ x("div", {
274
+ }), /* @__PURE__ */ w("div", {
267
275
  className: "text-sm text-text-secondary",
268
276
  children: "contract-based"
269
277
  })]
270
278
  }),
271
- /* @__PURE__ */ x("a", {
272
- href: h(e),
279
+ /* @__PURE__ */ w("a", {
280
+ href: v(e),
273
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",
274
282
  children: "Contact Us"
275
283
  })
276
284
  ]
277
- }), j = ({ plan: e, highlighted: t = !1, onView: n, onSubscribe: o }) => {
278
- let s = D(e.features || []), c = E(e.features || []).length - s.length, l = d(), { price: p, currency: h } = u(e.price, e.currency, e.currencyPrices, l);
279
- return /* @__PURE__ */ S("div", {
285
+ });
286
+ function P(e) {
287
+ return e?.kind === "current" ? "Current plan" : e?.kind === "change" ? "Change to this plan" : "Subscribe";
288
+ }
289
+ var F = ({ plan: e, highlighted: t = !1, onView: n, onSubscribe: o, action: s }) => {
290
+ let c = A(e.features || []), l = k(e.features || []).length - c.length, u = m(), { price: d, currency: f } = p(e.price, e.currency, e.currencyPrices, u);
291
+ return /* @__PURE__ */ T("div", {
280
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"}`,
281
293
  children: [
282
- t && /* @__PURE__ */ S("span", {
294
+ s?.kind === "current" && /* @__PURE__ */ w("span", {
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
+ children: "Current plan"
297
+ }),
298
+ t && /* @__PURE__ */ T("span", {
283
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",
284
- children: [/* @__PURE__ */ x(b, {
300
+ children: [/* @__PURE__ */ w(C, {
285
301
  className: "size-3.5",
286
302
  "aria-hidden": "true"
287
303
  }), "Most popular"]
288
304
  }),
289
- /* @__PURE__ */ S("div", {
305
+ /* @__PURE__ */ T("div", {
290
306
  className: "mb-4",
291
- children: [/* @__PURE__ */ x("h3", {
307
+ children: [/* @__PURE__ */ w("h3", {
292
308
  className: "text-lg font-semibold text-text-primary",
293
309
  children: e.name
294
- }), /* @__PURE__ */ x("span", {
310
+ }), /* @__PURE__ */ w("span", {
295
311
  className: "text-sm text-text-secondary",
296
312
  children: a(e.duration)
297
313
  })]
298
314
  }),
299
- /* @__PURE__ */ S("div", {
315
+ /* @__PURE__ */ T("div", {
300
316
  className: "flex items-baseline gap-1.5 mb-5",
301
- children: [/* @__PURE__ */ x("span", {
317
+ children: [/* @__PURE__ */ w("span", {
302
318
  className: "text-4xl font-bold tabular-nums tracking-tight text-text-primary",
303
- children: r(p, h)
304
- }), /* @__PURE__ */ S("span", {
319
+ children: r(d, f)
320
+ }), /* @__PURE__ */ T("span", {
305
321
  className: "text-text-secondary text-sm",
306
322
  children: ["/ ", i(e.duration)]
307
323
  })]
308
324
  }),
309
- s.length > 0 && /* @__PURE__ */ S("ul", {
325
+ c.length > 0 && /* @__PURE__ */ T("ul", {
310
326
  className: "space-y-2.5 mb-5 flex-1",
311
- children: [s.map((e) => /* @__PURE__ */ S("li", {
327
+ children: [c.map((e) => /* @__PURE__ */ T("li", {
312
328
  className: "flex items-center justify-between gap-2 text-sm",
313
- children: [/* @__PURE__ */ S("span", {
329
+ children: [/* @__PURE__ */ T("span", {
314
330
  className: "flex items-center gap-2 min-w-0",
315
- children: [/* @__PURE__ */ x("span", {
331
+ children: [/* @__PURE__ */ w("span", {
316
332
  className: "flex size-5 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)]",
317
- children: /* @__PURE__ */ x(y, {
333
+ children: /* @__PURE__ */ w(S, {
318
334
  className: "size-3 text-action-primary-bg",
319
335
  "aria-hidden": "true"
320
336
  })
321
- }), /* @__PURE__ */ x("span", {
337
+ }), /* @__PURE__ */ w("span", {
322
338
  className: "truncate text-text-primary",
323
- children: f[e.name] ?? e.name
339
+ children: h[e.name] ?? e.name
324
340
  })]
325
- }), /* @__PURE__ */ x("span", {
341
+ }), /* @__PURE__ */ w("span", {
326
342
  className: "font-semibold text-text-primary tabular-nums shrink-0",
327
- children: m(e.name, e.totalValue)
343
+ children: _(e.name, e.totalValue)
328
344
  })]
329
- }, e.quotaId)), c > 0 && /* @__PURE__ */ S("li", {
345
+ }, e.quotaId)), l > 0 && /* @__PURE__ */ T("li", {
330
346
  className: "text-sm text-text-secondary pl-7",
331
347
  children: [
332
348
  "+",
333
- c,
349
+ l,
334
350
  " more — see details"
335
351
  ]
336
352
  })]
337
353
  }),
338
- /* @__PURE__ */ S("div", {
354
+ /* @__PURE__ */ T("div", {
339
355
  className: "space-y-2 pt-4 border-t border-border-subtle mt-auto",
340
- children: [/* @__PURE__ */ S("button", {
356
+ children: [/* @__PURE__ */ T("button", {
341
357
  type: "button",
342
358
  onClick: o,
343
- className: "group 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)]",
344
- children: ["Subscribe", /* @__PURE__ */ x(v, {
359
+ disabled: s?.kind === "current",
360
+ "aria-disabled": s?.kind === "current",
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: [P(s), /* @__PURE__ */ w(x, {
345
363
  className: "size-4 transition-transform duration-200",
346
364
  "aria-hidden": "true"
347
365
  })]
348
- }), /* @__PURE__ */ x("button", {
366
+ }), /* @__PURE__ */ w("button", {
349
367
  type: "button",
350
368
  onClick: n,
351
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",
@@ -354,19 +372,19 @@ var O = () => {
354
372
  })
355
373
  ]
356
374
  });
357
- }, M = ({ plan: e, onView: t, onSubscribe: n }) => {
358
- let a = D(e.features || []), o = d();
359
- return /* @__PURE__ */ S("div", {
375
+ }, I = ({ plan: e, onView: t, onSubscribe: n, action: a }) => {
376
+ let o = A(e.features || []), s = m();
377
+ return /* @__PURE__ */ T("div", {
360
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",
361
379
  children: [
362
- /* @__PURE__ */ x("div", {
380
+ /* @__PURE__ */ w("div", {
363
381
  className: "size-10 rounded-lg bg-[var(--color-accent-soft)] flex items-center justify-center shrink-0",
364
- children: /* @__PURE__ */ x("svg", {
382
+ children: /* @__PURE__ */ w("svg", {
365
383
  className: "size-5 text-text-link",
366
384
  fill: "none",
367
385
  viewBox: "0 0 24 24",
368
386
  stroke: "currentColor",
369
- children: /* @__PURE__ */ x("path", {
387
+ children: /* @__PURE__ */ w("path", {
370
388
  strokeLinecap: "round",
371
389
  strokeLinejoin: "round",
372
390
  strokeWidth: 2,
@@ -374,42 +392,43 @@ var O = () => {
374
392
  })
375
393
  })
376
394
  }),
377
- /* @__PURE__ */ S("div", {
395
+ /* @__PURE__ */ T("div", {
378
396
  className: "flex-1 min-w-0",
379
- children: [/* @__PURE__ */ x("h3", {
397
+ children: [/* @__PURE__ */ w("h3", {
380
398
  className: "font-semibold text-text-primary truncate",
381
399
  children: e.name
382
- }), /* @__PURE__ */ S("p", {
400
+ }), /* @__PURE__ */ T("p", {
383
401
  className: "text-sm text-text-secondary",
384
402
  children: [
385
- a.length,
403
+ o.length,
386
404
  " key feature",
387
- a.length === 1 ? "" : "s",
405
+ o.length === 1 ? "" : "s",
388
406
  " included"
389
407
  ]
390
408
  })]
391
409
  }),
392
- /* @__PURE__ */ S("div", {
410
+ /* @__PURE__ */ T("div", {
393
411
  className: "text-right",
394
- children: [/* @__PURE__ */ x("div", {
412
+ children: [/* @__PURE__ */ w("div", {
395
413
  className: "font-semibold text-text-primary",
396
414
  children: (() => {
397
- let { price: t, currency: n } = u(e.price, e.currency, e.currencyPrices, o);
415
+ let { price: t, currency: n } = p(e.price, e.currency, e.currencyPrices, s);
398
416
  return r(t, n);
399
417
  })()
400
- }), /* @__PURE__ */ S("div", {
418
+ }), /* @__PURE__ */ T("div", {
401
419
  className: "text-sm text-text-secondary",
402
420
  children: ["per ", i(e.duration)]
403
421
  })]
404
422
  }),
405
- /* @__PURE__ */ S("div", {
423
+ /* @__PURE__ */ T("div", {
406
424
  className: "flex items-center gap-2",
407
- children: [/* @__PURE__ */ x("button", {
425
+ children: [/* @__PURE__ */ w("button", {
408
426
  type: "button",
409
427
  onClick: n,
410
- 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",
411
- children: "Subscribe"
412
- }), /* @__PURE__ */ x("button", {
428
+ disabled: a?.kind === "current",
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: P(a)
431
+ }), /* @__PURE__ */ w("button", {
413
432
  type: "button",
414
433
  onClick: t,
415
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",
@@ -419,6 +438,6 @@ var O = () => {
419
438
  ]
420
439
  });
421
440
  };
422
- export { O as PlansBrowsePage };
441
+ export { j as PlansBrowsePage };
423
442
 
424
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","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","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 { 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\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={() => navigateTo(`/checkout/${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={() => navigateTo(`/checkout/${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\nconst BrowsePlanCard: FC<{\n plan: Plan;\n highlighted?: boolean;\n onView: () => void;\n onSubscribe: () => void;\n}> = ({ plan, highlighted = false, onView, onSubscribe }) => {\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 {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 className=\"group 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 Subscribe\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<{ plan: Plan; onView: () => void; onSubscribe: () => void }> = ({\n plan,\n onView,\n onSubscribe,\n}) => {\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 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\"\n >\n Subscribe\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":";;;;;;;;;;;;;;;;;;;;AA6CA,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,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I;CACJ,IAAMK,IAAiBjD,EAAkB4B,EAAK,YAAY,CAAC,CAAC,GACtDuB,IAAkBC,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,UAAAxB,EAAK;IAAS,CAAA,GACxE,kBAAC,KAAD;KAAG,WAAU;KAAb,UAAA;MACGqB,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,EAC1BzB,EAAK,OACLA,EAAK,UACLA,EAAK,gBACLuB,CACF;MACA,OAAOM,EAAeC,GAAOC,CAAQ;KACvC,EAAA,CAAG;IACA,CAAA,GACL,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CAA6C,QAAKC,EAAmBhC,EAAK,QAAQ,CAAO;IACtF,CAAA,CAAA;;GAEL,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,UAAD;KACE,MAAK;KACL,SAASqC;KACT,WAAU;KACX,UAAA;IAEO,CAAA,GACR,kBAAC,UAAD;KACE,MAAK;KACL,SAASE;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","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,G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AAf,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"}
@@ -0,0 +1,16 @@
1
+ import { BillingSubscription } from '../../../shared/types';
2
+ export type PlanAction = {
3
+ kind: 'current';
4
+ subscriptionId: string;
5
+ } | {
6
+ kind: 'change';
7
+ subscriptionId: string;
8
+ } | {
9
+ kind: 'subscribe';
10
+ };
11
+ /**
12
+ * What a plan card should offer given the account's active subscriptions:
13
+ * mark the plan already held, send a subscriber to Change plan (never a second
14
+ * checkout), and only start a checkout when there is no active subscription.
15
+ */
16
+ export declare function resolvePlanAction(planId: string, activeSubscriptions: ReadonlyArray<Pick<BillingSubscription, 'id' | 'planId'>>): PlanAction;
@@ -0,0 +1,16 @@
1
+ // src/billing/modules/plans/utils/planAction.ts
2
+ function e(e, t) {
3
+ let n = t.find((t) => t.planId === e);
4
+ if (n) return {
5
+ kind: "current",
6
+ subscriptionId: n.id
7
+ };
8
+ let r = t[0];
9
+ return r ? {
10
+ kind: "change",
11
+ subscriptionId: r.id
12
+ } : { kind: "subscribe" };
13
+ }
14
+ export { e as resolvePlanAction };
15
+
16
+ //# sourceMappingURL=planAction.js.map
@@ -0,0 +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":";AAYA,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-billing",
3
- "version": "2026.1112.2",
3
+ "version": "2026.1112.3",
4
4
  "description": "Billing microfrontend for Burdenoff products",
5
5
  "type": "module",
6
6
  "files": [