feat(chat): unlock paid messages before payment
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
import type { UiMessage } from "@/data/dto/chat";
|
||||
import type { PendingChatUnlockKind } from "@/lib/navigation/chat_unlock_session";
|
||||
|
||||
export type ChatUpgradeReason = "weekly_limit" | "insufficient_credits";
|
||||
|
||||
export interface ChatUnlockPaywallRequest {
|
||||
messageId: string;
|
||||
kind: PendingChatUnlockKind;
|
||||
reason: string;
|
||||
creditBalance: number;
|
||||
requiredCredits: number;
|
||||
shortfallCredits: number;
|
||||
}
|
||||
|
||||
export interface ChatState {
|
||||
messages: UiMessage[];
|
||||
isReplyingAI: boolean;
|
||||
@@ -27,6 +37,11 @@ export interface ChatState {
|
||||
lockedHistoryCount: number;
|
||||
isUnlockingHistory: boolean;
|
||||
unlockHistoryError: string | null;
|
||||
isUnlockingMessage: boolean;
|
||||
unlockingMessageId: string | null;
|
||||
unlockingMessageKind: PendingChatUnlockKind | null;
|
||||
unlockMessageError: string | null;
|
||||
unlockPaywallRequest: ChatUnlockPaywallRequest | null;
|
||||
}
|
||||
|
||||
export const initialState: ChatState = {
|
||||
@@ -50,4 +65,9 @@ export const initialState: ChatState = {
|
||||
lockedHistoryCount: 0,
|
||||
isUnlockingHistory: false,
|
||||
unlockHistoryError: null,
|
||||
isUnlockingMessage: false,
|
||||
unlockingMessageId: null,
|
||||
unlockingMessageKind: null,
|
||||
unlockMessageError: null,
|
||||
unlockPaywallRequest: null,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user