From 8f714488fc5d21725f9a8d1286326f38c7b9608c Mon Sep 17 00:00:00 2001
From: Filip Naumovski
Date: Thu, 6 Jul 2023 13:11:04 +0200
Subject: [PATCH] fix: hide cancel button for inplayer configs
---
src/components/Payment/Payment.tsx | 9 ++++++---
src/pages/User/__snapshots__/User.test.tsx.snap | 7 -------
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/components/Payment/Payment.tsx b/src/components/Payment/Payment.tsx
index a3099d837..bd0e1f201 100644
--- a/src/components/Payment/Payment.tsx
+++ b/src/components/Payment/Payment.tsx
@@ -197,7 +197,7 @@ const Payment = ({
{activeSubscription.status === 'active' && !isGrantedSubscription && !pendingDowngradeOfferId
? t('user:payment.next_billing_date_on', { date: formatLocalizedDate(new Date(activeSubscription.expiresAt * 1000), i18n.language) })
: t('user:payment.subscription_expires_on', { date: formatLocalizedDate(new Date(activeSubscription.expiresAt * 1000), i18n.language) })}
- {(pendingOffer || pendingDowngradeOfferId) && (
+ {(pendingOffer || pendingDowngradeOfferId) && activeSubscription.status !== 'cancelled' && (
{t('user:payment.pending_offer_switch', {
title: getTitle(pendingOffer?.period || offers.find((offer) => offer.offerId === pendingDowngradeOfferId)?.period || 'month'),
@@ -218,7 +218,7 @@ const Payment = ({
className={styles.upgradeSubscription}
label={t('user:payment.change_subscription')}
onClick={() => {
- if (offers.length > 1) {
+ if (offers.length > 1 && !canRenewSubscription) {
setIsChangingOffer(true);
} else {
onUpgradeSubscriptionClick?.();
@@ -229,7 +229,10 @@ const Payment = ({
data-testid="change-subscription-button"
/>
)}
- {activeSubscription.status === 'active' && !isGrantedSubscription && !isChangingOffer ? (
+ {(activeSubscription.status === 'active' || activeSubscription.status === 'active_trial') &&
+ !isGrantedSubscription &&
+ !isChangingOffer &&
+ canRenewSubscription ? (
) : canRenewSubscription ? (
diff --git a/src/pages/User/__snapshots__/User.test.tsx.snap b/src/pages/User/__snapshots__/User.test.tsx.snap
index 7001fd16d..57a82bea3 100644
--- a/src/pages/User/__snapshots__/User.test.tsx.snap
+++ b/src/pages/User/__snapshots__/User.test.tsx.snap
@@ -650,13 +650,6 @@ exports[`User Component tests > Payments Page 1`] = `
-