Socket
Socket
Sign inDemoInstall

posthog-js

Package Overview
Dependencies
Maintainers
1
Versions
581
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posthog-js - npm Package Compare versions

Comparing version 1.161.2 to 1.161.3

1

dist/lib/src/extensions/replay/sessionrecording.d.ts

@@ -31,2 +31,3 @@ import { PostHog } from '../../posthog-core';

private _fullSnapshotTimer?;
private _removePageViewCaptureHook;
private _lastHref?;

@@ -33,0 +34,0 @@ _forceAllowLocalhostNetworkCapture: boolean;

2

dist/lib/src/posthog-core.d.ts

@@ -146,3 +146,3 @@ import { PostHogFeatureFlags } from './posthog-featureflags';

capture(event_name: string, properties?: Properties | null, options?: CaptureOptions): CaptureResult | undefined;
_addCaptureHook(callback: (eventName: string, eventPayload?: CaptureResult) => void): void;
_addCaptureHook(callback: (eventName: string, eventPayload?: CaptureResult) => void): () => void;
_calculate_event_properties(event_name: string, event_properties: Properties, timestamp?: Date): Properties;

@@ -149,0 +149,0 @@ _calculate_set_once_properties(dataSetOnce?: Properties): Properties | undefined;

{
"name": "posthog-js",
"version": "1.161.2",
"version": "1.161.3",
"description": "Posthog-js allows you to automatically capture usage and send events to PostHog.",

@@ -5,0 +5,0 @@ "repository": "https://github.com/PostHog/posthog-js",

@@ -31,2 +31,3 @@ import { PostHog } from '../../posthog-core';

private _fullSnapshotTimer?;
private _removePageViewCaptureHook;
private _lastHref?;

@@ -33,0 +34,0 @@ _forceAllowLocalhostNetworkCapture: boolean;

@@ -95,2 +95,3 @@ var __assign = (this && this.__assign) || function () {

this._linkedFlag = null;
this._removePageViewCaptureHook = undefined;
// Util to help developers working on this feature manually override

@@ -282,4 +283,6 @@ this._forceAllowLocalhostNetworkCapture = false;

SessionRecording.prototype.startIfEnabledOrStop = function () {
var _this = this;
if (this.isRecordingEnabled) {
this._startCapture();
// calling addEventListener multiple times is safe and will not add duplicates
window === null || window === void 0 ? void 0 : window.addEventListener('beforeunload', this._onBeforeUnload);

@@ -289,2 +292,22 @@ window === null || window === void 0 ? void 0 : window.addEventListener('offline', this._onOffline);

window === null || window === void 0 ? void 0 : window.addEventListener('visibilitychange', this._onVisibilityChange);
if (isNullish(this._removePageViewCaptureHook)) {
// :TRICKY: rrweb does not capture navigation within SPA-s, so hook into our $pageview events to get access to all events.
// Dropping the initial event is fine (it's always captured by rrweb).
this._removePageViewCaptureHook = this.instance._addCaptureHook(function (eventName) {
// If anything could go wrong here it has the potential to block the main loop,
// so we catch all errors.
try {
if (eventName === '$pageview') {
var href = window ? _this._maskUrl(window.location.href) : '';
if (!href) {
return;
}
_this._tryAddCustomEvent('$pageview', { href: href });
}
}
catch (e) {
logger.error('Could not add $pageview to rrweb session', e);
}
});
}
logger.info(LOGGER_PREFIX + ' started');

@@ -294,7 +317,6 @@ }

this.stopRecording();
this.clearBuffer();
clearInterval(this._fullSnapshotTimer);
}
};
SessionRecording.prototype.stopRecording = function () {
var _a;
if (this._captureStarted && this.stopRrweb) {

@@ -308,2 +330,6 @@ this.stopRrweb();

window === null || window === void 0 ? void 0 : window.removeEventListener('visibilitychange', this._onVisibilityChange);
this.clearBuffer();
clearInterval(this._fullSnapshotTimer);
(_a = this._removePageViewCaptureHook) === null || _a === void 0 ? void 0 : _a.call(this);
this._removePageViewCaptureHook = undefined;
logger.info(LOGGER_PREFIX + ' stopped');

@@ -623,20 +649,2 @@ }

}, plugins: activePlugins }, sessionRecordingOptions));
// :TRICKY: rrweb does not capture navigation within SPA-s, so hook into our $pageview events to get access to all events.
// Dropping the initial event is fine (it's always captured by rrweb).
this.instance._addCaptureHook(function (eventName) {
// If anything could go wrong here it has the potential to block the main loop,
// so we catch all errors.
try {
if (eventName === '$pageview') {
var href = window ? _this._maskUrl(window.location.href) : '';
if (!href) {
return;
}
_this._tryAddCustomEvent('$pageview', { href: href });
}
}
catch (e) {
logger.error('Could not add $pageview to rrweb session', e);
}
});
// We reset the last activity timestamp, resetting the idle timer

@@ -643,0 +651,0 @@ this._lastActivityTimestamp = Date.now();

@@ -146,3 +146,3 @@ import { PostHogFeatureFlags } from './posthog-featureflags';

capture(event_name: string, properties?: Properties | null, options?: CaptureOptions): CaptureResult | undefined;
_addCaptureHook(callback: (eventName: string, eventPayload?: CaptureResult) => void): void;
_addCaptureHook(callback: (eventName: string, eventPayload?: CaptureResult) => void): () => void;
_calculate_event_properties(event_name: string, event_properties: Properties, timestamp?: Date): Properties;

@@ -149,0 +149,0 @@ _calculate_set_once_properties(dataSetOnce?: Properties): Properties | undefined;

{
"name": "posthog-js",
"version": "1.161.2",
"version": "1.161.3",
"description": "Posthog-js allows you to automatically capture usage and send events to PostHog.",

@@ -5,0 +5,0 @@ "repository": "https://github.com/PostHog/posthog-js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc