@amplitude/session-replay-browser 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +95 -0
- package/lib/cjs/config.d.ts +18 -0
- package/lib/cjs/config.d.ts.map +1 -0
- package/lib/cjs/config.js +29 -0
- package/lib/cjs/config.js.map +1 -0
- package/lib/cjs/constants.d.ts +17 -0
- package/lib/cjs/constants.d.ts.map +1 -0
- package/lib/cjs/constants.js +23 -0
- package/lib/cjs/constants.js.map +1 -0
- package/lib/cjs/helpers.d.ts +4 -0
- package/lib/cjs/helpers.d.ts.map +1 -0
- package/lib/cjs/helpers.js +32 -0
- package/lib/cjs/helpers.js.map +1 -0
- package/lib/cjs/index.d.ts +4 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/index.js +6 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/messages.d.ts +7 -0
- package/lib/cjs/messages.d.ts.map +1 -0
- package/lib/cjs/messages.js +12 -0
- package/lib/cjs/messages.js.map +1 -0
- package/lib/cjs/session-replay-factory.d.ts +7 -0
- package/lib/cjs/session-replay-factory.d.ts.map +1 -0
- package/lib/cjs/session-replay-factory.js +25 -0
- package/lib/cjs/session-replay-factory.js.map +1 -0
- package/lib/cjs/session-replay.d.ts +64 -0
- package/lib/cjs/session-replay.d.ts.map +1 -0
- package/lib/cjs/session-replay.js +567 -0
- package/lib/cjs/session-replay.js.map +1 -0
- package/lib/cjs/typings/session-replay.d.ts +45 -0
- package/lib/cjs/typings/session-replay.d.ts.map +1 -0
- package/lib/cjs/typings/session-replay.js +8 -0
- package/lib/cjs/typings/session-replay.js.map +1 -0
- package/lib/esm/config.d.ts +18 -0
- package/lib/esm/config.d.ts.map +1 -0
- package/lib/esm/config.js +26 -0
- package/lib/esm/config.js.map +1 -0
- package/lib/esm/constants.d.ts +17 -0
- package/lib/esm/constants.d.ts.map +1 -0
- package/lib/esm/constants.js +21 -0
- package/lib/esm/constants.js.map +1 -0
- package/lib/esm/helpers.d.ts +4 -0
- package/lib/esm/helpers.d.ts.map +1 -0
- package/lib/esm/helpers.js +27 -0
- package/lib/esm/helpers.js.map +1 -0
- package/lib/esm/index.d.ts +4 -0
- package/lib/esm/index.d.ts.map +1 -0
- package/lib/esm/index.js +3 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/messages.d.ts +7 -0
- package/lib/esm/messages.d.ts.map +1 -0
- package/lib/esm/messages.js +9 -0
- package/lib/esm/messages.js.map +1 -0
- package/lib/esm/session-replay-factory.d.ts +7 -0
- package/lib/esm/session-replay-factory.d.ts.map +1 -0
- package/lib/esm/session-replay-factory.js +22 -0
- package/lib/esm/session-replay-factory.js.map +1 -0
- package/lib/esm/session-replay.d.ts +64 -0
- package/lib/esm/session-replay.d.ts.map +1 -0
- package/lib/esm/session-replay.js +565 -0
- package/lib/esm/session-replay.js.map +1 -0
- package/lib/esm/typings/session-replay.d.ts +45 -0
- package/lib/esm/typings/session-replay.d.ts.map +1 -0
- package/lib/esm/typings/session-replay.js +6 -0
- package/lib/esm/typings/session-replay.js.map +1 -0
- package/lib/scripts/amplitude-min.js +1 -0
- package/lib/scripts/amplitude-min.js.gz +0 -0
- package/lib/scripts/amplitude-min.umd.js +1 -0
- package/lib/scripts/amplitude-min.umd.js.gz +0 -0
- package/lib/scripts/config.d.ts +18 -0
- package/lib/scripts/config.d.ts.map +1 -0
- package/lib/scripts/constants.d.ts +17 -0
- package/lib/scripts/constants.d.ts.map +1 -0
- package/lib/scripts/helpers.d.ts +4 -0
- package/lib/scripts/helpers.d.ts.map +1 -0
- package/lib/scripts/index.d.ts +4 -0
- package/lib/scripts/index.d.ts.map +1 -0
- package/lib/scripts/messages.d.ts +7 -0
- package/lib/scripts/messages.d.ts.map +1 -0
- package/lib/scripts/session-replay-factory.d.ts +7 -0
- package/lib/scripts/session-replay-factory.d.ts.map +1 -0
- package/lib/scripts/session-replay.d.ts +64 -0
- package/lib/scripts/session-replay.d.ts.map +1 -0
- package/lib/scripts/typings/session-replay.d.ts +45 -0
- package/lib/scripts/typings/session-replay.d.ts.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AmplitudeReturn, Config, LogLevel, Logger } from '@amplitude/analytics-types';
|
|
2
|
+
export type Events = string[];
|
|
3
|
+
export interface SessionReplayContext {
|
|
4
|
+
events: Events;
|
|
5
|
+
sequenceId: number;
|
|
6
|
+
attempts: number;
|
|
7
|
+
timeout: number;
|
|
8
|
+
sessionId: number;
|
|
9
|
+
}
|
|
10
|
+
export declare enum RecordingStatus {
|
|
11
|
+
RECORDING = "recording",
|
|
12
|
+
SENT = "sent"
|
|
13
|
+
}
|
|
14
|
+
export interface IDBStoreSequence {
|
|
15
|
+
events: Events;
|
|
16
|
+
status: RecordingStatus;
|
|
17
|
+
}
|
|
18
|
+
export interface IDBStoreSession {
|
|
19
|
+
currentSequenceId: number;
|
|
20
|
+
sessionSequences: {
|
|
21
|
+
[sequenceId: number]: IDBStoreSequence;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface IDBStore {
|
|
25
|
+
[sessionId: number]: IDBStoreSession;
|
|
26
|
+
}
|
|
27
|
+
export interface SessionReplayConfig extends Config {
|
|
28
|
+
apiKey: string;
|
|
29
|
+
deviceId?: string;
|
|
30
|
+
sessionId?: number;
|
|
31
|
+
loggerProvider: Logger;
|
|
32
|
+
logLevel: LogLevel;
|
|
33
|
+
flushMaxRetries: number;
|
|
34
|
+
sampleRate: number;
|
|
35
|
+
}
|
|
36
|
+
export type SessionReplayOptions = Omit<Partial<SessionReplayConfig>, 'apiKey'>;
|
|
37
|
+
export interface AmplitudeSessionReplay {
|
|
38
|
+
init: (apiKey: string, options: SessionReplayOptions) => AmplitudeReturn<void>;
|
|
39
|
+
setSessionId: (sessionId: number) => void;
|
|
40
|
+
getSessionRecordingProperties: () => {
|
|
41
|
+
[key: string]: boolean;
|
|
42
|
+
};
|
|
43
|
+
shutdown: () => void;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=session-replay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEvF,MAAM,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;AAE9B,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,oBAAY,eAAe;IACzB,SAAS,cAAc;IACvB,IAAI,SAAS;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE;QAChB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAAC;KACxC,CAAC;CACH;AAED,MAAM,WAAW,QAAQ;IACvB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;CACtC;AAED,MAAM,WAAW,mBAAoB,SAAQ,MAAM;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE,QAAQ,CAAC,CAAC;AAEhF,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,KAAK,eAAe,CAAC,IAAI,CAAC,CAAC;IAC/E,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,6BAA6B,EAAE,MAAM;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAChE,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.RecordingStatus = void 0;
|
|
3
|
+
var RecordingStatus;
|
|
4
|
+
(function (RecordingStatus) {
|
|
5
|
+
RecordingStatus["RECORDING"] = "recording";
|
|
6
|
+
RecordingStatus["SENT"] = "sent";
|
|
7
|
+
})(RecordingStatus = exports.RecordingStatus || (exports.RecordingStatus = {}));
|
|
8
|
+
//# sourceMappingURL=session-replay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-replay.js","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":";;AAYA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,gCAAa,CAAA;AACf,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B","sourcesContent":["import { AmplitudeReturn, Config, LogLevel, Logger } from '@amplitude/analytics-types';\n\nexport type Events = string[];\n\nexport interface SessionReplayContext {\n events: Events;\n sequenceId: number;\n attempts: number;\n timeout: number;\n sessionId: number;\n}\n\nexport enum RecordingStatus {\n RECORDING = 'recording',\n SENT = 'sent',\n}\n\nexport interface IDBStoreSequence {\n events: Events;\n status: RecordingStatus;\n}\n\nexport interface IDBStoreSession {\n currentSequenceId: number;\n sessionSequences: {\n [sequenceId: number]: IDBStoreSequence;\n };\n}\n\nexport interface IDBStore {\n [sessionId: number]: IDBStoreSession;\n}\n\nexport interface SessionReplayConfig extends Config {\n apiKey: string;\n deviceId?: string;\n sessionId?: number;\n loggerProvider: Logger;\n logLevel: LogLevel;\n flushMaxRetries: number;\n sampleRate: number;\n}\n\nexport type SessionReplayOptions = Omit<Partial<SessionReplayConfig>, 'apiKey'>;\n\nexport interface AmplitudeSessionReplay {\n init: (apiKey: string, options: SessionReplayOptions) => AmplitudeReturn<void>;\n setSessionId: (sessionId: number) => void;\n getSessionRecordingProperties: () => { [key: string]: boolean };\n shutdown: () => void;\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FetchTransport } from '@amplitude/analytics-client-common';
|
|
2
|
+
import { Config, Logger } from '@amplitude/analytics-core';
|
|
3
|
+
import { LogLevel } from '@amplitude/analytics-types';
|
|
4
|
+
import { SessionReplayConfig as ISessionReplayConfig, SessionReplayOptions } from './typings/session-replay';
|
|
5
|
+
export declare const getDefaultConfig: () => {
|
|
6
|
+
flushMaxRetries: number;
|
|
7
|
+
logLevel: LogLevel;
|
|
8
|
+
loggerProvider: Logger;
|
|
9
|
+
transportProvider: FetchTransport;
|
|
10
|
+
};
|
|
11
|
+
export declare class SessionReplayConfig extends Config implements ISessionReplayConfig {
|
|
12
|
+
apiKey: string;
|
|
13
|
+
sampleRate: number;
|
|
14
|
+
deviceId?: string | undefined;
|
|
15
|
+
sessionId?: number | undefined;
|
|
16
|
+
constructor(apiKey: string, options: SessionReplayOptions);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,mBAAmB,IAAI,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAE7G,eAAO,MAAM,gBAAgB;;;;;CAK3B,CAAC;AAEH,qBAAa,mBAAoB,SAAQ,MAAO,YAAW,oBAAoB;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEnB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB;CAc1D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { __assign, __extends } from "tslib";
|
|
2
|
+
import { FetchTransport } from '@amplitude/analytics-client-common';
|
|
3
|
+
import { Config, Logger } from '@amplitude/analytics-core';
|
|
4
|
+
import { LogLevel } from '@amplitude/analytics-types';
|
|
5
|
+
export var getDefaultConfig = function () { return ({
|
|
6
|
+
flushMaxRetries: 5,
|
|
7
|
+
logLevel: LogLevel.Warn,
|
|
8
|
+
loggerProvider: new Logger(),
|
|
9
|
+
transportProvider: new FetchTransport(),
|
|
10
|
+
}); };
|
|
11
|
+
var SessionReplayConfig = /** @class */ (function (_super) {
|
|
12
|
+
__extends(SessionReplayConfig, _super);
|
|
13
|
+
function SessionReplayConfig(apiKey, options) {
|
|
14
|
+
var _this = this;
|
|
15
|
+
var defaultConfig = getDefaultConfig();
|
|
16
|
+
_this = _super.call(this, __assign(__assign({ transportProvider: defaultConfig.transportProvider }, options), { apiKey: apiKey })) || this;
|
|
17
|
+
_this.apiKey = apiKey;
|
|
18
|
+
_this.sampleRate = options.sampleRate || 1;
|
|
19
|
+
_this.deviceId = options.deviceId;
|
|
20
|
+
_this.sessionId = options.sessionId;
|
|
21
|
+
return _this;
|
|
22
|
+
}
|
|
23
|
+
return SessionReplayConfig;
|
|
24
|
+
}(Config));
|
|
25
|
+
export { SessionReplayConfig };
|
|
26
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAGtD,MAAM,CAAC,IAAM,gBAAgB,GAAG,cAAM,OAAA,CAAC;IACrC,eAAe,EAAE,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC,IAAI;IACvB,cAAc,EAAE,IAAI,MAAM,EAAE;IAC5B,iBAAiB,EAAE,IAAI,cAAc,EAAE;CACxC,CAAC,EALoC,CAKpC,CAAC;AAEH;IAAyC,uCAAM;IAM7C,6BAAY,MAAc,EAAE,OAA6B;QAAzD,iBAaC;QAZC,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;gBACzC,sCACE,iBAAiB,EAAE,aAAa,CAAC,iBAAiB,IAC/C,OAAO,KACV,MAAM,QAAA,IACN;QAEF,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC;QAE1C,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,KAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;;IACrC,CAAC;IACH,0BAAC;AAAD,CAAC,AApBD,CAAyC,MAAM,GAoB9C","sourcesContent":["import { FetchTransport } from '@amplitude/analytics-client-common';\nimport { Config, Logger } from '@amplitude/analytics-core';\nimport { LogLevel } from '@amplitude/analytics-types';\nimport { SessionReplayConfig as ISessionReplayConfig, SessionReplayOptions } from './typings/session-replay';\n\nexport const getDefaultConfig = () => ({\n flushMaxRetries: 5,\n logLevel: LogLevel.Warn,\n loggerProvider: new Logger(),\n transportProvider: new FetchTransport(),\n});\n\nexport class SessionReplayConfig extends Config implements ISessionReplayConfig {\n apiKey: string;\n sampleRate: number;\n deviceId?: string | undefined;\n sessionId?: number | undefined;\n\n constructor(apiKey: string, options: SessionReplayOptions) {\n const defaultConfig = getDefaultConfig();\n super({\n transportProvider: defaultConfig.transportProvider,\n ...options,\n apiKey,\n });\n\n this.apiKey = apiKey;\n this.sampleRate = options.sampleRate || 1;\n\n this.deviceId = options.deviceId;\n this.sessionId = options.sessionId;\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IDBStoreSession } from './typings/session-replay';
|
|
2
|
+
export declare const DEFAULT_EVENT_PROPERTY_PREFIX = "[Amplitude]";
|
|
3
|
+
export declare const DEFAULT_SESSION_REPLAY_PROPERTY: string;
|
|
4
|
+
export declare const DEFAULT_SESSION_START_EVENT = "session_start";
|
|
5
|
+
export declare const DEFAULT_SESSION_END_EVENT = "session_end";
|
|
6
|
+
export declare const BLOCK_CLASS = "amp-block";
|
|
7
|
+
export declare const MASK_TEXT_CLASS = "amp-mask";
|
|
8
|
+
export declare const UNMASK_TEXT_CLASS = "amp-unmask";
|
|
9
|
+
export declare const SESSION_REPLAY_SERVER_URL = "https://api-secure.amplitude.com/sessions/track";
|
|
10
|
+
export declare const SESSION_REPLAY_EU_URL = "https://api.eu.amplitude.com/sessions/track";
|
|
11
|
+
export declare const STORAGE_PREFIX: string;
|
|
12
|
+
export declare const MAX_EVENT_LIST_SIZE_IN_BYTES: number;
|
|
13
|
+
export declare const MIN_INTERVAL = 500;
|
|
14
|
+
export declare const MAX_INTERVAL: number;
|
|
15
|
+
export declare const defaultSessionStore: IDBStoreSession;
|
|
16
|
+
export declare const MAX_IDB_STORAGE_LENGTH: number;
|
|
17
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,eAAO,MAAM,6BAA6B,gBAAgB,CAAC;AAE3D,eAAO,MAAM,+BAA+B,QAAsD,CAAC;AACnG,eAAO,MAAM,2BAA2B,kBAAkB,CAAC;AAC3D,eAAO,MAAM,yBAAyB,gBAAgB,CAAC;AAEvD,eAAO,MAAM,WAAW,cAAc,CAAC;AACvC,eAAO,MAAM,eAAe,aAAa,CAAC;AAC1C,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAC9C,eAAO,MAAM,yBAAyB,oDAAoD,CAAC;AAC3F,eAAO,MAAM,qBAAqB,gDAAgD,CAAC;AACnF,eAAO,MAAM,cAAc,QAAsC,CAAC;AAElE,eAAO,MAAM,4BAA4B,QAAgE,CAAC;AAC1G,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,YAAY,QAAY,CAAC;AACtC,eAAO,MAAM,mBAAmB,EAAE,eAGjC,CAAC;AACF,eAAO,MAAM,sBAAsB,QAA0B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AMPLITUDE_PREFIX } from '@amplitude/analytics-core';
|
|
2
|
+
export var DEFAULT_EVENT_PROPERTY_PREFIX = '[Amplitude]';
|
|
3
|
+
export var DEFAULT_SESSION_REPLAY_PROPERTY = "".concat(DEFAULT_EVENT_PROPERTY_PREFIX, " Session Recorded");
|
|
4
|
+
export var DEFAULT_SESSION_START_EVENT = 'session_start';
|
|
5
|
+
export var DEFAULT_SESSION_END_EVENT = 'session_end';
|
|
6
|
+
export var BLOCK_CLASS = 'amp-block';
|
|
7
|
+
export var MASK_TEXT_CLASS = 'amp-mask';
|
|
8
|
+
export var UNMASK_TEXT_CLASS = 'amp-unmask';
|
|
9
|
+
export var SESSION_REPLAY_SERVER_URL = 'https://api-secure.amplitude.com/sessions/track';
|
|
10
|
+
export var SESSION_REPLAY_EU_URL = 'https://api.eu.amplitude.com/sessions/track';
|
|
11
|
+
export var STORAGE_PREFIX = "".concat(AMPLITUDE_PREFIX, "_replay_unsent");
|
|
12
|
+
var PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS = 500; // derived by JSON stringifying an example payload without events
|
|
13
|
+
export var MAX_EVENT_LIST_SIZE_IN_BYTES = 10 * 1000000 - PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS;
|
|
14
|
+
export var MIN_INTERVAL = 500; // 500 ms
|
|
15
|
+
export var MAX_INTERVAL = 10 * 1000; // 10 seconds
|
|
16
|
+
export var defaultSessionStore = {
|
|
17
|
+
currentSequenceId: 0,
|
|
18
|
+
sessionSequences: {},
|
|
19
|
+
};
|
|
20
|
+
export var MAX_IDB_STORAGE_LENGTH = 1000 * 60 * 60 * 24 * 3; // 3 days
|
|
21
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D,MAAM,CAAC,IAAM,6BAA6B,GAAG,aAAa,CAAC;AAE3D,MAAM,CAAC,IAAM,+BAA+B,GAAG,UAAG,6BAA6B,sBAAmB,CAAC;AACnG,MAAM,CAAC,IAAM,2BAA2B,GAAG,eAAe,CAAC;AAC3D,MAAM,CAAC,IAAM,yBAAyB,GAAG,aAAa,CAAC;AAEvD,MAAM,CAAC,IAAM,WAAW,GAAG,WAAW,CAAC;AACvC,MAAM,CAAC,IAAM,eAAe,GAAG,UAAU,CAAC;AAC1C,MAAM,CAAC,IAAM,iBAAiB,GAAG,YAAY,CAAC;AAC9C,MAAM,CAAC,IAAM,yBAAyB,GAAG,iDAAiD,CAAC;AAC3F,MAAM,CAAC,IAAM,qBAAqB,GAAG,6CAA6C,CAAC;AACnF,MAAM,CAAC,IAAM,cAAc,GAAG,UAAG,gBAAgB,mBAAgB,CAAC;AAClE,IAAM,8CAA8C,GAAG,GAAG,CAAC,CAAC,iEAAiE;AAC7H,MAAM,CAAC,IAAM,4BAA4B,GAAG,EAAE,GAAG,OAAO,GAAG,8CAA8C,CAAC;AAC1G,MAAM,CAAC,IAAM,YAAY,GAAG,GAAG,CAAC,CAAC,SAAS;AAC1C,MAAM,CAAC,IAAM,YAAY,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AACpD,MAAM,CAAC,IAAM,mBAAmB,GAAoB;IAClD,iBAAiB,EAAE,CAAC;IACpB,gBAAgB,EAAE,EAAE;CACrB,CAAC;AACF,MAAM,CAAC,IAAM,sBAAsB,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS","sourcesContent":["import { AMPLITUDE_PREFIX } from '@amplitude/analytics-core';\nimport { IDBStoreSession } from './typings/session-replay';\n\nexport const DEFAULT_EVENT_PROPERTY_PREFIX = '[Amplitude]';\n\nexport const DEFAULT_SESSION_REPLAY_PROPERTY = `${DEFAULT_EVENT_PROPERTY_PREFIX} Session Recorded`;\nexport const DEFAULT_SESSION_START_EVENT = 'session_start';\nexport const DEFAULT_SESSION_END_EVENT = 'session_end';\n\nexport const BLOCK_CLASS = 'amp-block';\nexport const MASK_TEXT_CLASS = 'amp-mask';\nexport const UNMASK_TEXT_CLASS = 'amp-unmask';\nexport const SESSION_REPLAY_SERVER_URL = 'https://api-secure.amplitude.com/sessions/track';\nexport const SESSION_REPLAY_EU_URL = 'https://api.eu.amplitude.com/sessions/track';\nexport const STORAGE_PREFIX = `${AMPLITUDE_PREFIX}_replay_unsent`;\nconst PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS = 500; // derived by JSON stringifying an example payload without events\nexport const MAX_EVENT_LIST_SIZE_IN_BYTES = 10 * 1000000 - PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS;\nexport const MIN_INTERVAL = 500; // 500 ms\nexport const MAX_INTERVAL = 10 * 1000; // 10 seconds\nexport const defaultSessionStore: IDBStoreSession = {\n currentSequenceId: 0,\n sessionSequences: {},\n};\nexport const MAX_IDB_STORAGE_LENGTH = 1000 * 60 * 60 * 24 * 3; // 3 days\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const maskInputFn: (text: string, element: HTMLElement) => string;
|
|
2
|
+
export declare const generateHashCode: (str: string) => number;
|
|
3
|
+
export declare const isSessionInSample: (sessionId: number, sampleRate: number) => boolean;
|
|
4
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,SAAU,MAAM,WAAW,WAAW,WAK7D,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAkB,MAAM,WASpD,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAAwB,MAAM,cAAc,MAAM,YAM/E,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { UNMASK_TEXT_CLASS } from './constants';
|
|
2
|
+
export var maskInputFn = function (text, element) {
|
|
3
|
+
var _a;
|
|
4
|
+
if ((_a = element.classList) === null || _a === void 0 ? void 0 : _a.contains(UNMASK_TEXT_CLASS)) {
|
|
5
|
+
return text;
|
|
6
|
+
}
|
|
7
|
+
return '*'.repeat(text.length);
|
|
8
|
+
};
|
|
9
|
+
export var generateHashCode = function (str) {
|
|
10
|
+
var hash = 0;
|
|
11
|
+
if (str.length === 0)
|
|
12
|
+
return hash;
|
|
13
|
+
for (var i = 0; i < str.length; i++) {
|
|
14
|
+
var chr = str.charCodeAt(i);
|
|
15
|
+
hash = (hash << 5) - hash + chr;
|
|
16
|
+
hash |= 0;
|
|
17
|
+
}
|
|
18
|
+
return hash;
|
|
19
|
+
};
|
|
20
|
+
export var isSessionInSample = function (sessionId, sampleRate) {
|
|
21
|
+
var hashNumber = generateHashCode(sessionId.toString());
|
|
22
|
+
var absHash = Math.abs(hashNumber);
|
|
23
|
+
var absHashMultiply = absHash * 31;
|
|
24
|
+
var mod = absHashMultiply % 100;
|
|
25
|
+
return mod / 100 < sampleRate;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,IAAY,EAAE,OAAoB;;IAC5D,IAAI,MAAA,OAAO,CAAC,SAAS,0CAAE,QAAQ,CAAC,iBAAiB,CAAC,EAAE;QAClD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAU,GAAW;IACnD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,IAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC;QAChC,IAAI,IAAI,CAAC,CAAC;KACX;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,iBAAiB,GAAG,UAAU,SAAiB,EAAE,UAAkB;IAC9E,IAAM,UAAU,GAAG,gBAAgB,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1D,IAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACrC,IAAM,eAAe,GAAG,OAAO,GAAG,EAAE,CAAC;IACrC,IAAM,GAAG,GAAG,eAAe,GAAG,GAAG,CAAC;IAClC,OAAO,GAAG,GAAG,GAAG,GAAG,UAAU,CAAC;AAChC,CAAC,CAAC","sourcesContent":["import { UNMASK_TEXT_CLASS } from './constants';\n\nexport const maskInputFn = (text: string, element: HTMLElement) => {\n if (element.classList?.contains(UNMASK_TEXT_CLASS)) {\n return text;\n }\n return '*'.repeat(text.length);\n};\n\nexport const generateHashCode = function (str: string) {\n let hash = 0;\n if (str.length === 0) return hash;\n for (let i = 0; i < str.length; i++) {\n const chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0;\n }\n return hash;\n};\n\nexport const isSessionInSample = function (sessionId: number, sampleRate: number) {\n const hashNumber = generateHashCode(sessionId.toString());\n const absHash = Math.abs(hashNumber);\n const absHashMultiply = absHash * 31;\n const mod = absHashMultiply % 100;\n return mod / 100 < sampleRate;\n};\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const init: (apiKey: string, options: import("./typings/session-replay").SessionReplayOptions) => import("@amplitude/analytics-types").AmplitudeReturn<void>, setSessionId: (sessionId: number) => void, getSessionRecordingProperties: () => {
|
|
2
|
+
[key: string]: boolean;
|
|
3
|
+
}, shutdown: () => void;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAQ,IAAI,oJAAE,YAAY,+BAAE,6BAA6B;;GAAE,QAAQ,YAAkB,CAAC"}
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import sessionReplay from './session-replay-factory';
|
|
2
|
+
export var init = sessionReplay.init, setSessionId = sessionReplay.setSessionId, getSessionRecordingProperties = sessionReplay.getSessionRecordingProperties, shutdown = sessionReplay.shutdown;
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,0BAA0B,CAAC;AACrD,MAAM,CAAS,IAAA,IAAI,GAA4D,aAAa,KAAzE,EAAE,YAAY,GAA8C,aAAa,aAA3D,EAAE,6BAA6B,GAAe,aAAa,8BAA5B,EAAE,QAAQ,GAAK,aAAa,SAAlB,CAAmB","sourcesContent":["import sessionReplay from './session-replay-factory';\nexport const { init, setSessionId, getSessionRecordingProperties, shutdown } = sessionReplay;\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const getSuccessMessage: (sessionId: number) => string;
|
|
2
|
+
export declare const UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";
|
|
3
|
+
export declare const MAX_RETRIES_EXCEEDED_MESSAGE = "Session replay event batch rejected due to exceeded retry count";
|
|
4
|
+
export declare const STORAGE_FAILURE = "Failed to store session replay events in IndexedDB";
|
|
5
|
+
export declare const MISSING_DEVICE_ID_MESSAGE = "Session replay event batch not sent due to missing device ID";
|
|
6
|
+
export declare const MISSING_API_KEY_MESSAGE = "Session replay event batch not sent due to missing api key";
|
|
7
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,cAAe,MAAM,WAC4B,CAAC;AAChF,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AACpE,eAAO,MAAM,4BAA4B,oEAAoE,CAAC;AAC9G,eAAO,MAAM,eAAe,uDAAuD,CAAC;AACpF,eAAO,MAAM,yBAAyB,iEAAiE,CAAC;AACxG,eAAO,MAAM,uBAAuB,+DAA+D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var getSuccessMessage = function (sessionId) {
|
|
2
|
+
return "Session replay event batch tracked successfully for session id ".concat(sessionId);
|
|
3
|
+
};
|
|
4
|
+
export var UNEXPECTED_ERROR_MESSAGE = 'Unexpected error occurred';
|
|
5
|
+
export var MAX_RETRIES_EXCEEDED_MESSAGE = 'Session replay event batch rejected due to exceeded retry count';
|
|
6
|
+
export var STORAGE_FAILURE = 'Failed to store session replay events in IndexedDB';
|
|
7
|
+
export var MISSING_DEVICE_ID_MESSAGE = 'Session replay event batch not sent due to missing device ID';
|
|
8
|
+
export var MISSING_API_KEY_MESSAGE = 'Session replay event batch not sent due to missing api key';
|
|
9
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,iBAAiB,GAAG,UAAC,SAAiB;IACjD,OAAA,yEAAkE,SAAS,CAAE;AAA7E,CAA6E,CAAC;AAChF,MAAM,CAAC,IAAM,wBAAwB,GAAG,2BAA2B,CAAC;AACpE,MAAM,CAAC,IAAM,4BAA4B,GAAG,iEAAiE,CAAC;AAC9G,MAAM,CAAC,IAAM,eAAe,GAAG,oDAAoD,CAAC;AACpF,MAAM,CAAC,IAAM,yBAAyB,GAAG,8DAA8D,CAAC;AACxG,MAAM,CAAC,IAAM,uBAAuB,GAAG,4DAA4D,CAAC","sourcesContent":["export const getSuccessMessage = (sessionId: number) =>\n `Session replay event batch tracked successfully for session id ${sessionId}`;\nexport const UNEXPECTED_ERROR_MESSAGE = 'Unexpected error occurred';\nexport const MAX_RETRIES_EXCEEDED_MESSAGE = 'Session replay event batch rejected due to exceeded retry count';\nexport const STORAGE_FAILURE = 'Failed to store session replay events in IndexedDB';\nexport const MISSING_DEVICE_ID_MESSAGE = 'Session replay event batch not sent due to missing device ID';\nexport const MISSING_API_KEY_MESSAGE = 'Session replay event batch not sent due to missing api key';\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LogConfig } from '@amplitude/analytics-types';
|
|
2
|
+
import { SessionReplay } from './session-replay';
|
|
3
|
+
import { AmplitudeSessionReplay } from './typings/session-replay';
|
|
4
|
+
export declare const getLogConfig: (sessionReplay: SessionReplay) => () => LogConfig;
|
|
5
|
+
declare const _default: AmplitudeSessionReplay;
|
|
6
|
+
export default _default;
|
|
7
|
+
//# sourceMappingURL=session-replay-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-replay-factory.d.ts","sourceRoot":"","sources":["../../src/session-replay-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,eAAO,MAAM,YAAY,kBAAmB,aAAa,WAAS,SAOjE,CAAC;;AAoBF,wBAAgC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { debugWrapper } from '@amplitude/analytics-core';
|
|
2
|
+
import { getDefaultConfig } from './config';
|
|
3
|
+
import { SessionReplay } from './session-replay';
|
|
4
|
+
export var getLogConfig = function (sessionReplay) { return function () {
|
|
5
|
+
var config = sessionReplay.config;
|
|
6
|
+
var _a = config || getDefaultConfig(), logger = _a.loggerProvider, logLevel = _a.logLevel;
|
|
7
|
+
return {
|
|
8
|
+
logger: logger,
|
|
9
|
+
logLevel: logLevel,
|
|
10
|
+
};
|
|
11
|
+
}; };
|
|
12
|
+
var createInstance = function () {
|
|
13
|
+
var sessionReplay = new SessionReplay();
|
|
14
|
+
return {
|
|
15
|
+
init: debugWrapper(sessionReplay.init.bind(sessionReplay), 'init', getLogConfig(sessionReplay)),
|
|
16
|
+
setSessionId: debugWrapper(sessionReplay.setSessionId.bind(sessionReplay), 'setSessionId', getLogConfig(sessionReplay)),
|
|
17
|
+
getSessionRecordingProperties: debugWrapper(sessionReplay.getSessionRecordingProperties.bind(sessionReplay), 'getSessionRecordingProperties', getLogConfig(sessionReplay)),
|
|
18
|
+
shutdown: debugWrapper(sessionReplay.shutdown.bind(sessionReplay), 'teardown', getLogConfig(sessionReplay)),
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export default createInstance();
|
|
22
|
+
//# sourceMappingURL=session-replay-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-replay-factory.js","sourceRoot":"","sources":["../../src/session-replay-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,MAAM,CAAC,IAAM,YAAY,GAAG,UAAC,aAA4B,IAAK,OAAA;IACpD,IAAA,MAAM,GAAK,aAAa,OAAlB,CAAmB;IAC3B,IAAA,KAAuC,MAAM,IAAI,gBAAgB,EAAE,EAAjD,MAAM,oBAAA,EAAE,QAAQ,cAAiC,CAAC;IAC1E,OAAO;QACL,MAAM,QAAA;QACN,QAAQ,UAAA;KACT,CAAC;AACJ,CAAC,EAP6D,CAO7D,CAAC;AAEF,IAAM,cAAc,GAAiC;IACnD,IAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;IAC1C,OAAO;QACL,IAAI,EAAE,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;QAC/F,YAAY,EAAE,YAAY,CACxB,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,EAC9C,cAAc,EACd,YAAY,CAAC,aAAa,CAAC,CAC5B;QACD,6BAA6B,EAAE,YAAY,CACzC,aAAa,CAAC,6BAA6B,CAAC,IAAI,CAAC,aAAa,CAAC,EAC/D,+BAA+B,EAC/B,YAAY,CAAC,aAAa,CAAC,CAC5B;QACD,QAAQ,EAAE,YAAY,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;KAC5G,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,EAAE,CAAC","sourcesContent":["import { debugWrapper } from '@amplitude/analytics-core';\nimport { LogConfig } from '@amplitude/analytics-types';\nimport { getDefaultConfig } from './config';\nimport { SessionReplay } from './session-replay';\nimport { AmplitudeSessionReplay } from './typings/session-replay';\n\nexport const getLogConfig = (sessionReplay: SessionReplay) => (): LogConfig => {\n const { config } = sessionReplay;\n const { loggerProvider: logger, logLevel } = config || getDefaultConfig();\n return {\n logger,\n logLevel,\n };\n};\n\nconst createInstance: () => AmplitudeSessionReplay = () => {\n const sessionReplay = new SessionReplay();\n return {\n init: debugWrapper(sessionReplay.init.bind(sessionReplay), 'init', getLogConfig(sessionReplay)),\n setSessionId: debugWrapper(\n sessionReplay.setSessionId.bind(sessionReplay),\n 'setSessionId',\n getLogConfig(sessionReplay),\n ),\n getSessionRecordingProperties: debugWrapper(\n sessionReplay.getSessionRecordingProperties.bind(sessionReplay),\n 'getSessionRecordingProperties',\n getLogConfig(sessionReplay),\n ),\n shutdown: debugWrapper(sessionReplay.shutdown.bind(sessionReplay), 'teardown', getLogConfig(sessionReplay)),\n };\n};\n\nexport default createInstance();\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Logger as ILogger } from '@amplitude/analytics-types';
|
|
2
|
+
import { record } from 'rrweb';
|
|
3
|
+
import { AmplitudeSessionReplay, Events, IDBStore, SessionReplayConfig as ISessionReplayConfig, SessionReplayContext, SessionReplayOptions } from './typings/session-replay';
|
|
4
|
+
export declare class SessionReplay implements AmplitudeSessionReplay {
|
|
5
|
+
name: string;
|
|
6
|
+
config: ISessionReplayConfig | undefined;
|
|
7
|
+
loggerProvider: ILogger;
|
|
8
|
+
storageKey: string;
|
|
9
|
+
retryTimeout: number;
|
|
10
|
+
events: Events;
|
|
11
|
+
currentSequenceId: number;
|
|
12
|
+
private scheduled;
|
|
13
|
+
queue: SessionReplayContext[];
|
|
14
|
+
stopRecordingEvents: ReturnType<typeof record> | null;
|
|
15
|
+
maxPersistedEventsSize: number;
|
|
16
|
+
interval: number;
|
|
17
|
+
timeAtLastSend: number | null;
|
|
18
|
+
constructor();
|
|
19
|
+
init(apiKey: string, options: SessionReplayOptions): import("@amplitude/analytics-types").AmplitudeReturn<void>;
|
|
20
|
+
protected _init(apiKey: string, options: SessionReplayOptions): Promise<void>;
|
|
21
|
+
setSessionId(sessionId: number): void;
|
|
22
|
+
getSessionRecordingProperties(): {
|
|
23
|
+
[x: string]: boolean;
|
|
24
|
+
};
|
|
25
|
+
blurListener: () => void;
|
|
26
|
+
focusListener: () => void;
|
|
27
|
+
stopRecordingAndSendEvents(sessionId?: number): void;
|
|
28
|
+
initialize(shouldSendStoredEvents?: boolean): Promise<void>;
|
|
29
|
+
shouldOptOut(): boolean | undefined;
|
|
30
|
+
getShouldRecord(): boolean;
|
|
31
|
+
sendStoredEvents(storedReplaySessions: IDBStore): void;
|
|
32
|
+
recordEvents(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Determines whether to send the events list to the backend and start a new
|
|
35
|
+
* empty events list, based on the size of the list as well as the last time sent
|
|
36
|
+
* @param nextEventString
|
|
37
|
+
* @returns boolean
|
|
38
|
+
*/
|
|
39
|
+
shouldSplitEventsList: (nextEventString: string) => boolean;
|
|
40
|
+
sendEventsList({ events, sequenceId, sessionId }: {
|
|
41
|
+
events: string[];
|
|
42
|
+
sequenceId: number;
|
|
43
|
+
sessionId: number;
|
|
44
|
+
}): void;
|
|
45
|
+
addToQueue(...list: SessionReplayContext[]): void;
|
|
46
|
+
schedule(timeout: number): void;
|
|
47
|
+
flush(useRetry?: boolean): Promise<void>;
|
|
48
|
+
getServerUrl(): "https://api-secure.amplitude.com/sessions/track" | "https://api.eu.amplitude.com/sessions/track";
|
|
49
|
+
getDeviceId(): string | undefined;
|
|
50
|
+
send(context: SessionReplayContext, useRetry?: boolean): Promise<void>;
|
|
51
|
+
handleReponse(status: number, context: SessionReplayContext): void;
|
|
52
|
+
handleSuccessResponse(context: SessionReplayContext): void;
|
|
53
|
+
handleOtherResponse(context: SessionReplayContext): void;
|
|
54
|
+
getAllSessionEventsFromStore(): Promise<IDBStore | undefined>;
|
|
55
|
+
storeEventsForSession(events: Events, sequenceId: number, sessionId: number): Promise<void>;
|
|
56
|
+
cleanUpSessionEventsStore(sessionId: number, sequenceId: number): Promise<void>;
|
|
57
|
+
completeRequest({ context, err, success }: {
|
|
58
|
+
context: SessionReplayContext;
|
|
59
|
+
err?: string;
|
|
60
|
+
success?: string;
|
|
61
|
+
}): void;
|
|
62
|
+
shutdown(): void;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=session-replay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAsB,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EAAQ,MAAM,EAAE,MAAM,OAAO,CAAC;AAwBrC,OAAO,EACL,sBAAsB,EACtB,MAAM,EACN,QAAQ,EAER,mBAAmB,IAAI,oBAAoB,EAE3C,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAElC,qBAAa,aAAc,YAAW,sBAAsB;IAC1D,IAAI,SAAuC;IAC3C,MAAM,EAAE,oBAAoB,GAAG,SAAS,CAAC;IACzC,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,SAAM;IAChB,YAAY,SAAQ;IACpB,MAAM,EAAE,MAAM,CAAM;IACpB,iBAAiB,SAAK;IACtB,OAAO,CAAC,SAAS,CAA8C;IAC/D,KAAK,EAAE,oBAAoB,EAAE,CAAM;IACnC,mBAAmB,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,GAAG,IAAI,CAAQ;IAC7D,sBAAsB,SAAgC;IACtD,QAAQ,SAAgB;IACxB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAQ;;IAMrC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB;cAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB;IAmBnE,YAAY,CAAC,SAAS,EAAE,MAAM;IAY9B,6BAA6B;;;IAgB7B,YAAY,aAEV;IACF,aAAa,aAEX;IAEF,0BAA0B,CAAC,SAAS,CAAC,EAAE,MAAM;IAkBvC,UAAU,CAAC,sBAAsB,UAAQ;IAgC/C,YAAY;IAUZ,eAAe;IA+Bf,gBAAgB,CAAC,oBAAoB,EAAE,QAAQ;IAqB/C,YAAY;IA2CZ;;;;;OAKG;IACH,qBAAqB,oBAAqB,MAAM,KAAG,OAAO,CAYxD;IAEF,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IAU7G,UAAU,CAAC,GAAG,IAAI,EAAE,oBAAoB,EAAE;IA0B1C,QAAQ,CAAC,OAAO,EAAE,MAAM;IAWlB,KAAK,CAAC,QAAQ,UAAQ;IAc5B,YAAY;IAOZ,WAAW;IAUL,IAAI,CAAC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,UAAO;IAmDzD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB;IAW3D,qBAAqB,CAAC,OAAO,EAAE,oBAAoB;IAInD,mBAAmB,CAAC,OAAO,EAAE,oBAAoB;IAO3C,4BAA4B;IAW5B,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IA2B3E,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAmCrE,eAAe,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,oBAAoB,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAS5G,QAAQ;CAST"}
|