feat(chat): handle credit-gated send responses
This commit is contained in:
@@ -84,8 +84,26 @@ export function getChatPaywallSubscriptionUrl(): string {
|
||||
});
|
||||
}
|
||||
|
||||
export function getChatPaywallNavigationUrl(loginStatus: LoginStatus): string {
|
||||
const subscriptionUrl = getChatPaywallSubscriptionUrl();
|
||||
export function getChatCreditsTopUpSubscriptionUrl(): string {
|
||||
return ROUTE_BUILDERS.subscription("topup", {
|
||||
returnTo: "chat",
|
||||
});
|
||||
}
|
||||
|
||||
export function getInsufficientCreditsSubscriptionType(
|
||||
isVip: boolean,
|
||||
): "vip" | "topup" {
|
||||
return isVip ? "topup" : "vip";
|
||||
}
|
||||
|
||||
export function getChatPaywallNavigationUrl(
|
||||
loginStatus: LoginStatus,
|
||||
type: "vip" | "topup" = "vip",
|
||||
): string {
|
||||
const subscriptionUrl =
|
||||
type === "topup"
|
||||
? getChatCreditsTopUpSubscriptionUrl()
|
||||
: getChatPaywallSubscriptionUrl();
|
||||
if (deriveIsGuest(loginStatus)) {
|
||||
return ROUTE_BUILDERS.authWithRedirect(subscriptionUrl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user