Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .changeset/brave-kiwis-slide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-js': minor
'@clerk/types': minor
---

[Billing Beta] Rename payment source descriptors to use "payment method".
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ export const PaymentSourceRow = ({ paymentSource }: { paymentSource: BillingPaym
sx={{ overflow: 'hidden' }}
gap={2}
align='baseline'
elementDescriptor={descriptors.paymentSourceRow}
elementDescriptor={descriptors.paymentMethodRow}
>
<Icon
icon={paymentSource.paymentType === 'card' ? CreditCard : GenericPayment}
sx={t => ({ alignSelf: 'center', color: t.colors.$colorMutedForeground })}
elementDescriptor={descriptors.paymentSourceRowIcon}
elementDescriptor={descriptors.paymentMethodRowIcon}
/>
<Text
sx={t => ({ color: t.colors.$colorForeground, textTransform: 'capitalize' })}
truncate
elementDescriptor={descriptors.paymentSourceRowType}
elementDescriptor={descriptors.paymentMethodRowType}
>
{/* TODO(@COMMERCE): Localize this */}
{paymentSource.paymentType === 'card' ? paymentSource.cardType : paymentSource.paymentType}
Expand All @@ -28,21 +28,21 @@ export const PaymentSourceRow = ({ paymentSource }: { paymentSource: BillingPaym
sx={t => ({ color: t.colors.$colorMutedForeground })}
variant='caption'
truncate
elementDescriptor={descriptors.paymentSourceRowValue}
elementDescriptor={descriptors.paymentMethodRowValue}
>
{paymentSource.paymentType === 'card' ? `⋯ ${paymentSource.last4}` : null}
</Text>
{paymentSource.isDefault && (
<Badge
elementDescriptor={descriptors.paymentSourceRowBadge}
elementId={descriptors.paymentSourceRowBadge.setId('default')}
elementDescriptor={descriptors.paymentMethodRowBadge}
elementId={descriptors.paymentMethodRowBadge.setId('default')}
localizationKey={localizationKeys('badge__default')}
/>
)}
{paymentSource.status === 'expired' && (
<Badge
elementDescriptor={descriptors.paymentSourceRowBadge}
elementId={descriptors.paymentSourceRowBadge.setId('expired')}
elementDescriptor={descriptors.paymentMethodRowBadge}
elementId={descriptors.paymentMethodRowBadge.setId('expired')}
colorScheme='danger'
localizationKey={localizationKeys('badge__expired')}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const PaymentSources = withCardStateProvider(() => {
<ProfileSection.Root
title={localizationKeys(`${localizationRoot}.billingPage.paymentSourcesSection.title`)}
centered={false}
id='paymentSources'
id='paymentMethods'
sx={t => ({
flex: 1,
borderTopWidth: t.borderWidths.$normal,
Expand All @@ -139,7 +139,7 @@ export const PaymentSources = withCardStateProvider(() => {
>
<Action.Root>
<ProfileSection.ItemList
id='paymentSources'
id='paymentMethods'
disableAnimation
>
{isLoading ? (
Expand All @@ -148,7 +148,7 @@ export const PaymentSources = withCardStateProvider(() => {
<>
{sortedPaymentSources.map(paymentSource => (
<Fragment key={paymentSource.id}>
<ProfileSection.Item id='paymentSources'>
<ProfileSection.Item id='paymentMethods'>
<PaymentSourceRow paymentSource={paymentSource} />
<PaymentSourceMenu
paymentSource={paymentSource}
Expand All @@ -170,7 +170,7 @@ export const PaymentSources = withCardStateProvider(() => {
<>
<Action.Trigger value='add'>
<ProfileSection.ArrowButton
id='paymentSources'
id='paymentMethods'
localizationKey={localizationKeys(`${localizationRoot}.billingPage.paymentSourcesSection.add`)}
/>
</Action.Trigger>
Expand Down
12 changes: 6 additions & 6 deletions packages/clerk-js/src/ui/customizables/elementDescriptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ export const APPEARANCE_KEYS = containsAllElementsConfigKeys([
'selectOptionsContainer',
'selectOption',

'paymentSourceRow',
'paymentSourceRowIcon',
'paymentSourceRowText',
'paymentSourceRowType',
'paymentSourceRowValue',
'paymentSourceRowBadge',
'paymentMethodRow',
'paymentMethodRowIcon',
'paymentMethodRowText',
'paymentMethodRowType',
'paymentMethodRowValue',
'paymentMethodRowBadge',

'statementRoot',
'statementHeader',
Expand Down
12 changes: 6 additions & 6 deletions packages/types/src/appearance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

export type CssColorOrScale = string | ColorScaleWithRequiredBase;
export type CssColorOrAlphaScale = string | AlphaColorScale;
type CssColor = string | TransparentColor | BuiltInColors;

Check warning on line 54 in packages/types/src/appearance.ts

View workflow job for this annotation

GitHub Actions / Static analysis

"black" | "blue" | "red" | "green" | "grey" | "white" | "yellow" is overridden by string in this union type

Check warning on line 54 in packages/types/src/appearance.ts

View workflow job for this annotation

GitHub Actions / Static analysis

"transparent" is overridden by string in this union type
type CssLengthUnit = string;

type FontSizeScale = {
Expand Down Expand Up @@ -84,7 +84,7 @@
| 'Trebuchet MS'
| 'Verdana';

export type FontFamily = string | WebSafeFont;

Check warning on line 87 in packages/types/src/appearance.ts

View workflow job for this annotation

GitHub Actions / Static analysis

"Arial" | "Brush Script MT" | "Courier New" | "Garamond" | "Georgia" | "Helvetica" | "Tahoma" | "Times New Roman" | "Trebuchet MS" | "Verdana" is overridden by string in this union type

type LoadingState = 'loading';
type ErrorState = 'error';
Expand Down Expand Up @@ -493,12 +493,12 @@
selectOptionsContainer: WithOptions<SelectId>;
selectOption: WithOptions<SelectId>;

paymentSourceRow: WithOptions;
paymentSourceRowIcon: WithOptions;
paymentSourceRowText: WithOptions;
paymentSourceRowType: WithOptions;
paymentSourceRowValue: WithOptions;
paymentSourceRowBadge: WithOptions<'default' | 'expired'>;
paymentMethodRow: WithOptions;
paymentMethodRowIcon: WithOptions;
paymentMethodRowText: WithOptions;
paymentMethodRowType: WithOptions;
paymentMethodRowValue: WithOptions;
paymentMethodRowBadge: WithOptions<'default' | 'expired'>;

statementRoot: WithOptions;
statementHeader: WithOptions;
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/elementIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export type ProfileSectionId =
| 'organizationDomains'
| 'manageVerifiedDomains'
| 'subscriptionsList'
| 'paymentSources';
| 'paymentMethods';
export type ProfilePageId = 'account' | 'security' | 'organizationGeneral' | 'organizationMembers' | 'billing';

export type UserPreviewId = 'userButton' | 'personalWorkspace';
Expand Down
Loading