Files
cozsweet-frontend-nextjs/src/stores/private-zone/private-zone-state.ts
T
Codex 8c0d1ad3ce
Docker Image / Build and Push Docker Image (push) Successful in 5m2s
feat(chat): render role-bound payment guidance
2026-07-27 18:21:13 +08:00

47 lines
1.3 KiB
TypeScript

import { DEFAULT_CHARACTER_ID } from "@/data/constants/character";
import type { PrivateAlbum } from "@/data/schemas/private-zone";
import type { PaymentGuidance } from "@/data/schemas/chat";
export interface PrivateZoneUnlockPaywallRequest {
albumId: string;
reason: string;
requiredCredits: number;
currentCredits: number;
shortfallCredits: number;
paymentGuidance?: PaymentGuidance | null;
}
export interface PrivateZoneState {
characterId: string;
items: readonly PrivateAlbum[];
creditBalance: number;
pendingImageCount: number;
hasIncompleteContent: boolean;
errorMessage: string | null;
unlockingAlbumId: string | null;
unlockErrorMessage: string | null;
pendingConfirmAlbumId: string | null;
unlockPaywallRequest: PrivateZoneUnlockPaywallRequest | null;
unlockSuccessNonce: number;
}
export function createInitialPrivateZoneState(
characterId: string,
): PrivateZoneState {
return {
characterId,
items: [],
creditBalance: 0,
pendingImageCount: 0,
hasIncompleteContent: false,
errorMessage: null,
unlockingAlbumId: null,
unlockErrorMessage: null,
pendingConfirmAlbumId: null,
unlockPaywallRequest: null,
unlockSuccessNonce: 0,
};
}
export const initialState = createInitialPrivateZoneState(DEFAULT_CHARACTER_ID);