|
|
@ -24,7 +24,7 @@ export function BillingPage() { |
|
|
|
const [showUpgradeModal, setShowUpgradeModal] = useState(false); |
|
|
|
const [showUpgradeModal, setShowUpgradeModal] = useState(false); |
|
|
|
const [showVerifyUpgradeModal, setShowVerifyUpgradeModal] = useState(false); |
|
|
|
const [showVerifyUpgradeModal, setShowVerifyUpgradeModal] = useState(false); |
|
|
|
|
|
|
|
|
|
|
|
const { data: billingDetails, isPending } = useQuery( |
|
|
|
const { data: billingDetails, isPending: isLoadingBillingDetails } = useQuery( |
|
|
|
billingDetailsOptions(), |
|
|
|
billingDetailsOptions(), |
|
|
|
queryClient, |
|
|
|
queryClient, |
|
|
|
); |
|
|
|
); |
|
|
@ -50,7 +50,7 @@ export function BillingPage() { |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (isPending) { |
|
|
|
if (isLoadingBillingDetails) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -59,9 +59,9 @@ export function BillingPage() { |
|
|
|
if (shouldVerifyUpgrade) { |
|
|
|
if (shouldVerifyUpgrade) { |
|
|
|
setShowVerifyUpgradeModal(true); |
|
|
|
setShowVerifyUpgradeModal(true); |
|
|
|
} |
|
|
|
} |
|
|
|
}, [isPending]); |
|
|
|
}, [isLoadingBillingDetails]); |
|
|
|
|
|
|
|
|
|
|
|
if (isPending || !billingDetails) { |
|
|
|
if (isLoadingBillingDetails || !billingDetails) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -98,7 +98,7 @@ export function BillingPage() { |
|
|
|
|
|
|
|
|
|
|
|
{showVerifyUpgradeModal && <VerifyUpgrade />} |
|
|
|
{showVerifyUpgradeModal && <VerifyUpgrade />} |
|
|
|
|
|
|
|
|
|
|
|
{billingDetails?.status === 'none' && !isPending && ( |
|
|
|
{billingDetails?.status === 'none' && !isLoadingBillingDetails && ( |
|
|
|
<div className="flex h-full w-full flex-col"> |
|
|
|
<div className="flex h-full w-full flex-col"> |
|
|
|
<p className="text-gray-800"> |
|
|
|
<p className="text-gray-800"> |
|
|
|
You are using free plan, |
|
|
|
You are using free plan, |
|
|
@ -114,12 +114,12 @@ export function BillingPage() { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)} |
|
|
|
)} |
|
|
|
|
|
|
|
|
|
|
|
{billingDetails?.status !== 'none' && !isPending && ( |
|
|
|
{billingDetails?.status !== 'none' && !isLoadingBillingDetails && ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
{billingDetails?.status === 'past_due' && ( |
|
|
|
{billingDetails?.status === 'past_due' && ( |
|
|
|
<div className="mb-4 rounded-md border border-red-300 bg-red-50 p-2 text-red-500"> |
|
|
|
<div className="mb-4 rounded-md border border-red-300 bg-red-50 p-2 text-sm text-red-500"> |
|
|
|
Your subscription is past due. Please update your payment |
|
|
|
We were not able to charge your card. Please update your payment |
|
|
|
information from the Stripe Portal. |
|
|
|
information. |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)} |
|
|
|
)} |
|
|
|
|
|
|
|
|
|
|
|