Files
cozsweet-frontend-nextjs/src/stores/payment/payment-state.ts
T
Codex abb6e4235f
Docker Image / Quality and Bundle Budgets (push) Successful in 3s
Docker Image / Build and Push Docker Image (push) Successful in 1m52s
Add chat gifts and relationship diary UI
2026-07-21 18:35:01 +08:00

65 lines
1.6 KiB
TypeScript

/** Context shared by the default and Tip payment catalogs. */
import type {
GiftCategory,
GiftOffer,
GiftProduct,
PayChannel,
PaymentOrderStatus,
PaymentPlan,
TipMessageResponse,
} from "@/data/schemas/payment";
export type PaymentPlanCatalog = "default" | "tip";
export interface PaymentState {
planCatalog: PaymentPlanCatalog;
plans: readonly PaymentPlan[];
giftCategories: readonly GiftCategory[];
giftOffer: GiftOffer | null;
giftProducts: readonly GiftProduct[];
giftCharacterId: string | null;
selectedGiftCategory: string | null;
requestedGiftCategory: string | null;
requestedGiftPlanId: string | null;
isFirstRecharge: boolean;
selectedPlanId: string;
payChannel: PayChannel;
autoRenew: boolean;
agreed: boolean;
currentOrderId: string | null;
currentOrderPlanId: string | null;
payParams: Record<string, unknown> | null;
orderStatus: PaymentOrderStatus | null;
tipMessage: TipMessageResponse | null;
tipMessageError: string | null;
orderPollingStartedAt: number | null;
errorMessage: string | null;
launchNonce: number;
}
export const initialState: PaymentState = {
planCatalog: "default",
plans: [],
giftCategories: [],
giftOffer: null,
giftProducts: [],
giftCharacterId: null,
selectedGiftCategory: null,
requestedGiftCategory: null,
requestedGiftPlanId: null,
isFirstRecharge: false,
selectedPlanId: "",
payChannel: "stripe",
autoRenew: true,
agreed: true,
currentOrderId: null,
currentOrderPlanId: null,
payParams: null,
orderStatus: null,
tipMessage: null,
tipMessageError: null,
orderPollingStartedAt: null,
errorMessage: null,
launchNonce: 0,
};