@amplitude/session-replay-browser
Advanced tools
Comparing version 0.7.2 to 0.8.0-beta.0
@@ -18,4 +18,5 @@ import { FetchTransport } from '@amplitude/analytics-client-common'; | ||
privacyConfig?: SessionReplayPrivacyConfig; | ||
debugMode?: boolean; | ||
constructor(apiKey: string, options: SessionReplayOptions); | ||
} | ||
//# sourceMappingURL=config.d.ts.map |
@@ -40,2 +40,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
} | ||
if (options.debugMode) { | ||
_this.debugMode = options.debugMode; | ||
} | ||
return _this; | ||
@@ -42,0 +45,0 @@ } |
@@ -9,2 +9,3 @@ import { IDBStoreSession } from './typings/session-replay'; | ||
export declare const DEFAULT_SERVER_ZONE = ServerZone.US; | ||
export declare const SESSION_REPLAY_DEBUG_PROPERTY: string; | ||
export declare const BLOCK_CLASS = "amp-block"; | ||
@@ -11,0 +12,0 @@ export declare const MASK_TEXT_CLASS = "amp-mask"; |
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_STAGING_URL = exports.SESSION_REPLAY_EU_URL = exports.SESSION_REPLAY_SERVER_URL = exports.UNMASK_TEXT_CLASS = exports.MASK_TEXT_CLASS = exports.BLOCK_CLASS = 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.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_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"); | ||
@@ -11,2 +11,3 @@ var analytics_types_1 = require("@amplitude/analytics-types"); | ||
exports.DEFAULT_SERVER_ZONE = analytics_types_1.ServerZone.US; | ||
exports.SESSION_REPLAY_DEBUG_PROPERTY = "".concat(exports.DEFAULT_EVENT_PROPERTY_PREFIX, " Session Replay Debug"); | ||
exports.BLOCK_CLASS = 'amp-block'; | ||
@@ -13,0 +14,0 @@ exports.MASK_TEXT_CLASS = 'amp-mask'; |
@@ -22,2 +22,3 @@ import { Logger as ILogger } from '@amplitude/analytics-types'; | ||
setSessionId(sessionId: number): void; | ||
getSessionReplayDebugPropertyValue(): string; | ||
getSessionReplayProperties(): { | ||
@@ -24,0 +25,0 @@ [x: string]: string | null; |
@@ -102,2 +102,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
}; | ||
SessionReplay.prototype.getSessionReplayDebugPropertyValue = function () { | ||
var apiKeyHash = ''; | ||
if (this.config) { | ||
apiKeyHash = (0, helpers_1.generateHashCode)(this.config.apiKey).toString(); | ||
} | ||
return JSON.stringify({ | ||
appHash: apiKeyHash, | ||
}); | ||
}; | ||
SessionReplay.prototype.getSessionReplayProperties = function () { | ||
@@ -111,5 +120,9 @@ var _a; | ||
if (shouldRecord) { | ||
return _a = {}, | ||
var eventProperties = (_a = {}, | ||
_a[constants_1.DEFAULT_SESSION_REPLAY_PROPERTY] = this.config.sessionReplayId ? this.config.sessionReplayId : null, | ||
_a; | ||
_a); | ||
if (this.config.debugMode) { | ||
eventProperties[constants_1.SESSION_REPLAY_DEBUG_PROPERTY] = this.getSessionReplayDebugPropertyValue(); | ||
} | ||
return eventProperties; | ||
} | ||
@@ -213,10 +226,7 @@ return {}; | ||
} | ||
else if (this.config.sampleRate) { | ||
var isInSample = (0, helpers_1.isSessionInSample)(this.config.sessionId, this.config.sampleRate); | ||
if (!isInSample) { | ||
this.loggerProvider.log("Opting session ".concat(this.config.sessionId, " out of recording due to sample rate.")); | ||
} | ||
return isInSample; | ||
var isInSample = (0, helpers_1.isSessionInSample)(this.config.sessionId, this.getSampleRate()); | ||
if (!isInSample) { | ||
this.loggerProvider.log("Opting session ".concat(this.config.sessionId, " out of recording due to sample rate.")); | ||
} | ||
return true; | ||
return isInSample; | ||
}; | ||
@@ -223,0 +233,0 @@ SessionReplay.prototype.getBlockSelectors = function () { |
@@ -40,2 +40,3 @@ import { AmplitudeReturn, Config, LogLevel, Logger } from '@amplitude/analytics-types'; | ||
privacyConfig?: SessionReplayPrivacyConfig; | ||
debugMode?: boolean; | ||
} | ||
@@ -42,0 +43,0 @@ export type SessionReplayOptions = Omit<Partial<SessionReplayConfig>, 'apiKey'>; |
@@ -18,4 +18,5 @@ import { FetchTransport } from '@amplitude/analytics-client-common'; | ||
privacyConfig?: SessionReplayPrivacyConfig; | ||
debugMode?: boolean; | ||
constructor(apiKey: string, options: SessionReplayOptions); | ||
} | ||
//# sourceMappingURL=config.d.ts.map |
@@ -37,2 +37,5 @@ import { __assign, __extends } from "tslib"; | ||
} | ||
if (options.debugMode) { | ||
_this.debugMode = options.debugMode; | ||
} | ||
return _this; | ||
@@ -39,0 +42,0 @@ } |
@@ -9,2 +9,3 @@ import { IDBStoreSession } from './typings/session-replay'; | ||
export declare const DEFAULT_SERVER_ZONE = ServerZone.US; | ||
export declare const SESSION_REPLAY_DEBUG_PROPERTY: string; | ||
export declare const BLOCK_CLASS = "amp-block"; | ||
@@ -11,0 +12,0 @@ export declare const MASK_TEXT_CLASS = "amp-mask"; |
@@ -9,2 +9,3 @@ import { AMPLITUDE_PREFIX } from '@amplitude/analytics-core'; | ||
export var DEFAULT_SERVER_ZONE = ServerZone.US; | ||
export var SESSION_REPLAY_DEBUG_PROPERTY = "".concat(DEFAULT_EVENT_PROPERTY_PREFIX, " Session Replay Debug"); | ||
export var BLOCK_CLASS = 'amp-block'; | ||
@@ -11,0 +12,0 @@ export var MASK_TEXT_CLASS = 'amp-mask'; |
@@ -22,2 +22,3 @@ import { Logger as ILogger } from '@amplitude/analytics-types'; | ||
setSessionId(sessionId: number): void; | ||
getSessionReplayDebugPropertyValue(): string; | ||
getSessionReplayProperties(): { | ||
@@ -24,0 +25,0 @@ [x: string]: string | null; |
@@ -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, } from './constants'; | ||
import { isSessionInSample, maskInputFn, getCurrentUrl, generateSessionReplayId } 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_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 { MAX_RETRIES_EXCEEDED_MESSAGE, MISSING_API_KEY_MESSAGE, MISSING_DEVICE_ID_MESSAGE, STORAGE_FAILURE, UNEXPECTED_ERROR_MESSAGE, UNEXPECTED_NETWORK_ERROR_MESSAGE, getSuccessMessage, } from './messages'; | ||
@@ -101,2 +101,11 @@ import { RecordingStatus, } from './typings/session-replay'; | ||
}; | ||
SessionReplay.prototype.getSessionReplayDebugPropertyValue = function () { | ||
var apiKeyHash = ''; | ||
if (this.config) { | ||
apiKeyHash = generateHashCode(this.config.apiKey).toString(); | ||
} | ||
return JSON.stringify({ | ||
appHash: apiKeyHash, | ||
}); | ||
}; | ||
SessionReplay.prototype.getSessionReplayProperties = function () { | ||
@@ -110,5 +119,9 @@ var _a; | ||
if (shouldRecord) { | ||
return _a = {}, | ||
var eventProperties = (_a = {}, | ||
_a[DEFAULT_SESSION_REPLAY_PROPERTY] = this.config.sessionReplayId ? this.config.sessionReplayId : null, | ||
_a; | ||
_a); | ||
if (this.config.debugMode) { | ||
eventProperties[SESSION_REPLAY_DEBUG_PROPERTY] = this.getSessionReplayDebugPropertyValue(); | ||
} | ||
return eventProperties; | ||
} | ||
@@ -212,10 +225,7 @@ return {}; | ||
} | ||
else if (this.config.sampleRate) { | ||
var isInSample = isSessionInSample(this.config.sessionId, this.config.sampleRate); | ||
if (!isInSample) { | ||
this.loggerProvider.log("Opting session ".concat(this.config.sessionId, " out of recording due to sample rate.")); | ||
} | ||
return isInSample; | ||
var isInSample = isSessionInSample(this.config.sessionId, this.getSampleRate()); | ||
if (!isInSample) { | ||
this.loggerProvider.log("Opting session ".concat(this.config.sessionId, " out of recording due to sample rate.")); | ||
} | ||
return true; | ||
return isInSample; | ||
}; | ||
@@ -222,0 +232,0 @@ SessionReplay.prototype.getBlockSelectors = function () { |
@@ -40,2 +40,3 @@ import { AmplitudeReturn, Config, LogLevel, Logger } from '@amplitude/analytics-types'; | ||
privacyConfig?: SessionReplayPrivacyConfig; | ||
debugMode?: boolean; | ||
} | ||
@@ -42,0 +43,0 @@ export type SessionReplayOptions = Omit<Partial<SessionReplayConfig>, 'apiKey'>; |
@@ -18,4 +18,5 @@ import { FetchTransport } from '@amplitude/analytics-client-common'; | ||
privacyConfig?: SessionReplayPrivacyConfig; | ||
debugMode?: boolean; | ||
constructor(apiKey: string, options: SessionReplayOptions); | ||
} | ||
//# sourceMappingURL=config.d.ts.map |
@@ -9,2 +9,3 @@ import { IDBStoreSession } from './typings/session-replay'; | ||
export declare const DEFAULT_SERVER_ZONE = ServerZone.US; | ||
export declare const SESSION_REPLAY_DEBUG_PROPERTY: string; | ||
export declare const BLOCK_CLASS = "amp-block"; | ||
@@ -11,0 +12,0 @@ export declare const MASK_TEXT_CLASS = "amp-mask"; |
@@ -22,2 +22,3 @@ import { Logger as ILogger } from '@amplitude/analytics-types'; | ||
setSessionId(sessionId: number): void; | ||
getSessionReplayDebugPropertyValue(): string; | ||
getSessionReplayProperties(): { | ||
@@ -24,0 +25,0 @@ [x: string]: string | null; |
@@ -40,2 +40,3 @@ import { AmplitudeReturn, Config, LogLevel, Logger } from '@amplitude/analytics-types'; | ||
privacyConfig?: SessionReplayPrivacyConfig; | ||
debugMode?: boolean; | ||
} | ||
@@ -42,0 +43,0 @@ export type SessionReplayOptions = Omit<Partial<SessionReplayConfig>, 'apiKey'>; |
{ | ||
"name": "@amplitude/session-replay-browser", | ||
"version": "0.7.2", | ||
"version": "0.8.0-beta.0", | ||
"description": "", | ||
@@ -60,3 +60,3 @@ "author": "Amplitude Inc", | ||
], | ||
"gitHead": "6cf16141d4c60f5ec6d8d72ece241b7eefbf69a1" | ||
"gitHead": "7b9b1bfc6fabd0f10506d52929c4751ea791289a" | ||
} |
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
504350
2845