@@ -93,10 +93,6 @@ const CheckoutFormElements = ({
93
93
const { __experimental_commerce } = useClerk ( ) ;
94
94
const { organization } = useOrganization ( ) ;
95
95
const { subscriberType } = useCheckoutContext ( ) ;
96
- const [ openAccountFundsDropDown , setOpenAccountFundsDropDown ] = useState ( true ) ;
97
- const [ openAddNewSourceDropDown , setOpenAddNewSourceDropDown ] = useState ( true ) ;
98
- const [ isSubmitting , setIsSubmitting ] = useState ( false ) ;
99
- const [ submitError , setSubmitError ] = useState < ClerkRuntimeError | ClerkAPIError | string | undefined > ( ) ;
100
96
101
97
const { data } = useFetch (
102
98
__experimental_commerce ?. getPaymentSources ,
@@ -106,6 +102,12 @@ const CheckoutFormElements = ({
106
102
undefined ,
107
103
'commerce-payment-sources' ,
108
104
) ;
105
+
106
+ const [ openAccountFundsDropDown , setOpenAccountFundsDropDown ] = useState ( true ) ;
107
+ const [ openAddNewSourceDropDown , setOpenAddNewSourceDropDown ] = useState ( ( data ?. data . length || 0 ) === 0 ) ;
108
+ const [ isSubmitting , setIsSubmitting ] = useState ( false ) ;
109
+ const [ submitError , setSubmitError ] = useState < ClerkRuntimeError | ClerkAPIError | string | undefined > ( ) ;
110
+
109
111
const { data : paymentSources } = data || { data : [ ] } ;
110
112
111
113
const confirmCheckout = async ( { paymentSourceId } : { paymentSourceId : string } ) => {
@@ -160,7 +162,7 @@ const CheckoutFormElements = ({
160
162
onOpenChange = { setOpenAccountFundsDropDown }
161
163
>
162
164
{ /* TODO(@Commerce): needs localization */ }
163
- < Disclosure . Trigger text = 'Account Funds ' />
165
+ < Disclosure . Trigger text = 'Payment Sources ' />
164
166
< Disclosure . Content >
165
167
< Col gap = { 3 } >
166
168
< PaymentSourceMethods
@@ -181,8 +183,9 @@ const CheckoutFormElements = ({
181
183
open = { openAddNewSourceDropDown }
182
184
onOpenChange = { setOpenAddNewSourceDropDown }
183
185
>
184
- { /* TODO(@Commerce): needs localization */ }
185
- < Disclosure . Trigger text = 'Add a New Payment Source' />
186
+ < Disclosure . Trigger
187
+ text = { localizationKeys ( 'userProfile.__experimental_billingPage.paymentSourcesSection.add' ) }
188
+ />
186
189
< Disclosure . Content >
187
190
< __experimental_PaymentSourcesContext . Provider value = { { componentName : 'PaymentSources' , subscriberType } } >
188
191
< AddPaymentSource
0 commit comments