Added session downloader for chrome extension (#1522)

* Added session downloader for chrome extension

- The session list now has a button to download sessions as .json files for use with rrweb-player
- Improved styling for the delete and download buttons
This commit is contained in:
Arun Kunigiri
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 5217a09c60
commit 4277d7e9c3
3 changed files with 57 additions and 19 deletions

View File

@@ -88,3 +88,22 @@ export async function deleteSessions(ids: string[]) {
return Promise.all([eventTransition.done, sessionTransition.done]);
});
}
export async function downloadSessions(ids: string[]) {
for (const sessionId of ids) {
const events = await getEvents(sessionId);
const session = await getSession(sessionId);
const blob = new Blob([JSON.stringify({ session, events }, null, 2)], {
type: 'application/json',
});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `${session.name}.json`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
}