feat(chat): add promotional external entry flow

This commit is contained in:
2026-07-13 12:43:18 +08:00
parent e5ee9940ca
commit 3752b3b729
44 changed files with 1623 additions and 190 deletions
+16 -1
View File
@@ -1,11 +1,18 @@
import type { UiMessage } from "@/data/dto/chat";
import type { PendingChatUnlockKind } from "@/lib/navigation/chat_unlock_session";
import type { ChatLockType } from "@/data/schemas/chat";
import type { PendingChatPromotion } from "@/data/storage/navigation";
import type { ChatPromotionState } from "./chat-promotion";
export type ChatUpgradeReason = "insufficient_credits";
export interface ChatUnlockPaywallRequest {
messageId: string;
displayMessageId: string;
messageId?: string;
kind: PendingChatUnlockKind;
lockType?: ChatLockType;
clientLockId?: string;
promotion?: PendingChatPromotion;
reason: string;
creditBalance: number;
requiredCredits: number;
@@ -14,6 +21,7 @@ export interface ChatUnlockPaywallRequest {
export interface ChatState {
messages: UiMessage[];
promotion: ChatPromotionState | null;
isReplyingAI: boolean;
pendingReplyCount: number;
upgradePromptVisible: boolean;
@@ -40,12 +48,16 @@ export interface ChatState {
isUnlockingMessage: boolean;
unlockingMessageId: string | null;
unlockingMessageKind: PendingChatUnlockKind | null;
unlockingRemoteMessageId: string | null;
unlockingLockType: ChatLockType | null;
unlockingClientLockId: string | null;
unlockMessageError: string | null;
unlockPaywallRequest: ChatUnlockPaywallRequest | null;
}
export const initialState: ChatState = {
messages: [],
promotion: null,
isReplyingAI: false,
pendingReplyCount: 0,
upgradePromptVisible: false,
@@ -68,6 +80,9 @@ export const initialState: ChatState = {
isUnlockingMessage: false,
unlockingMessageId: null,
unlockingMessageKind: null,
unlockingRemoteMessageId: null,
unlockingLockType: null,
unlockingClientLockId: null,
unlockMessageError: null,
unlockPaywallRequest: null,
};