Skip to content

chore(clerk-js,types): Use subscriptionItems on commerce payments responses #6272

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/short-stars-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
'@clerk/clerk-js': patch
'@clerk/types': patch
---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are missing the actual changelog here

16 changes: 8 additions & 8 deletions packages/clerk-js/src/ui/components/Statements/StatementPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export const StatementPage = () => {
{group.items.map(item => (
<Statement.SectionContentItem key={item.id}>
<Statement.SectionContentDetailsHeader
title={item.subscription.plan.name}
description={`${item.subscription.amount?.currencySymbol}${item.subscription.amount?.amountFormatted} / ${item.subscription.planPeriod === 'month' ? t(localizationKeys('commerce.month')) : t(localizationKeys('commerce.year'))}`}
title={item.subscriptionItem.plan.name}
description={`${item.subscriptionItem.amount?.currencySymbol}${item.subscriptionItem.amount?.amountFormatted} / ${item.subscriptionItem.planPeriod === 'month' ? t(localizationKeys('commerce.month')) : t(localizationKeys('commerce.year'))}`}
secondaryTitle={`${item.amount.currencySymbol}${item.amount.amountFormatted}`}
/>
<Statement.SectionContentDetailsList>
Expand All @@ -78,15 +78,15 @@ export const StatementPage = () => {
? localizationKeys(
`${localizationRoot}.billingPage.statementsSection.itemCaption__paidForPlan`,
{
plan: item.subscription.plan.name,
period: item.subscription.planPeriod,
plan: item.subscriptionItem.plan.name,
period: item.subscriptionItem.planPeriod,
},
)
: localizationKeys(
`${localizationRoot}.billingPage.statementsSection.itemCaption__subscribedAndPaidForPlan`,
{
plan: item.subscription.plan.name,
period: item.subscription.planPeriod,
plan: item.subscriptionItem.plan.name,
period: item.subscriptionItem.planPeriod,
},
)
}
Expand All @@ -95,12 +95,12 @@ export const StatementPage = () => {
valueTruncated
valueCopyable
/>
{item.subscription.credit && item.subscription.credit.amount.amount > 0 ? (
{item.subscriptionItem.credit && item.subscriptionItem.credit.amount.amount > 0 ? (
<Statement.SectionContentDetailsListItem
label={localizationKeys(
`${localizationRoot}.billingPage.statementsSection.itemCaption__proratedCredit`,
)}
value={`(${item.subscription.credit.amount.currencySymbol}${item.subscription.credit.amount.amountFormatted})`}
value={`(${item.subscriptionItem.credit.amount.currencySymbol}${item.subscriptionItem.credit.amount.amountFormatted})`}
/>
) : null}
</Statement.SectionContentDetailsList>
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/commerce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ export interface CommercePaymentResource extends ClerkResource {
failedAt?: Date;
updatedAt: Date;
paymentSource: CommercePaymentSourceResource;
subscription: CommerceSubscriptionResource;
subscriptionItem: CommerceSubscriptionResource;
subscription: CommerceSubscriptionResource;
chargeType: CommercePaymentChargeType;
status: CommercePaymentStatus;
}
Expand Down
Loading