47 lines
1.3 KiB
TypeScript
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);
|