From 50df3eda0f9191dc76d1caca373d04faba24d07b Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Mon, 7 Apr 2025 19:58:58 +0100 Subject: [PATCH] Fix issue where in complete is shown as active subscription --- src/components/Billing/BillingPage.tsx | 60 ++++++++++++++++++-------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/src/components/Billing/BillingPage.tsx b/src/components/Billing/BillingPage.tsx index fb9f5b83b..48468694d 100644 --- a/src/components/Billing/BillingPage.tsx +++ b/src/components/Billing/BillingPage.tsx @@ -19,8 +19,10 @@ import { CreditCard, ArrowRightLeft, CircleX, + AlertCircle, } from 'lucide-react'; import { BillingWarning } from './BillingWarning'; +import { cn } from '../../lib/classname'; export type CreateCustomerPortalBody = {}; @@ -42,6 +44,7 @@ export function BillingPage() { const isCanceled = billingDetails?.status === 'canceled' || billingDetails?.cancelAtPeriodEnd; const isPastDue = billingDetails?.status === 'past_due'; + const isIncomplete = billingDetails?.status === 'incomplete'; const { mutate: createCustomerPortal, @@ -117,6 +120,19 @@ export function BillingPage() { !isLoadingBillingDetails && priceDetails && (
+ {isIncomplete && ( + { + createCustomerPortal({}); + }} + isLoading={ + isCreatingCustomerPortal || isCreatingCustomerPortalSuccess + } + /> + )} {isCanceled && (
- + Payment

@@ -170,27 +186,35 @@ export function BillingPage() {

-
-
-
- -
-
- - {billingDetails?.cancelAtPeriodEnd - ? 'Expires On' - : 'Renews On'} - -

- {formattedNextBillDate} -

+
+ {!isIncomplete && ( +
+
+ +
+
+ + {billingDetails?.cancelAtPeriodEnd + ? 'Expires On' + : 'Renews On'} + +

+ {formattedNextBillDate} +

+
-
+ )}
{!isCanceled && (