New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@amplitude/session-replay-browser

Package Overview
Dependencies
Maintainers
0
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplitude/session-replay-browser - npm Package Compare versions

Comparing version 1.13.0 to 1.13.1

4

lib/cjs/constants.d.ts

@@ -23,2 +23,6 @@ import { ServerZone } from '@amplitude/analytics-types';

export declare const KB_SIZE = 1024;
export declare enum CustomRRwebEvent {
GET_SR_PROPS = "get-sr-props",
DEBUG_INFO = "debug-info"
}
//# sourceMappingURL=constants.d.ts.map
Object.defineProperty(exports, "__esModule", { value: true });
exports.KB_SIZE = exports.MAX_IDB_STORAGE_LENGTH = exports.MAX_INTERVAL = exports.MIN_INTERVAL = exports.INTERACTION_MAX_INTERVAL = exports.INTERACTION_MIN_INTERVAL = exports.MAX_EVENT_LIST_SIZE_IN_BYTES = exports.STORAGE_PREFIX = exports.SESSION_REPLAY_STAGING_URL = exports.SESSION_REPLAY_EU_URL = exports.SESSION_REPLAY_SERVER_URL = exports.UNMASK_TEXT_CLASS = exports.MASK_TEXT_CLASS = exports.BLOCK_CLASS = exports.SESSION_REPLAY_DEBUG_PROPERTY = exports.DEFAULT_SERVER_ZONE = exports.DEFAULT_SAMPLE_RATE = exports.DEFAULT_SESSION_END_EVENT = exports.DEFAULT_SESSION_START_EVENT = exports.DEFAULT_SESSION_REPLAY_PROPERTY = exports.DEFAULT_EVENT_PROPERTY_PREFIX = void 0;
exports.CustomRRwebEvent = exports.KB_SIZE = exports.MAX_IDB_STORAGE_LENGTH = exports.MAX_INTERVAL = exports.MIN_INTERVAL = exports.INTERACTION_MAX_INTERVAL = exports.INTERACTION_MIN_INTERVAL = exports.MAX_EVENT_LIST_SIZE_IN_BYTES = exports.STORAGE_PREFIX = exports.SESSION_REPLAY_STAGING_URL = exports.SESSION_REPLAY_EU_URL = exports.SESSION_REPLAY_SERVER_URL = exports.UNMASK_TEXT_CLASS = exports.MASK_TEXT_CLASS = exports.BLOCK_CLASS = exports.SESSION_REPLAY_DEBUG_PROPERTY = exports.DEFAULT_SERVER_ZONE = exports.DEFAULT_SAMPLE_RATE = exports.DEFAULT_SESSION_END_EVENT = exports.DEFAULT_SESSION_START_EVENT = exports.DEFAULT_SESSION_REPLAY_PROPERTY = exports.DEFAULT_EVENT_PROPERTY_PREFIX = void 0;
var analytics_core_1 = require("@amplitude/analytics-core");

@@ -26,2 +26,7 @@ var analytics_types_1 = require("@amplitude/analytics-types");

exports.KB_SIZE = 1024;
var CustomRRwebEvent;
(function (CustomRRwebEvent) {
CustomRRwebEvent["GET_SR_PROPS"] = "get-sr-props";
CustomRRwebEvent["DEBUG_INFO"] = "debug-info";
})(CustomRRwebEvent = exports.CustomRRwebEvent || (exports.CustomRRwebEvent = {}));
//# sourceMappingURL=constants.js.map

9

lib/cjs/helpers.js

@@ -121,6 +121,7 @@ var _this = this;

var getStorageSize = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var globalScope, _a, usage, quota, usageDetails, totalStorageSize, percentOfQuota;
var globalScope, _a, usage, quota, usageDetails, totalStorageSize, percentOfQuota, e_1;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_b.trys.push([0, 3, , 4]);
globalScope = (0, analytics_client_common_1.getGlobalScope)();

@@ -134,3 +135,7 @@ if (!globalScope) return [3 /*break*/, 2];

return [2 /*return*/, { totalStorageSize: totalStorageSize, percentOfQuota: percentOfQuota, usageDetails: JSON.stringify(usageDetails) }];
case 2: return [2 /*return*/, { totalStorageSize: 0, percentOfQuota: 0, usageDetails: '' }];
case 2: return [3 /*break*/, 4];
case 3:
e_1 = _b.sent();
return [3 /*break*/, 4];
case 4: return [2 /*return*/, { totalStorageSize: 0, percentOfQuota: 0, usageDetails: '' }];
}

