-
Notifications
You must be signed in to change notification settings - Fork 371
chore(clerk-js,types): Switch to fees for plan prices #6490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d7daf96
53d1c86
6975c49
69c583c
0100be0
360986c
171100a
0bb6872
6a0d739
dbe1805
3dd40eb
22841e6
5377039
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@clerk/clerk-js': minor | ||
'@clerk/types': minor | ||
--- | ||
|
||
[Billing Beta] Replace usage of top level amounts in plan with fees for displaying prices. |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||||||||||||||||
import { __experimental_useCheckout as useCheckout, useOrganization } from '@clerk/shared/react'; | ||||||||||||||||||||
import type { CommerceMoney, CommercePaymentSourceResource, ConfirmCheckoutParams } from '@clerk/types'; | ||||||||||||||||||||
import type { CommerceMoneyAmount, CommercePaymentSourceResource, ConfirmCheckoutParams } from '@clerk/types'; | ||||||||||||||||||||
import { useMemo, useState } from 'react'; | ||||||||||||||||||||
|
||||||||||||||||||||
import { Card } from '@/ui/elements/Card'; | ||||||||||||||||||||
|
@@ -35,6 +35,8 @@ export const CheckoutForm = withCardStateProvider(() => { | |||||||||||||||||||
const showPastDue = !!totals.pastDue?.amount && totals.pastDue.amount > 0; | ||||||||||||||||||||
const showDowngradeInfo = !isImmediatePlanChange; | ||||||||||||||||||||
|
||||||||||||||||||||
const fee = planPeriod === 'month' ? plan.fee : plan.annualMonthlyFee; | ||||||||||||||||||||
|
||||||||||||||||||||
return ( | ||||||||||||||||||||
<Drawer.Body> | ||||||||||||||||||||
<Box | ||||||||||||||||||||
|
@@ -54,7 +56,7 @@ export const CheckoutForm = withCardStateProvider(() => { | |||||||||||||||||||
/> | ||||||||||||||||||||
<LineItems.Description | ||||||||||||||||||||
prefix={planPeriod === 'annual' ? 'x12' : undefined} | ||||||||||||||||||||
text={`${plan.currencySymbol}${planPeriod === 'month' ? plan.amountFormatted : plan.annualMonthlyAmountFormatted}`} | ||||||||||||||||||||
text={`${fee.currencySymbol}${fee.amountFormatted}`} | ||||||||||||||||||||
suffix={localizationKeys('commerce.checkout.perMonth')} | ||||||||||||||||||||
/> | ||||||||||||||||||||
Comment on lines
58
to
61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Localize hard-coded 'x12' multiplier All user-facing strings must be localized. Replace - prefix={planPeriod === 'annual' ? 'x12' : undefined}
+ prefix={planPeriod === 'annual' ? localizationKeys('commerce.checkout.x12') : undefined} 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||
</LineItems.Group> | ||||||||||||||||||||
|
@@ -312,7 +314,7 @@ const ExistingPaymentSourceForm = withCardStateProvider( | |||||||||||||||||||
totalDueNow, | ||||||||||||||||||||
paymentSources, | ||||||||||||||||||||
}: { | ||||||||||||||||||||
totalDueNow: CommerceMoney; | ||||||||||||||||||||
totalDueNow: CommerceMoneyAmount; | ||||||||||||||||||||
paymentSources: CommercePaymentSourceResource[]; | ||||||||||||||||||||
}) => { | ||||||||||||||||||||
const { checkout } = useCheckout(); | ||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.