@amplitude/session-replay-browser
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -8,3 +8,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var getDefaultConfig = function () { return ({ | ||
flushMaxRetries: 5, | ||
flushMaxRetries: 2, | ||
logLevel: analytics_types_1.LogLevel.Warn, | ||
@@ -21,2 +21,6 @@ loggerProvider: new analytics_core_1.Logger(), | ||
_this = _super.call(this, tslib_1.__assign(tslib_1.__assign({ transportProvider: defaultConfig.transportProvider }, options), { apiKey: apiKey })) || this; | ||
_this.flushMaxRetries = | ||
options.flushMaxRetries !== undefined && options.flushMaxRetries <= defaultConfig.flushMaxRetries | ||
? options.flushMaxRetries | ||
: defaultConfig.flushMaxRetries; | ||
_this.apiKey = apiKey; | ||
@@ -23,0 +27,0 @@ _this.sampleRate = options.sampleRate || 1; |
@@ -9,4 +9,4 @@ import { IDBStoreSession } from './typings/session-replay'; | ||
export declare const UNMASK_TEXT_CLASS = "amp-unmask"; | ||
export declare const SESSION_REPLAY_SERVER_URL = "https://api-sr.amplitude.com/sessions/track"; | ||
export declare const SESSION_REPLAY_EU_URL = "https://api-sr.eu.amplitude.com/sessions/track"; | ||
export declare const SESSION_REPLAY_SERVER_URL = "https://api-sr.amplitude.com/sessions/v2/track"; | ||
export declare const SESSION_REPLAY_EU_URL = "https://api-sr.eu.amplitude.com/sessions/v2/track"; | ||
export declare const STORAGE_PREFIX: string; | ||
@@ -13,0 +13,0 @@ export declare const MAX_EVENT_LIST_SIZE_IN_BYTES: number; |
@@ -11,7 +11,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UNMASK_TEXT_CLASS = 'amp-unmask'; | ||
exports.SESSION_REPLAY_SERVER_URL = 'https://api-sr.amplitude.com/sessions/track'; | ||
exports.SESSION_REPLAY_EU_URL = 'https://api-sr.eu.amplitude.com/sessions/track'; | ||
exports.SESSION_REPLAY_SERVER_URL = 'https://api-sr.amplitude.com/sessions/v2/track'; | ||
exports.SESSION_REPLAY_EU_URL = 'https://api-sr.eu.amplitude.com/sessions/v2/track'; | ||
exports.STORAGE_PREFIX = "".concat(analytics_core_1.AMPLITUDE_PREFIX, "_replay_unsent"); | ||
var PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS = 500; // derived by JSON stringifying an example payload without events | ||
exports.MAX_EVENT_LIST_SIZE_IN_BYTES = 10 * 1000000 - PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS; | ||
exports.MAX_EVENT_LIST_SIZE_IN_BYTES = 1 * 1000000; // 1 MB | ||
exports.MIN_INTERVAL = 500; // 500 ms | ||
@@ -18,0 +17,0 @@ exports.MAX_INTERVAL = 10 * 1000; // 10 seconds |
@@ -51,3 +51,3 @@ import { Logger as ILogger } from '@amplitude/analytics-types'; | ||
flush(useRetry?: boolean): Promise<void>; | ||
getServerUrl(): "https://api-sr.amplitude.com/sessions/track" | "https://api-sr.eu.amplitude.com/sessions/track"; | ||
getServerUrl(): "https://api-sr.amplitude.com/sessions/v2/track" | "https://api-sr.eu.amplitude.com/sessions/v2/track"; | ||
getDeviceId(): string | undefined; | ||
@@ -54,0 +54,0 @@ send(context: SessionReplayContext, useRetry?: boolean): Promise<void>; |
@@ -375,3 +375,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var apiKey, deviceId, payload, options, server_url, res, responseBody, e_1; | ||
var apiKey, deviceId, urlParams, payload, options, server_url, res, responseBody, e_1; | ||
return tslib_1.__generator(this, function (_b) { | ||
@@ -388,12 +388,10 @@ switch (_b.label) { | ||
} | ||
urlParams = new URLSearchParams({ | ||
device_id: deviceId, | ||
session_id: "".concat(context.sessionId), | ||
seq_number: "".concat(context.sequenceId), | ||
}); | ||
payload = { | ||
api_key: apiKey, | ||
device_id: deviceId, | ||
session_id: context.sessionId, | ||
start_timestamp: context.sessionId, | ||
events_batch: { | ||
version: 1, | ||
events: context.events, | ||
seq_number: context.sequenceId, | ||
}, | ||
version: 1, | ||
events: context.events, | ||
}; | ||
@@ -407,2 +405,3 @@ _b.label = 1; | ||
Accept: '*/*', | ||
Authorization: "Bearer ".concat(apiKey), | ||
}, | ||
@@ -412,3 +411,3 @@ body: JSON.stringify(payload), | ||
}; | ||
server_url = this.getServerUrl(); | ||
server_url = "".concat(this.getServerUrl(), "?").concat(urlParams.toString()); | ||
return [4 /*yield*/, fetch(server_url, options)]; | ||
@@ -415,0 +414,0 @@ case 2: |
@@ -6,3 +6,3 @@ import { __assign, __extends } from "tslib"; | ||
export var getDefaultConfig = function () { return ({ | ||
flushMaxRetries: 5, | ||
flushMaxRetries: 2, | ||
logLevel: LogLevel.Warn, | ||
@@ -18,2 +18,6 @@ loggerProvider: new Logger(), | ||
_this = _super.call(this, __assign(__assign({ transportProvider: defaultConfig.transportProvider }, options), { apiKey: apiKey })) || this; | ||
_this.flushMaxRetries = | ||
options.flushMaxRetries !== undefined && options.flushMaxRetries <= defaultConfig.flushMaxRetries | ||
? options.flushMaxRetries | ||
: defaultConfig.flushMaxRetries; | ||
_this.apiKey = apiKey; | ||
@@ -20,0 +24,0 @@ _this.sampleRate = options.sampleRate || 1; |
@@ -9,4 +9,4 @@ import { IDBStoreSession } from './typings/session-replay'; | ||
export declare const UNMASK_TEXT_CLASS = "amp-unmask"; | ||
export declare const SESSION_REPLAY_SERVER_URL = "https://api-sr.amplitude.com/sessions/track"; | ||
export declare const SESSION_REPLAY_EU_URL = "https://api-sr.eu.amplitude.com/sessions/track"; | ||
export declare const SESSION_REPLAY_SERVER_URL = "https://api-sr.amplitude.com/sessions/v2/track"; | ||
export declare const SESSION_REPLAY_EU_URL = "https://api-sr.eu.amplitude.com/sessions/v2/track"; | ||
export declare const STORAGE_PREFIX: string; | ||
@@ -13,0 +13,0 @@ export declare const MAX_EVENT_LIST_SIZE_IN_BYTES: number; |
@@ -9,7 +9,6 @@ import { AMPLITUDE_PREFIX } from '@amplitude/analytics-core'; | ||
export var UNMASK_TEXT_CLASS = 'amp-unmask'; | ||
export var SESSION_REPLAY_SERVER_URL = 'https://api-sr.amplitude.com/sessions/track'; | ||
export var SESSION_REPLAY_EU_URL = 'https://api-sr.eu.amplitude.com/sessions/track'; | ||
export var SESSION_REPLAY_SERVER_URL = 'https://api-sr.amplitude.com/sessions/v2/track'; | ||
export var SESSION_REPLAY_EU_URL = 'https://api-sr.eu.amplitude.com/sessions/v2/track'; | ||
export var STORAGE_PREFIX = "".concat(AMPLITUDE_PREFIX, "_replay_unsent"); | ||
var PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS = 500; // derived by JSON stringifying an example payload without events | ||
export var MAX_EVENT_LIST_SIZE_IN_BYTES = 10 * 1000000 - PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS; | ||
export var MAX_EVENT_LIST_SIZE_IN_BYTES = 1 * 1000000; // 1 MB | ||
export var MIN_INTERVAL = 500; // 500 ms | ||
@@ -16,0 +15,0 @@ export var MAX_INTERVAL = 10 * 1000; // 10 seconds |
@@ -51,3 +51,3 @@ import { Logger as ILogger } from '@amplitude/analytics-types'; | ||
flush(useRetry?: boolean): Promise<void>; | ||
getServerUrl(): "https://api-sr.amplitude.com/sessions/track" | "https://api-sr.eu.amplitude.com/sessions/track"; | ||
getServerUrl(): "https://api-sr.amplitude.com/sessions/v2/track" | "https://api-sr.eu.amplitude.com/sessions/v2/track"; | ||
getDeviceId(): string | undefined; | ||
@@ -54,0 +54,0 @@ send(context: SessionReplayContext, useRetry?: boolean): Promise<void>; |
@@ -373,3 +373,3 @@ import { __assign, __awaiter, __generator, __read } from "tslib"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var apiKey, deviceId, payload, options, server_url, res, responseBody, e_1; | ||
var apiKey, deviceId, urlParams, payload, options, server_url, res, responseBody, e_1; | ||
return __generator(this, function (_b) { | ||
@@ -386,12 +386,10 @@ switch (_b.label) { | ||
} | ||
urlParams = new URLSearchParams({ | ||
device_id: deviceId, | ||
session_id: "".concat(context.sessionId), | ||
seq_number: "".concat(context.sequenceId), | ||
}); | ||
payload = { | ||
api_key: apiKey, | ||
device_id: deviceId, | ||
session_id: context.sessionId, | ||
start_timestamp: context.sessionId, | ||
events_batch: { | ||
version: 1, | ||
events: context.events, | ||
seq_number: context.sequenceId, | ||
}, | ||
version: 1, | ||
events: context.events, | ||
}; | ||
@@ -405,2 +403,3 @@ _b.label = 1; | ||
Accept: '*/*', | ||
Authorization: "Bearer ".concat(apiKey), | ||
}, | ||
@@ -410,3 +409,3 @@ body: JSON.stringify(payload), | ||
}; | ||
server_url = this.getServerUrl(); | ||
server_url = "".concat(this.getServerUrl(), "?").concat(urlParams.toString()); | ||
return [4 /*yield*/, fetch(server_url, options)]; | ||
@@ -413,0 +412,0 @@ case 2: |
@@ -9,4 +9,4 @@ import { IDBStoreSession } from './typings/session-replay'; | ||
export declare const UNMASK_TEXT_CLASS = "amp-unmask"; | ||
export declare const SESSION_REPLAY_SERVER_URL = "https://api-sr.amplitude.com/sessions/track"; | ||
export declare const SESSION_REPLAY_EU_URL = "https://api-sr.eu.amplitude.com/sessions/track"; | ||
export declare const SESSION_REPLAY_SERVER_URL = "https://api-sr.amplitude.com/sessions/v2/track"; | ||
export declare const SESSION_REPLAY_EU_URL = "https://api-sr.eu.amplitude.com/sessions/v2/track"; | ||
export declare const STORAGE_PREFIX: string; | ||
@@ -13,0 +13,0 @@ export declare const MAX_EVENT_LIST_SIZE_IN_BYTES: number; |
@@ -51,3 +51,3 @@ import { Logger as ILogger } from '@amplitude/analytics-types'; | ||
flush(useRetry?: boolean): Promise<void>; | ||
getServerUrl(): "https://api-sr.amplitude.com/sessions/track" | "https://api-sr.eu.amplitude.com/sessions/track"; | ||
getServerUrl(): "https://api-sr.amplitude.com/sessions/v2/track" | "https://api-sr.eu.amplitude.com/sessions/v2/track"; | ||
getDeviceId(): string | undefined; | ||
@@ -54,0 +54,0 @@ send(context: SessionReplayContext, useRetry?: boolean): Promise<void>; |
{ | ||
"name": "@amplitude/session-replay-browser", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "", | ||
@@ -59,3 +59,3 @@ "author": "Amplitude Inc", | ||
], | ||
"gitHead": "f30d116fdd253e3d0fca2eeed605cd4cb7806a03" | ||
"gitHead": "be0375ac85cd57b6cb5fedfcb39625c7631350bc" | ||
} |
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
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
493153
2708