feat(chat): tailor insufficient credits guidance
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user