@growth-operations/ui-shared 1.8.0 → 1.9.0
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/package.json +1 -1
- package/src/billing/PlanGrid.jsx +22 -7
package/package.json
CHANGED
package/src/billing/PlanGrid.jsx
CHANGED
|
@@ -118,15 +118,24 @@ function PlanCard({
|
|
|
118
118
|
const leg = interval === "annual" ? plan.annual : plan.monthly;
|
|
119
119
|
const periodLabel = interval === "annual" ? "/yr" : "/mo";
|
|
120
120
|
|
|
121
|
+
// Annual is billed as one yearly charge, but SaaS pricing convention shows
|
|
122
|
+
// it as an equivalent MONTHLY rate up front (the full annual total reads as
|
|
123
|
+
// sticker shock) — the actual "$X/yr" total moves to a smaller line below.
|
|
124
|
+
const monthlyEquivalent =
|
|
125
|
+
interval === "annual" && leg ? Math.round(leg.unit_amount / 12) : null;
|
|
126
|
+
|
|
121
127
|
const priceText = plan.talk_to_sales
|
|
122
128
|
? "Custom"
|
|
123
129
|
: leg
|
|
124
|
-
?
|
|
130
|
+
? monthlyEquivalent != null
|
|
131
|
+
? `${fmtMoney(monthlyEquivalent, leg.currency)}/mo`
|
|
132
|
+
: `${fmtMoney(leg.unit_amount, leg.currency)}${periodLabel}`
|
|
125
133
|
: "Free";
|
|
126
134
|
|
|
127
135
|
// Annual savings vs. paying monthly for a year. Only when this card is showing
|
|
128
|
-
// annual AND has both legs to compare. annualFull = the
|
|
129
|
-
// monthly" reference
|
|
136
|
+
// annual AND has both legs to compare. annualFull = the un-discounted "12×
|
|
137
|
+
// monthly" reference used only to compute savingsPct — never rendered as a
|
|
138
|
+
// dollar figure itself (see the "no full-year price shown" note above).
|
|
130
139
|
const showAnnualSavings =
|
|
131
140
|
interval === "annual" && hasMonthly && hasAnnual && plan.annual?.unit_amount;
|
|
132
141
|
const annualFull = showAnnualSavings ? plan.monthly.unit_amount * 12 : null;
|
|
@@ -185,10 +194,16 @@ function PlanCard({
|
|
|
185
194
|
<StatusTag variant="success">Save {savingsPct}%</StatusTag>
|
|
186
195
|
)}
|
|
187
196
|
</Flex>
|
|
188
|
-
{/*
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
197
|
+
{/* Annual is billed as one yearly charge — show the real total in a
|
|
198
|
+
lighter line under the monthly-equivalent headline price, instead
|
|
199
|
+
of a struck-through full-year dollar figure. Deliberately no
|
|
200
|
+
"$X/yr" reference price shown as a big number anywhere on this
|
|
201
|
+
card — only the small parenthetical and the Save % badge above.
|
|
202
|
+
variant "microcopy" is the SDK's de-emphasized text style (no
|
|
203
|
+
fontColor option exists on Text). */}
|
|
204
|
+
{monthlyEquivalent != null && (
|
|
205
|
+
<Text variant="microcopy">
|
|
206
|
+
(or {fmtMoney(leg.unit_amount, leg.currency)}/yr)
|
|
192
207
|
</Text>
|
|
193
208
|
)}
|
|
194
209
|
|