diff --git a/prisma/migrations/18_add_session_recording/migration.sql b/prisma/migrations/18_add_session_recording/migration.sql index 830892716..088a58095 100644 --- a/prisma/migrations/18_add_session_recording/migration.sql +++ b/prisma/migrations/18_add_session_recording/migration.sql @@ -1,10 +1,10 @@ -- AlterTable -ALTER TABLE "website" ADD COLUMN "recording_enabled" BOOLEAN NOT NULL DEFAULT false; -ALTER TABLE "website" ADD COLUMN "recording_config" JSONB; +ALTER TABLE "website" ADD COLUMN "replay_enabled" BOOLEAN NOT NULL DEFAULT false; +ALTER TABLE "website" ADD COLUMN "replay_config" JSONB; -- CreateTable -CREATE TABLE "session_recording" ( - "recording_id" UUID NOT NULL, +CREATE TABLE "session_replay" ( + "replay_id" UUID NOT NULL, "website_id" UUID NOT NULL, "session_id" UUID NOT NULL, "chunk_index" INTEGER NOT NULL, @@ -14,12 +14,12 @@ CREATE TABLE "session_recording" ( "ended_at" TIMESTAMPTZ(6) NOT NULL, "created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP, - CONSTRAINT "session_recording_pkey" PRIMARY KEY ("recording_id") + CONSTRAINT "session_replay_pkey" PRIMARY KEY ("replay_id") ); -- CreateIndex -CREATE INDEX "session_recording_website_id_idx" ON "session_recording"("website_id"); -CREATE INDEX "session_recording_session_id_idx" ON "session_recording"("session_id"); -CREATE INDEX "session_recording_website_id_session_id_idx" ON "session_recording"("website_id", "session_id"); -CREATE INDEX "session_recording_website_id_created_at_idx" ON "session_recording"("website_id", "created_at"); -CREATE INDEX "session_recording_session_id_chunk_index_idx" ON "session_recording"("session_id", "chunk_index"); +CREATE INDEX "session_replay_website_id_idx" ON "session_replay"("website_id"); +CREATE INDEX "session_replay_session_id_idx" ON "session_replay"("session_id"); +CREATE INDEX "session_replay_website_id_session_id_idx" ON "session_replay"("website_id", "session_id"); +CREATE INDEX "session_replay_website_id_created_at_idx" ON "session_replay"("website_id", "created_at"); +CREATE INDEX "session_replay_session_id_chunk_index_idx" ON "session_replay"("session_id", "chunk_index"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 273e67fb7..da35bf7f1 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -75,8 +75,8 @@ model Website { updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6) deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6) - recordingEnabled Boolean @default(false) @map("recording_enabled") - recordingConfig Json? @map("recording_config") + replayEnabled Boolean @default(false) @map("replay_enabled") + replayConfig Json? @map("replay_config") user User? @relation("user", fields: [userId], references: [id]) createUser User? @relation("createUser", fields: [createdBy], references: [id]) @@ -86,7 +86,7 @@ model Website { revenue Revenue[] segments Segment[] sessionData SessionData[] - sessionRecordings SessionRecording[] + sessionReplays SessionReplay[] @@index([userId]) @@index([teamId]) @@ -355,8 +355,8 @@ model Share { @@map("share") } -model SessionRecording { - id String @id() @map("recording_id") @db.Uuid +model SessionReplay { + id String @id() @map("replay_id") @db.Uuid websiteId String @map("website_id") @db.Uuid sessionId String @map("session_id") @db.Uuid chunkIndex Int @map("chunk_index") @db.Integer @@ -373,5 +373,5 @@ model SessionRecording { @@index([websiteId, sessionId]) @@index([websiteId, createdAt]) @@index([sessionId, chunkIndex]) - @@map("session_recording") + @@map("session_replay") } diff --git a/rollup.recorder.config.js b/rollup.recorder.config.js index 7662e4218..c1dd305e7 100644 --- a/rollup.recorder.config.js +++ b/rollup.recorder.config.js @@ -15,7 +15,7 @@ export default { commonjs(), replace({ __COLLECT_API_HOST__: process.env.COLLECT_API_HOST || '', - __COLLECT_RECORDING_ENDPOINT__: process.env.COLLECT_RECORDING_ENDPOINT || '/api/record', + __COLLECT_REPLAY_ENDPOINT__: process.env.COLLECT_REPLAY_ENDPOINT || '/api/record', delimiters: ['', ''], preventAssignment: true, }), diff --git a/src/app/(main)/websites/[websiteId]/recordings/RecordingsDataTable.tsx b/src/app/(main)/websites/[websiteId]/recordings/RecordingsDataTable.tsx deleted file mode 100644 index a19f6b1a3..000000000 --- a/src/app/(main)/websites/[websiteId]/recordings/RecordingsDataTable.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { DataGrid } from '@/components/common/DataGrid'; -import { useRecordingsQuery } from '@/components/hooks'; -import { RecordingsTable } from './RecordingsTable'; - -export function RecordingsDataTable({ websiteId }: { websiteId: string }) { - const queryResult = useRecordingsQuery(websiteId); - - return ( - - {({ data }) => { - return ; - }} - - ); -} diff --git a/src/app/(main)/websites/[websiteId]/replays/ReplaysDataTable.tsx b/src/app/(main)/websites/[websiteId]/replays/ReplaysDataTable.tsx new file mode 100644 index 000000000..19e195d80 --- /dev/null +++ b/src/app/(main)/websites/[websiteId]/replays/ReplaysDataTable.tsx @@ -0,0 +1,15 @@ +import { DataGrid } from '@/components/common/DataGrid'; +import { useReplaysQuery } from '@/components/hooks'; +import { ReplaysTable } from './ReplaysTable'; + +export function ReplaysDataTable({ websiteId }: { websiteId: string }) { + const queryResult = useReplaysQuery(websiteId); + + return ( + + {({ data }) => { + return ; + }} + + ); +} diff --git a/src/app/(main)/websites/[websiteId]/recordings/RecordingsPage.tsx b/src/app/(main)/websites/[websiteId]/replays/ReplaysPage.tsx similarity index 63% rename from src/app/(main)/websites/[websiteId]/recordings/RecordingsPage.tsx rename to src/app/(main)/websites/[websiteId]/replays/ReplaysPage.tsx index 824e2ea71..65836e769 100644 --- a/src/app/(main)/websites/[websiteId]/recordings/RecordingsPage.tsx +++ b/src/app/(main)/websites/[websiteId]/replays/ReplaysPage.tsx @@ -2,14 +2,14 @@ import { Column } from '@umami/react-zen'; import { WebsiteControls } from '@/app/(main)/websites/[websiteId]/WebsiteControls'; import { Panel } from '@/components/common/Panel'; -import { RecordingsDataTable } from './RecordingsDataTable'; +import { ReplaysDataTable } from './ReplaysDataTable'; -export function RecordingsPage({ websiteId }: { websiteId: string }) { +export function ReplaysPage({ websiteId }: { websiteId: string }) { return ( - + ); diff --git a/src/app/(main)/websites/[websiteId]/recordings/RecordingsTable.tsx b/src/app/(main)/websites/[websiteId]/replays/ReplaysTable.tsx similarity index 93% rename from src/app/(main)/websites/[websiteId]/recordings/RecordingsTable.tsx rename to src/app/(main)/websites/[websiteId]/replays/ReplaysTable.tsx index 2416f9fbe..aa762e2b7 100644 --- a/src/app/(main)/websites/[websiteId]/recordings/RecordingsTable.tsx +++ b/src/app/(main)/websites/[websiteId]/replays/ReplaysTable.tsx @@ -13,7 +13,7 @@ function formatDuration(ms: number) { return `${minutes}:${secs.toString().padStart(2, '0')}`; } -export function RecordingsTable({ websiteId, ...props }: DataTableProps & { websiteId: string }) { +export function ReplaysTable({ websiteId, ...props }: DataTableProps & { websiteId: string }) { const { formatMessage, labels } = useMessages(); const { formatValue } = useFormat(); @@ -52,7 +52,7 @@ export function RecordingsTable({ websiteId, ...props }: DataTableProps & { webs {(row: any) => ( - +