diff --git a/src/app/chat/__tests__/chat-screen.helpers.test.ts b/src/app/chat/__tests__/chat-screen.helpers.test.ts index 9c8de28a..8444766d 100644 --- a/src/app/chat/__tests__/chat-screen.helpers.test.ts +++ b/src/app/chat/__tests__/chat-screen.helpers.test.ts @@ -11,35 +11,13 @@ afterEach(() => { }); describe("getInsufficientCreditsMessageLimitView", () => { - it("asks guests to log in for more free chats", () => { - expect(getInsufficientCreditsMessageLimitView("guest")).toEqual({ - title: "Log in to get more free chats", + it("shows the same top-up prompt without checking login status", () => { + expect(getInsufficientCreditsMessageLimitView()).toEqual({ + title: "Insufficient credits", description: "Free chats refresh every day.", - ctaLabel: "Log in to continue", - action: "auth", + ctaLabel: "Top up credits to continue", }); }); - - it("treats the transient not logged in state like guest", () => { - expect(getInsufficientCreditsMessageLimitView("notLoggedIn")).toEqual({ - title: "Log in to get more free chats", - description: "Free chats refresh every day.", - ctaLabel: "Log in to continue", - action: "auth", - }); - }); - - it.each(["email", "facebook", "google"] as const)( - "asks %s users to top up credits", - (loginStatus) => { - expect(getInsufficientCreditsMessageLimitView(loginStatus)).toEqual({ - title: "Insufficient credits", - description: "Free chats refresh every day.", - ctaLabel: "Top up credits to continue", - action: "topup", - }); - }, - ); }); describe("shouldShowMessageLimitBanner", () => { diff --git a/src/app/chat/chat-screen.helpers.ts b/src/app/chat/chat-screen.helpers.ts index c932d89e..3da5447d 100644 --- a/src/app/chat/chat-screen.helpers.ts +++ b/src/app/chat/chat-screen.helpers.ts @@ -12,13 +12,10 @@ export interface ExternalBrowserPromptState { isInAppBrowser?: boolean; } -export type InsufficientCreditsAction = "auth" | "topup"; - export interface InsufficientCreditsMessageLimitView { title: string; description: string; ctaLabel: string; - action: InsufficientCreditsAction; } export interface MessageLimitBannerState { @@ -37,23 +34,12 @@ export function shouldShowMessageLimitBanner({ return upgradePromptVisible && upgradeReason === "insufficient_credits"; } -export function getInsufficientCreditsMessageLimitView( - loginStatus: LoginStatus, -): InsufficientCreditsMessageLimitView { - if (loginStatus === "guest" || loginStatus === "notLoggedIn") { - return { - title: "Log in to get more free chats", - description: "Free chats refresh every day.", - ctaLabel: "Log in to continue", - action: "auth", - }; - } - +export function getInsufficientCreditsMessageLimitView(): + InsufficientCreditsMessageLimitView { return { title: "Insufficient credits", description: "Free chats refresh every day.", ctaLabel: "Top up credits to continue", - action: "topup", }; } diff --git a/src/app/chat/chat-screen.tsx b/src/app/chat/chat-screen.tsx index 32da0f6d..aed2ca33 100644 --- a/src/app/chat/chat-screen.tsx +++ b/src/app/chat/chat-screen.tsx @@ -88,7 +88,6 @@ export function ChatScreen() { const messageLimitBanner = useChatMessageLimitBanner({ upgradePromptVisible: state.upgradePromptVisible, upgradeReason: state.upgradeReason, - loginStatus: authState.loginStatus, }); const firstRechargeOfferBanner = useFirstRechargeOfferBanner({ historyLoaded: state.historyLoaded, diff --git a/src/app/chat/hooks/use-chat-message-limit-banner.ts b/src/app/chat/hooks/use-chat-message-limit-banner.ts index a3604197..1bc5d6c7 100644 --- a/src/app/chat/hooks/use-chat-message-limit-banner.ts +++ b/src/app/chat/hooks/use-chat-message-limit-banner.ts @@ -2,9 +2,7 @@ import { useEffect, useRef } from "react"; -import type { LoginStatus } from "@/data/dto/auth"; import { behaviorAnalytics } from "@/lib/analytics"; -import { ROUTES } from "@/router/routes"; import { useAppNavigator } from "@/router/use-app-navigator"; import type { ChatUpgradeReason } from "@/stores/chat/chat-state"; import { useUserSelector } from "@/stores/user/user-context"; @@ -19,7 +17,6 @@ import { export interface UseChatMessageLimitBannerInput { upgradePromptVisible: boolean; upgradeReason: ChatUpgradeReason | null; - loginStatus: LoginStatus; } export interface ChatMessageLimitBannerView @@ -31,11 +28,10 @@ export interface ChatMessageLimitBannerView export function useChatMessageLimitBanner({ upgradePromptVisible, upgradeReason, - loginStatus, }: UseChatMessageLimitBannerInput): ChatMessageLimitBannerView { const navigator = useAppNavigator(); const isVip = useUserSelector((state) => state.context.isVip); - const view = getInsufficientCreditsMessageLimitView(loginStatus); + const view = getInsufficientCreditsMessageLimitView(); const visible = shouldShowMessageLimitBanner({ upgradePromptVisible, upgradeReason, @@ -59,11 +55,6 @@ export function useChatMessageLimitBanner({ }, [isVip, visible]); function unlock(): void { - if (view.action === "auth") { - navigator.openAuth(ROUTES.chat); - return; - } - navigator.openSubscription({ type: getInsufficientCreditsSubscriptionType(isVip), returnTo: "chat",