@@ -137,0 +142,0 @@ });

import { Logger as ILogger } from '@amplitude/analytics-types';
import { record } from '@amplitude/rrweb';
import { SessionReplayJoinedConfig, SessionReplayJoinedConfigGenerator } from './config/types';
import { AmplitudeSessionReplay, SessionReplayEventsManager as AmplitudeSessionReplayEventsManager, DebugInfo, SessionIdentifiers as ISessionIdentifiers, SessionReplayOptions } from './typings/session-replay';
import { CustomRRwebEvent } from './constants';
import { AmplitudeSessionReplay, SessionReplayEventsManager as AmplitudeSessionReplayEventsManager, SessionIdentifiers as ISessionIdentifiers, SessionReplayOptions } from './typings/session-replay';
type PageLeaveFn = (e: PageTransitionEvent | Event) => void;

@@ -14,2 +15,3 @@ export declare class SessionReplay implements AmplitudeSessionReplay {

recordCancelCallback: ReturnType<typeof record> | null;
eventCount: number;
pageLeaveFns: PageLeaveFn[];

@@ -42,7 +44,5 @@ private scrollHook?;

recordEvents(): void;
/**
* Used to send a debug RRWeb event. Typing is included for ease of debugging later on, but probably not
* used at compile/run time.
*/
getDebugInfo: () => Promise<DebugInfo | undefined>;
addCustomRRWebEvent: (eventName: CustomRRwebEvent, eventData?: {
[key: string]: any;
}, addStorageInfo?: boolean) => Promise<void>;
stopRecordingEvents: () => void;

@@ -49,0 +49,0 @@ getDeviceId(): string | undefined;

@@ -21,2 +21,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

this.recordCancelCallback = null;
this.eventCount = 0;
// Visible for testing

@@ -63,21 +64,41 @@ this.pageLeaveFns = [];

};
/**
* Used to send a debug RRWeb event. Typing is included for ease of debugging later on, but probably not
* used at compile/run time.
*/
this.getDebugInfo = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var storageSizeData;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.config) {
return [2 /*return*/];
}
return [4 /*yield*/, (0, helpers_1.getStorageSize)()];
case 1:
storageSizeData = _a.sent();
return [2 /*return*/, tslib_1.__assign(tslib_1.__assign({}, storageSizeData), { config: (0, helpers_1.getDebugConfig)(this.config), version: version_1.VERSION })];
}
this.addCustomRRWebEvent = function (eventName, eventData, addStorageInfo) {
if (eventData === void 0) { eventData = {}; }
if (addStorageInfo === void 0) { addStorageInfo = true; }
return tslib_1.__awaiter(_this, void 0, void 0, function () {
var debugInfo, storageSizeData, e_1;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 3, , 4]);
debugInfo = undefined;
if (!this.config) return [3 /*break*/, 2];
debugInfo = {
config: (0, helpers_1.getDebugConfig)(this.config),
version: version_1.VERSION,
};
if (!addStorageInfo) return [3 /*break*/, 2];
return [4 /*yield*/, (0, helpers_1.getStorageSize)()];
case 1:
storageSizeData = _a.sent();
debugInfo = tslib_1.__assign(tslib_1.__assign({}, storageSizeData), debugInfo);
_a.label = 2;
case 2:
// Check first to ensure we are recording
if (this.recordCancelCallback) {
rrweb_1.record.addCustomEvent(eventName, tslib_1.__assign(tslib_1.__assign({}, eventData), debugInfo));
}
else {
this.loggerProvider.debug("Not able to add custom replay capture event ".concat(eventName, " due to no ongoing recording."));
}
return [3 /*break*/, 4];
case 3:
e_1 = _a.sent();
this.loggerProvider.debug('Error while adding custom replay capture event: ', e_1);
return [3 /*break*/, 4];
case 4: return [2 /*return*/];
}
});
});
}); };
};
this.stopRecordingEvents = function () {

@@ -205,4 +226,5 @@ try {

var shouldRecord = this.getShouldRecord();
var eventProperties = {};
if (shouldRecord) {
var eventProperties = (_a = {},
eventProperties = (_a = {},
_a[constants_1.DEFAULT_SESSION_REPLAY_PROPERTY] = this.identifiers.sessionReplayId ? this.identifiers.sessionReplayId : null,

@@ -213,5 +235,12 @@ _a);

}
return eventProperties;
}
return {};
void this.addCustomRRWebEvent(constants_1.CustomRRwebEvent.GET_SR_PROPS, {
shouldRecord: shouldRecord,
eventProperties: eventProperties,
}, this.eventCount === 10);
if (this.eventCount === 10) {
this.eventCount = 0;
}
this.eventCount++;
return eventProperties;
};

@@ -355,9 +384,3 @@ SessionReplay.prototype.sendEvents = function (sessionId) {

});
this.getDebugInfo()
.then(function (debugInfo) {
debugInfo && rrweb_1.record.addCustomEvent('debug-info', debugInfo);
})
.catch(function () {
// swallow error
});
void this.addCustomRRWebEvent(constants_1.CustomRRwebEvent.DEBUG_INFO);
};

