Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

1.1 KB
Raw Blame
import { eventWithTime } from 'posthog-js/rrweb-types'

export interface RecordingSegment {
    kind: 'window' | 'buffer' | 'gap'
    startTimestamp: number
    endTimestamp: number
    durationMs: number
    windowId?: number
    isActive: boolean
    isLoading?: boolean
}

export type EncodedRecordingSnapshot = {
    windowId: number
    data: eventWithTime[]
}

export const SnapshotSourceType = {
    blob_v2: 'blob_v2',
    file: 'file',
} as const

export type SnapshotSourceType = (typeof SnapshotSourceType)[keyof typeof SnapshotSourceType]

export interface SessionRecordingSnapshotSource {
    source: SnapshotSourceType
    start_timestamp?: string
    end_timestamp?: string
    blob_key?: string
    /** Fetch this block here directly, with the listing's block token, instead of through the snapshots endpoint. */
    url?: string
}

export interface SessionRecordingSnapshotSourceResponse {
    sources?: Pick<SessionRecordingSnapshotSource, 'source' | 'blob_key'>[]
    snapshots?: RecordingSnapshot[]
    processed?: boolean
    sourceLoaded?: boolean
}

export type RecordingSnapshot = eventWithTime & {
    windowId: number
}