File tree Expand file tree Collapse file tree 4 files changed +13
-3
lines changed
apps/studio/components/interfaces
Organization/BillingSettings/Subscription Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ interface AddNewPaymentMethodModalProps {
1818 onCancel : ( ) => void
1919 onConfirm : ( ) => void
2020 showSetDefaultCheckbox ?: boolean
21+ autoMarkAsDefaultPaymentMethod ?: boolean
2122}
2223
2324const stripePromise = loadStripe ( STRIPE_PUBLIC_KEY )
@@ -28,6 +29,7 @@ const AddNewPaymentMethodModal = ({
2829 onCancel,
2930 onConfirm,
3031 showSetDefaultCheckbox,
32+ autoMarkAsDefaultPaymentMethod,
3133} : AddNewPaymentMethodModalProps ) => {
3234 const { resolvedTheme } = useTheme ( )
3335 const [ intent , setIntent ] = useState < any > ( )
@@ -140,6 +142,7 @@ const AddNewPaymentMethodModal = ({
140142 onCancel = { onLocalCancel }
141143 onConfirm = { onLocalConfirm }
142144 showSetDefaultCheckbox = { showSetDefaultCheckbox }
145+ autoMarkAsDefaultPaymentMethod = { autoMarkAsDefaultPaymentMethod }
143146 />
144147 </ Elements >
145148 </ Modal >
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ interface AddPaymentMethodFormProps {
1212 onCancel : ( ) => void
1313 onConfirm : ( ) => void
1414 showSetDefaultCheckbox ?: boolean
15+ autoMarkAsDefaultPaymentMethod ?: boolean
1516}
1617
1718// Stripe docs recommend to use the new SetupIntent flow over
@@ -23,6 +24,7 @@ const AddPaymentMethodForm = ({
2324 onCancel,
2425 onConfirm,
2526 showSetDefaultCheckbox = false ,
27+ autoMarkAsDefaultPaymentMethod = false ,
2628} : AddPaymentMethodFormProps ) => {
2729 const stripe = useStripe ( )
2830 const elements = useElements ( )
@@ -59,7 +61,11 @@ const AddPaymentMethodForm = ({
5961 setIsSaving ( false )
6062 toast . error ( error ?. message ?? ' Failed to save card details' )
6163 } else {
62- if ( isDefault && selectedOrganization && typeof setupIntent ?. payment_method === 'string' ) {
64+ if (
65+ ( isDefault || autoMarkAsDefaultPaymentMethod ) &&
66+ selectedOrganization &&
67+ typeof setupIntent ?. payment_method === 'string'
68+ ) {
6369 try {
6470 await markAsDefault ( {
6571 slug : selectedOrganization . slug ,
Original file line number Diff line number Diff line change @@ -150,6 +150,7 @@ const PaymentMethodSelection = ({
150150 visible = { showAddNewPaymentMethodModal }
151151 returnUrl = { `${ getURL ( ) } /org/${ selectedOrganization ?. slug } /billing?panel=subscriptionPlan` }
152152 onCancel = { ( ) => setShowAddNewPaymentMethodModal ( false ) }
153+ autoMarkAsDefaultPaymentMethod = { true }
153154 onConfirm = { async ( ) => {
154155 setShowAddNewPaymentMethodModal ( false )
155156 toast . success ( 'Successfully added new payment method' )
Original file line number Diff line number Diff line change @@ -147,9 +147,9 @@ const Subscription = () => {
147147 title = "This organization is limited by the included usage"
148148 >
149149 < div className = "[&>p]:!leading-normal prose text-sm" >
150- Projects may become unresponsive when this organization exceeds its
150+ Projects may become unresponsive when this organization exceeds its{ ' ' }
151151 < Link href = { `/org/${ slug } /usage` } > included usage quota</ Link > . To scale
152- seamlessly and pay for over-usage, $
152+ seamlessly and pay for over-usage,{ ' ' }
153153 { currentPlan ?. id === 'free'
154154 ? 'upgrade to a paid plan.'
155155 : 'you can disable Spend Cap under the Cost Control settings.' }
You can’t perform that action at this time.
0 commit comments