@@ -364,0 +387,0 @@ SessionReplay.prototype.getDeviceId = function () {

@@ -8,3 +8,3 @@ import { AmplitudeReturn, ServerZone } from '@amplitude/analytics-types';

};
export interface DebugInfo extends StorageData {
export interface DebugInfo extends Partial<StorageData> {
config: SessionReplayJoinedConfig;

@@ -11,0 +11,0 @@ version: string;

@@ -1,2 +0,2 @@

export declare const VERSION = "1.13.0";
export declare const VERSION = "1.13.1";
//# sourceMappingURL=version.d.ts.map
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = void 0;
// Autogenerated by `yarn version-file`. DO NOT EDIT
exports.VERSION = '1.13.0';
exports.VERSION = '1.13.1';
//# sourceMappingURL=version.js.map

@@ -23,2 +23,6 @@ import { ServerZone } from '@amplitude/analytics-types';

export declare const KB_SIZE = 1024;
export declare enum CustomRRwebEvent {
GET_SR_PROPS = "get-sr-props",
DEBUG_INFO = "debug-info"
}
//# sourceMappingURL=constants.d.ts.map

@@ -24,2 +24,7 @@ import { AMPLITUDE_PREFIX } from '@amplitude/analytics-core';

export var KB_SIZE = 1024;
export var CustomRRwebEvent;
(function (CustomRRwebEvent) {
CustomRRwebEvent["GET_SR_PROPS"] = "get-sr-props";
CustomRRwebEvent["DEBUG_INFO"] = "debug-info";
})(CustomRRwebEvent || (CustomRRwebEvent = {}));
//# sourceMappingURL=constants.js.map

@@ -112,6 +112,7 @@ import { __assign, __awaiter, __generator } from "tslib";

export var getStorageSize = function () { return __awaiter(void 0, void 0, void 0, function () {
var globalScope, _a, usage, quota, usageDetails, totalStorageSize, percentOfQuota;
var globalScope, _a, usage, quota, usageDetails, totalStorageSize, percentOfQuota, e_1;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_b.trys.push([0, 3, , 4]);
globalScope = getGlobalScope();

@@ -125,3 +126,7 @@ if (!globalScope) return [3 /*break*/, 2];

return [2 /*return*/, { totalStorageSize: totalStorageSize, percentOfQuota: percentOfQuota, usageDetails: JSON.stringify(usageDetails) }];
case 2: return [2 /*return*/, { totalStorageSize: 0, percentOfQuota: 0, usageDetails: '' }];
case 2: return [3 /*break*/, 4];
case 3:
e_1 = _b.sent();
return [3 /*break*/, 4];
case 4: return [2 /*return*/, { totalStorageSize: 0, percentOfQuota: 0, usageDetails: '' }];
}

@@ -128,0 +133,0 @@ });

import { Logger as ILogger } from '@amplitude/analytics-types';
import { record } from '@amplitude/rrweb';
import { SessionReplayJoinedConfig, SessionReplayJoinedConfigGenerator } from './config/types';
import { AmplitudeSessionReplay, SessionReplayEventsManager as AmplitudeSessionReplayEventsManager, DebugInfo, SessionIdentifiers as ISessionIdentifiers, SessionReplayOptions } from './typings/session-replay';
import { CustomRRwebEvent } from './constants';
import { AmplitudeSessionReplay, SessionReplayEventsManager as AmplitudeSessionReplayEventsManager, SessionIdentifiers as ISessionIdentifiers, SessionReplayOptions } from './typings/session-replay';
type PageLeaveFn = (e: PageTransitionEvent | Event) => void;

@@ -14,2 +15,3 @@ export declare class SessionReplay implements AmplitudeSessionReplay {

recordCancelCallback: ReturnType<typeof record> | null;
eventCount: number;
pageLeaveFns: PageLeaveFn[];

@@ -42,7 +44,5 @@ private scrollHook?;

recordEvents(): void;
/**
* Used to send a debug RRWeb event. Typing is included for ease of debugging later on, but probably not
* used at compile/run time.
*/
getDebugInfo: () => Promise<DebugInfo | undefined>;
addCustomRRWebEvent: (eventName: CustomRRwebEvent, eventData?: {
[key: string]: any;
}, addStorageInfo?: boolean) => Promise<void>;
stopRecordingEvents: () => void;

@@ -49,0 +49,0 @@ getDeviceId(): string | undefined;

@@ -6,3 +6,3 @@ import { __assign, __awaiter, __generator, __read, __spreadArray } from "tslib";

import { createSessionReplayJoinedConfigGenerator } from './config/joined-config';
import { BLOCK_CLASS, DEFAULT_SESSION_REPLAY_PROPERTY, INTERACTION_MAX_INTERVAL, INTERACTION_MIN_INTERVAL, MASK_TEXT_CLASS, SESSION_REPLAY_DEBUG_PROPERTY, } from './constants';
import { BLOCK_CLASS, CustomRRwebEvent, DEFAULT_SESSION_REPLAY_PROPERTY, INTERACTION_MAX_INTERVAL, INTERACTION_MIN_INTERVAL, MASK_TEXT_CLASS, SESSION_REPLAY_DEBUG_PROPERTY, } from './constants';
import { createEventsManager } from './events/events-manager';

@@ -20,2 +20,3 @@ import { MultiEventManager } from './events/multi-manager';

this.recordCancelCallback = null;
this.eventCount = 0;
// Visible for testing

@@ -62,21 +63,41 @@ this.pageLeaveFns = [];

};
/**
* Used to send a debug RRWeb event. Typing is included for ease of debugging later on, but probably not
* used at compile/run time.
*/
this.getDebugInfo = function () { return __awaiter(_this, void 0, void 0, function () {
var storageSizeData;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.config) {
return [2 /*return*/];
}
return [4 /*yield*/, getStorageSize()];
case 1:
storageSizeData = _a.sent();
return [2 /*return*/, __assign(__assign({}, storageSizeData), { config: getDebugConfig(this.config), version: VERSION })];
}
this.addCustomRRWebEvent = function (eventName, eventData, addStorageInfo) {
if (eventData === void 0) { eventData = {}; }
if (addStorageInfo === void 0) { addStorageInfo = true; }
return __awaiter(_this, void 0, void 0, function () {
var debugInfo, storageSizeData, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 3, , 4]);
debugInfo = undefined;
if (!this.config) return [3 /*break*/, 2];
debugInfo = {
config: getDebugConfig(this.config),
version: VERSION,
};
if (!addStorageInfo) return [3 /*break*/, 2];
return [4 /*yield*/, getStorageSize()];
case 1:
storageSizeData = _a.sent();
debugInfo = __assign(__assign({}, storageSizeData), debugInfo);
_a.label = 2;
case 2:
// Check first to ensure we are recording
if (this.recordCancelCallback) {
record.addCustomEvent(eventName, __assign(__assign({}, eventData), debugInfo));
}
else {
this.loggerProvider.debug("Not able to add custom replay capture event ".concat(eventName, " due to no ongoing recording."));
}
return [3 /*break*/, 4];
case 3:
e_1 = _a.sent();
this.loggerProvider.debug('Error while adding custom replay capture event: ', e_1);
return [3 /*break*/, 4];
case 4: return [2 /*return*/];
}
});
});
}); };
};
this.stopRecordingEvents = function () {

@@ -204,4 +225,5 @@ try {

var shouldRecord = this.getShouldRecord();
var eventProperties = {};
if (shouldRecord) {
var eventProperties = (_a = {},
eventProperties = (_a = {},
_a[DEFAULT_SESSION_REPLAY_PROPERTY] = this.identifiers.sessionReplayId ? this.identifiers.sessionReplayId : null,

@@ -212,5 +234,12 @@ _a);

}
return eventProperties;
}
return {};
void this.addCustomRRWebEvent(CustomRRwebEvent.GET_SR_PROPS, {
shouldRecord: shouldRecord,
eventProperties: eventProperties,
}, this.eventCount === 10);
if (this.eventCount === 10) {
this.eventCount = 0;
}
this.eventCount++;
return eventProperties;
};

@@ -354,9 +383,3 @@ SessionReplay.prototype.sendEvents = function (sessionId) {

});
this.getDebugInfo()
.then(function (debugInfo) {
debugInfo && record.addCustomEvent('debug-info', debugInfo);
})
.catch(function () {
// swallow error
});
void this.addCustomRRWebEvent(CustomRRwebEvent.DEBUG_INFO);
};

