diff --git a/src/app/chat/components/pwa-install-overlay.tsx b/src/app/chat/components/pwa-install-overlay.tsx index 337ca233..be6f330b 100644 --- a/src/app/chat/components/pwa-install-overlay.tsx +++ b/src/app/chat/components/pwa-install-overlay.tsx @@ -26,7 +26,8 @@ export function PwaInstallOverlay() { let mounted = true; const init = async () => { - const isDev = AppEnvUtil.isDevelopment(); + // const isDev = AppEnvUtil.isDevelopment(); + const isDev = false; const shouldShowDialog = await shouldShowPwaInstallDialog(isDev); if (!shouldShowDialog) return; diff --git a/src/data/dto/payment/index.ts b/src/data/dto/payment/index.ts index 058dbf94..670dfeab 100644 --- a/src/data/dto/payment/index.ts +++ b/src/data/dto/payment/index.ts @@ -8,4 +8,3 @@ export * from "./payment_order_status_response"; export * from "./payment_plan"; export * from "./payment_plans_response"; export * from "./payment_vip_status_response"; -export * from "./payment_websocket_event"; diff --git a/src/data/dto/payment/payment_websocket_event.ts b/src/data/dto/payment/payment_websocket_event.ts deleted file mode 100644 index cf963b99..00000000 --- a/src/data/dto/payment/payment_websocket_event.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 支付 WebSocket 事件 DTO - */ -import { - PaymentWebSocketEventSchema, - type PaymentWebSocketEventData, - type PaymentWebSocketEventInput, -} from "@/data/schemas/payment/payment_websocket_event"; - -export class PaymentWebSocketEvent { - declare readonly type: PaymentWebSocketEventData["type"]; - declare readonly orderId: string; - - private constructor(input: PaymentWebSocketEventInput) { - const data = PaymentWebSocketEventSchema.parse(input); - Object.assign(this, data); - Object.freeze(this); - } - - static from(input: PaymentWebSocketEventInput): PaymentWebSocketEvent { - return new PaymentWebSocketEvent(input); - } - - static fromJson(json: unknown): PaymentWebSocketEvent { - return PaymentWebSocketEvent.from(json as PaymentWebSocketEventInput); - } - - toJson(): PaymentWebSocketEventData { - return PaymentWebSocketEventSchema.parse(this); - } -} - -export type { PaymentWebSocketEventData }; diff --git a/src/data/schemas/payment/index.ts b/src/data/schemas/payment/index.ts index 119c6cf2..b113cc1a 100644 --- a/src/data/schemas/payment/index.ts +++ b/src/data/schemas/payment/index.ts @@ -8,4 +8,3 @@ export * from "./payment_order_status_response"; export * from "./payment_plan"; export * from "./payment_plans_response"; export * from "./payment_vip_status_response"; -export * from "./payment_websocket_event"; diff --git a/src/data/schemas/payment/payment_websocket_event.ts b/src/data/schemas/payment/payment_websocket_event.ts deleted file mode 100644 index 4d6b872d..00000000 --- a/src/data/schemas/payment/payment_websocket_event.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * 支付 WebSocket 事件 - */ -import { z } from "zod"; - -export const PaymentSuccessVipEventSchema = z.object({ - type: z.literal("payment_success"), - orderId: z.string(), - payType: z.literal("vip"), - planName: z.string(), - vipExpiresAt: z.string().nullable(), -}); - -export const PaymentSuccessDolEventSchema = z.object({ - type: z.literal("payment_success"), - orderId: z.string(), - payType: z.literal("dol"), - planName: z.string(), - dolAmount: z.number(), - dolBalance: z.number(), -}); - -export const PaymentFailedEventSchema = z.object({ - type: z.literal("payment_failed"), - orderId: z.string(), - info: z.string(), -}); - -export const PaymentSuccessEventSchema = z.discriminatedUnion("payType", [ - PaymentSuccessVipEventSchema, - PaymentSuccessDolEventSchema, -]); - -export const PaymentWebSocketEventSchema = z.union([ - PaymentSuccessEventSchema, - PaymentFailedEventSchema, -]); - -export type PaymentSuccessVipEventData = z.output< - typeof PaymentSuccessVipEventSchema ->; -export type PaymentSuccessDolEventData = z.output< - typeof PaymentSuccessDolEventSchema ->; -export type PaymentFailedEventData = z.output; -export type PaymentSuccessEventData = z.output; -export type PaymentWebSocketEventInput = z.input< - typeof PaymentWebSocketEventSchema ->; -export type PaymentWebSocketEventData = z.output< - typeof PaymentWebSocketEventSchema ->;