@openreplay/tracker
Advanced tools
Comparing version 3.4.4 to 3.4.5
@@ -46,2 +46,3 @@ import Message from '../messages/message'; | ||
private commit; | ||
attachCommitCallback(cb: CommitCallback): void; | ||
addCommitCallback(cb: CommitCallback): void; | ||
@@ -48,0 +49,0 @@ safe<T extends (...args: any[]) => void>(fn: T): T; |
@@ -20,3 +20,3 @@ "use strict"; | ||
this.isActive = false; | ||
this.version = '3.4.4'; | ||
this.version = '3.4.5'; | ||
this.projectKey = projectKey; | ||
@@ -89,3 +89,3 @@ this.options = Object.assign({ | ||
if (this.options.__debug_log) { | ||
utils_1.warn("OpenReplay errror: ", context, e); | ||
utils_1.warn("OpenReplay error: ", context, e); | ||
} | ||
@@ -110,5 +110,9 @@ } | ||
} | ||
addCommitCallback(cb) { | ||
attachCommitCallback(cb) { | ||
this.commitCallbacks.push(cb); | ||
} | ||
// @Depricated (TODO: remove in 3.5.*) | ||
addCommitCallback(cb) { | ||
this.attachCommitCallback(cb); | ||
} | ||
safe(fn) { | ||
@@ -115,0 +119,0 @@ const app = this; |
@@ -322,8 +322,15 @@ "use strict"; | ||
handleIframe(iframe) { | ||
let context = null; | ||
const handle = () => { | ||
const context = iframe.contentWindow; | ||
const id = this.app.nodes.getID(iframe); | ||
if (!context || id === undefined) { | ||
if (id === undefined) { | ||
return; | ||
} | ||
if (iframe.contentWindow === context) { | ||
return; | ||
} | ||
context = iframe.contentWindow; | ||
if (!context) { | ||
return; | ||
} | ||
const observer = new Observer(this.app, this.options, context); | ||
@@ -330,0 +337,0 @@ this.iframeObservers.push(observer); |
@@ -9,6 +9,5 @@ import App from './app'; | ||
import { Options as InputOptions } from './modules/input'; | ||
import { Options as MouseOptions } from './modules/mouse'; | ||
import { Options as PerformanceOptions } from './modules/performance'; | ||
import { Options as TimingOptions } from './modules/timing'; | ||
export declare type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & MouseOptions & PerformanceOptions & TimingOptions> & { | ||
export declare type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & PerformanceOptions & TimingOptions> & { | ||
projectID?: number; | ||
@@ -15,0 +14,0 @@ projectKey: string; |
@@ -100,3 +100,3 @@ "use strict"; | ||
input_1.default(this.app, options); | ||
mouse_1.default(this.app, options); | ||
mouse_1.default(this.app); | ||
timing_1.default(this.app, options); | ||
@@ -116,3 +116,3 @@ performance_1.default(this.app, options); | ||
req.send(JSON.stringify({ | ||
trackerVersion: '3.4.4', | ||
trackerVersion: '3.4.5', | ||
projectKey: options.projectKey, | ||
@@ -119,0 +119,0 @@ doNotTrack, |
@@ -102,3 +102,3 @@ "use strict"; | ||
app.ticker.attach(reset, 33, false); | ||
options.consoleMethods.forEach((method) => { | ||
const patchConsole = (console) => options.consoleMethods.forEach((method) => { | ||
if (consoleMethods.indexOf(method) === -1) { | ||
@@ -117,3 +117,18 @@ console.error(`OpenReplay: unsupported console method "${method}"`); | ||
}); | ||
patchConsole(window.console); | ||
app.nodes.attachNodeCallback(node => { | ||
if (node instanceof HTMLIFrameElement) { | ||
let context = node.contentWindow; | ||
if (context) { | ||
patchConsole(context.console); | ||
} | ||
app.attachEventListener(node, "load", () => { | ||
if (node.contentWindow !== context) { | ||
context = node.contentWindow; | ||
patchConsole(context.console); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
exports.default = default_1; |
@@ -24,4 +24,4 @@ "use strict"; | ||
const observer = new PerformanceObserver((list) => list.getEntries().forEach(longTask)); | ||
observer.observe({ entryTypes: ['longtask'], buffered: true }); | ||
observer.observe({ entryTypes: ['longtask'] }); | ||
} | ||
exports.default = default_1; |
@@ -1,10 +0,2 @@ | ||
import type { Options as FinderOptions } from '../vendors/finder/finder'; | ||
import App from '../app'; | ||
interface HeatmapsOptions { | ||
finder: FinderOptions; | ||
} | ||
export interface Options { | ||
heatmaps: boolean | HeatmapsOptions; | ||
} | ||
export default function (app: App, opts: Partial<Options>): void; | ||
export {}; | ||
export default function (app: App): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const finder_1 = require("../vendors/finder/finder"); | ||
const utils_1 = require("../utils"); | ||
const messages_1 = require("../messages"); | ||
const input_1 = require("./input"); | ||
function _getSelector(target) { | ||
let el = target; | ||
let selector = null; | ||
do { | ||
if (el.id) { | ||
return `#${el.id}` + (selector ? ` > ${selector}` : ''); | ||
} | ||
selector = | ||
el.className.split(' ') | ||
.map(cn => cn.trim()) | ||
.filter(cn => cn !== '') | ||
.reduce((sel, cn) => `${sel}.${cn}`, el.tagName.toLowerCase()) + | ||
(selector ? ` > ${selector}` : ''); | ||
if (el === document.body) { | ||
return selector; | ||
} | ||
el = el.parentElement; | ||
} while (el !== document.body && el !== null); | ||
return selector; | ||
} | ||
//TODO: fix (typescript doesn't allow work when the guard is inside the function) | ||
function getTarget(target) { | ||
@@ -68,11 +88,7 @@ if (target instanceof Element) { | ||
} | ||
function default_1(app, opts) { | ||
const options = Object.assign({ | ||
heatmaps: false // { | ||
// finder: { | ||
// threshold: 5, | ||
// maxNumberOfTries: 600, | ||
// }, | ||
// }, | ||
}, opts); | ||
function default_1(app) { | ||
// const options: Options = Object.assign( | ||
// {}, | ||
// opts, | ||
// ); | ||
let mousePositionX = -1; | ||
@@ -97,7 +113,3 @@ let mousePositionY = -1; | ||
function getSelector(id, target) { | ||
if (options.heatmaps === false) { | ||
return ''; | ||
} | ||
return selectorMap[id] = selectorMap[id] || | ||
finder_1.finder(target, options.heatmaps === true ? undefined : options.heatmaps.finder); | ||
return selectorMap[id] = selectorMap[id] || _getSelector(target); | ||
} | ||
@@ -104,0 +116,0 @@ app.attachEventListener(document.documentElement, 'mouseover', (e) => { |
@@ -46,2 +46,3 @@ import Message from '../messages/message'; | ||
private commit; | ||
attachCommitCallback(cb: CommitCallback): void; | ||
addCommitCallback(cb: CommitCallback): void; | ||
@@ -48,0 +49,0 @@ safe<T extends (...args: any[]) => void>(fn: T): T; |
@@ -17,3 +17,3 @@ import { timestamp, log, warn } from '../utils'; | ||
this.isActive = false; | ||
this.version = '3.4.4'; | ||
this.version = '3.4.5'; | ||
this.projectKey = projectKey; | ||
@@ -86,3 +86,3 @@ this.options = Object.assign({ | ||
if (this.options.__debug_log) { | ||
warn("OpenReplay errror: ", context, e); | ||
warn("OpenReplay error: ", context, e); | ||
} | ||
@@ -107,5 +107,9 @@ } | ||
} | ||
addCommitCallback(cb) { | ||
attachCommitCallback(cb) { | ||
this.commitCallbacks.push(cb); | ||
} | ||
// @Depricated (TODO: remove in 3.5.*) | ||
addCommitCallback(cb) { | ||
this.attachCommitCallback(cb); | ||
} | ||
safe(fn) { | ||
@@ -112,0 +116,0 @@ const app = this; |
@@ -320,8 +320,15 @@ import { stars, hasOpenreplayAttribute } from '../utils'; | ||
handleIframe(iframe) { | ||
let context = null; | ||
const handle = () => { | ||
const context = iframe.contentWindow; | ||
const id = this.app.nodes.getID(iframe); | ||
if (!context || id === undefined) { | ||
if (id === undefined) { | ||
return; | ||
} | ||
if (iframe.contentWindow === context) { | ||
return; | ||
} | ||
context = iframe.contentWindow; | ||
if (!context) { | ||
return; | ||
} | ||
const observer = new Observer(this.app, this.options, context); | ||
@@ -328,0 +335,0 @@ this.iframeObservers.push(observer); |
@@ -9,6 +9,5 @@ import App from './app'; | ||
import { Options as InputOptions } from './modules/input'; | ||
import { Options as MouseOptions } from './modules/mouse'; | ||
import { Options as PerformanceOptions } from './modules/performance'; | ||
import { Options as TimingOptions } from './modules/timing'; | ||
export declare type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & MouseOptions & PerformanceOptions & TimingOptions> & { | ||
export declare type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & PerformanceOptions & TimingOptions> & { | ||
projectID?: number; | ||
@@ -15,0 +14,0 @@ projectKey: string; |
@@ -96,3 +96,3 @@ import App, { DEFAULT_INGEST_POINT } from './app'; | ||
Input(this.app, options); | ||
Mouse(this.app, options); | ||
Mouse(this.app); | ||
Timing(this.app, options); | ||
@@ -112,3 +112,3 @@ Performance(this.app, options); | ||
req.send(JSON.stringify({ | ||
trackerVersion: '3.4.4', | ||
trackerVersion: '3.4.5', | ||
projectKey: options.projectKey, | ||
@@ -115,0 +115,0 @@ doNotTrack, |
@@ -100,3 +100,3 @@ import { IN_BROWSER } from '../utils'; | ||
app.ticker.attach(reset, 33, false); | ||
options.consoleMethods.forEach((method) => { | ||
const patchConsole = (console) => options.consoleMethods.forEach((method) => { | ||
if (consoleMethods.indexOf(method) === -1) { | ||
@@ -115,2 +115,17 @@ console.error(`OpenReplay: unsupported console method "${method}"`); | ||
}); | ||
patchConsole(window.console); | ||
app.nodes.attachNodeCallback(node => { | ||
if (node instanceof HTMLIFrameElement) { | ||
let context = node.contentWindow; | ||
if (context) { | ||
patchConsole(context.console); | ||
} | ||
app.attachEventListener(node, "load", () => { | ||
if (node.contentWindow !== context) { | ||
context = node.contentWindow; | ||
patchConsole(context.console); | ||
} | ||
}); | ||
} | ||
}); | ||
} |
@@ -22,3 +22,3 @@ import { LongTask } from '../messages'; | ||
const observer = new PerformanceObserver((list) => list.getEntries().forEach(longTask)); | ||
observer.observe({ entryTypes: ['longtask'], buffered: true }); | ||
observer.observe({ entryTypes: ['longtask'] }); | ||
} |
@@ -1,10 +0,2 @@ | ||
import type { Options as FinderOptions } from '../vendors/finder/finder'; | ||
import App from '../app'; | ||
interface HeatmapsOptions { | ||
finder: FinderOptions; | ||
} | ||
export interface Options { | ||
heatmaps: boolean | HeatmapsOptions; | ||
} | ||
export default function (app: App, opts: Partial<Options>): void; | ||
export {}; | ||
export default function (app: App): void; |
@@ -1,5 +0,25 @@ | ||
import { finder } from '../vendors/finder/finder'; | ||
import { normSpaces, hasOpenreplayAttribute, getLabelAttribute } from '../utils'; | ||
import { MouseMove, MouseClick } from '../messages'; | ||
import { getInputLabel } from './input'; | ||
function _getSelector(target) { | ||
let el = target; | ||
let selector = null; | ||
do { | ||
if (el.id) { | ||
return `#${el.id}` + (selector ? ` > ${selector}` : ''); | ||
} | ||
selector = | ||
el.className.split(' ') | ||
.map(cn => cn.trim()) | ||
.filter(cn => cn !== '') | ||
.reduce((sel, cn) => `${sel}.${cn}`, el.tagName.toLowerCase()) + | ||
(selector ? ` > ${selector}` : ''); | ||
if (el === document.body) { | ||
return selector; | ||
} | ||
el = el.parentElement; | ||
} while (el !== document.body && el !== null); | ||
return selector; | ||
} | ||
//TODO: fix (typescript doesn't allow work when the guard is inside the function) | ||
function getTarget(target) { | ||
@@ -66,11 +86,7 @@ if (target instanceof Element) { | ||
} | ||
export default function (app, opts) { | ||
const options = Object.assign({ | ||
heatmaps: false // { | ||
// finder: { | ||
// threshold: 5, | ||
// maxNumberOfTries: 600, | ||
// }, | ||
// }, | ||
}, opts); | ||
export default function (app) { | ||
// const options: Options = Object.assign( | ||
// {}, | ||
// opts, | ||
// ); | ||
let mousePositionX = -1; | ||
@@ -95,7 +111,3 @@ let mousePositionY = -1; | ||
function getSelector(id, target) { | ||
if (options.heatmaps === false) { | ||
return ''; | ||
} | ||
return selectorMap[id] = selectorMap[id] || | ||
finder(target, options.heatmaps === true ? undefined : options.heatmaps.finder); | ||
return selectorMap[id] = selectorMap[id] || _getSelector(target); | ||
} | ||
@@ -102,0 +114,0 @@ app.attachEventListener(document.documentElement, 'mouseover', (e) => { |
{ | ||
"name": "@openreplay/tracker", | ||
"description": "The OpenReplay tracker main package", | ||
"version": "3.4.4", | ||
"version": "3.4.5", | ||
"keywords": [ | ||
@@ -41,3 +41,2 @@ "logging", | ||
"dependencies": { | ||
"@medv/finder": "^2.0.0", | ||
"error-stack-parser": "^2.0.6" | ||
@@ -44,0 +43,0 @@ }, |
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
323715
1
8120
- Removed@medv/finder@^2.0.0
- Removed@medv/finder@2.1.0(transitive)