feat(tracker): add option to jump to current time in getSessionURL
This commit is contained in:
parent
6a930a433a
commit
07b23a8f0d
2 changed files with 12 additions and 5 deletions
|
|
@ -312,8 +312,8 @@ export default class App {
|
|||
return this.session.getInfo().sessionID || undefined
|
||||
}
|
||||
|
||||
getSessionURL(): string | undefined {
|
||||
const { projectID, sessionID } = this.session.getInfo()
|
||||
getSessionURL(options?: { withCurrentTime?: boolean }): string | undefined {
|
||||
const { projectID, sessionID, timestamp } = this.session.getInfo()
|
||||
if (!projectID || !sessionID) {
|
||||
this.debug.error('OpenReplay error: Unable to build session URL')
|
||||
return undefined
|
||||
|
|
@ -323,7 +323,14 @@ export default class App {
|
|||
|
||||
const projectPath = isSaas ? ingest.replace('api', 'app') : ingest
|
||||
|
||||
return projectPath.replace(/ingest$/, `${projectID}/session/${sessionID}`)
|
||||
const url = projectPath.replace(/ingest$/, `${projectID}/session/${sessionID}`)
|
||||
|
||||
if (options?.withCurrentTime) {
|
||||
const jumpTo = now() - timestamp
|
||||
return `${url}?jumpto=${jumpTo}`
|
||||
}
|
||||
|
||||
return url
|
||||
}
|
||||
|
||||
getHost(): string {
|
||||
|
|
|
|||
|
|
@ -212,11 +212,11 @@ export default class API {
|
|||
return this.getSessionID()
|
||||
}
|
||||
|
||||
getSessionURL(): string | undefined {
|
||||
getSessionURL(options?: { withCurrentTime?: boolean }): string | undefined {
|
||||
if (this.app === null) {
|
||||
return undefined
|
||||
}
|
||||
return this.app.getSessionURL()
|
||||
return this.app.getSessionURL(options)
|
||||
}
|
||||
|
||||
setUserID(id: string): void {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue