Skip to content

Commit

Permalink
fix(billing): hide banner if user has signed in with trial before
Browse files Browse the repository at this point in the history
  • Loading branch information
baktun14 committed Dec 10, 2024
1 parent 3891eb6 commit 979ea68
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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]
);

Expand Down

0 comments on commit 979ea68

Please sign in to comment.