65 lines
1.6 KiB
TypeScript
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,
|
|
};
|