@amplitude/session-replay-react-native 0.1.0-beta.3 → 0.1.0-beta.5
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/README.md +1 -17
- package/android/src/main/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeModule.kt +99 -48
- package/android/src/oldarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeSpec.kt +2 -1
- package/ios/AMPNativeSessionReplay.mm +4 -2
- package/ios/NativeSessionReplay.swift +41 -37
- package/lib/commonjs/index.js +15 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native-module.js.map +1 -1
- package/lib/commonjs/plugin-session-replay.js +23 -32
- package/lib/commonjs/plugin-session-replay.js.map +1 -1
- package/lib/commonjs/session-replay-config.js +0 -1
- package/lib/commonjs/session-replay-config.js.map +1 -1
- package/lib/commonjs/session-replay.js +40 -40
- package/lib/commonjs/session-replay.js.map +1 -1
- package/lib/commonjs/specs/NativeAmpSessionReplay.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/native-module.js.map +1 -1
- package/lib/module/plugin-session-replay.js +24 -33
- package/lib/module/plugin-session-replay.js.map +1 -1
- package/lib/module/session-replay-config.js +0 -1
- package/lib/module/session-replay-config.js.map +1 -1
- package/lib/module/session-replay.js +38 -39
- package/lib/module/session-replay.js.map +1 -1
- package/lib/module/specs/NativeAmpSessionReplay.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/index.d.ts +2 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/native-module.d.ts +9 -12
- package/lib/typescript/native-module.d.ts.map +1 -1
- package/lib/typescript/plugin-session-replay.d.ts +9 -14
- package/lib/typescript/plugin-session-replay.d.ts.map +1 -1
- package/lib/typescript/session-replay-config.d.ts +0 -5
- package/lib/typescript/session-replay-config.d.ts.map +1 -1
- package/lib/typescript/session-replay.d.ts +18 -28
- package/lib/typescript/session-replay.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAmpSessionReplay.d.ts +2 -1
- package/lib/typescript/specs/NativeAmpSessionReplay.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/index.tsx +3 -4
- package/src/native-module.ts +11 -14
- package/src/plugin-session-replay.ts +24 -33
- package/src/session-replay-config.ts +0 -7
- package/src/session-replay.ts +38 -42
- package/src/specs/NativeAmpSessionReplay.ts +2 -1
- package/src/version.ts +1 -1
|
@@ -5,13 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.flush = flush;
|
|
7
7
|
exports.getSessionId = getSessionId;
|
|
8
|
-
exports.getSessionReplayProperties = getSessionReplayProperties;
|
|
9
8
|
exports.init = init;
|
|
10
9
|
exports.privateInit = privateInit;
|
|
11
10
|
exports.setDeviceId = setDeviceId;
|
|
11
|
+
exports.setOptOut = setOptOut;
|
|
12
12
|
exports.setSessionId = setSessionId;
|
|
13
13
|
exports.start = start;
|
|
14
14
|
exports.stop = stop;
|
|
15
|
+
exports.teardown = teardown;
|
|
15
16
|
var _nativeModule = require("./native-module");
|
|
16
17
|
var _sessionReplayConfig = require("./session-replay-config");
|
|
17
18
|
var _logger = require("./logger");
|
|
@@ -49,17 +50,16 @@ function normalizeConfig(config) {
|
|
|
49
50
|
}
|
|
50
51
|
return rest;
|
|
51
52
|
}
|
|
52
|
-
let fullConfig = null;
|
|
53
53
|
let isInitialized = false;
|
|
54
54
|
let logger = (0, _logger.createSessionReplayLogger)();
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
* Configure the SDK
|
|
57
|
+
* Configure the SDK. Call `start()` explicitly to begin collecting replays.
|
|
58
58
|
* This function must be called before any other session replay operations.
|
|
59
59
|
*
|
|
60
60
|
* @param config - Configuration object containing API key, device ID, session ID, and other options
|
|
61
|
-
* @returns Promise that resolves when initialization is complete
|
|
62
|
-
*
|
|
61
|
+
* @returns Promise that resolves when initialization is complete. Native setup
|
|
62
|
+
* failures are logged and do not reject the promise.
|
|
63
63
|
*
|
|
64
64
|
* @example
|
|
65
65
|
* ```typescript
|
|
@@ -81,14 +81,14 @@ async function init(config) {
|
|
|
81
81
|
// the default object wholesale. That's fine while `PrivacyConfig` only
|
|
82
82
|
// carries `maskLevel`, but if it ever grows more fields a deeper merge will
|
|
83
83
|
// be needed so partial user configs don't drop defaults.
|
|
84
|
-
|
|
84
|
+
const resolvedConfig = {
|
|
85
85
|
...(0, _sessionReplayConfig.getDefaultConfig)(),
|
|
86
86
|
...normalizeConfig(config)
|
|
87
87
|
};
|
|
88
|
-
logger.setLogLevel(
|
|
89
|
-
logger.log(`initializing @amplitude/session-replay-react-native version: ${_version.VERSION} with config: `,
|
|
88
|
+
logger.setLogLevel(resolvedConfig.logLevel);
|
|
89
|
+
logger.log(`initializing @amplitude/session-replay-react-native version: ${_version.VERSION} with config: `, resolvedConfig);
|
|
90
90
|
try {
|
|
91
|
-
await _nativeModule.NativeSessionReplay.setup(nativeConfig(
|
|
91
|
+
await _nativeModule.NativeSessionReplay.setup(nativeConfig(resolvedConfig));
|
|
92
92
|
logger.log('SessionReplay initialized');
|
|
93
93
|
isInitialized = true;
|
|
94
94
|
} catch (error) {
|
|
@@ -159,35 +159,6 @@ async function getSessionId() {
|
|
|
159
159
|
return await _nativeModule.NativeSessionReplay.getSessionId();
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
/**
|
|
163
|
-
* Interface for session replay properties that should be attached to Amplitude events.
|
|
164
|
-
* These properties help correlate events with session recordings.
|
|
165
|
-
*/
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* When you send events to Amplitude, call this function to get the most up-to-date session replay properties for the event.
|
|
169
|
-
* Collect Session Replay properties to send with other event properties.
|
|
170
|
-
*
|
|
171
|
-
* @returns Promise that resolves to an object containing session replay metadata
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* ```typescript
|
|
175
|
-
* const sessionReplayProperties = await getSessionReplayProperties();
|
|
176
|
-
* analytics.track('Button Clicked', {
|
|
177
|
-
* buttonName: 'submit',
|
|
178
|
-
* ...sessionReplayProperties // Merge session replay properties
|
|
179
|
-
* });
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
async function getSessionReplayProperties() {
|
|
183
|
-
if (!isInitialized) {
|
|
184
|
-
logger.warn('SessionReplay is not initialized');
|
|
185
|
-
return {};
|
|
186
|
-
}
|
|
187
|
-
const properties = await _nativeModule.NativeSessionReplay.getSessionReplayProperties();
|
|
188
|
-
return properties;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
162
|
/**
|
|
192
163
|
* Flush any pending session replay data to the server.
|
|
193
164
|
* Forces immediate upload of recorded session data that may be buffered locally.
|
|
@@ -211,13 +182,12 @@ async function flush() {
|
|
|
211
182
|
/**
|
|
212
183
|
* Start session replay recording.
|
|
213
184
|
* Begins capturing user interactions and screen content for replay.
|
|
214
|
-
* If autoStart is enabled in the configuration, this is called automatically during initialization.
|
|
215
185
|
*
|
|
216
186
|
* @returns Promise that resolves when recording starts
|
|
217
187
|
*
|
|
218
188
|
* @example
|
|
219
189
|
* ```typescript
|
|
220
|
-
* //
|
|
190
|
+
* // Recording starts only after this explicit call.
|
|
221
191
|
* await start();
|
|
222
192
|
* ```
|
|
223
193
|
*/
|
|
@@ -248,6 +218,36 @@ async function stop() {
|
|
|
248
218
|
}
|
|
249
219
|
await _nativeModule.NativeSessionReplay.stop();
|
|
250
220
|
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Update whether session replay collection is disabled for the current user.
|
|
224
|
+
*
|
|
225
|
+
* @param optOut - Whether to opt out of session replay collection
|
|
226
|
+
* @returns Promise that resolves when the opt-out state is updated
|
|
227
|
+
*/
|
|
228
|
+
async function setOptOut(optOut) {
|
|
229
|
+
if (!isInitialized) {
|
|
230
|
+
logger.warn('SessionReplay is not initialized');
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
await _nativeModule.NativeSessionReplay.setOptOut(optOut);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Shut down the native SDK and clear all JavaScript lifecycle state.
|
|
238
|
+
* Call `init()` again before using any other session replay operation.
|
|
239
|
+
*
|
|
240
|
+
* @returns Promise that resolves when teardown is complete
|
|
241
|
+
*/
|
|
242
|
+
async function teardown() {
|
|
243
|
+
if (!isInitialized) {
|
|
244
|
+
logger.warn('SessionReplay is not initialized');
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
await _nativeModule.NativeSessionReplay.teardown();
|
|
248
|
+
isInitialized = false;
|
|
249
|
+
logger = (0, _logger.createSessionReplayLogger)();
|
|
250
|
+
}
|
|
251
251
|
function nativeConfig(config) {
|
|
252
252
|
// Resolve the effective mask level here — the single source of truth for the
|
|
253
253
|
// default. `normalizeConfig()` already folded the deprecated top-level
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativeModule","require","_sessionReplayConfig","_logger","_version","normalizeConfig","config","maskLevel","privacyConfig","rest","undefined","
|
|
1
|
+
{"version":3,"names":["_nativeModule","require","_sessionReplayConfig","_logger","_version","normalizeConfig","config","maskLevel","privacyConfig","rest","undefined","isInitialized","logger","createSessionReplayLogger","init","warn","resolvedConfig","getDefaultConfig","setLogLevel","logLevel","log","VERSION","NativeSessionReplay","setup","nativeConfig","error","setSessionId","sessionId","setDeviceId","deviceId","getSessionId","flush","start","stop","setOptOut","optOut","teardown","resolvedMaskLevel","privateInit","newLogger"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":";;;;;;;;;;;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AALA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,eAAeA,CAAC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EAAkB;EAC1C,IAAI,CAACtB,aAAa,EAAE;IAClBC,MAAM,CAACG,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMO,iCAAmB,CAACW,IAAI,CAAC,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,SAASA,CAACC,MAAe,EAAiB;EAC9D,IAAI,CAACxB,aAAa,EAAE;IAClBC,MAAM,CAACG,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMO,iCAAmB,CAACY,SAAS,CAACC,MAAM,CAAC;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,QAAQA,CAAA,EAAkB;EAC9C,IAAI,CAACzB,aAAa,EAAE;IAClBC,MAAM,CAACG,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMO,iCAAmB,CAACc,QAAQ,CAAC,CAAC;EACpCzB,aAAa,GAAG,KAAK;EACrBC,MAAM,GAAG,IAAAC,iCAAyB,EAAC,CAAC;AACtC;AAEA,SAASW,YAAYA,CAAClB,MAAmC,EAA6B;EACpF;EACA;EACA;EACA;EACA;EACA;EACA,MAAM;IAAEE,aAAa;IAAE,GAAGC;EAAK,CAAC,GAAGH,MAAM;EACzC,MAAM+B,iBAAyD,GAAG7B,aAAa,CAACD,SAAS,IAAI,QAAQ;EACrG,OAAO;IACL,GAAGE,IAAI;IACPU,QAAQ,EAAEV,IAAI,CAACU,QAAiD;IAChE;IACAZ,SAAS,EAAE8B;EACb,CAAC;AACH;AAEO,eAAeC,WAAWA,CAC/BhC,MAA2B,EAC3BiC,SAAuD,EACxC;EACf3B,MAAM,GAAG2B,SAAS;EAClB,OAAOzB,IAAI,CAACR,MAAM,CAAC;AACrB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeAmpSessionReplay.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeAmpSessionReplay.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACeC,gCAAmB,CAACC,GAAG,CAAO,wBAAwB,CAAC","ignoreList":[]}
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { init, setSessionId, getSessionId,
|
|
2
|
-
export {
|
|
1
|
+
export { init, setSessionId, getSessionId, flush, start, stop, setDeviceId, setOptOut, teardown } from './session-replay';
|
|
2
|
+
export { LogLevel } from './session-replay-config';
|
|
3
3
|
export { AmpMaskView } from './amp-mask-view';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["init","setSessionId","getSessionId","
|
|
1
|
+
{"version":3,"names":["init","setSessionId","getSessionId","flush","start","stop","setDeviceId","setOptOut","teardown","LogLevel","AmpMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SACEA,IAAI,EACJC,YAAY,EACZC,YAAY,EACZC,KAAK,EACLC,KAAK,EACLC,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,QAAQ,QACH,kBAAkB;AAEzB,SAASC,QAAQ,QAAQ,yBAAyB;AAElD,SAASC,WAAW,QAA+B,iBAAiB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","SessionReplaySpec","LINKING_ERROR","select","ios","default","NativeSessionReplay","Proxy","get","Error"],"sourceRoot":"../../src","sources":["native-module.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,iBAAiB,MAAM,gCAAgC;AAE9D,MAAMC,aAAa,GACjB,iGAAiG,GACjGF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAIL,iBAAiB,IACnD,IAAIM,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAwC;;AAE1C;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["Platform","SessionReplaySpec","LINKING_ERROR","select","ios","default","NativeSessionReplay","Proxy","get","Error"],"sourceRoot":"../../src","sources":["native-module.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,iBAAiB,MAAM,gCAAgC;AAE9D,MAAMC,aAAa,GACjB,iGAAiG,GACjGF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAIL,iBAAiB,IACnD,IAAIM,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAwC;;AAE1C;AACA;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultSessionReplayPluginConfig } from './plugin-session-replay-config';
|
|
2
|
-
import { getSessionId,
|
|
2
|
+
import { getSessionId, privateInit, setOptOut, setSessionId, start, stop, teardown } from './session-replay';
|
|
3
3
|
import { createSessionReplayLogger } from './logger';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -60,12 +60,15 @@ export class SessionReplayPlugin {
|
|
|
60
60
|
sampleRate: this.sessionReplayConfig.sampleRate,
|
|
61
61
|
enableRemoteConfig: this.sessionReplayConfig.enableRemoteConfig,
|
|
62
62
|
logLevel: this.sessionReplayConfig.logLevel,
|
|
63
|
-
|
|
63
|
+
optOut: config.optOut
|
|
64
64
|
}, this.logger);
|
|
65
65
|
this.isInitialized = true;
|
|
66
|
+
if (this.sessionReplayConfig.autoStart) {
|
|
67
|
+
await start();
|
|
68
|
+
}
|
|
66
69
|
}
|
|
67
70
|
async execute(event) {
|
|
68
|
-
var _this$config
|
|
71
|
+
var _this$config;
|
|
69
72
|
if (!this.isInitialized) {
|
|
70
73
|
return Promise.resolve(event);
|
|
71
74
|
}
|
|
@@ -76,15 +79,6 @@ export class SessionReplayPlugin {
|
|
|
76
79
|
if ((_this$config = this.config) !== null && _this$config !== void 0 && _this$config.sessionId && this.config.sessionId !== (await getSessionId())) {
|
|
77
80
|
await setSessionId(this.config.sessionId);
|
|
78
81
|
}
|
|
79
|
-
// Treating config.sessionId as source of truth, if the event's session id doesn't match, the
|
|
80
|
-
// event is not of the current session (offline/late events). In that case, don't tag the events
|
|
81
|
-
if ((_this$config2 = this.config) !== null && _this$config2 !== void 0 && _this$config2.sessionId && this.config.sessionId === event.session_id) {
|
|
82
|
-
const sessionRecordingProperties = await getSessionReplayProperties();
|
|
83
|
-
event.event_properties = {
|
|
84
|
-
...event.event_properties,
|
|
85
|
-
...sessionRecordingProperties
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
82
|
return Promise.resolve(event);
|
|
89
83
|
}
|
|
90
84
|
|
|
@@ -111,34 +105,31 @@ export class SessionReplayPlugin {
|
|
|
111
105
|
await stop();
|
|
112
106
|
}
|
|
113
107
|
}
|
|
114
|
-
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Update whether session replay collection is disabled for the current user.
|
|
111
|
+
*
|
|
112
|
+
* @param optOut - Whether to opt out of session replay collection
|
|
113
|
+
* @returns Promise that resolves when the opt-out state is updated
|
|
114
|
+
*/
|
|
115
|
+
async setOptOut(optOut) {
|
|
115
116
|
if (this.isInitialized) {
|
|
116
|
-
await
|
|
117
|
+
await setOptOut(optOut);
|
|
117
118
|
}
|
|
118
|
-
this.config = null;
|
|
119
|
-
this.isInitialized = false;
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
/**
|
|
123
|
-
*
|
|
124
|
-
* When you send events to Amplitude, call this method to get the most up-to-date session replay properties for the event.
|
|
125
|
-
*
|
|
126
|
-
* @returns Promise that resolves to an object containing session replay metadata
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```typescript
|
|
130
|
-
* const sessionReplayProperties = await plugin.getSessionReplayProperties();
|
|
131
|
-
* analytics.track('Button Clicked', {
|
|
132
|
-
* buttonName: 'submit',
|
|
133
|
-
* ...sessionReplayProperties
|
|
134
|
-
* });
|
|
135
|
-
* ```
|
|
122
|
+
* Amplitude SDK hook. `client.setOptOut()` fans this out through the plugin timeline.
|
|
136
123
|
*/
|
|
137
|
-
async
|
|
138
|
-
|
|
139
|
-
|
|
124
|
+
async onOptOutChanged(optOut) {
|
|
125
|
+
await this.setOptOut(optOut);
|
|
126
|
+
}
|
|
127
|
+
async teardown() {
|
|
128
|
+
if (this.isInitialized) {
|
|
129
|
+
await teardown();
|
|
140
130
|
}
|
|
141
|
-
|
|
131
|
+
this.config = null;
|
|
132
|
+
this.isInitialized = false;
|
|
142
133
|
}
|
|
143
134
|
}
|
|
144
135
|
//# sourceMappingURL=plugin-session-replay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getDefaultSessionReplayPluginConfig","getSessionId","
|
|
1
|
+
{"version":3,"names":["getDefaultSessionReplayPluginConfig","getSessionId","privateInit","setOptOut","setSessionId","start","stop","teardown","createSessionReplayLogger","SessionReplayPlugin","name","type","config","isInitialized","logger","constructor","sessionReplayConfig","setLogLevel","logLevel","log","setup","_","apiKey","deviceId","sessionId","serverZone","sampleRate","enableRemoteConfig","optOut","autoStart","execute","event","_this$config","Promise","resolve","onOptOutChanged"],"sourceRoot":"../../src","sources":["plugin-session-replay.ts"],"mappings":"AAOA,SAAoCA,mCAAmC,QAAQ,gCAAgC;AAC/G,SAASC,YAAY,EAAEC,WAAW,EAAEC,SAAS,EAAEC,YAAY,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,kBAAkB;AAC5G,SAASC,yBAAyB,QAAQ,UAAU;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,CAAmE;EACjGC,IAAI,GAAG,+CAA+C;EACtDC,IAAI,GAAG,YAAY;EAEXC,MAAM,GAA6B,IAAI;EACvCC,aAAa,GAAG,KAAK;EAGrBC,MAAM,GAAGN,yBAAyB,CAAC,CAAC;;EAE5C;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEO,WAAWA,CAACH,MAAiC,GAAG,CAAC,CAAC,EAAE;IAClD,IAAI,CAACI,mBAAmB,GAAG;MACzB,GAAGhB,mCAAmC,CAAC,CAAC;MACxC,GAAGY;IACL,CAAC;IAED,IAAI,CAACE,MAAM,CAACG,WAAW,CAAC,IAAI,CAACD,mBAAmB,CAACE,QAAQ,CAAC;IAC1D,IAAI,CAACJ,MAAM,CAACK,GAAG,CAAC,4CAA4C,EAAE,IAAI,CAACH,mBAAmB,CAAC;EACzF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMI,KAAKA,CAACR,MAAyB,EAAES,CAAoB,EAAiB;IAC1E,IAAI,CAACT,MAAM,GAAGA,MAAM;IACpB,MAAMV,WAAW,CACf;MACEoB,MAAM,EAAEV,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AAMP,IAAI,CAAC,CAAC;IACd;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMH,SAASA,CAACyB,MAAe,EAAiB;IAC9C,IAAI,IAAI,CAACf,aAAa,EAAE;MACtB,MAAMV,SAAS,CAACyB,MAAM,CAAC;IACzB;EACF;;EAEA;AACF;AACA;EACE,MAAMO,eAAeA,CAACP,MAAe,EAAiB;IACpD,MAAM,IAAI,CAACzB,SAAS,CAACyB,MAAM,CAAC;EAC9B;EAEA,MAAMrB,QAAQA,CAAA,EAAkB;IAC9B,IAAI,IAAI,CAACM,aAAa,EAAE;MACtB,MAAMN,QAAQ,CAAC,CAAC;IAClB;IAEA,IAAI,CAACK,MAAM,GAAG,IAAI;IAClB,IAAI,CAACC,aAAa,GAAG,KAAK;EAC5B;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LogLevel","getDefaultConfig","
|
|
1
|
+
{"version":3,"names":["LogLevel","getDefaultConfig","deviceId","enableRemoteConfig","logLevel","Warn","optOut","privacyConfig","sampleRate","serverZone","sessionId"],"sourceRoot":"../../src","sources":["session-replay-config.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,4BAA4B;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;;AAqEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,MAAMC,gBAA6E,GAAGA,CAAA,KAAM;EACjG,OAAO;IACLC,QAAQ,EAAE,IAAI;IACdC,kBAAkB,EAAE,IAAI;IACxBC,QAAQ,EAAEJ,QAAQ,CAACK,IAAI;IACvBC,MAAM,EAAE,KAAK;IACb;IACA;IACA;IACA;IACAC,aAAa,EAAE,CAAC,CAAC;IACjBC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,IAAI;IAChBC,SAAS,EAAE,CAAC;EACd,CAAC;AACH,CAAC;AACD,SAASV,QAAQ","ignoreList":[]}
|
|
@@ -35,17 +35,16 @@ function normalizeConfig(config) {
|
|
|
35
35
|
}
|
|
36
36
|
return rest;
|
|
37
37
|
}
|
|
38
|
-
let fullConfig = null;
|
|
39
38
|
let isInitialized = false;
|
|
40
39
|
let logger = createSessionReplayLogger();
|
|
41
40
|
|
|
42
41
|
/**
|
|
43
|
-
* Configure the SDK
|
|
42
|
+
* Configure the SDK. Call `start()` explicitly to begin collecting replays.
|
|
44
43
|
* This function must be called before any other session replay operations.
|
|
45
44
|
*
|
|
46
45
|
* @param config - Configuration object containing API key, device ID, session ID, and other options
|
|
47
|
-
* @returns Promise that resolves when initialization is complete
|
|
48
|
-
*
|
|
46
|
+
* @returns Promise that resolves when initialization is complete. Native setup
|
|
47
|
+
* failures are logged and do not reject the promise.
|
|
49
48
|
*
|
|
50
49
|
* @example
|
|
51
50
|
* ```typescript
|
|
@@ -67,14 +66,14 @@ export async function init(config) {
|
|
|
67
66
|
// the default object wholesale. That's fine while `PrivacyConfig` only
|
|
68
67
|
// carries `maskLevel`, but if it ever grows more fields a deeper merge will
|
|
69
68
|
// be needed so partial user configs don't drop defaults.
|
|
70
|
-
|
|
69
|
+
const resolvedConfig = {
|
|
71
70
|
...getDefaultConfig(),
|
|
72
71
|
...normalizeConfig(config)
|
|
73
72
|
};
|
|
74
|
-
logger.setLogLevel(
|
|
75
|
-
logger.log(`initializing @amplitude/session-replay-react-native version: ${VERSION} with config: `,
|
|
73
|
+
logger.setLogLevel(resolvedConfig.logLevel);
|
|
74
|
+
logger.log(`initializing @amplitude/session-replay-react-native version: ${VERSION} with config: `, resolvedConfig);
|
|
76
75
|
try {
|
|
77
|
-
await NativeSessionReplay.setup(nativeConfig(
|
|
76
|
+
await NativeSessionReplay.setup(nativeConfig(resolvedConfig));
|
|
78
77
|
logger.log('SessionReplay initialized');
|
|
79
78
|
isInitialized = true;
|
|
80
79
|
} catch (error) {
|
|
@@ -145,35 +144,6 @@ export async function getSessionId() {
|
|
|
145
144
|
return await NativeSessionReplay.getSessionId();
|
|
146
145
|
}
|
|
147
146
|
|
|
148
|
-
/**
|
|
149
|
-
* Interface for session replay properties that should be attached to Amplitude events.
|
|
150
|
-
* These properties help correlate events with session recordings.
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* When you send events to Amplitude, call this function to get the most up-to-date session replay properties for the event.
|
|
155
|
-
* Collect Session Replay properties to send with other event properties.
|
|
156
|
-
*
|
|
157
|
-
* @returns Promise that resolves to an object containing session replay metadata
|
|
158
|
-
*
|
|
159
|
-
* @example
|
|
160
|
-
* ```typescript
|
|
161
|
-
* const sessionReplayProperties = await getSessionReplayProperties();
|
|
162
|
-
* analytics.track('Button Clicked', {
|
|
163
|
-
* buttonName: 'submit',
|
|
164
|
-
* ...sessionReplayProperties // Merge session replay properties
|
|
165
|
-
* });
|
|
166
|
-
* ```
|
|
167
|
-
*/
|
|
168
|
-
export async function getSessionReplayProperties() {
|
|
169
|
-
if (!isInitialized) {
|
|
170
|
-
logger.warn('SessionReplay is not initialized');
|
|
171
|
-
return {};
|
|
172
|
-
}
|
|
173
|
-
const properties = await NativeSessionReplay.getSessionReplayProperties();
|
|
174
|
-
return properties;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
147
|
/**
|
|
178
148
|
* Flush any pending session replay data to the server.
|
|
179
149
|
* Forces immediate upload of recorded session data that may be buffered locally.
|
|
@@ -197,13 +167,12 @@ export async function flush() {
|
|
|
197
167
|
/**
|
|
198
168
|
* Start session replay recording.
|
|
199
169
|
* Begins capturing user interactions and screen content for replay.
|
|
200
|
-
* If autoStart is enabled in the configuration, this is called automatically during initialization.
|
|
201
170
|
*
|
|
202
171
|
* @returns Promise that resolves when recording starts
|
|
203
172
|
*
|
|
204
173
|
* @example
|
|
205
174
|
* ```typescript
|
|
206
|
-
* //
|
|
175
|
+
* // Recording starts only after this explicit call.
|
|
207
176
|
* await start();
|
|
208
177
|
* ```
|
|
209
178
|
*/
|
|
@@ -234,6 +203,36 @@ export async function stop() {
|
|
|
234
203
|
}
|
|
235
204
|
await NativeSessionReplay.stop();
|
|
236
205
|
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Update whether session replay collection is disabled for the current user.
|
|
209
|
+
*
|
|
210
|
+
* @param optOut - Whether to opt out of session replay collection
|
|
211
|
+
* @returns Promise that resolves when the opt-out state is updated
|
|
212
|
+
*/
|
|
213
|
+
export async function setOptOut(optOut) {
|
|
214
|
+
if (!isInitialized) {
|
|
215
|
+
logger.warn('SessionReplay is not initialized');
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
await NativeSessionReplay.setOptOut(optOut);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Shut down the native SDK and clear all JavaScript lifecycle state.
|
|
223
|
+
* Call `init()` again before using any other session replay operation.
|
|
224
|
+
*
|
|
225
|
+
* @returns Promise that resolves when teardown is complete
|
|
226
|
+
*/
|
|
227
|
+
export async function teardown() {
|
|
228
|
+
if (!isInitialized) {
|
|
229
|
+
logger.warn('SessionReplay is not initialized');
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
await NativeSessionReplay.teardown();
|
|
233
|
+
isInitialized = false;
|
|
234
|
+
logger = createSessionReplayLogger();
|
|
235
|
+
}
|
|
237
236
|
function nativeConfig(config) {
|
|
238
237
|
// Resolve the effective mask level here — the single source of truth for the
|
|
239
238
|
// default. `normalizeConfig()` already folded the deprecated top-level
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeSessionReplay","getDefaultConfig","createSessionReplayLogger","VERSION","normalizeConfig","config","maskLevel","privacyConfig","rest","undefined","
|
|
1
|
+
{"version":3,"names":["NativeSessionReplay","getDefaultConfig","createSessionReplayLogger","VERSION","normalizeConfig","config","maskLevel","privacyConfig","rest","undefined","isInitialized","logger","init","warn","resolvedConfig","setLogLevel","logLevel","log","setup","nativeConfig","error","setSessionId","sessionId","setDeviceId","deviceId","getSessionId","flush","start","stop","setOptOut","optOut","teardown","resolvedMaskLevel","privateInit","newLogger"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":"AAAA;;AAEA,SAASA,mBAAmB,QAAwC,iBAAiB;AACrF,SAASC,gBAAgB,QAA0D,yBAAyB;AAC5G,SAASC,yBAAyB,QAAQ,UAAU;AACpD,SAASC,OAAO,QAAQ,WAAW;AAInC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CAACC,MAA2B,EAA+B;EACjF,MAAM;IAAEC,SAAS;IAAEC,aAAa;IAAE,GAAGC;EAAK,CAAC,GAAGH,MAAM;EACpD,IAAIE,aAAa,KAAKE,SAAS,EAAE;IAC/B,OAAO;MAAE,GAAGD,IAAI;MAAED;IAAc,CAAC;EACnC;EACA,IAAID,SAAS,KAAKG,SAAS,EAAE;IAC3B,OAAO;MAAE,GAAGD,IAAI;MAAED,aAAa,EAAE;QAAED;MAAU;IAAE,CAAC;EAClD;EACA,OAAOE,IAAI;AACb;AAEA,IAAIE,aAAa,GAAG,KAAK;AACzB,IAAIC,MAAM,GAAGT,yBAAyB,CAAC,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeU,IAAIA,CAACP,MAA2B,EAAiB;EACrE,IAAIK,aAAa,EAAE;IACjBC,MAAM,CAACE,IAAI,CAAC,sCAAsC,CAAC;IACnD;EACF;;EAEA;EACA;EACA;EACA;EACA,MAAMC,cAA2C,GAAG;IAClD,GAAGb,gBAAgB,CAAC,CAAC;IACrB,GAAGG,eAAe,CAACC,MAAM;EAC3B,CAAC;EAEDM,MAAM,CAACI,WAAW,CAACD,cAAc,CAACE,QAAQ,CAAC;EAC3CL,MAAM,CAACM,GAAG,CAAC,gEAAgEd,OAAO,gBAAgB,EAAEW,cAAc,CAAC;EAEnH,IAAI;IACF,MAAMd,mBAAmB,CAACkB,KAAK,CAACC,YAAY,CAACL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,QAAiD;IAChE;IACAV,SAAS,EAAE0B;EACb,CAAC;AACH;AAEA,OAAO,eAAeC,WAAWA,CAC/B5B,MAA2B,EAC3B6B,SAAuD,EACxC;EACfvB,MAAM,GAAGuB,SAAS;EAClB,OAAOtB,IAAI,CAACP,MAAM,CAAC;AACrB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeAmpSessionReplay.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAClD;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeAmpSessionReplay.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAClD;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,wBAAwB,CAAC","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.1.0-beta.
|
|
1
|
+
export const VERSION = '0.1.0-beta.5';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { init, setSessionId, getSessionId,
|
|
1
|
+
export { init, setSessionId, getSessionId, flush, start, stop, setDeviceId, setOptOut, teardown, } from './session-replay';
|
|
2
2
|
export { type SessionReplayConfig, type MaskLevel, type PrivacyConfig } from './session-replay-config';
|
|
3
|
-
export {
|
|
4
|
-
export type { SessionReplayPluginConfig } from './plugin-session-replay-config';
|
|
3
|
+
export { LogLevel } from './session-replay-config';
|
|
5
4
|
export { AmpMaskView, type AmpMaskViewProps } from './amp-mask-view';
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,KAAK,EACL,IAAI,EACJ,WAAW,EACX,SAAS,EACT,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACvG,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -6,8 +6,6 @@ export declare const NativeSessionReplay: NativeSessionReplaySpec;
|
|
|
6
6
|
export interface NativeSessionReplayConfig {
|
|
7
7
|
/** Your Amplitude API key for authentication and data routing */
|
|
8
8
|
apiKey: string;
|
|
9
|
-
/** Whether to automatically start recording when the module is initialized */
|
|
10
|
-
autoStart: boolean;
|
|
11
9
|
/** Device identifier that matches the device ID sent with Amplitude events */
|
|
12
10
|
deviceId: string | null;
|
|
13
11
|
/** Whether to enable remote configuration for dynamic settings updates */
|
|
@@ -25,9 +23,6 @@ export interface NativeSessionReplayConfig {
|
|
|
25
23
|
/** Current session identifier for correlating events with recordings */
|
|
26
24
|
sessionId: number;
|
|
27
25
|
}
|
|
28
|
-
export interface NativeSessionReplayProperties {
|
|
29
|
-
[key: string]: string | number | boolean;
|
|
30
|
-
}
|
|
31
26
|
/**
|
|
32
27
|
* Interface defining the native session replay module specification.
|
|
33
28
|
* This interface provides the contract for communication between JavaScript and
|
|
@@ -48,13 +43,6 @@ export interface NativeSessionReplaySpec {
|
|
|
48
43
|
* @note OLD ARCH: ideally we want to cache that on JS side to avoid bridge overhead
|
|
49
44
|
*/
|
|
50
45
|
getSessionId(): Promise<number>;
|
|
51
|
-
/**
|
|
52
|
-
* Retrieves session replay properties that should be attached to Amplitude events.
|
|
53
|
-
* These properties help correlate events with session recordings.
|
|
54
|
-
* @returns Promise resolving to an object containing session replay metadata
|
|
55
|
-
* @note OLD ARCH: ideally we want to cache that on JS side to avoid bridge overhead
|
|
56
|
-
*/
|
|
57
|
-
getSessionReplayProperties(): Promise<NativeSessionReplayProperties>;
|
|
58
46
|
/**
|
|
59
47
|
* Updates the device identifier used for session replay tracking.
|
|
60
48
|
* @param deviceId - The device identifier string, or null to clear the device ID
|
|
@@ -67,6 +55,11 @@ export interface NativeSessionReplaySpec {
|
|
|
67
55
|
* @note OLD ARCH: combine those into one method to avoid bridge overhead
|
|
68
56
|
*/
|
|
69
57
|
setSessionId(sessionId: number): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Updates whether session replay collection is disabled for the current user.
|
|
60
|
+
* @param optOut - Whether to opt out of session replay collection
|
|
61
|
+
*/
|
|
62
|
+
setOptOut(optOut: boolean): Promise<void>;
|
|
70
63
|
/**
|
|
71
64
|
* Initializes the native session replay module with the provided configuration.
|
|
72
65
|
* This method must be called before any other session replay operations.
|
|
@@ -83,5 +76,9 @@ export interface NativeSessionReplaySpec {
|
|
|
83
76
|
* Ends the current recording session and processes any captured data.
|
|
84
77
|
*/
|
|
85
78
|
stop(): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Shuts down the native session replay instance and releases its resources.
|
|
81
|
+
*/
|
|
82
|
+
teardown(): Promise<void>;
|
|
86
83
|
}
|
|
87
84
|
//# sourceMappingURL=native-module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-module.d.ts","sourceRoot":"","sources":["../../src/native-module.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,mBAAmB,yBAQU,CAAC;AAE3C;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,iEAAiE;IAC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,CAAC,IAAI,CAAC,CAAC;IAExD;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtB;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B"}
|
|
@@ -56,22 +56,17 @@ export declare class SessionReplayPlugin implements EnrichmentPlugin<ReactNative
|
|
|
56
56
|
* @returns Promise that resolves when recording stops
|
|
57
57
|
*/
|
|
58
58
|
stop(): Promise<void>;
|
|
59
|
-
teardown(): Promise<void>;
|
|
60
59
|
/**
|
|
61
|
-
*
|
|
62
|
-
* When you send events to Amplitude, call this method to get the most up-to-date session replay properties for the event.
|
|
63
|
-
*
|
|
64
|
-
* @returns Promise that resolves to an object containing session replay metadata
|
|
60
|
+
* Update whether session replay collection is disabled for the current user.
|
|
65
61
|
*
|
|
66
|
-
* @
|
|
67
|
-
*
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
* });
|
|
73
|
-
* ```
|
|
62
|
+
* @param optOut - Whether to opt out of session replay collection
|
|
63
|
+
* @returns Promise that resolves when the opt-out state is updated
|
|
64
|
+
*/
|
|
65
|
+
setOptOut(optOut: boolean): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Amplitude SDK hook. `client.setOptOut()` fans this out through the plugin timeline.
|
|
74
68
|
*/
|
|
75
|
-
|
|
69
|
+
onOptOutChanged(optOut: boolean): Promise<void>;
|
|
70
|
+
teardown(): Promise<void>;
|
|
76
71
|
}
|
|
77
72
|
//# sourceMappingURL=plugin-session-replay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-session-replay.d.ts","sourceRoot":"","sources":["../../src/plugin-session-replay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,KAAK,EACV,KAAK,iBAAiB,EACt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CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAclD;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B;;;;;OAKG;IACG,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAM/C;;OAEG;IACG,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAQhC"}
|
|
@@ -23,11 +23,6 @@ export interface SessionReplayConfig {
|
|
|
23
23
|
* @required
|
|
24
24
|
*/
|
|
25
25
|
apiKey: string;
|
|
26
|
-
/**
|
|
27
|
-
* Whether to automatically start recording when the SDK is initialized
|
|
28
|
-
* @default true
|
|
29
|
-
*/
|
|
30
|
-
autoStart?: boolean;
|
|
31
26
|
/**
|
|
32
27
|
* Device identifier that matches the device ID sent with Amplitude events
|
|
33
28
|
* Must match the Device ID passed as event properties to Amplitude
|