Skip to content

Commit 588b262

Browse files
committed
[Web] Allow changing credit card
1 parent ce61254 commit 588b262

3 files changed

Lines changed: 19 additions & 13 deletions

File tree

packages/components/src/components/modals/PricingModal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ export function PricingModal(props: PricingModalProps) {
316316
<SubHeader
317317
title={
318318
userPlanDetails && userPlanDetails.amount
319-
? 'CHANGE PLAN'
319+
? userPlanDetails.id === selectedPlanId
320+
? 'CHANGE CREDIT CARD'
321+
: 'CHANGE PLAN'
320322
: 'SELECT A PLAN'
321323
}
322324
/>
@@ -347,9 +349,7 @@ export function PricingModal(props: PricingModalProps) {
347349
analyticsCategory="subscribe"
348350
analyticsAction="subscribe"
349351
analyticsLabel="subscribe"
350-
disabled={
351-
!selectedPlan || selectedPlan.id === (userPlan && userPlan.id)
352-
}
352+
disabled={!selectedPlan}
353353
onPress={() => {
354354
if (!(selectedPlan && selectedPlan.id)) return
355355

@@ -372,7 +372,7 @@ export function PricingModal(props: PricingModalProps) {
372372
{selectedPlan
373373
? selectedPlan.amount > 0
374374
? userPlan && userPlan.id === selectedPlan.id
375-
? 'You are on this plan'
375+
? 'Change credit card'
376376
: 'Continue'
377377
: userPlan && userPlan.amount > 0
378378
? 'Downgrade to free plan'

packages/components/src/components/modals/SubscribeModal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,14 @@ export function SubscribeModal(props: SubscribeModalProps) {
7575
: 'Cancel subscription'
7676
: plan.amount < userPlan.amount
7777
? 'Downgrade plan'
78+
: userPlan.id === plan.id
79+
? 'Change credit card'
7880
: 'Change plan'
7981
: 'Subscribe'
8082
}
8183
>
8284
<>
83-
{!!(plan && plan.amount) && (
85+
{!!(plan && plan.amount && !(userPlan && userPlan.id === plan.id)) && (
8486
<>
8587
<SubHeader title="Review your choice" />
8688

packages/components/src/components/modals/partials/SubscribeForm.web.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,17 @@ const SubscribeFormWithStripe = React.memo(
480480
>
481481
{plan
482482
? plan.amount > 0
483-
? `${
484-
userPlan && userPlan.amount && userPlan.amount < plan.amount
485-
? 'Upgrade to'
486-
: userPlan && userPlan.amount > plan.amount
487-
? 'Downgrade to'
488-
: 'Unlock for'
489-
} ${formatPriceAndInterval(plan.amount, plan)}`
483+
? userPlan && userPlan.id === plan.id
484+
? 'Change credit card'
485+
: `${
486+
userPlan &&
487+
userPlan.amount &&
488+
userPlan.amount < plan.amount
489+
? 'Upgrade to'
490+
: userPlan && userPlan.amount > plan.amount
491+
? 'Downgrade to'
492+
: 'Unlock for'
493+
} ${formatPriceAndInterval(plan.amount, plan)}`
490494
: userPlan && userPlan.amount > 0
491495
? 'Confirm downgrade to free plan'
492496
: 'Subscribe'

0 commit comments

Comments
 (0)