@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.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +95 -0
  3. package/lib/cjs/config.d.ts +18 -0
  4. package/lib/cjs/config.d.ts.map +1 -0
  5. package/lib/cjs/config.js +29 -0
  6. package/lib/cjs/config.js.map +1 -0
  7. package/lib/cjs/constants.d.ts +17 -0
  8. package/lib/cjs/constants.d.ts.map +1 -0
  9. package/lib/cjs/constants.js +23 -0
  10. package/lib/cjs/constants.js.map +1 -0
  11. package/lib/cjs/helpers.d.ts +4 -0
  12. package/lib/cjs/helpers.d.ts.map +1 -0
  13. package/lib/cjs/helpers.js +32 -0
  14. package/lib/cjs/helpers.js.map +1 -0
  15. package/lib/cjs/index.d.ts +4 -0
  16. package/lib/cjs/index.d.ts.map +1 -0
  17. package/lib/cjs/index.js +6 -0
  18. package/lib/cjs/index.js.map +1 -0
  19. package/lib/cjs/messages.d.ts +7 -0
  20. package/lib/cjs/messages.d.ts.map +1 -0
  21. package/lib/cjs/messages.js +12 -0
  22. package/lib/cjs/messages.js.map +1 -0
  23. package/lib/cjs/session-replay-factory.d.ts +7 -0
  24. package/lib/cjs/session-replay-factory.d.ts.map +1 -0
  25. package/lib/cjs/session-replay-factory.js +25 -0
  26. package/lib/cjs/session-replay-factory.js.map +1 -0
  27. package/lib/cjs/session-replay.d.ts +64 -0
  28. package/lib/cjs/session-replay.d.ts.map +1 -0
  29. package/lib/cjs/session-replay.js +567 -0
  30. package/lib/cjs/session-replay.js.map +1 -0
  31. package/lib/cjs/typings/session-replay.d.ts +45 -0
  32. package/lib/cjs/typings/session-replay.d.ts.map +1 -0
  33. package/lib/cjs/typings/session-replay.js +8 -0
  34. package/lib/cjs/typings/session-replay.js.map +1 -0
  35. package/lib/esm/config.d.ts +18 -0
  36. package/lib/esm/config.d.ts.map +1 -0
  37. package/lib/esm/config.js +26 -0
  38. package/lib/esm/config.js.map +1 -0
  39. package/lib/esm/constants.d.ts +17 -0
  40. package/lib/esm/constants.d.ts.map +1 -0
  41. package/lib/esm/constants.js +21 -0
  42. package/lib/esm/constants.js.map +1 -0
  43. package/lib/esm/helpers.d.ts +4 -0
  44. package/lib/esm/helpers.d.ts.map +1 -0
  45. package/lib/esm/helpers.js +27 -0
  46. package/lib/esm/helpers.js.map +1 -0
  47. package/lib/esm/index.d.ts +4 -0
  48. package/lib/esm/index.d.ts.map +1 -0
  49. package/lib/esm/index.js +3 -0
  50. package/lib/esm/index.js.map +1 -0
  51. package/lib/esm/messages.d.ts +7 -0
  52. package/lib/esm/messages.d.ts.map +1 -0
  53. package/lib/esm/messages.js +9 -0
  54. package/lib/esm/messages.js.map +1 -0
  55. package/lib/esm/session-replay-factory.d.ts +7 -0
  56. package/lib/esm/session-replay-factory.d.ts.map +1 -0
  57. package/lib/esm/session-replay-factory.js +22 -0
  58. package/lib/esm/session-replay-factory.js.map +1 -0
  59. package/lib/esm/session-replay.d.ts +64 -0
  60. package/lib/esm/session-replay.d.ts.map +1 -0
  61. package/lib/esm/session-replay.js +565 -0
  62. package/lib/esm/session-replay.js.map +1 -0
  63. package/lib/esm/typings/session-replay.d.ts +45 -0
  64. package/lib/esm/typings/session-replay.d.ts.map +1 -0
  65. package/lib/esm/typings/session-replay.js +6 -0
  66. package/lib/esm/typings/session-replay.js.map +1 -0
  67. package/lib/scripts/amplitude-min.js +1 -0
  68. package/lib/scripts/amplitude-min.js.gz +0 -0
  69. package/lib/scripts/amplitude-min.umd.js +1 -0
  70. package/lib/scripts/amplitude-min.umd.js.gz +0 -0
  71. package/lib/scripts/config.d.ts +18 -0
  72. package/lib/scripts/config.d.ts.map +1 -0
  73. package/lib/scripts/constants.d.ts +17 -0
  74. package/lib/scripts/constants.d.ts.map +1 -0
  75. package/lib/scripts/helpers.d.ts +4 -0
  76. package/lib/scripts/helpers.d.ts.map +1 -0
  77. package/lib/scripts/index.d.ts +4 -0
  78. package/lib/scripts/index.d.ts.map +1 -0
  79. package/lib/scripts/messages.d.ts +7 -0
  80. package/lib/scripts/messages.d.ts.map +1 -0
  81. package/lib/scripts/session-replay-factory.d.ts +7 -0
  82. package/lib/scripts/session-replay-factory.d.ts.map +1 -0
  83. package/lib/scripts/session-replay.d.ts +64 -0
  84. package/lib/scripts/session-replay.d.ts.map +1 -0
  85. package/lib/scripts/typings/session-replay.d.ts +45 -0
  86. package/lib/scripts/typings/session-replay.d.ts.map +1 -0
  87. package/package.json +61 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Amplitude Analytics
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ <p align="center">
2
+ <a href="https://amplitude.com" target="_blank" align="center">
3
+ <img src="https://static.amplitude.com/lightning/46c85bfd91905de8047f1ee65c7c93d6fa9ee6ea/static/media/amplitude-logo-with-text.4fb9e463.svg" width="280">
4
+ </a>
5
+ <br />
6
+ </p>
7
+
8
+ # @amplitude/session-replay-browser
9
+
10
+ Official Session Replay SDK
11
+
12
+ ## Installation
13
+
14
+ This package is published on NPM registry and is available to be installed using npm and yarn.
15
+
16
+ ```sh
17
+ # npm
18
+ npm install @amplitude/session-replay-browser
19
+
20
+ # yarn
21
+ yarn add @amplitude/session-replay-browser
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ This SDK provides access to the Amplitude Session Replay product.
27
+
28
+ This plugin requires that default tracking for sessions is enabled. If default tracking for sessions is not enabled in the config, the plugin will automatically enable it.
29
+
30
+ ### 1. Import Amplitude packages
31
+
32
+ * `@amplitude/session-replay-browser`
33
+
34
+ ```typescript
35
+ import * as sessionReplay from '@amplitude/session-replay-browser';
36
+ ```
37
+
38
+ ### 2. Initialize session recordings
39
+
40
+ The SDK must be configured via the following code. This call kicks off recording for the user.
41
+
42
+ ```typescript
43
+ sessionReplay.init(API_KEY, {
44
+ deviceId: DEVICE_ID,
45
+ sessionId: SESSION_ID,
46
+ sampleRate: 0.5,
47
+ });
48
+ ```
49
+
50
+ ### 3. Get session recording event properties
51
+ Any event that occurs within the span of a session recording must be tagged with properties that signal to Amplitude to include it in the scope of the recording. The following shows an example of how to use the properties
52
+ ```typescript
53
+ const sessionRecordingProperties = sessionReplay.getSessionRecordingProperties();
54
+ track(EVENT_NAME, {
55
+ ...eventProperties,
56
+ ...sessionRecordingProperties
57
+ })
58
+ ```
59
+
60
+ ### 4. Update session id
61
+ Any time that the session id for the user changes, the session replay SDK must be notified of that change. Update the session id via the following method:
62
+ ```typescript
63
+ sessionReplay.setSessionId(UNIX_TIMESTAMP)
64
+ ```
65
+
66
+ ### 5. Shutdown (optional)
67
+ If at any point you would like to discontinue recording, for example in a part of your application where you would not like sessions to be recorded, you can use the following method to stop recording and remove recording event listeners.
68
+ ```typescript
69
+ sessionReplay.shutdown()
70
+ ```
71
+
72
+ #### Options
73
+
74
+ |Name|Type|Required|Default|Description|
75
+ |-|-|-|-|-|
76
+ |`deviceId`|`string`|Yes|`undefined`|Sets an identifier for the device running your application.|
77
+ |`sessionId`|`number`|Yes|`undefined`|Sets an identifier for the users current session. The value must be in milliseconds since epoch (Unix Timestamp).|
78
+ |`sampleRate`|`number`|No|`undefined`|Use this option to control how many sessions will be selected for recording. A selected session will be recorded, while sessions that are not selected will not be recorded. <br></br>The number should be a decimal between 0 and 1, ie `0.4`, representing the fraction of sessions you would like to have randomly selected for recording. Over a large number of sessions, `0.4` would select `40%` of those sessions.|
79
+ |`optOut`|`boolean`|No|`false`|Sets permission to record sessions. Setting a value of true prevents Amplitude from recording sessions.|
80
+ |`flushMaxRetries`|`number`|No|`5`|Sets the maximum number of retries for failed upload attempts. This is only applicable to retryable errors.|
81
+ |`logLevel`|`number`|No|`LogLevel.Warn`|`LogLevel.None` or `LogLevel.Error` or `LogLevel.Warn` or `LogLevel.Verbose` or `LogLevel.Debug`. Sets the log level.|
82
+ |`loggerProvider`|`Logger`|No|`Logger`|Sets a custom loggerProvider class from the Logger to emit log messages to desired destination.|
83
+ |`serverZone`|`string`|No|`US`|EU or US. Sets the Amplitude server zone. Set this to EU for Amplitude projects created in EU data center.|
84
+
85
+ ## Privacy
86
+ By default, the session recording will mask all inputs, meaning the text in inputs will appear in a session replay as asterisks: `***`. You may require more specific masking controls based on your use case, so we offer the following controls:
87
+
88
+ #### 1. Unmask inputs
89
+ In your application code, add the class `.amp-unmask` to any __input__ whose text you'd like to have unmasked in the recording. In the replay of a recorded session, it will be possible to read the exact text entered into an input with this class, the text will not be converted to asterisks.
90
+
91
+ #### 2. Mask non-input elements
92
+ In your application code, add the class `.amp-mask` to any __non-input element__ whose text you'd like to have masked from the recording. The text in the element, as well as it's children, will all be converted to asterisks.
93
+
94
+ #### 3. Block non-text elements
95
+ In your application code, add the class `.amp-block` to any element you would like to have blocked from the recording. The element will appear in the replay as a placeholder with the same dimensions.
@@ -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,29 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.SessionReplayConfig = exports.getDefaultConfig = void 0;
3
+ var tslib_1 = require("tslib");
4
+ var analytics_client_common_1 = require("@amplitude/analytics-client-common");
5
+ var analytics_core_1 = require("@amplitude/analytics-core");
6
+ var analytics_types_1 = require("@amplitude/analytics-types");
7
+ var getDefaultConfig = function () { return ({
8
+ flushMaxRetries: 5,
9
+ logLevel: analytics_types_1.LogLevel.Warn,
10
+ loggerProvider: new analytics_core_1.Logger(),
11
+ transportProvider: new analytics_client_common_1.FetchTransport(),
12
+ }); };
13
+ exports.getDefaultConfig = getDefaultConfig;
14
+ var SessionReplayConfig = /** @class */ (function (_super) {
15
+ tslib_1.__extends(SessionReplayConfig, _super);
16
+ function SessionReplayConfig(apiKey, options) {
17
+ var _this = this;
18
+ var defaultConfig = (0, exports.getDefaultConfig)();
19
+ _this = _super.call(this, tslib_1.__assign(tslib_1.__assign({ transportProvider: defaultConfig.transportProvider }, options), { apiKey: apiKey })) || this;
20
+ _this.apiKey = apiKey;
21
+ _this.sampleRate = options.sampleRate || 1;
22
+ _this.deviceId = options.deviceId;
23
+ _this.sessionId = options.sessionId;
24
+ return _this;
25
+ }
26
+ return SessionReplayConfig;
27
+ }(analytics_core_1.Config));
28
+ exports.SessionReplayConfig = SessionReplayConfig;
29
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;AAAA,8EAAoE;AACpE,4DAA2D;AAC3D,8DAAsD;AAG/C,IAAM,gBAAgB,GAAG,cAAM,OAAA,CAAC;IACrC,eAAe,EAAE,CAAC;IAClB,QAAQ,EAAE,0BAAQ,CAAC,IAAI;IACvB,cAAc,EAAE,IAAI,uBAAM,EAAE;IAC5B,iBAAiB,EAAE,IAAI,wCAAc,EAAE;CACxC,CAAC,EALoC,CAKpC,CAAC;AALU,QAAA,gBAAgB,oBAK1B;AAEH;IAAyC,+CAAM;IAM7C,6BAAY,MAAc,EAAE,OAA6B;QAAzD,iBAaC;QAZC,IAAM,aAAa,GAAG,IAAA,wBAAgB,GAAE,CAAC;gBACzC,sDACE,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,uBAAM,GAoB9C;AApBY,kDAAmB","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,23 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ 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;
3
+ var analytics_core_1 = require("@amplitude/analytics-core");
4
+ exports.DEFAULT_EVENT_PROPERTY_PREFIX = '[Amplitude]';
5
+ exports.DEFAULT_SESSION_REPLAY_PROPERTY = "".concat(exports.DEFAULT_EVENT_PROPERTY_PREFIX, " Session Recorded");
6
+ exports.DEFAULT_SESSION_START_EVENT = 'session_start';
7
+ exports.DEFAULT_SESSION_END_EVENT = 'session_end';
8
+ exports.BLOCK_CLASS = 'amp-block';
9
+ exports.MASK_TEXT_CLASS = 'amp-mask';
10
+ exports.UNMASK_TEXT_CLASS = 'amp-unmask';
11
+ exports.SESSION_REPLAY_SERVER_URL = 'https://api-secure.amplitude.com/sessions/track';
12
+ exports.SESSION_REPLAY_EU_URL = 'https://api.eu.amplitude.com/sessions/track';
13
+ exports.STORAGE_PREFIX = "".concat(analytics_core_1.AMPLITUDE_PREFIX, "_replay_unsent");
14
+ var PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS = 500; // derived by JSON stringifying an example payload without events
15
+ exports.MAX_EVENT_LIST_SIZE_IN_BYTES = 10 * 1000000 - PAYLOAD_ESTIMATED_SIZE_IN_BYTES_WITHOUT_EVENTS;
16
+ exports.MIN_INTERVAL = 500; // 500 ms
17
+ exports.MAX_INTERVAL = 10 * 1000; // 10 seconds
18
+ exports.defaultSessionStore = {
19
+ currentSequenceId: 0,
20
+ sessionSequences: {},
21
+ };
22
+ exports.MAX_IDB_STORAGE_LENGTH = 1000 * 60 * 60 * 24 * 3; // 3 days
23
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;AAAA,4DAA6D;AAGhD,QAAA,6BAA6B,GAAG,aAAa,CAAC;AAE9C,QAAA,+BAA+B,GAAG,UAAG,qCAA6B,sBAAmB,CAAC;AACtF,QAAA,2BAA2B,GAAG,eAAe,CAAC;AAC9C,QAAA,yBAAyB,GAAG,aAAa,CAAC;AAE1C,QAAA,WAAW,GAAG,WAAW,CAAC;AAC1B,QAAA,eAAe,GAAG,UAAU,CAAC;AAC7B,QAAA,iBAAiB,GAAG,YAAY,CAAC;AACjC,QAAA,yBAAyB,GAAG,iDAAiD,CAAC;AAC9E,QAAA,qBAAqB,GAAG,6CAA6C,CAAC;AACtE,QAAA,cAAc,GAAG,UAAG,iCAAgB,mBAAgB,CAAC;AAClE,IAAM,8CAA8C,GAAG,GAAG,CAAC,CAAC,iEAAiE;AAChH,QAAA,4BAA4B,GAAG,EAAE,GAAG,OAAO,GAAG,8CAA8C,CAAC;AAC7F,QAAA,YAAY,GAAG,GAAG,CAAC,CAAC,SAAS;AAC7B,QAAA,YAAY,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AACvC,QAAA,mBAAmB,GAAoB;IAClD,iBAAiB,EAAE,CAAC;IACpB,gBAAgB,EAAE,EAAE;CACrB,CAAC;AACW,QAAA,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,32 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.isSessionInSample = exports.generateHashCode = exports.maskInputFn = void 0;
3
+ var constants_1 = require("./constants");
4
+ var maskInputFn = function (text, element) {
5
+ var _a;
6
+ if ((_a = element.classList) === null || _a === void 0 ? void 0 : _a.contains(constants_1.UNMASK_TEXT_CLASS)) {
7
+ return text;
8
+ }
9
+ return '*'.repeat(text.length);
10
+ };
11
+ exports.maskInputFn = maskInputFn;
12
+ var generateHashCode = function (str) {
13
+ var hash = 0;
14
+ if (str.length === 0)
15
+ return hash;
16
+ for (var i = 0; i < str.length; i++) {
17
+ var chr = str.charCodeAt(i);
18
+ hash = (hash << 5) - hash + chr;
19
+ hash |= 0;
20
+ }
21
+ return hash;
22
+ };
23
+ exports.generateHashCode = generateHashCode;
24
+ var isSessionInSample = function (sessionId, sampleRate) {
25
+ var hashNumber = (0, exports.generateHashCode)(sessionId.toString());
26
+ var absHash = Math.abs(hashNumber);
27
+ var absHashMultiply = absHash * 31;
28
+ var mod = absHashMultiply % 100;
29
+ return mod / 100 < sampleRate;
30
+ };
31
+ exports.isSessionInSample = isSessionInSample;
32
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;AAAA,yCAAgD;AAEzC,IAAM,WAAW,GAAG,UAAC,IAAY,EAAE,OAAoB;;IAC5D,IAAI,MAAA,OAAO,CAAC,SAAS,0CAAE,QAAQ,CAAC,6BAAiB,CAAC,EAAE;QAClD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC,CAAC;AALW,QAAA,WAAW,eAKtB;AAEK,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;AATW,QAAA,gBAAgB,oBAS3B;AAEK,IAAM,iBAAiB,GAAG,UAAU,SAAiB,EAAE,UAAkB;IAC9E,IAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,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;AANW,QAAA,iBAAiB,qBAM5B","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"}
@@ -0,0 +1,6 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.shutdown = exports.getSessionRecordingProperties = exports.setSessionId = exports.init = void 0;
3
+ var tslib_1 = require("tslib");
4
+ var session_replay_factory_1 = tslib_1.__importDefault(require("./session-replay-factory"));
5
+ exports.init = session_replay_factory_1.default.init, exports.setSessionId = session_replay_factory_1.default.setSessionId, exports.getSessionRecordingProperties = session_replay_factory_1.default.getSessionRecordingProperties, exports.shutdown = session_replay_factory_1.default.shutdown;
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,4FAAqD;AACtC,QAAA,IAAI,GAA4D,gCAAa,OAAvE,QAAA,YAAY,GAA8C,gCAAa,eAAzD,QAAA,6BAA6B,GAAe,gCAAa,gCAA1B,QAAA,QAAQ,GAAK,gCAAa,UAAC","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,12 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.MISSING_API_KEY_MESSAGE = exports.MISSING_DEVICE_ID_MESSAGE = exports.STORAGE_FAILURE = exports.MAX_RETRIES_EXCEEDED_MESSAGE = exports.UNEXPECTED_ERROR_MESSAGE = exports.getSuccessMessage = void 0;
3
+ var getSuccessMessage = function (sessionId) {
4
+ return "Session replay event batch tracked successfully for session id ".concat(sessionId);
5
+ };
6
+ exports.getSuccessMessage = getSuccessMessage;
7
+ exports.UNEXPECTED_ERROR_MESSAGE = 'Unexpected error occurred';
8
+ exports.MAX_RETRIES_EXCEEDED_MESSAGE = 'Session replay event batch rejected due to exceeded retry count';
9
+ exports.STORAGE_FAILURE = 'Failed to store session replay events in IndexedDB';
10
+ exports.MISSING_DEVICE_ID_MESSAGE = 'Session replay event batch not sent due to missing device ID';
11
+ exports.MISSING_API_KEY_MESSAGE = 'Session replay event batch not sent due to missing api key';
12
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":";;AAAO,IAAM,iBAAiB,GAAG,UAAC,SAAiB;IACjD,OAAA,yEAAkE,SAAS,CAAE;AAA7E,CAA6E,CAAC;AADnE,QAAA,iBAAiB,qBACkD;AACnE,QAAA,wBAAwB,GAAG,2BAA2B,CAAC;AACvD,QAAA,4BAA4B,GAAG,iEAAiE,CAAC;AACjG,QAAA,eAAe,GAAG,oDAAoD,CAAC;AACvE,QAAA,yBAAyB,GAAG,8DAA8D,CAAC;AAC3F,QAAA,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,25 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.getLogConfig = void 0;
3
+ var analytics_core_1 = require("@amplitude/analytics-core");
4
+ var config_1 = require("./config");
5
+ var session_replay_1 = require("./session-replay");
6
+ var getLogConfig = function (sessionReplay) { return function () {
7
+ var config = sessionReplay.config;
8
+ var _a = config || (0, config_1.getDefaultConfig)(), logger = _a.loggerProvider, logLevel = _a.logLevel;
9
+ return {
10
+ logger: logger,
11
+ logLevel: logLevel,
12
+ };
13
+ }; };
14
+ exports.getLogConfig = getLogConfig;
15
+ var createInstance = function () {
16
+ var sessionReplay = new session_replay_1.SessionReplay();
17
+ return {
18
+ init: (0, analytics_core_1.debugWrapper)(sessionReplay.init.bind(sessionReplay), 'init', (0, exports.getLogConfig)(sessionReplay)),
19
+ setSessionId: (0, analytics_core_1.debugWrapper)(sessionReplay.setSessionId.bind(sessionReplay), 'setSessionId', (0, exports.getLogConfig)(sessionReplay)),
20
+ getSessionRecordingProperties: (0, analytics_core_1.debugWrapper)(sessionReplay.getSessionRecordingProperties.bind(sessionReplay), 'getSessionRecordingProperties', (0, exports.getLogConfig)(sessionReplay)),
21
+ shutdown: (0, analytics_core_1.debugWrapper)(sessionReplay.shutdown.bind(sessionReplay), 'teardown', (0, exports.getLogConfig)(sessionReplay)),
22
+ };
23
+ };
24
+ exports.default = createInstance();
25
+ //# 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,4DAAyD;AAEzD,mCAA4C;AAC5C,mDAAiD;AAG1C,IAAM,YAAY,GAAG,UAAC,aAA4B,IAAK,OAAA;IACpD,IAAA,MAAM,GAAK,aAAa,OAAlB,CAAmB;IAC3B,IAAA,KAAuC,MAAM,IAAI,IAAA,yBAAgB,GAAE,EAAjD,MAAM,oBAAA,EAAE,QAAQ,cAAiC,CAAC;IAC1E,OAAO;QACL,MAAM,QAAA;QACN,QAAQ,UAAA;KACT,CAAC;AACJ,CAAC,EAP6D,CAO7D,CAAC;AAPW,QAAA,YAAY,gBAOvB;AAEF,IAAM,cAAc,GAAiC;IACnD,IAAM,aAAa,GAAG,IAAI,8BAAa,EAAE,CAAC;IAC1C,OAAO;QACL,IAAI,EAAE,IAAA,6BAAY,EAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,IAAA,oBAAY,EAAC,aAAa,CAAC,CAAC;QAC/F,YAAY,EAAE,IAAA,6BAAY,EACxB,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,EAC9C,cAAc,EACd,IAAA,oBAAY,EAAC,aAAa,CAAC,CAC5B;QACD,6BAA6B,EAAE,IAAA,6BAAY,EACzC,aAAa,CAAC,6BAA6B,CAAC,IAAI,CAAC,aAAa,CAAC,EAC/D,+BAA+B,EAC/B,IAAA,oBAAY,EAAC,aAAa,CAAC,CAC5B;QACD,QAAQ,EAAE,IAAA,6BAAY,EAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,IAAA,oBAAY,EAAC,aAAa,CAAC,CAAC;KAC5G,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,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"}