From 979ea68aba56f4c9d1759230df82588daf609128 Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp <15185355+baktun14@users.noreply.github.com> Date: Tue, 10 Dec 2024 09:58:32 -0500 Subject: [PATCH] fix(billing): hide banner if user has signed in with trial before --- apps/deploy-web/src/hooks/useHasCreditCardBanner.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/deploy-web/src/hooks/useHasCreditCardBanner.ts b/apps/deploy-web/src/hooks/useHasCreditCardBanner.ts index 01f42b118..30e69871e 100644 --- a/apps/deploy-web/src/hooks/useHasCreditCardBanner.ts +++ b/apps/deploy-web/src/hooks/useHasCreditCardBanner.ts @@ -3,6 +3,8 @@ import { useEffect, useMemo, useState } from "react"; import { browserEnvConfig } from "@src/config/browser-env.config"; import { useWallet } from "@src/context/WalletProvider"; import { useUser } from "./useUser"; +import { useAtom } from "jotai"; +import walletStore from "@src/store/walletStore"; const withBilling = browserEnvConfig.NEXT_PUBLIC_BILLING_ENABLED; @@ -11,8 +13,9 @@ export function useHasCreditCardBanner() { const [isBannerVisible, setIsBannerVisible] = useState(false); const [isInitialized, setIsInitialized] = useState(false); const { hasManagedWallet, isWalletLoading } = useWallet(); + const [isSignedInWithTrial] = useAtom(walletStore.isSignedInWithTrial); const shouldShowBanner = useMemo( - () => isInitialized && withBilling && !hasManagedWallet && !isWalletLoading, + () => isInitialized && withBilling && !hasManagedWallet && !isWalletLoading && !isSignedInWithTrial, [isInitialized, hasManagedWallet, isWalletLoading] );