@openreplay/tracker
Advanced tools
Comparing version 3.5.9 to 3.5.10
@@ -11,2 +11,7 @@ import Message from "../messages/message.js"; | ||
import type { Options as WebworkerOptions } from "../../webworker/types.js"; | ||
export interface StartOptions { | ||
userID?: string; | ||
metadata?: Record<string, string>; | ||
forceNew?: boolean; | ||
} | ||
export interface OnStartInfo { | ||
@@ -17,7 +22,4 @@ sessionID: string; | ||
} | ||
export interface StartOptions { | ||
userID?: string; | ||
metadata?: Record<string, string>; | ||
forceNew?: boolean; | ||
} | ||
declare type StartCallback = (i: OnStartInfo) => void; | ||
declare type CommitCallback = (messages: Array<Message>) => void; | ||
declare type AppOptions = { | ||
@@ -36,7 +38,5 @@ revID: string; | ||
__debug__?: LoggerOptions; | ||
onStart?: (info: OnStartInfo) => void; | ||
onStart?: StartCallback; | ||
} & WebworkerOptions; | ||
export declare type Options = AppOptions & ObserverOptions & SanitizerOptions; | ||
declare type Callback = () => void; | ||
declare type CommitCallback = (messages: Array<Message>) => void; | ||
export declare const CANCELED = "canceled"; | ||
@@ -64,3 +64,2 @@ export declare const DEFAULT_INGEST_POINT = "https://api.openreplay.com/ingest"; | ||
private _debug; | ||
private readonly preStartMessages; | ||
send(message: Message, urgent?: boolean): void; | ||
@@ -70,4 +69,4 @@ private commit; | ||
attachCommitCallback(cb: CommitCallback): void; | ||
attachStartCallback(cb: Callback): void; | ||
attachStopCallback(cb: Callback): void; | ||
attachStartCallback(cb: StartCallback): void; | ||
attachStopCallback(cb: Function): void; | ||
attachEventListener(target: EventTarget, type: string, listener: EventListener, useSafe?: boolean, useCapture?: boolean): void; | ||
@@ -74,0 +73,0 @@ checkRequiredVersion(version: string): boolean; |
@@ -32,4 +32,3 @@ "use strict"; | ||
this.activityState = ActivityState.NotActive; | ||
this.version = '3.5.9'; // TODO: version compatability check inside each plugin. | ||
this.preStartMessages = []; | ||
this.version = '3.5.10'; // TODO: version compatability check inside each plugin. | ||
this.projectKey = projectKey; | ||
@@ -107,11 +106,8 @@ this.options = Object.assign({ | ||
} | ||
if (this.activityState === ActivityState.Starting) { | ||
this.preStartMessages.push(message); | ||
} | ||
if (this.preStartMessages.length) { | ||
this.messages.push(...this.preStartMessages); | ||
this.preStartMessages.length = 0; | ||
} | ||
this.messages.push(message); | ||
if (urgent) { | ||
// TODO: commit on start if there were `urgent` sends; | ||
// Clearify where urgent can be used for; | ||
// Clearify workflow for each type of message in case it was sent before start | ||
// (like Fetch before start; maybe add an option "preCapture: boolean" or sth alike) | ||
if (this.activityState === ActivityState.Active && urgent) { | ||
this.commit(); | ||
@@ -297,3 +293,4 @@ } | ||
this.worker.postMessage(startWorkerMsg); | ||
this.startCallbacks.forEach((cb) => cb()); | ||
const onStartInfo = { sessionToken: token, userUUID, sessionID }; | ||
this.startCallbacks.forEach((cb) => cb(onStartInfo)); | ||
this.observer.observe(); | ||
@@ -303,3 +300,2 @@ this.ticker.start(); | ||
// TODO: get rid of onStart | ||
const onStartInfo = { sessionToken: token, userUUID, sessionID }; | ||
if (typeof this.options.onStart === 'function') { | ||
@@ -306,0 +302,0 @@ this.options.onStart(onStartInfo); |
@@ -130,3 +130,3 @@ "use strict"; | ||
req.send(JSON.stringify({ | ||
trackerVersion: '3.5.9', | ||
trackerVersion: '3.5.10', | ||
projectKey: options.projectKey, | ||
@@ -133,0 +133,0 @@ doNotTrack, |
@@ -73,14 +73,2 @@ "use strict"; | ||
} // Resources are necessary for all timings | ||
const mQueue = []; | ||
function sendOnStart(m) { | ||
if (app.active()) { | ||
app.send(m); | ||
} | ||
else { | ||
mQueue.push(m); | ||
} | ||
} | ||
app.attachStartCallback(function () { | ||
mQueue.forEach(m => app.send(m)); | ||
}); | ||
let resources = {}; | ||
@@ -93,3 +81,3 @@ function resourceTiming(entry) { | ||
} | ||
sendOnStart(new index_js_1.ResourceTiming(entry.startTime + performance.timing.navigationStart, entry.duration, entry.responseStart && entry.startTime | ||
app.send(new index_js_1.ResourceTiming(entry.startTime + performance.timing.navigationStart, entry.duration, entry.responseStart && entry.startTime | ||
? entry.responseStart - entry.startTime | ||
@@ -101,4 +89,13 @@ : 0, entry.transferSize > entry.encodedBodySize | ||
const observer = new PerformanceObserver((list) => list.getEntries().forEach(resourceTiming)); | ||
performance.getEntriesByType('resource').forEach(resourceTiming); | ||
observer.observe({ entryTypes: ['resource'] }); | ||
let prevSessionID; | ||
app.attachStartCallback(function ({ sessionID }) { | ||
if (sessionID !== prevSessionID) { // Send past page resources on a newly started session | ||
performance.getEntriesByType('resource').forEach(resourceTiming); | ||
prevSessionID = sessionID; | ||
} | ||
observer.observe({ entryTypes: ['resource'] }); | ||
}); | ||
app.attachStopCallback(function () { | ||
observer.disconnect(); | ||
}); | ||
let firstPaint = 0, firstContentfulPaint = 0; | ||
@@ -105,0 +102,0 @@ if (options.capturePageLoadTimings) { |
@@ -11,2 +11,7 @@ import Message from "../messages/message.js"; | ||
import type { Options as WebworkerOptions } from "../../webworker/types.js"; | ||
export interface StartOptions { | ||
userID?: string; | ||
metadata?: Record<string, string>; | ||
forceNew?: boolean; | ||
} | ||
export interface OnStartInfo { | ||
@@ -17,7 +22,4 @@ sessionID: string; | ||
} | ||
export interface StartOptions { | ||
userID?: string; | ||
metadata?: Record<string, string>; | ||
forceNew?: boolean; | ||
} | ||
declare type StartCallback = (i: OnStartInfo) => void; | ||
declare type CommitCallback = (messages: Array<Message>) => void; | ||
declare type AppOptions = { | ||
@@ -36,7 +38,5 @@ revID: string; | ||
__debug__?: LoggerOptions; | ||
onStart?: (info: OnStartInfo) => void; | ||
onStart?: StartCallback; | ||
} & WebworkerOptions; | ||
export declare type Options = AppOptions & ObserverOptions & SanitizerOptions; | ||
declare type Callback = () => void; | ||
declare type CommitCallback = (messages: Array<Message>) => void; | ||
export declare const CANCELED = "canceled"; | ||
@@ -64,3 +64,2 @@ export declare const DEFAULT_INGEST_POINT = "https://api.openreplay.com/ingest"; | ||
private _debug; | ||
private readonly preStartMessages; | ||
send(message: Message, urgent?: boolean): void; | ||
@@ -70,4 +69,4 @@ private commit; | ||
attachCommitCallback(cb: CommitCallback): void; | ||
attachStartCallback(cb: Callback): void; | ||
attachStopCallback(cb: Callback): void; | ||
attachStartCallback(cb: StartCallback): void; | ||
attachStopCallback(cb: Function): void; | ||
attachEventListener(target: EventTarget, type: string, listener: EventListener, useSafe?: boolean, useCapture?: boolean): void; | ||
@@ -74,0 +73,0 @@ checkRequiredVersion(version: string): boolean; |
@@ -29,4 +29,3 @@ import { timestamp } from "../utils.js"; | ||
this.activityState = ActivityState.NotActive; | ||
this.version = '3.5.9'; // TODO: version compatability check inside each plugin. | ||
this.preStartMessages = []; | ||
this.version = '3.5.10'; // TODO: version compatability check inside each plugin. | ||
this.projectKey = projectKey; | ||
@@ -104,11 +103,8 @@ this.options = Object.assign({ | ||
} | ||
if (this.activityState === ActivityState.Starting) { | ||
this.preStartMessages.push(message); | ||
} | ||
if (this.preStartMessages.length) { | ||
this.messages.push(...this.preStartMessages); | ||
this.preStartMessages.length = 0; | ||
} | ||
this.messages.push(message); | ||
if (urgent) { | ||
// TODO: commit on start if there were `urgent` sends; | ||
// Clearify where urgent can be used for; | ||
// Clearify workflow for each type of message in case it was sent before start | ||
// (like Fetch before start; maybe add an option "preCapture: boolean" or sth alike) | ||
if (this.activityState === ActivityState.Active && urgent) { | ||
this.commit(); | ||
@@ -294,3 +290,4 @@ } | ||
this.worker.postMessage(startWorkerMsg); | ||
this.startCallbacks.forEach((cb) => cb()); | ||
const onStartInfo = { sessionToken: token, userUUID, sessionID }; | ||
this.startCallbacks.forEach((cb) => cb(onStartInfo)); | ||
this.observer.observe(); | ||
@@ -300,3 +297,2 @@ this.ticker.start(); | ||
// TODO: get rid of onStart | ||
const onStartInfo = { sessionToken: token, userUUID, sessionID }; | ||
if (typeof this.options.onStart === 'function') { | ||
@@ -303,0 +299,0 @@ this.options.onStart(onStartInfo); |
@@ -126,3 +126,3 @@ import App, { DEFAULT_INGEST_POINT } from "./app/index.js"; | ||
req.send(JSON.stringify({ | ||
trackerVersion: '3.5.9', | ||
trackerVersion: '3.5.10', | ||
projectKey: options.projectKey, | ||
@@ -129,0 +129,0 @@ doNotTrack, |
@@ -71,14 +71,2 @@ import { isURL } from "../utils.js"; | ||
} // Resources are necessary for all timings | ||
const mQueue = []; | ||
function sendOnStart(m) { | ||
if (app.active()) { | ||
app.send(m); | ||
} | ||
else { | ||
mQueue.push(m); | ||
} | ||
} | ||
app.attachStartCallback(function () { | ||
mQueue.forEach(m => app.send(m)); | ||
}); | ||
let resources = {}; | ||
@@ -91,3 +79,3 @@ function resourceTiming(entry) { | ||
} | ||
sendOnStart(new ResourceTiming(entry.startTime + performance.timing.navigationStart, entry.duration, entry.responseStart && entry.startTime | ||
app.send(new ResourceTiming(entry.startTime + performance.timing.navigationStart, entry.duration, entry.responseStart && entry.startTime | ||
? entry.responseStart - entry.startTime | ||
@@ -99,4 +87,13 @@ : 0, entry.transferSize > entry.encodedBodySize | ||
const observer = new PerformanceObserver((list) => list.getEntries().forEach(resourceTiming)); | ||
performance.getEntriesByType('resource').forEach(resourceTiming); | ||
observer.observe({ entryTypes: ['resource'] }); | ||
let prevSessionID; | ||
app.attachStartCallback(function ({ sessionID }) { | ||
if (sessionID !== prevSessionID) { // Send past page resources on a newly started session | ||
performance.getEntriesByType('resource').forEach(resourceTiming); | ||
prevSessionID = sessionID; | ||
} | ||
observer.observe({ entryTypes: ['resource'] }); | ||
}); | ||
app.attachStopCallback(function () { | ||
observer.disconnect(); | ||
}); | ||
let firstPaint = 0, firstContentfulPaint = 0; | ||
@@ -103,0 +100,0 @@ if (options.capturePageLoadTimings) { |
{ | ||
"name": "@openreplay/tracker", | ||
"description": "The OpenReplay tracker main package", | ||
"version": "3.5.9", | ||
"version": "3.5.10", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "logging", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
363661
9045