diff --git a/.changeset/soft-houses-camp.md b/.changeset/soft-houses-camp.md new file mode 100644 index 00000000000..c8805c1af2b --- /dev/null +++ b/.changeset/soft-houses-camp.md @@ -0,0 +1,5 @@ +--- +'@clerk/clerk-js': patch +--- + +Update plan feed rendering within `` to only render `annualMonthlyAmount` when it's greater than 0. diff --git a/packages/clerk-js/src/ui/components/PricingTable/PlanCard.tsx b/packages/clerk-js/src/ui/components/PricingTable/PlanCard.tsx index bc5aa512e21..ba903bc7406 100644 --- a/packages/clerk-js/src/ui/components/PricingTable/PlanCard.tsx +++ b/packages/clerk-js/src/ui/components/PricingTable/PlanCard.tsx @@ -147,13 +147,19 @@ export const PlanCardHeader = React.forwardRef ({ transition: isMotionSafe ? `grid-template-rows ${t.transitionDuration.$slower} ${t.transitionTiming.$slowBezier}` : 'none', }); + const getPlanFee = React.useMemo(() => { + if (annualMonthlyAmount <= 0) { + return plan.amountFormatted; + } + return planPeriod === 'annual' ? plan.annualMonthlyAmountFormatted : plan.amountFormatted; + }, [annualMonthlyAmount, planPeriod, plan.amountFormatted, plan.annualMonthlyAmountFormatted]); return ( {plan.currencySymbol} - {planPeriod === 'month' ? plan.amountFormatted : plan.annualMonthlyAmountFormatted} + {getPlanFee} - ({ - width: '100%', - display: 'grid', - gridTemplateRows: planPeriod === 'annual' ? '1fr' : '0fr', - }), - planCardFeePeriodNoticeAnimation, - ]} - // @ts-ignore - Needed until React 19 support - inert={planPeriod !== 'annual' ? 'true' : undefined} - > + {annualMonthlyAmount > 0 ? ( - ({ + elementDescriptor={descriptors.planCardFeePeriodNotice} + sx={[ + _ => ({ width: '100%', - display: 'flex', - alignItems: 'center', - columnGap: t.space.$1, - })} + display: 'grid', + gridTemplateRows: planPeriod === 'annual' ? '1fr' : '0fr', + }), + planCardFeePeriodNoticeAnimation, + ]} + // @ts-ignore - Needed until React 19 support + inert={planPeriod !== 'annual' ? 'true' : undefined} + > + - {' '} - - + ({ + width: '100%', + display: 'flex', + alignItems: 'center', + columnGap: t.space.$1, + })} + > + {' '} + + + - + ) : null} ) : ( )} - {plan.hasBaseFee ? ( + {plan.hasBaseFee && annualMonthlyAmount > 0 ? ( ({