@amplitude/plugin-session-replay-browser
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -15,2 +15,3 @@ import { IDBStoreSession } from './typings/session-replay'; | ||
export declare const defaultSessionStore: IDBStoreSession; | ||
export declare const MAX_IDB_STORAGE_LENGTH: number; | ||
//# sourceMappingURL=constants.d.ts.map |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.defaultSessionStore = exports.MAX_INTERVAL = exports.MIN_INTERVAL = exports.MAX_EVENT_LIST_SIZE_IN_BYTES = exports.STORAGE_PREFIX = exports.SESSION_REPLAY_SERVER_URL = exports.UNMASK_TEXT_CLASS = exports.MASK_TEXT_CLASS = exports.BLOCK_CLASS = exports.DEFAULT_SESSION_END_EVENT = exports.DEFAULT_SESSION_START_EVENT = exports.DEFAULT_SESSION_REPLAY_PROPERTY = exports.DEFAULT_EVENT_PROPERTY_PREFIX = void 0; | ||
exports.MAX_IDB_STORAGE_LENGTH = exports.defaultSessionStore = exports.MAX_INTERVAL = exports.MIN_INTERVAL = exports.MAX_EVENT_LIST_SIZE_IN_BYTES = exports.STORAGE_PREFIX = exports.SESSION_REPLAY_SERVER_URL = exports.UNMASK_TEXT_CLASS = exports.MASK_TEXT_CLASS = exports.BLOCK_CLASS = 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"); | ||
@@ -22,2 +22,3 @@ exports.DEFAULT_EVENT_PROPERTY_PREFIX = '[Amplitude]'; | ||
}; | ||
exports.MAX_IDB_STORAGE_LENGTH = 1000 * 60 * 60 * 24 * 3; // 3 days | ||
//# sourceMappingURL=constants.js.map |
@@ -168,4 +168,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
SessionReplay.prototype.setShouldRecord = function (sessionStore) { | ||
if ((sessionStore === null || sessionStore === void 0 ? void 0 : sessionStore.shouldRecord) === false) { | ||
this.shouldRecord = false; | ||
if (sessionStore && typeof sessionStore.shouldRecord === 'boolean') { | ||
this.shouldRecord = sessionStore.shouldRecord; | ||
} | ||
@@ -344,3 +344,3 @@ else if (this.config.optOut) { | ||
if (res === null) { | ||
this.completeRequest({ context: context, err: messages_1.UNEXPECTED_ERROR_MESSAGE, removeEvents: false }); | ||
this.completeRequest({ context: context, err: messages_1.UNEXPECTED_ERROR_MESSAGE }); | ||
return [2 /*return*/]; | ||
@@ -364,3 +364,3 @@ } | ||
e_1 = _a.sent(); | ||
this.completeRequest({ context: context, err: e_1, removeEvents: false }); | ||
this.completeRequest({ context: context, err: e_1 }); | ||
return [3 /*break*/, 4]; | ||
@@ -479,2 +479,3 @@ case 4: return [2 /*return*/]; | ||
sequenceToUpdate.status = session_replay_1.RecordingStatus.SENT; | ||
// Delete sent sequences for current session | ||
Object.entries(session.sessionSequences).forEach(function (_a) { | ||
@@ -487,2 +488,9 @@ var _b = tslib_1.__read(_a, 2), storedSeqId = _b[0], sequence = _b[1]; | ||
}); | ||
// Delete any sessions that are older than 3 days | ||
Object.keys(sessionMap).forEach(function (sessionId) { | ||
var numericSessionId = parseInt(sessionId, 10); | ||
if (Date.now() - numericSessionId >= constants_1.MAX_IDB_STORAGE_LENGTH) { | ||
delete sessionMap[numericSessionId]; | ||
} | ||
}); | ||
return sessionMap; | ||
@@ -503,4 +511,4 @@ })]; | ||
SessionReplay.prototype.completeRequest = function (_a) { | ||
var context = _a.context, err = _a.err, success = _a.success, _b = _a.removeEvents, removeEvents = _b === void 0 ? true : _b; | ||
removeEvents && context.sessionId && this.cleanUpSessionEventsStore(context.sessionId, context.sequenceId); | ||
var context = _a.context, err = _a.err, success = _a.success; | ||
context.sessionId && this.cleanUpSessionEventsStore(context.sessionId, context.sequenceId); | ||
if (err) { | ||
@@ -507,0 +515,0 @@ this.config.loggerProvider.error(err); |
@@ -15,2 +15,3 @@ import { IDBStoreSession } from './typings/session-replay'; | ||
export declare const defaultSessionStore: IDBStoreSession; | ||
export declare const MAX_IDB_STORAGE_LENGTH: number; | ||
//# sourceMappingURL=constants.d.ts.map |
@@ -20,2 +20,3 @@ import { AMPLITUDE_PREFIX } from '@amplitude/analytics-core'; | ||
}; | ||
export var MAX_IDB_STORAGE_LENGTH = 1000 * 60 * 60 * 24 * 3; // 3 days | ||
//# sourceMappingURL=constants.js.map |
@@ -7,3 +7,3 @@ import { __assign, __awaiter, __generator, __read } from "tslib"; | ||
import { pack, record } from 'rrweb'; | ||
import { BLOCK_CLASS, DEFAULT_SESSION_END_EVENT, DEFAULT_SESSION_REPLAY_PROPERTY, DEFAULT_SESSION_START_EVENT, MASK_TEXT_CLASS, MAX_EVENT_LIST_SIZE_IN_BYTES, MAX_INTERVAL, MIN_INTERVAL, SESSION_REPLAY_SERVER_URL, STORAGE_PREFIX, defaultSessionStore, } from './constants'; | ||
import { BLOCK_CLASS, DEFAULT_SESSION_END_EVENT, DEFAULT_SESSION_REPLAY_PROPERTY, DEFAULT_SESSION_START_EVENT, MASK_TEXT_CLASS, MAX_EVENT_LIST_SIZE_IN_BYTES, MAX_IDB_STORAGE_LENGTH, MAX_INTERVAL, MIN_INTERVAL, SESSION_REPLAY_SERVER_URL, STORAGE_PREFIX, defaultSessionStore, } from './constants'; | ||
import { maskInputFn } from './helpers'; | ||
@@ -167,4 +167,4 @@ import { MAX_RETRIES_EXCEEDED_MESSAGE, STORAGE_FAILURE, UNEXPECTED_ERROR_MESSAGE, getSuccessMessage } from './messages'; | ||
SessionReplay.prototype.setShouldRecord = function (sessionStore) { | ||
if ((sessionStore === null || sessionStore === void 0 ? void 0 : sessionStore.shouldRecord) === false) { | ||
this.shouldRecord = false; | ||
if (sessionStore && typeof sessionStore.shouldRecord === 'boolean') { | ||
this.shouldRecord = sessionStore.shouldRecord; | ||
} | ||
@@ -343,3 +343,3 @@ else if (this.config.optOut) { | ||
if (res === null) { | ||
this.completeRequest({ context: context, err: UNEXPECTED_ERROR_MESSAGE, removeEvents: false }); | ||
this.completeRequest({ context: context, err: UNEXPECTED_ERROR_MESSAGE }); | ||
return [2 /*return*/]; | ||
@@ -363,3 +363,3 @@ } | ||
e_1 = _a.sent(); | ||
this.completeRequest({ context: context, err: e_1, removeEvents: false }); | ||
this.completeRequest({ context: context, err: e_1 }); | ||
return [3 /*break*/, 4]; | ||
@@ -478,2 +478,3 @@ case 4: return [2 /*return*/]; | ||
sequenceToUpdate.status = RecordingStatus.SENT; | ||
// Delete sent sequences for current session | ||
Object.entries(session.sessionSequences).forEach(function (_a) { | ||
@@ -486,2 +487,9 @@ var _b = __read(_a, 2), storedSeqId = _b[0], sequence = _b[1]; | ||
}); | ||
// Delete any sessions that are older than 3 days | ||
Object.keys(sessionMap).forEach(function (sessionId) { | ||
var numericSessionId = parseInt(sessionId, 10); | ||
if (Date.now() - numericSessionId >= MAX_IDB_STORAGE_LENGTH) { | ||
delete sessionMap[numericSessionId]; | ||
} | ||
}); | ||
return sessionMap; | ||
@@ -502,4 +510,4 @@ })]; | ||
SessionReplay.prototype.completeRequest = function (_a) { | ||
var context = _a.context, err = _a.err, success = _a.success, _b = _a.removeEvents, removeEvents = _b === void 0 ? true : _b; | ||
removeEvents && context.sessionId && this.cleanUpSessionEventsStore(context.sessionId, context.sequenceId); | ||
var context = _a.context, err = _a.err, success = _a.success; | ||
context.sessionId && this.cleanUpSessionEventsStore(context.sessionId, context.sequenceId); | ||
if (err) { | ||
@@ -506,0 +514,0 @@ this.config.loggerProvider.error(err); |
@@ -15,2 +15,3 @@ import { IDBStoreSession } from './typings/session-replay'; | ||
export declare const defaultSessionStore: IDBStoreSession; | ||
export declare const MAX_IDB_STORAGE_LENGTH: number; | ||
//# sourceMappingURL=constants.d.ts.map |
{ | ||
"name": "@amplitude/plugin-session-replay-browser", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "", | ||
@@ -58,3 +58,3 @@ "author": "Amplitude Inc", | ||
], | ||
"gitHead": "856f91dc11c7f0336a800e299838ef2e2b8556df" | ||
"gitHead": "e641477064763d7dedf41bcd870aa149cccf1832" | ||
} |
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
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
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
412719
2147
5