refactor(chat): simplify paid message lock state

This commit is contained in:
2026-07-13 15:20:07 +08:00
parent fd631168c8
commit 4682b4bf3f
17 changed files with 86 additions and 190 deletions
-10
View File
@@ -5,21 +5,15 @@ import { z } from "zod";
import {
booleanOrFalse,
booleanOrTrue,
schemaOr,
stringOrNull,
unknownRecordOrNull,
} from "../nullable-defaults";
const CHAT_IMAGE_DEFAULTS = { type: null, url: null } as const;
const CHAT_LOCK_DETAIL_DEFAULTS = {
locked: false,
showContent: true,
showUpgrade: false,
reason: null,
hint: null,
detail: null,
} as const;
export const ChatImageSchema = schemaOr(
@@ -33,11 +27,7 @@ export const ChatImageSchema = schemaOr(
export const ChatLockDetailSchema = schemaOr(
z.object({
locked: booleanOrFalse,
showContent: booleanOrTrue,
showUpgrade: booleanOrFalse,
reason: stringOrNull,
hint: stringOrNull,
detail: unknownRecordOrNull,
}),
CHAT_LOCK_DETAIL_DEFAULTS,
);