fix(billing): cancelled team sub on a different stop reads Change plan, not Resubscribe (FE-934)

This commit is contained in:
dante01yoon
2026-06-20 23:08:58 +09:00
parent 456cf7227e
commit 3d228e3306
2 changed files with 29 additions and 4 deletions

View File

@@ -170,6 +170,26 @@ describe('UnifiedPricingTable team plan CTA', () => {
expect(emitted().resubscribe).toBeTruthy()
})
it('changes plan (not re-subscribe) when a cancelled sub picks a different stop', async () => {
const user = userEvent.setup()
mockSubscription.value = {
tier: 'TEAM',
duration: 'ANNUAL',
isCancelled: true
}
mockCurrentTeamCreditStop.value = TEAM_STOP
const { emitted } = renderComponent({ initialPlanMode: 'team' })
await user.click(screen.getByTestId('team-slider'))
const cta = screen.getByRole('button', { name: 'Change plan' })
expect(cta).toBeEnabled()
await user.click(cta)
expect(emitted().subscribeTeam).toBeTruthy()
expect(emitted().resubscribe).toBeFalsy()
})
it('prompts a fresh subscribe when on no team plan', () => {
renderComponent({ initialPlanMode: 'team' })

View File

@@ -684,9 +684,13 @@ const teamButtonLabel = computed(() => {
? t('subscription.teamPlan.cta')
: t('subscription.teamPlan.ctaMonthly')
}
if (isCancelled.value) return t('subscription.resubscribe')
if (isTeamCurrentStopSelected.value)
return t('subscription.teamPlan.currentPlan')
// Only the current stop re-subscribes (cancelled) or reads "Current plan"
// (active); any other stop is a plan change.
if (isTeamCurrentStopSelected.value) {
return isCancelled.value
? t('subscription.resubscribe')
: t('subscription.teamPlan.currentPlan')
}
return t('subscription.teamPlan.changePlan')
})
@@ -811,7 +815,8 @@ function handleSubscribe(tierKey: CheckoutTierKey) {
function handleSubscribeTeam() {
if (isTeamButtonDisabled.value) return
if (isTeamSubscribed.value && isCancelled.value) {
// Re-subscribe only when keeping the current stop; a different stop is a change.
if (isCancelled.value && isTeamCurrentStopSelected.value) {
emit('resubscribe')
return
}