export const MAX_CHAT_IMAGES = 4; export const MAX_CHAT_IMAGE_BYTES = 10 * 1024 * 1024; export interface PendingChatImage { readonly file: File; readonly id: string; readonly previewUrl: string; } export interface ImageValidationResult { readonly accepted: boolean; readonly message?: string; } export const validateChatImage = ( file: Pick ): ImageValidationResult => { if (!file.type.startsWith("image/")) { return { accepted: false, message: "Only image files can be attached" }; } if (file.size > MAX_CHAT_IMAGE_BYTES) { return { accepted: false, message: "Images must be 10 MB or smaller", }; } return { accepted: true }; };