@@ -147,13 +147,19 @@ export const PlanCardHeader = React.forwardRef<HTMLDivElement, PlanCardHeaderPro
147
147
const prefersReducedMotion = usePrefersReducedMotion ( ) ;
148
148
const { animations : layoutAnimations } = useAppearance ( ) . parsedLayout ;
149
149
const { plan, isCompact, planPeriod, setPlanPeriod, closeSlot } = props ;
150
- const { name, avatarUrl, isActiveForPayer } = plan ;
150
+ const { name, avatarUrl, isActiveForPayer, annualMonthlyAmount } = plan ;
151
151
const isMotionSafe = ! prefersReducedMotion && layoutAnimations === true ;
152
152
const planCardFeePeriodNoticeAnimation : ThemableCssProp = t => ( {
153
153
transition : isMotionSafe
154
154
? `grid-template-rows ${ t . transitionDuration . $slower } ${ t . transitionTiming . $slowBezier } `
155
155
: 'none' ,
156
156
} ) ;
157
+ const getPlanFee = React . useMemo ( ( ) => {
158
+ if ( annualMonthlyAmount <= 0 ) {
159
+ return plan . amountFormatted ;
160
+ }
161
+ return planPeriod === 'annual' ? plan . annualMonthlyAmountFormatted : plan . amountFormatted ;
162
+ } , [ annualMonthlyAmount , planPeriod , plan . amountFormatted , plan . annualMonthlyAmountFormatted ] ) ;
157
163
return (
158
164
< Box
159
165
ref = { ref }
@@ -247,7 +253,7 @@ export const PlanCardHeader = React.forwardRef<HTMLDivElement, PlanCardHeaderPro
247
253
colorScheme = 'body'
248
254
>
249
255
{ plan . currencySymbol }
250
- { planPeriod === 'month' ? plan . amountFormatted : plan . annualMonthlyAmountFormatted }
256
+ { getPlanFee }
251
257
</ Text >
252
258
< Text
253
259
elementDescriptor = { descriptors . planCardFeePeriod }
@@ -262,47 +268,49 @@ export const PlanCardHeader = React.forwardRef<HTMLDivElement, PlanCardHeaderPro
262
268
} ) }
263
269
localizationKey = { localizationKeys ( '__experimental_commerce.month' ) }
264
270
/>
265
- < Box
266
- elementDescriptor = { descriptors . planCardFeePeriodNotice }
267
- sx = { [
268
- _ => ( {
269
- width : '100%' ,
270
- display : 'grid' ,
271
- gridTemplateRows : planPeriod === 'annual' ? '1fr' : '0fr' ,
272
- } ) ,
273
- planCardFeePeriodNoticeAnimation ,
274
- ] }
275
- // @ts -ignore - Needed until React 19 support
276
- inert = { planPeriod !== 'annual' ? 'true' : undefined }
277
- >
271
+ { annualMonthlyAmount > 0 ? (
278
272
< Box
279
- elementDescriptor = { descriptors . planCardFeePeriodNoticeInner }
280
- sx = { {
281
- overflow : 'hidden' ,
282
- minHeight : 0 ,
283
- } }
284
- >
285
- < Text
286
- elementDescriptor = { descriptors . planCardFeePeriodNoticeLabel }
287
- variant = 'caption'
288
- colorScheme = 'secondary'
289
- sx = { t => ( {
273
+ elementDescriptor = { descriptors . planCardFeePeriodNotice }
274
+ sx = { [
275
+ _ => ( {
290
276
width : '100%' ,
291
- display : 'flex' ,
292
- alignItems : 'center' ,
293
- columnGap : t . space . $1 ,
294
- } ) }
277
+ display : 'grid' ,
278
+ gridTemplateRows : planPeriod === 'annual' ? '1fr' : '0fr' ,
279
+ } ) ,
280
+ planCardFeePeriodNoticeAnimation ,
281
+ ] }
282
+ // @ts -ignore - Needed until React 19 support
283
+ inert = { planPeriod !== 'annual' ? 'true' : undefined }
284
+ >
285
+ < Box
286
+ elementDescriptor = { descriptors . planCardFeePeriodNoticeInner }
287
+ sx = { {
288
+ overflow : 'hidden' ,
289
+ minHeight : 0 ,
290
+ } }
295
291
>
296
- < Icon
297
- icon = { InformationCircle }
298
- colorScheme = 'neutral'
299
- size = 'sm'
300
- aria-hidden
301
- /> { ' ' }
302
- < Span localizationKey = { localizationKeys ( '__experimental_commerce.billedAnnually' ) } />
303
- </ Text >
292
+ < Text
293
+ elementDescriptor = { descriptors . planCardFeePeriodNoticeLabel }
294
+ variant = 'caption'
295
+ colorScheme = 'secondary'
296
+ sx = { t => ( {
297
+ width : '100%' ,
298
+ display : 'flex' ,
299
+ alignItems : 'center' ,
300
+ columnGap : t . space . $1 ,
301
+ } ) }
302
+ >
303
+ < Icon
304
+ icon = { InformationCircle }
305
+ colorScheme = 'neutral'
306
+ size = 'sm'
307
+ aria-hidden
308
+ /> { ' ' }
309
+ < Span localizationKey = { localizationKeys ( '__experimental_commerce.billedAnnually' ) } />
310
+ </ Text >
311
+ </ Box >
304
312
</ Box >
305
- </ Box >
313
+ ) : null }
306
314
</ >
307
315
) : (
308
316
< Text
@@ -313,7 +321,7 @@ export const PlanCardHeader = React.forwardRef<HTMLDivElement, PlanCardHeaderPro
313
321
/>
314
322
) }
315
323
</ Flex >
316
- { plan . hasBaseFee ? (
324
+ { plan . hasBaseFee && annualMonthlyAmount > 0 ? (
317
325
< Box
318
326
elementDescriptor = { descriptors . planCardPeriodToggle }
319
327
sx = { t => ( {
0 commit comments