@amplitude/session-replay-browser
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -21,3 +21,3 @@ import { Logger as ILogger } from '@amplitude/analytics-types'; | ||
protected _init(apiKey: string, options: SessionReplayOptions): Promise<void>; | ||
setSessionId(sessionId: number): void; | ||
setSessionId(sessionId: number, deviceId?: string): void; | ||
getSessionReplayDebugPropertyValue(): string; | ||
@@ -24,0 +24,0 @@ getSessionReplayProperties(): { |
@@ -84,3 +84,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
}; | ||
SessionReplay.prototype.setSessionId = function (sessionId) { | ||
SessionReplay.prototype.setSessionId = function (sessionId, deviceId) { | ||
if (!this.config) { | ||
@@ -90,6 +90,9 @@ this.loggerProvider.error('Session replay init has not been called, cannot set session id.'); | ||
} | ||
if (deviceId) { | ||
this.config.deviceId = deviceId; | ||
} | ||
// use a consistent device id. | ||
var deviceId = this.getDeviceId(); | ||
if (sessionId && deviceId) { | ||
this.config.sessionReplayId = (0, helpers_1.generateSessionReplayId)(sessionId, deviceId); | ||
var deviceIdForReplayId = this.getDeviceId(); | ||
if (sessionId && deviceIdForReplayId) { | ||
this.config.sessionReplayId = (0, helpers_1.generateSessionReplayId)(sessionId, deviceIdForReplayId); | ||
} | ||
@@ -96,0 +99,0 @@ else { |
@@ -21,3 +21,3 @@ import { Logger as ILogger } from '@amplitude/analytics-types'; | ||
protected _init(apiKey: string, options: SessionReplayOptions): Promise<void>; | ||
setSessionId(sessionId: number): void; | ||
setSessionId(sessionId: number, deviceId?: string): void; | ||
getSessionReplayDebugPropertyValue(): string; | ||
@@ -24,0 +24,0 @@ getSessionReplayProperties(): { |
@@ -8,4 +8,4 @@ import { __assign, __awaiter, __generator, __read } from "tslib"; | ||
import { SessionReplayConfig } from './config'; | ||
import { BLOCK_CLASS, DEFAULT_SAMPLE_RATE, DEFAULT_SESSION_REPLAY_PROPERTY, MASK_TEXT_CLASS, MAX_EVENT_LIST_SIZE_IN_BYTES, MAX_IDB_STORAGE_LENGTH, MAX_INTERVAL, MIN_INTERVAL, SESSION_REPLAY_EU_URL as SESSION_REPLAY_EU_SERVER_URL, SESSION_REPLAY_STAGING_URL as SESSION_REPLAY_STAGING_SERVER_URL, SESSION_REPLAY_SERVER_URL, STORAGE_PREFIX, defaultSessionStore, SESSION_REPLAY_DEBUG_PROPERTY, } from './constants'; | ||
import { isSessionInSample, maskInputFn, getCurrentUrl, generateSessionReplayId, generateHashCode } from './helpers'; | ||
import { BLOCK_CLASS, DEFAULT_SAMPLE_RATE, DEFAULT_SESSION_REPLAY_PROPERTY, MASK_TEXT_CLASS, MAX_EVENT_LIST_SIZE_IN_BYTES, MAX_IDB_STORAGE_LENGTH, MAX_INTERVAL, MIN_INTERVAL, SESSION_REPLAY_DEBUG_PROPERTY, SESSION_REPLAY_EU_URL as SESSION_REPLAY_EU_SERVER_URL, SESSION_REPLAY_SERVER_URL, SESSION_REPLAY_STAGING_URL as SESSION_REPLAY_STAGING_SERVER_URL, STORAGE_PREFIX, defaultSessionStore, } from './constants'; | ||
import { generateHashCode, generateSessionReplayId, getCurrentUrl, isSessionInSample, maskInputFn } from './helpers'; | ||
import { MAX_RETRIES_EXCEEDED_MESSAGE, MISSING_API_KEY_MESSAGE, MISSING_DEVICE_ID_MESSAGE, STORAGE_FAILURE, UNEXPECTED_ERROR_MESSAGE, UNEXPECTED_NETWORK_ERROR_MESSAGE, getSuccessMessage, } from './messages'; | ||
@@ -83,3 +83,3 @@ import { RecordingStatus, } from './typings/session-replay'; | ||
}; | ||
SessionReplay.prototype.setSessionId = function (sessionId) { | ||
SessionReplay.prototype.setSessionId = function (sessionId, deviceId) { | ||
if (!this.config) { | ||
@@ -89,6 +89,9 @@ this.loggerProvider.error('Session replay init has not been called, cannot set session id.'); | ||
} | ||
if (deviceId) { | ||
this.config.deviceId = deviceId; | ||
} | ||
// use a consistent device id. | ||
var deviceId = this.getDeviceId(); | ||
if (sessionId && deviceId) { | ||
this.config.sessionReplayId = generateSessionReplayId(sessionId, deviceId); | ||
var deviceIdForReplayId = this.getDeviceId(); | ||
if (sessionId && deviceIdForReplayId) { | ||
this.config.sessionReplayId = generateSessionReplayId(sessionId, deviceIdForReplayId); | ||
} | ||
@@ -95,0 +98,0 @@ else { |
@@ -21,3 +21,3 @@ import { Logger as ILogger } from '@amplitude/analytics-types'; | ||
protected _init(apiKey: string, options: SessionReplayOptions): Promise<void>; | ||
setSessionId(sessionId: number): void; | ||
setSessionId(sessionId: number, deviceId?: string): void; | ||
getSessionReplayDebugPropertyValue(): string; | ||
@@ -24,0 +24,0 @@ getSessionReplayProperties(): { |
{ | ||
"name": "@amplitude/session-replay-browser", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -60,3 +60,3 @@ "author": "Amplitude Inc", | ||
], | ||
"gitHead": "1d08e7d07c782a722837857b81e49f00c643f697" | ||
"gitHead": "8dbf320a45451e9c204077d823d5e722b5b7cbe4" | ||
} |
@@ -65,2 +65,6 @@ <p align="center"> | ||
``` | ||
You can optionally pass a new device id as a second argument as well: | ||
```typescript | ||
sessionReplay.setSessionId(UNIX_TIMESTAMP, deviceId) | ||
``` | ||
@@ -67,0 +71,0 @@ ### 5. Shutdown (optional) |
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
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
510807
2885
113
9