: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { eventWithTime } from 'posthog-js/rrweb-types'
import { createSegments as _createSegments, mapSnapshotsToWindowId } from '@posthog/replay-shared'
import { Dayjs } from 'lib/dayjs'
import { RecordingSegment, RecordingSnapshot } from '~/types'
export { mapSnapshotsToWindowId }
export const createSegments = (
snapshots: RecordingSnapshot[],
start: Dayjs | null,
end: Dayjs | null,
trackedWindow: number | null | undefined,
snapshotsByWindowId: Record<number, eventWithTime[]>,
isRangeLoaded?: (startTimestamp: number, endTimestamp: number) => boolean | null
): RecordingSegment[] => {
return _createSegments(
snapshots,
start?.valueOf() ?? null,
end?.valueOf() ?? null,
trackedWindow,
snapshotsByWindowId,
isRangeLoaded
)
}