import type { Channel, LocalMessage } from 'stream-chat' import type { PaymentStatus } from '../../../stream-custom-data' export interface LockedAttachmentGalleryItem { /** Drives the per-item play/lock affordance. */ mimeType: string /** Poster image, locked or unlocked. */ thumbnailUrl?: string /** Media source, shown only when unlocked. */ sourceUrl?: string } export interface LockedAttachmentSource { /** Proxied URL for in-app playback. */ sourceUrl: string /** Opened when the visitor clicks Download. */ redeemUrl?: string /** Overrides the metadata thumbnail when present. */ thumbnailUrl?: string } export type { PaymentStatus } /** Fetches the underlying source; `void` return means none available. */ export type FetchSourceHandler = () => Promise export interface LockedAttachmentContextValue { /** Whether the given message is mid-checkout. */ isUnlocking: (id: string) => boolean /** Opens the checkout flow for a message. */ onUnlockClick?: (message: LocalMessage, channel: Channel) => void /** Handles a Download click for a message. */ onDownloadClick?: (message: LocalMessage, channel: Channel) => void /** Reveals the locked media's source. Unused for text — payment writes `message.text` directly. */ onFetchSource?: ( message: LocalMessage, channel: Channel ) => Promise } export const defaultLockedAttachmentContextValue: LockedAttachmentContextValue = { isUnlocking: () => false, }