heatmap migration/code clean-up
This commit is contained in:
1 parent
3888ec6f4f
commit
8a0bdc2727
13 files changed
+49
-1326
No files matched your search
@@ -217,7 +217,6 @@ export async function POST(request: Request) {
|
||||
sessionId,
|
||||
visitId,
|
||||
eventType: event.type === 'click' ? HEATMAP_EVENT_TYPE.click : HEATMAP_EVENT_TYPE.scroll,
|
||||
nodeId: null,
|
||||
x: event.type === 'click' ? (event.x ?? null) : null,
|
||||
y: event.type === 'click' ? (event.y ?? null) : null,
|
||||
pageX: event.type === 'click' ? (event.pageX ?? null) : null,
|
||||
@@ -229,9 +228,6 @@ export async function POST(request: Request) {
|
||||
scrollPct: event.type === 'scroll' ? (event.scrollPct ?? null) : null,
|
||||
urlPath: getUrlPath(event.url),
|
||||
createdAt: new Date(event.timestamp ?? fallbackMs),
|
||||
replayChunkIndex: null,
|
||||
replayEventIndex: null,
|
||||
replayTimeMs: null,
|
||||
}));
|
||||
|
||||
if (heatmapRows.length) {
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
import { parseRequest } from '@/lib/request';
|
||||
import { notFound, unauthorized } from '@/lib/response';
|
||||
import { canViewAuthenticatedWebsite } from '@/permissions';
|
||||
import { getHeatmapSnapshotImage } from '@/queries/sql/heatmap/ensureHeatmapSnapshot';
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: Promise<{ websiteId: string; snapshotId: string }> },
|
||||
) {
|
||||
const { auth, error } = await parseRequest(request);
|
||||
const { websiteId, snapshotId } = await params;
|
||||
|
||||
if (error) {
|
||||
return error();
|
||||
}
|
||||
|
||||
if (!(await canViewAuthenticatedWebsite(auth, websiteId))) {
|
||||
return unauthorized();
|
||||
}
|
||||
|
||||
const snapshot = await getHeatmapSnapshotImage(websiteId, snapshotId);
|
||||
|
||||
if (!snapshot) {
|
||||
return notFound({ message: 'Snapshot not found.' });
|
||||
}
|
||||
|
||||
return new Response(new Uint8Array(snapshot.imageData), {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Content-Type': snapshot.mimeType,
|
||||
'Cache-Control': 'private, max-age=300',
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user