feat(chat): tailor insufficient credits guidance

This commit is contained in:
2026-07-08 11:15:32 +08:00
parent 43e5cc95af
commit 6b8345e318
5 changed files with 91 additions and 6 deletions
+29
View File
@@ -9,10 +9,39 @@ export interface ExternalBrowserPromptState {
loginStatus: LoginStatus;
}
export type InsufficientCreditsAction = "auth" | "topup";
export interface InsufficientCreditsMessageLimitView {
title: string;
description: string;
ctaLabel: string;
action: InsufficientCreditsAction;
}
export function deriveIsGuest(loginStatus: LoginStatus): boolean {
return loginStatus === "guest";
}
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. Log in to get more chances.",
ctaLabel: "Log in to continue",
action: "auth",
};
}
return {
title: "Insufficient credits",
description: "Free chats refresh every day. You can also top up credits now.",
ctaLabel: "Top up credits to continue",
action: "topup",
};
}
export function isChatDevelopmentEnvironment(): boolean {
return AppEnvUtil.isDevelopment();
}