@amplitude/plugin-session-replay-browser
Advanced tools
Comparing version 0.4.2 to 0.5.0
@@ -10,2 +10,3 @@ import { IDBStoreSession } from './typings/session-replay'; | ||
export declare const SESSION_REPLAY_SERVER_URL = "https://api-secure.amplitude.com/sessions/track"; | ||
export declare const SESSION_REPLAY_EU_URL = "https://api.eu.amplitude.com/sessions/track"; | ||
export declare const STORAGE_PREFIX: string; | ||
@@ -12,0 +13,0 @@ export declare const MAX_EVENT_LIST_SIZE_IN_BYTES: number; |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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; | ||
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_EU_URL = 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"); | ||
@@ -12,2 +12,3 @@ exports.DEFAULT_EVENT_PROPERTY_PREFIX = '[Amplitude]'; | ||
exports.SESSION_REPLAY_SERVER_URL = 'https://api-secure.amplitude.com/sessions/track'; | ||
exports.SESSION_REPLAY_EU_URL = 'https://api.eu.amplitude.com/sessions/track'; | ||
exports.STORAGE_PREFIX = "".concat(analytics_core_1.AMPLITUDE_PREFIX, "_replay_unsent"); | ||
@@ -14,0 +15,0 @@ var PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS = 500; // derived by JSON stringifying an example payload without events |
@@ -141,2 +141,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
storedReplaySessions = _a.sent(); | ||
// This resolves a timing issue when focus is fired multiple times in short succession, | ||
// we only want the rest of this function to run once. We can be sure that initialize has | ||
// already been called if this.stopRecordingEvents is defined | ||
if (this.stopRecordingEvents) { | ||
return [2 /*return*/]; | ||
} | ||
storedSequencesForSession = storedReplaySessions && storedReplaySessions[this.config.sessionId]; | ||
@@ -160,5 +166,3 @@ if (storedReplaySessions && storedSequencesForSession && storedSequencesForSession.sessionSequences) { | ||
} | ||
if (!this.stopRecordingEvents) { | ||
this.recordEvents(); | ||
} | ||
this.recordEvents(); | ||
return [2 /*return*/]; | ||
@@ -312,6 +316,12 @@ } | ||
}; | ||
SessionReplay.prototype.getServerUrl = function () { | ||
if (this.config.serverZone === analytics_types_1.ServerZone.EU) { | ||
return constants_1.SESSION_REPLAY_EU_URL; | ||
} | ||
return constants_1.SESSION_REPLAY_SERVER_URL; | ||
}; | ||
SessionReplay.prototype.send = function (context, useRetry) { | ||
if (useRetry === void 0) { useRetry = true; } | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var payload, options, res, responseBody, e_1; | ||
var payload, options, server_url, res, responseBody, e_1; | ||
return tslib_1.__generator(this, function (_a) { | ||
@@ -342,3 +352,4 @@ switch (_a.label) { | ||
}; | ||
return [4 /*yield*/, fetch(constants_1.SESSION_REPLAY_SERVER_URL, options)]; | ||
server_url = this.getServerUrl(); | ||
return [4 /*yield*/, fetch(server_url, options)]; | ||
case 2: | ||
@@ -345,0 +356,0 @@ res = _a.sent(); |
@@ -10,2 +10,3 @@ import { IDBStoreSession } from './typings/session-replay'; | ||
export declare const SESSION_REPLAY_SERVER_URL = "https://api-secure.amplitude.com/sessions/track"; | ||
export declare const SESSION_REPLAY_EU_URL = "https://api.eu.amplitude.com/sessions/track"; | ||
export declare const STORAGE_PREFIX: string; | ||
@@ -12,0 +13,0 @@ export declare const MAX_EVENT_LIST_SIZE_IN_BYTES: number; |
@@ -10,2 +10,3 @@ import { AMPLITUDE_PREFIX } from '@amplitude/analytics-core'; | ||
export var SESSION_REPLAY_SERVER_URL = 'https://api-secure.amplitude.com/sessions/track'; | ||
export var SESSION_REPLAY_EU_URL = 'https://api.eu.amplitude.com/sessions/track'; | ||
export var STORAGE_PREFIX = "".concat(AMPLITUDE_PREFIX, "_replay_unsent"); | ||
@@ -12,0 +13,0 @@ var PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS = 500; // derived by JSON stringifying an example payload without events |
import { __assign, __awaiter, __generator, __read } from "tslib"; | ||
import { getGlobalScope } from '@amplitude/analytics-client-common'; | ||
import { BaseTransport } from '@amplitude/analytics-core'; | ||
import { Status } from '@amplitude/analytics-types'; | ||
import { ServerZone, Status } from '@amplitude/analytics-types'; | ||
import * as IDBKeyVal from 'idb-keyval'; | ||
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_IDB_STORAGE_LENGTH, 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, SESSION_REPLAY_EU_URL as SESSION_REPLAY_EU_SERVER_URL, } from './constants'; | ||
import { maskInputFn } from './helpers'; | ||
@@ -139,2 +139,8 @@ import { MAX_RETRIES_EXCEEDED_MESSAGE, STORAGE_FAILURE, UNEXPECTED_ERROR_MESSAGE, getSuccessMessage } from './messages'; | ||
storedReplaySessions = _a.sent(); | ||
// This resolves a timing issue when focus is fired multiple times in short succession, | ||
// we only want the rest of this function to run once. We can be sure that initialize has | ||
// already been called if this.stopRecordingEvents is defined | ||
if (this.stopRecordingEvents) { | ||
return [2 /*return*/]; | ||
} | ||
storedSequencesForSession = storedReplaySessions && storedReplaySessions[this.config.sessionId]; | ||
@@ -158,5 +164,3 @@ if (storedReplaySessions && storedSequencesForSession && storedSequencesForSession.sessionSequences) { | ||
} | ||
if (!this.stopRecordingEvents) { | ||
this.recordEvents(); | ||
} | ||
this.recordEvents(); | ||
return [2 /*return*/]; | ||
@@ -310,6 +314,12 @@ } | ||
}; | ||
SessionReplay.prototype.getServerUrl = function () { | ||
if (this.config.serverZone === ServerZone.EU) { | ||
return SESSION_REPLAY_EU_SERVER_URL; | ||
} | ||
return SESSION_REPLAY_SERVER_URL; | ||
}; | ||
SessionReplay.prototype.send = function (context, useRetry) { | ||
if (useRetry === void 0) { useRetry = true; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var payload, options, res, responseBody, e_1; | ||
var payload, options, server_url, res, responseBody, e_1; | ||
return __generator(this, function (_a) { | ||
@@ -340,3 +350,4 @@ switch (_a.label) { | ||
}; | ||
return [4 /*yield*/, fetch(SESSION_REPLAY_SERVER_URL, options)]; | ||
server_url = this.getServerUrl(); | ||
return [4 /*yield*/, fetch(server_url, options)]; | ||
case 2: | ||
@@ -343,0 +354,0 @@ res = _a.sent(); |
@@ -10,2 +10,3 @@ import { IDBStoreSession } from './typings/session-replay'; | ||
export declare const SESSION_REPLAY_SERVER_URL = "https://api-secure.amplitude.com/sessions/track"; | ||
export declare const SESSION_REPLAY_EU_URL = "https://api.eu.amplitude.com/sessions/track"; | ||
export declare const STORAGE_PREFIX: string; | ||
@@ -12,0 +13,0 @@ export declare const MAX_EVENT_LIST_SIZE_IN_BYTES: number; |
{ | ||
"name": "@amplitude/plugin-session-replay-browser", | ||
"version": "0.4.2", | ||
"version": "0.5.0", | ||
"description": "", | ||
@@ -58,3 +58,3 @@ "author": "Amplitude Inc", | ||
], | ||
"gitHead": "e641477064763d7dedf41bcd870aa149cccf1832" | ||
"gitHead": "a9293cb635a4c088ec928f2205f2d19cc47ec4e1" | ||
} |
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
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
417011
2175
4