@@ -363,0 +386,0 @@ SessionReplay.prototype.getDeviceId = function () {

@@ -8,3 +8,3 @@ import { AmplitudeReturn, ServerZone } from '@amplitude/analytics-types';

};
export interface DebugInfo extends StorageData {
export interface DebugInfo extends Partial<StorageData> {
config: SessionReplayJoinedConfig;

@@ -11,0 +11,0 @@ version: string;

@@ -1,2 +0,2 @@

export declare const VERSION = "1.13.0";
export declare const VERSION = "1.13.1";
//# sourceMappingURL=version.d.ts.map
// Autogenerated by `yarn version-file`. DO NOT EDIT
export var VERSION = '1.13.0';
export var VERSION = '1.13.1';
//# sourceMappingURL=version.js.map

@@ -23,2 +23,6 @@ import { ServerZone } from '@amplitude/analytics-types';

export declare const KB_SIZE = 1024;
export declare enum CustomRRwebEvent {
GET_SR_PROPS = "get-sr-props",
DEBUG_INFO = "debug-info"
}
//# sourceMappingURL=constants.d.ts.map
import { Logger as ILogger } from '@amplitude/analytics-types';
import { record } from '@amplitude/rrweb';
import { SessionReplayJoinedConfig, SessionReplayJoinedConfigGenerator } from './config/types';
import { AmplitudeSessionReplay, SessionReplayEventsManager as AmplitudeSessionReplayEventsManager, DebugInfo, SessionIdentifiers as ISessionIdentifiers, SessionReplayOptions } from './typings/session-replay';
import { CustomRRwebEvent } from './constants';
import { AmplitudeSessionReplay, SessionReplayEventsManager as AmplitudeSessionReplayEventsManager, SessionIdentifiers as ISessionIdentifiers, SessionReplayOptions } from './typings/session-replay';
type PageLeaveFn = (e: PageTransitionEvent | Event) => void;

@@ -14,2 +15,3 @@ export declare class SessionReplay implements AmplitudeSessionReplay {

recordCancelCallback: ReturnType<typeof record> | null;
eventCount: number;
pageLeaveFns: PageLeaveFn[];

@@ -42,7 +44,5 @@ private scrollHook?;

recordEvents(): void;
/**
* Used to send a debug RRWeb event. Typing is included for ease of debugging later on, but probably not
* used at compile/run time.
*/
getDebugInfo: () => Promise<DebugInfo | undefined>;
addCustomRRWebEvent: (eventName: CustomRRwebEvent, eventData?: {
[key: string]: any;
}, addStorageInfo?: boolean) => Promise<void>;
stopRecordingEvents: () => void;

@@ -49,0 +49,0 @@ getDeviceId(): string | undefined;

@@ -8,3 +8,3 @@ import { AmplitudeReturn, ServerZone } from '@amplitude/analytics-types';

};
export interface DebugInfo extends StorageData {
export interface DebugInfo extends Partial<StorageData> {
config: SessionReplayJoinedConfig;

@@ -11,0 +11,0 @@ version: string;

@@ -1,2 +0,2 @@

export declare const VERSION = "1.13.0";
export declare const VERSION = "1.13.1";
//# sourceMappingURL=version.d.ts.map
{
"name": "@amplitude/session-replay-browser",
"version": "1.13.0",
"version": "1.13.1",
"description": "",

@@ -43,3 +43,3 @@ "author": "Amplitude Inc",

"@amplitude/analytics-core": ">=1 <3",
"@amplitude/analytics-remote-config": "^0.3.4",
"@amplitude/analytics-remote-config": "^0.3.5",
"@amplitude/analytics-types": ">=1 <3",

@@ -67,3 +67,3 @@ "@amplitude/rrweb": "2.0.0-alpha.19",

],
"gitHead": "4514fbd5e5ac24426e4091ddb8d2604228099b14"
"gitHead": "bec7a72759f8830aaad99256dc521d2f9fd2e0a7"
}

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 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 not supported yet

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 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