Skip to content

Commit 65b7cc7

Browse files
authored
chore(clerk-js,types): Rename descriptors from payment source to method (#6951)
1 parent 9766c4a commit 65b7cc7

File tree

6 files changed

+31
-25
lines changed

6 files changed

+31
-25
lines changed

.changeset/brave-kiwis-slide.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/clerk-js': minor
3+
'@clerk/types': minor
4+
---
5+
6+
[Billing Beta] Rename payment source descriptors to use "payment method".

packages/clerk-js/src/ui/components/PaymentSources/PaymentSourceRow.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ export const PaymentSourceRow = ({ paymentSource }: { paymentSource: BillingPaym
99
sx={{ overflow: 'hidden' }}
1010
gap={2}
1111
align='baseline'
12-
elementDescriptor={descriptors.paymentSourceRow}
12+
elementDescriptor={descriptors.paymentMethodRow}
1313
>
1414
<Icon
1515
icon={paymentSource.paymentType === 'card' ? CreditCard : GenericPayment}
1616
sx={t => ({ alignSelf: 'center', color: t.colors.$colorMutedForeground })}
17-
elementDescriptor={descriptors.paymentSourceRowIcon}
17+
elementDescriptor={descriptors.paymentMethodRowIcon}
1818
/>
1919
<Text
2020
sx={t => ({ color: t.colors.$colorForeground, textTransform: 'capitalize' })}
2121
truncate
22-
elementDescriptor={descriptors.paymentSourceRowType}
22+
elementDescriptor={descriptors.paymentMethodRowType}
2323
>
2424
{/* TODO(@COMMERCE): Localize this */}
2525
{paymentSource.paymentType === 'card' ? paymentSource.cardType : paymentSource.paymentType}
@@ -28,21 +28,21 @@ export const PaymentSourceRow = ({ paymentSource }: { paymentSource: BillingPaym
2828
sx={t => ({ color: t.colors.$colorMutedForeground })}
2929
variant='caption'
3030
truncate
31-
elementDescriptor={descriptors.paymentSourceRowValue}
31+
elementDescriptor={descriptors.paymentMethodRowValue}
3232
>
3333
{paymentSource.paymentType === 'card' ? `⋯ ${paymentSource.last4}` : null}
3434
</Text>
3535
{paymentSource.isDefault && (
3636
<Badge
37-
elementDescriptor={descriptors.paymentSourceRowBadge}
38-
elementId={descriptors.paymentSourceRowBadge.setId('default')}
37+
elementDescriptor={descriptors.paymentMethodRowBadge}
38+
elementId={descriptors.paymentMethodRowBadge.setId('default')}
3939
localizationKey={localizationKeys('badge__default')}
4040
/>
4141
)}
4242
{paymentSource.status === 'expired' && (
4343
<Badge
44-
elementDescriptor={descriptors.paymentSourceRowBadge}
45-
elementId={descriptors.paymentSourceRowBadge.setId('expired')}
44+
elementDescriptor={descriptors.paymentMethodRowBadge}
45+
elementId={descriptors.paymentMethodRowBadge.setId('expired')}
4646
colorScheme='danger'
4747
localizationKey={localizationKeys('badge__expired')}
4848
/>

packages/clerk-js/src/ui/components/PaymentSources/PaymentSources.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const PaymentSources = withCardStateProvider(() => {
129129
<ProfileSection.Root
130130
title={localizationKeys(`${localizationRoot}.billingPage.paymentSourcesSection.title`)}
131131
centered={false}
132-
id='paymentSources'
132+
id='paymentMethods'
133133
sx={t => ({
134134
flex: 1,
135135
borderTopWidth: t.borderWidths.$normal,
@@ -139,7 +139,7 @@ export const PaymentSources = withCardStateProvider(() => {
139139
>
140140
<Action.Root>
141141
<ProfileSection.ItemList
142-
id='paymentSources'
142+
id='paymentMethods'
143143
disableAnimation
144144
>
145145
{isLoading ? (
@@ -148,7 +148,7 @@ export const PaymentSources = withCardStateProvider(() => {
148148
<>
149149
{sortedPaymentSources.map(paymentSource => (
150150
<Fragment key={paymentSource.id}>
151-
<ProfileSection.Item id='paymentSources'>
151+
<ProfileSection.Item id='paymentMethods'>
152152
<PaymentSourceRow paymentSource={paymentSource} />
153153
<PaymentSourceMenu
154154
paymentSource={paymentSource}
@@ -170,7 +170,7 @@ export const PaymentSources = withCardStateProvider(() => {
170170
<>
171171
<Action.Trigger value='add'>
172172
<ProfileSection.ArrowButton
173-
id='paymentSources'
173+
id='paymentMethods'
174174
localizationKey={localizationKeys(`${localizationRoot}.billingPage.paymentSourcesSection.add`)}
175175
/>
176176
</Action.Trigger>

packages/clerk-js/src/ui/customizables/elementDescriptors.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,12 @@ export const APPEARANCE_KEYS = containsAllElementsConfigKeys([
360360
'selectOptionsContainer',
361361
'selectOption',
362362

363-
'paymentSourceRow',
364-
'paymentSourceRowIcon',
365-
'paymentSourceRowText',
366-
'paymentSourceRowType',
367-
'paymentSourceRowValue',
368-
'paymentSourceRowBadge',
363+
'paymentMethodRow',
364+
'paymentMethodRowIcon',
365+
'paymentMethodRowText',
366+
'paymentMethodRowType',
367+
'paymentMethodRowValue',
368+
'paymentMethodRowBadge',
369369

370370
'statementRoot',
371371
'statementHeader',

packages/types/src/appearance.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -493,12 +493,12 @@ export type ElementsConfig = {
493493
selectOptionsContainer: WithOptions<SelectId>;
494494
selectOption: WithOptions<SelectId>;
495495

496-
paymentSourceRow: WithOptions;
497-
paymentSourceRowIcon: WithOptions;
498-
paymentSourceRowText: WithOptions;
499-
paymentSourceRowType: WithOptions;
500-
paymentSourceRowValue: WithOptions;
501-
paymentSourceRowBadge: WithOptions<'default' | 'expired'>;
496+
paymentMethodRow: WithOptions;
497+
paymentMethodRowIcon: WithOptions;
498+
paymentMethodRowText: WithOptions;
499+
paymentMethodRowType: WithOptions;
500+
paymentMethodRowValue: WithOptions;
501+
paymentMethodRowBadge: WithOptions<'default' | 'expired'>;
502502

503503
statementRoot: WithOptions;
504504
statementHeader: WithOptions;

packages/types/src/elementIds.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export type ProfileSectionId =
4343
| 'organizationDomains'
4444
| 'manageVerifiedDomains'
4545
| 'subscriptionsList'
46-
| 'paymentSources';
46+
| 'paymentMethods';
4747
export type ProfilePageId = 'account' | 'security' | 'organizationGeneral' | 'organizationMembers' | 'billing';
4848

4949
export type UserPreviewId = 'userButton' | 'personalWorkspace';

0 commit comments

Comments
 (0)