@amplitude/session-replay-react-native 0.1.0-beta.3 → 0.1.0-beta.4
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/android/src/main/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeModule.kt +1 -29
- package/android/src/oldarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeSpec.kt +0 -1
- package/ios/AMPNativeSessionReplay.mm +0 -2
- package/ios/NativeSessionReplay.swift +0 -14
- package/lib/commonjs/index.js +0 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native-module.js.map +1 -1
- package/lib/commonjs/plugin-session-replay.js +5 -34
- 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 +4 -35
- 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 +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/native-module.js.map +1 -1
- package/lib/module/plugin-session-replay.js +6 -35
- 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 +4 -34
- 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 +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/native-module.d.ts +0 -12
- package/lib/typescript/native-module.d.ts.map +1 -1
- package/lib/typescript/plugin-session-replay.d.ts +0 -16
- 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 +4 -28
- package/lib/typescript/session-replay.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAmpSessionReplay.d.ts +0 -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 +1 -10
- package/src/native-module.ts +0 -14
- package/src/plugin-session-replay.ts +4 -33
- package/src/session-replay-config.ts +0 -7
- package/src/session-replay.ts +4 -37
- package/src/specs/NativeAmpSessionReplay.ts +0 -1
- package/src/version.ts +1 -1
|
@@ -9,8 +9,6 @@ import com.amplitude.core.ServerZone
|
|
|
9
9
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
10
10
|
import com.facebook.react.bridge.ReactMethod
|
|
11
11
|
import com.facebook.react.bridge.Promise
|
|
12
|
-
import com.facebook.react.bridge.WritableMap
|
|
13
|
-
import com.facebook.react.bridge.WritableNativeMap
|
|
14
12
|
import com.facebook.react.bridge.ReadableMap
|
|
15
13
|
|
|
16
14
|
// `@ReactMethod` is required on the legacy architecture and ignored on the new
|
|
@@ -33,7 +31,6 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
|
|
|
33
31
|
val sampleRate = config.getDouble("sampleRate")
|
|
34
32
|
val enableRemoteConfig = config.getBoolean("enableRemoteConfig")
|
|
35
33
|
val logLevel = config.getInt("logLevel")
|
|
36
|
-
val autoStart = config.getBoolean("autoStart")
|
|
37
34
|
val optOut = config.getBoolean("optOut")
|
|
38
35
|
val maskLevel = when ((config.getString("maskLevel") ?: "medium").lowercase()) {
|
|
39
36
|
"light" -> MaskLevel.LIGHT
|
|
@@ -60,7 +57,6 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
|
|
|
60
57
|
Sample Rate: $sampleRate
|
|
61
58
|
Enable Remote Config: $enableRemoteConfig
|
|
62
59
|
Log Level: $logLevel
|
|
63
|
-
Auto Start: $autoStart
|
|
64
60
|
Mask Level: $maskLevel
|
|
65
61
|
Opt Out: $optOut
|
|
66
62
|
""".trimIndent())
|
|
@@ -78,7 +74,7 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
|
|
|
78
74
|
"EU" -> ServerZone.EU
|
|
79
75
|
else -> ServerZone.US
|
|
80
76
|
},
|
|
81
|
-
autoStart =
|
|
77
|
+
autoStart = false,
|
|
82
78
|
privacyConfig = PrivacyConfig(maskLevel = maskLevel),
|
|
83
79
|
)
|
|
84
80
|
|
|
@@ -117,30 +113,6 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
|
|
|
117
113
|
}
|
|
118
114
|
}
|
|
119
115
|
|
|
120
|
-
@ReactMethod
|
|
121
|
-
override fun getSessionReplayProperties(promise: Promise) {
|
|
122
|
-
try {
|
|
123
|
-
val properties: Map<String, Any> = sessionReplay.getSessionReplayProperties()
|
|
124
|
-
val map: WritableMap = WritableNativeMap()
|
|
125
|
-
for ((key, value) in properties) {
|
|
126
|
-
if (value is String) {
|
|
127
|
-
map.putString(key, value)
|
|
128
|
-
} else if (value is Int) {
|
|
129
|
-
map.putInt(key, value)
|
|
130
|
-
} else if (value is Long) {
|
|
131
|
-
map.putDouble(key, value.toDouble())
|
|
132
|
-
} else if (value is Double) {
|
|
133
|
-
map.putDouble(key, value)
|
|
134
|
-
} else if (value is Boolean) {
|
|
135
|
-
map.putBoolean(key, value)
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
promise.resolve(map)
|
|
139
|
-
} catch (e: Exception) {
|
|
140
|
-
promise.reject("GET_PROPERTIES_ERROR", e.message, e)
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
116
|
@ReactMethod
|
|
145
117
|
override fun start(promise: Promise) {
|
|
146
118
|
try {
|
|
@@ -13,7 +13,6 @@ abstract class SessionReplayReactNativeSpec(reactContext: ReactApplicationContex
|
|
|
13
13
|
abstract fun setSessionId(sessionId: Double, promise: Promise)
|
|
14
14
|
abstract fun setDeviceId(deviceId: String?, promise: Promise)
|
|
15
15
|
abstract fun getSessionId(promise: Promise)
|
|
16
|
-
abstract fun getSessionReplayProperties(promise: Promise)
|
|
17
16
|
abstract fun start(promise: Promise)
|
|
18
17
|
abstract fun stop(promise: Promise)
|
|
19
18
|
abstract fun flush(promise: Promise)
|
|
@@ -6,8 +6,6 @@ RCT_EXTERN_METHOD(flush:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseReject
|
|
|
6
6
|
|
|
7
7
|
RCT_EXTERN_METHOD(getSessionId:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
8
8
|
|
|
9
|
-
RCT_EXTERN_METHOD(getSessionReplayProperties:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
10
|
-
|
|
11
9
|
RCT_EXTERN_METHOD(setSessionId:(nonnull NSNumber)sessionId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
12
10
|
|
|
13
11
|
RCT_EXTERN_METHOD(setDeviceId:(NSString)deviceId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
@@ -23,7 +23,6 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
|
|
|
23
23
|
let sampleRate = config["sampleRate"] as? NSNumber,
|
|
24
24
|
let enableRemoteConfig = config["enableRemoteConfig"] as? Bool,
|
|
25
25
|
let logLevel = config["logLevel"] as? Int,
|
|
26
|
-
let autoStart = config["autoStart"] as? Bool,
|
|
27
26
|
let maskLevel = config["maskLevel"] as? String,
|
|
28
27
|
let optOut = config["optOut"] as? Bool else {
|
|
29
28
|
reject("INVALID_CONFIG", "Invalid configuration parameters", nil)
|
|
@@ -44,7 +43,6 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
|
|
|
44
43
|
Sample Rate: \(sampleRate)
|
|
45
44
|
Enable Remote Config: \(enableRemoteConfig)
|
|
46
45
|
Log Level: \(logLevel)
|
|
47
|
-
Auto Start: \(autoStart)
|
|
48
46
|
Mask Level: \(maskLevel)
|
|
49
47
|
Opt Out: \(optOut)
|
|
50
48
|
"""
|
|
@@ -62,9 +60,6 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
|
|
|
62
60
|
enableRemoteConfig: enableRemoteConfig
|
|
63
61
|
)
|
|
64
62
|
|
|
65
|
-
if (autoStart) {
|
|
66
|
-
sessionReplay.start()
|
|
67
|
-
}
|
|
68
63
|
resolve(nil)
|
|
69
64
|
}
|
|
70
65
|
|
|
@@ -91,15 +86,6 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
|
|
|
91
86
|
resolve(NSNumber(value:sessionReplay.sessionId))
|
|
92
87
|
}
|
|
93
88
|
|
|
94
|
-
@objc(getSessionReplayProperties:reject:)
|
|
95
|
-
func getSessionReplayProperties(
|
|
96
|
-
_ resolve: RCTPromiseResolveBlock,
|
|
97
|
-
reject: RCTPromiseRejectBlock
|
|
98
|
-
) {
|
|
99
|
-
logger.debug(message: "getSessionReplayProperties")
|
|
100
|
-
resolve(sessionReplay.additionalEventProperties)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
89
|
@objc(start:reject:)
|
|
104
90
|
func start(_ resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
|
|
105
91
|
logger.debug(message: "start")
|
package/lib/commonjs/index.js
CHANGED
|
@@ -27,12 +27,6 @@ Object.defineProperty(exports, "getSessionId", {
|
|
|
27
27
|
return _sessionReplay.getSessionId;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
Object.defineProperty(exports, "getSessionReplayProperties", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _sessionReplay.getSessionReplayProperties;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
30
|
Object.defineProperty(exports, "init", {
|
|
37
31
|
enumerable: true,
|
|
38
32
|
get: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_sessionReplay","require","_pluginSessionReplay","_ampMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_sessionReplay","require","_pluginSessionReplay","_ampMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AAGA,IAAAE,YAAA,GAAAF,OAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_NativeAmpSessionReplay","_interopRequireDefault","e","__esModule","default","LINKING_ERROR","Platform","select","ios","NativeSessionReplay","exports","SessionReplaySpec","Proxy","get","Error"],"sourceRoot":"../../src","sources":["native-module.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA+D,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/D,MAAMG,aAAa,GACjB,iGAAiG,GACjGC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEJ,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAIE,+BAAiB,IACnD,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAwC;;AAE1C;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_NativeAmpSessionReplay","_interopRequireDefault","e","__esModule","default","LINKING_ERROR","Platform","select","ios","NativeSessionReplay","exports","SessionReplaySpec","Proxy","get","Error"],"sourceRoot":"../../src","sources":["native-module.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA+D,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/D,MAAMG,aAAa,GACjB,iGAAiG,GACjGC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEJ,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAIE,+BAAiB,IACnD,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAwC;;AAE1C;AACA;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -64,13 +64,15 @@ class SessionReplayPlugin {
|
|
|
64
64
|
serverZone: config.serverZone,
|
|
65
65
|
sampleRate: this.sessionReplayConfig.sampleRate,
|
|
66
66
|
enableRemoteConfig: this.sessionReplayConfig.enableRemoteConfig,
|
|
67
|
-
logLevel: this.sessionReplayConfig.logLevel
|
|
68
|
-
autoStart: this.sessionReplayConfig.autoStart
|
|
67
|
+
logLevel: this.sessionReplayConfig.logLevel
|
|
69
68
|
}, this.logger);
|
|
70
69
|
this.isInitialized = true;
|
|
70
|
+
if (this.sessionReplayConfig.autoStart) {
|
|
71
|
+
await (0, _sessionReplay.start)();
|
|
72
|
+
}
|
|
71
73
|
}
|
|
72
74
|
async execute(event) {
|
|
73
|
-
var _this$config
|
|
75
|
+
var _this$config;
|
|
74
76
|
if (!this.isInitialized) {
|
|
75
77
|
return Promise.resolve(event);
|
|
76
78
|
}
|
|
@@ -81,15 +83,6 @@ class SessionReplayPlugin {
|
|
|
81
83
|
if ((_this$config = this.config) !== null && _this$config !== void 0 && _this$config.sessionId && this.config.sessionId !== (await (0, _sessionReplay.getSessionId)())) {
|
|
82
84
|
await (0, _sessionReplay.setSessionId)(this.config.sessionId);
|
|
83
85
|
}
|
|
84
|
-
// Treating config.sessionId as source of truth, if the event's session id doesn't match, the
|
|
85
|
-
// event is not of the current session (offline/late events). In that case, don't tag the events
|
|
86
|
-
if ((_this$config2 = this.config) !== null && _this$config2 !== void 0 && _this$config2.sessionId && this.config.sessionId === event.session_id) {
|
|
87
|
-
const sessionRecordingProperties = await (0, _sessionReplay.getSessionReplayProperties)();
|
|
88
|
-
event.event_properties = {
|
|
89
|
-
...event.event_properties,
|
|
90
|
-
...sessionRecordingProperties
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
86
|
return Promise.resolve(event);
|
|
94
87
|
}
|
|
95
88
|
|
|
@@ -123,28 +116,6 @@ class SessionReplayPlugin {
|
|
|
123
116
|
this.config = null;
|
|
124
117
|
this.isInitialized = false;
|
|
125
118
|
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Get session replay properties for manual event correlation.
|
|
129
|
-
* When you send events to Amplitude, call this method to get the most up-to-date session replay properties for the event.
|
|
130
|
-
*
|
|
131
|
-
* @returns Promise that resolves to an object containing session replay metadata
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* ```typescript
|
|
135
|
-
* const sessionReplayProperties = await plugin.getSessionReplayProperties();
|
|
136
|
-
* analytics.track('Button Clicked', {
|
|
137
|
-
* buttonName: 'submit',
|
|
138
|
-
* ...sessionReplayProperties
|
|
139
|
-
* });
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
142
|
-
async getSessionReplayProperties() {
|
|
143
|
-
if (!this.isInitialized) {
|
|
144
|
-
return {};
|
|
145
|
-
}
|
|
146
|
-
return (0, _sessionReplay.getSessionReplayProperties)();
|
|
147
|
-
}
|
|
148
119
|
}
|
|
149
120
|
exports.SessionReplayPlugin = SessionReplayPlugin;
|
|
150
121
|
//# sourceMappingURL=plugin-session-replay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pluginSessionReplayConfig","require","_sessionReplay","_logger","SessionReplayPlugin","name","type","config","isInitialized","logger","createSessionReplayLogger","constructor","sessionReplayConfig","getDefaultSessionReplayPluginConfig","setLogLevel","logLevel","log","setup","_","privateInit","apiKey","deviceId","sessionId","serverZone","sampleRate","enableRemoteConfig","autoStart","execute","event","_this$config","
|
|
1
|
+
{"version":3,"names":["_pluginSessionReplayConfig","require","_sessionReplay","_logger","SessionReplayPlugin","name","type","config","isInitialized","logger","createSessionReplayLogger","constructor","sessionReplayConfig","getDefaultSessionReplayPluginConfig","setLogLevel","logLevel","log","setup","_","privateInit","apiKey","deviceId","sessionId","serverZone","sampleRate","enableRemoteConfig","autoStart","start","execute","event","_this$config","Promise","resolve","getSessionId","setSessionId","stop","teardown","exports"],"sourceRoot":"../../src","sources":["plugin-session-replay.ts"],"mappings":";;;;;;AAOA,IAAAA,0BAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,mBAAmB,CAAmE;EACjGC,IAAI,GAAG,+CAA+C;EACtDC,IAAI,GAAG,YAAY;EAEXC,MAAM,GAA6B,IAAI;EACvCC,aAAa,GAAG,KAAK;EAGrBC,MAAM,GAAG,IAAAC,iCAAyB,EAAC,CAAC;;EAE5C;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACJ,MAAiC,GAAG,CAAC,CAAC,EAAE;IAClD,IAAI,CAACK,mBAAmB,GAAG;MACzB,GAAG,IAAAC,8DAAmC,EAAC,CAAC;MACxC,GAAGN;IAC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B,MAAM,CAACe,SAAS,CAAC;IAC3C;IACA,OAAOS,OAAO,CAACC,OAAO,CAACH,KAAK,CAAC;EAC/B;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMF,KAAKA,CAAA,EAAkB;IAC3B,IAAI,IAAI,CAACnB,aAAa,EAAE;MACtB,MAAM,IAAAmB,oBAAK,EAAC,CAAC;IACf;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMQ,IAAIA,CAAA,EAAkB;IAC1B,IAAI,IAAI,CAAC3B,aAAa,EAAE;MACtB,MAAM,IAAA2B,mBAAI,EAAC,CAAC;IACd;EACF;EAEA,MAAMC,QAAQA,CAAA,EAAkB;IAC9B,IAAI,IAAI,CAAC5B,aAAa,EAAE;MACtB,MAAM,IAAA2B,mBAAI,EAAC,CAAC;IACd;IAEA,IAAI,CAAC5B,MAAM,GAAG,IAAI;IAClB,IAAI,CAACC,aAAa,GAAG,KAAK;EAC5B;AACF;AAAC6B,OAAA,CAAAjC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_analyticsTypes","require","getDefaultConfig","
|
|
1
|
+
{"version":3,"names":["_analyticsTypes","require","getDefaultConfig","deviceId","enableRemoteConfig","logLevel","LogLevel","Warn","optOut","privacyConfig","sampleRate","serverZone","sessionId","exports"],"sourceRoot":"../../src","sources":["session-replay-config.ts"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;;AAqEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGO,MAAMC,gBAA6E,GAAGA,CAAA,KAAM;EACjG,OAAO;IACLC,QAAQ,EAAE,IAAI;IACdC,kBAAkB,EAAE,IAAI;IACxBC,QAAQ,EAAEC,wBAAQ,CAACC,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;AAACC,OAAA,CAAAX,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -5,7 +5,6 @@ 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;
|
|
@@ -54,12 +53,12 @@ let isInitialized = false;
|
|
|
54
53
|
let logger = (0, _logger.createSessionReplayLogger)();
|
|
55
54
|
|
|
56
55
|
/**
|
|
57
|
-
* Configure the SDK
|
|
56
|
+
* Configure the SDK. Call `start()` explicitly to begin collecting replays.
|
|
58
57
|
* This function must be called before any other session replay operations.
|
|
59
58
|
*
|
|
60
59
|
* @param config - Configuration object containing API key, device ID, session ID, and other options
|
|
61
|
-
* @returns Promise that resolves when initialization is complete
|
|
62
|
-
*
|
|
60
|
+
* @returns Promise that resolves when initialization is complete. Native setup
|
|
61
|
+
* failures are logged and do not reject the promise.
|
|
63
62
|
*
|
|
64
63
|
* @example
|
|
65
64
|
* ```typescript
|
|
@@ -159,35 +158,6 @@ async function getSessionId() {
|
|
|
159
158
|
return await _nativeModule.NativeSessionReplay.getSessionId();
|
|
160
159
|
}
|
|
161
160
|
|
|
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
161
|
/**
|
|
192
162
|
* Flush any pending session replay data to the server.
|
|
193
163
|
* Forces immediate upload of recorded session data that may be buffered locally.
|
|
@@ -211,13 +181,12 @@ async function flush() {
|
|
|
211
181
|
/**
|
|
212
182
|
* Start session replay recording.
|
|
213
183
|
* Begins capturing user interactions and screen content for replay.
|
|
214
|
-
* If autoStart is enabled in the configuration, this is called automatically during initialization.
|
|
215
184
|
*
|
|
216
185
|
* @returns Promise that resolves when recording starts
|
|
217
186
|
*
|
|
218
187
|
* @example
|
|
219
188
|
* ```typescript
|
|
220
|
-
* //
|
|
189
|
+
* // Recording starts only after this explicit call.
|
|
221
190
|
* await start();
|
|
222
191
|
* ```
|
|
223
192
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativeModule","require","_sessionReplayConfig","_logger","_version","normalizeConfig","config","maskLevel","privacyConfig","rest","undefined","fullConfig","isInitialized","logger","createSessionReplayLogger","init","warn","getDefaultConfig","setLogLevel","logLevel","log","VERSION","NativeSessionReplay","setup","nativeConfig","error","setSessionId","sessionId","setDeviceId","deviceId","getSessionId","
|
|
1
|
+
{"version":3,"names":["_nativeModule","require","_sessionReplayConfig","_logger","_version","normalizeConfig","config","maskLevel","privacyConfig","rest","undefined","fullConfig","isInitialized","logger","createSessionReplayLogger","init","warn","getDefaultConfig","setLogLevel","logLevel","log","VERSION","NativeSessionReplay","setup","nativeConfig","error","setSessionId","sessionId","setDeviceId","deviceId","getSessionId","flush","start","stop","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,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,UAA8C,GAAG,IAAI;AACzD,IAAIC,aAAa,GAAG,KAAK;AACzB,IAAIC,MAAM,GAAG,IAAAC,iCAAyB,EAAC,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,IAAIA,CAACT,MAA2B,EAAiB;EACrE,IAAIM,aAAa,EAAE;IACjBC,MAAM,CAACG,IAAI,CAAC,sCAAsC,CAAC;IACnD;EACF;;EAEA;EACA;EACA;EACA;EACAL,UAAU,GAAG;IACX,GAAG,IAAAM,qCAAgB,EAAC,CAAC;IACrB,GAAGZ,eAAe,CAACC,MAAM;EAC3B,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AKA,CAAA,EAAkB;EAC3C,IAAI,CAACnB,aAAa,EAAE;IAClBC,MAAM,CAACG,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMM,iCAAmB,CAACS,KAAK,CAAC,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,KAAKA,CAAA,EAAkB;EAC3C,IAAI,CAACpB,aAAa,EAAE;IAClBC,MAAM,CAACG,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMM,iCAAmB,CAACU,KAAK,CAAC,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,IAAIA,CAAA,EAAkB;EAC1C,IAAI,CAACrB,aAAa,EAAE;IAClBC,MAAM,CAACG,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMM,iCAAmB,CAACW,IAAI,CAAC,CAAC;AAClC;AAEA,SAAST,YAAYA,CAAClB,MAAmC,EAA6B;EACpF;EACA;EACA;EACA;EACA;EACA;EACA,MAAM;IAAEE,aAAa;IAAE,GAAGC;EAAK,CAAC,GAAGH,MAAM;EACzC,MAAM4B,iBAAyD,GAAG1B,aAAa,CAACD,SAAS,IAAI,QAAQ;EACrG,OAAO;IACL,GAAGE,IAAI;IACPU,QAAQ,EAAEV,IAAI,CAACU,QAAiD;IAChE;IACAZ,SAAS,EAAE2B;EACb,CAAC;AACH;AAEO,eAAeC,WAAWA,CAC/B7B,MAA2B,EAC3B8B,SAAuD,EACxC;EACfvB,MAAM,GAAGuB,SAAS;EAClB,OAAOrB,IAAI,CAACT,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;AAWA;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,
|
|
1
|
+
export { init, setSessionId, getSessionId, flush, start, stop, setDeviceId } from './session-replay';
|
|
2
2
|
export { SessionReplayPlugin } from './plugin-session-replay';
|
|
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","SessionReplayPlugin","AmpMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,IAAI,EAAEC,YAAY,EAAEC,YAAY,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,EAAEC,WAAW,QAAQ,kBAAkB;AAGpG,SAASC,mBAAmB,QAAQ,yBAAyB;AAG7D,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, setSessionId, start, stop } from './session-replay';
|
|
3
3
|
import { createSessionReplayLogger } from './logger';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -59,13 +59,15 @@ export class SessionReplayPlugin {
|
|
|
59
59
|
serverZone: config.serverZone,
|
|
60
60
|
sampleRate: this.sessionReplayConfig.sampleRate,
|
|
61
61
|
enableRemoteConfig: this.sessionReplayConfig.enableRemoteConfig,
|
|
62
|
-
logLevel: this.sessionReplayConfig.logLevel
|
|
63
|
-
autoStart: this.sessionReplayConfig.autoStart
|
|
62
|
+
logLevel: this.sessionReplayConfig.logLevel
|
|
64
63
|
}, this.logger);
|
|
65
64
|
this.isInitialized = true;
|
|
65
|
+
if (this.sessionReplayConfig.autoStart) {
|
|
66
|
+
await start();
|
|
67
|
+
}
|
|
66
68
|
}
|
|
67
69
|
async execute(event) {
|
|
68
|
-
var _this$config
|
|
70
|
+
var _this$config;
|
|
69
71
|
if (!this.isInitialized) {
|
|
70
72
|
return Promise.resolve(event);
|
|
71
73
|
}
|
|
@@ -76,15 +78,6 @@ export class SessionReplayPlugin {
|
|
|
76
78
|
if ((_this$config = this.config) !== null && _this$config !== void 0 && _this$config.sessionId && this.config.sessionId !== (await getSessionId())) {
|
|
77
79
|
await setSessionId(this.config.sessionId);
|
|
78
80
|
}
|
|
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
81
|
return Promise.resolve(event);
|
|
89
82
|
}
|
|
90
83
|
|
|
@@ -118,27 +111,5 @@ export class SessionReplayPlugin {
|
|
|
118
111
|
this.config = null;
|
|
119
112
|
this.isInitialized = false;
|
|
120
113
|
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Get session replay properties for manual event correlation.
|
|
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
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
async getSessionReplayProperties() {
|
|
138
|
-
if (!this.isInitialized) {
|
|
139
|
-
return {};
|
|
140
|
-
}
|
|
141
|
-
return getSessionReplayProperties();
|
|
142
|
-
}
|
|
143
114
|
}
|
|
144
115
|
//# sourceMappingURL=plugin-session-replay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getDefaultSessionReplayPluginConfig","getSessionId","
|
|
1
|
+
{"version":3,"names":["getDefaultSessionReplayPluginConfig","getSessionId","privateInit","setSessionId","start","stop","createSessionReplayLogger","SessionReplayPlugin","name","type","config","isInitialized","logger","constructor","sessionReplayConfig","setLogLevel","logLevel","log","setup","_","apiKey","deviceId","sessionId","serverZone","sampleRate","enableRemoteConfig","autoStart","execute","event","_this$config","Promise","resolve","teardown"],"sourceRoot":"../../src","sources":["plugin-session-replay.ts"],"mappings":"AAOA,SAAoCA,mCAAmC,QAAQ,gCAAgC;AAC/G,SAASC,YAAY,EAAEC,WAAW,EAAEC,YAAY,EAAEC,KAAK,EAAEC,IAAI,QAAQ,kBAAkB;AACvF,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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AAE;MACvB,OAAOmB,OAAO,CAACC,OAAO,CAACH,KAAK,CAAC;IAC/B;;IAEA;IACA;IACA;IACA,IAAI,CAAAC,YAAA,OAAI,CAACnB,MAAM,cAAAmB,YAAA,eAAXA,YAAA,CAAaP,SAAS,IAAI,IAAI,CAACZ,MAAM,CAACY,SAAS,MAAM,MAAMrB,YAAY,CAAC,CAAC,CAAC,EAAE;MAC9E,MAAME,YAAY,CAAC,IAAI,CAACO,MAAM,CAACY,SAAS,CAAC;IAC3C;IACA,OAAOQ,OAAO,CAACC,OAAO,CAACH,KAAK,CAAC;EAC/B;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMxB,KAAKA,CAAA,EAAkB;IAC3B,IAAI,IAAI,CAACO,aAAa,EAAE;MACtB,MAAMP,KAAK,CAAC,CAAC;IACf;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMC,IAAIA,CAAA,EAAkB;IAC1B,IAAI,IAAI,CAACM,aAAa,EAAE;MACtB,MAAMN,IAAI,CAAC,CAAC;IACd;EACF;EAEA,MAAM2B,QAAQA,CAAA,EAAkB;IAC9B,IAAI,IAAI,CAACrB,aAAa,EAAE;MACtB,MAAMN,IAAI,CAAC,CAAC;IACd;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":[]}
|
|
@@ -40,12 +40,12 @@ let isInitialized = false;
|
|
|
40
40
|
let logger = createSessionReplayLogger();
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* Configure the SDK
|
|
43
|
+
* Configure the SDK. Call `start()` explicitly to begin collecting replays.
|
|
44
44
|
* This function must be called before any other session replay operations.
|
|
45
45
|
*
|
|
46
46
|
* @param config - Configuration object containing API key, device ID, session ID, and other options
|
|
47
|
-
* @returns Promise that resolves when initialization is complete
|
|
48
|
-
*
|
|
47
|
+
* @returns Promise that resolves when initialization is complete. Native setup
|
|
48
|
+
* failures are logged and do not reject the promise.
|
|
49
49
|
*
|
|
50
50
|
* @example
|
|
51
51
|
* ```typescript
|
|
@@ -145,35 +145,6 @@ export async function getSessionId() {
|
|
|
145
145
|
return await NativeSessionReplay.getSessionId();
|
|
146
146
|
}
|
|
147
147
|
|
|
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
148
|
/**
|
|
178
149
|
* Flush any pending session replay data to the server.
|
|
179
150
|
* Forces immediate upload of recorded session data that may be buffered locally.
|
|
@@ -197,13 +168,12 @@ export async function flush() {
|
|
|
197
168
|
/**
|
|
198
169
|
* Start session replay recording.
|
|
199
170
|
* Begins capturing user interactions and screen content for replay.
|
|
200
|
-
* If autoStart is enabled in the configuration, this is called automatically during initialization.
|
|
201
171
|
*
|
|
202
172
|
* @returns Promise that resolves when recording starts
|
|
203
173
|
*
|
|
204
174
|
* @example
|
|
205
175
|
* ```typescript
|
|
206
|
-
* //
|
|
176
|
+
* // Recording starts only after this explicit call.
|
|
207
177
|
* await start();
|
|
208
178
|
* ```
|
|
209
179
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeSessionReplay","getDefaultConfig","createSessionReplayLogger","VERSION","normalizeConfig","config","maskLevel","privacyConfig","rest","undefined","fullConfig","isInitialized","logger","init","warn","setLogLevel","logLevel","log","setup","nativeConfig","error","setSessionId","sessionId","setDeviceId","deviceId","getSessionId","
|
|
1
|
+
{"version":3,"names":["NativeSessionReplay","getDefaultConfig","createSessionReplayLogger","VERSION","normalizeConfig","config","maskLevel","privacyConfig","rest","undefined","fullConfig","isInitialized","logger","init","warn","setLogLevel","logLevel","log","setup","nativeConfig","error","setSessionId","sessionId","setDeviceId","deviceId","getSessionId","flush","start","stop","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,UAA8C,GAAG,IAAI;AACzD,IAAIC,aAAa,GAAG,KAAK;AACzB,IAAIC,MAAM,GAAGV,yBAAyB,CAAC,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeW,IAAIA,CAACR,MAA2B,EAAiB;EACrE,IAAIM,aAAa,EAAE;IACjBC,MAAM,CAACE,IAAI,CAAC,sCAAsC,CAAC;IACnD;EACF;;EAEA;EACA;EACA;EACA;EACAJ,UAAU,GAAG;IACX,GAAGT,gBAAgB,CAAC,CAAC;IACrB,GAAGG,eAAe,CAACC,MAAM;EAC3B,CAAC;EAEDO,MAAM,CAACG,WAAW,CAACL,UAAU,CAACM,QAAQ,CAAC;EACvCJ,MAAM,CAACK,GAAG,CAAC,gEAAgEd,OAAO,gBAAgB,EAAEO,UAAU,CAAC;EAE/G,IAAI;IACF,MAAMV,mBAAmB,CAACkB,KAAK,C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AEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,KAAKA,CAAA,EAAkB;EAC3C,IAAI,CAAChB,aAAa,EAAE;IAClBC,MAAM,CAACE,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMd,mBAAmB,CAAC2B,KAAK,CAAC,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,IAAIA,CAAA,EAAkB;EAC1C,IAAI,CAACjB,aAAa,EAAE;IAClBC,MAAM,CAACE,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMd,mBAAmB,CAAC4B,IAAI,CAAC,CAAC;AAClC;AAEA,SAAST,YAAYA,CAACd,MAAmC,EAA6B;EACpF;EACA;EACA;EACA;EACA;EACA;EACA,MAAM;IAAEE,aAAa;IAAE,GAAGC;EAAK,CAAC,GAAGH,MAAM;EACzC,MAAMwB,iBAAyD,GAAGtB,aAAa,CAACD,SAAS,IAAI,QAAQ;EACrG,OAAO;IACL,GAAGE,IAAI;IACPQ,QAAQ,EAAER,IAAI,CAACQ,QAAiD;IAChE;IACAV,SAAS,EAAEuB;EACb,CAAC;AACH;AAEA,OAAO,eAAeC,WAAWA,CAC/BzB,MAA2B,EAC3B0B,SAAuD,EACxC;EACfnB,MAAM,GAAGmB,SAAS;EAClB,OAAOlB,IAAI,CAACR,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;;AAWA;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.4';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { init, setSessionId, getSessionId,
|
|
1
|
+
export { init, setSessionId, getSessionId, flush, start, stop, setDeviceId } from './session-replay';
|
|
2
2
|
export { type SessionReplayConfig, type MaskLevel, type PrivacyConfig } from './session-replay-config';
|
|
3
3
|
export { SessionReplayPlugin } from './plugin-session-replay';
|
|
4
4
|
export type { SessionReplayPluginConfig } from './plugin-session-replay-config';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrG,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEvG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAEhF,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
|
|
@@ -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;IACjE,MAAM,EAAE,MAA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,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB"}
|
|
@@ -57,21 +57,5 @@ export declare class SessionReplayPlugin implements EnrichmentPlugin<ReactNative
|
|
|
57
57
|
*/
|
|
58
58
|
stop(): Promise<void>;
|
|
59
59
|
teardown(): Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Get session replay properties for manual event correlation.
|
|
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
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```typescript
|
|
68
|
-
* const sessionReplayProperties = await plugin.getSessionReplayProperties();
|
|
69
|
-
* analytics.track('Button Clicked', {
|
|
70
|
-
* buttonName: 'submit',
|
|
71
|
-
* ...sessionReplayProperties
|
|
72
|
-
* });
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
getSessionReplayProperties(): Promise<import("./session-replay").SessionReplayProperties>;
|
|
76
60
|
}
|
|
77
61
|
//# 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,EACtB,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,yBAAyB,EAAuC,MAAM,gCAAgC,CAAC;AAIhH;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,YAAW,gBAAgB,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAChG,IAAI,SAAmD;IACvD,IAAI,eAAyB;IAE7B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO,CAAC,mBAAmB,CAAsC;IACjE,OAAO,CAAC,MAAM,CAA+B;IAE7C;;;;;;;;;;;;;;OAcG;gBACS,MAAM,GAAE,yBAA8B;IAUlD;;;;;;;OAOG;IACG,KAAK,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
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,EACtB,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,yBAAyB,EAAuC,MAAM,gCAAgC,CAAC;AAIhH;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,YAAW,gBAAgB,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAChG,IAAI,SAAmD;IACvD,IAAI,eAAyB;IAE7B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO,CAAC,mBAAmB,CAAsC;IACjE,OAAO,CAAC,MAAM,CAA+B;IAE7C;;;;;;;;;;;;;;OAcG;gBACS,MAAM,GAAE,yBAA8B;IAUlD;;;;;;;OAOG;IACG,KAAK,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBrE,OAAO,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;IAMrB,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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay-config.d.ts","sourceRoot":"","sources":["../../src/session-replay-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,cAAc,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf
|
|
1
|
+
{"version":3,"file":"session-replay-config.d.ts","sourceRoot":"","sources":["../../src/session-replay-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,cAAc,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;AAEjF,eAAO,MAAM,gBAAgB,EAAE,MAAM,QAAQ,CAAC,IAAI,CAAC,2BAA2B,EAAE,QAAQ,CAAC,CAexF,CAAC;AACF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SessionReplayConfig } from './session-replay-config';
|
|
2
2
|
import { createSessionReplayLogger } from './logger';
|
|
3
3
|
/**
|
|
4
|
-
* Configure the SDK
|
|
4
|
+
* Configure the SDK. Call `start()` explicitly to begin collecting replays.
|
|
5
5
|
* This function must be called before any other session replay operations.
|
|
6
6
|
*
|
|
7
7
|
* @param config - Configuration object containing API key, device ID, session ID, and other options
|
|
8
|
-
* @returns Promise that resolves when initialization is complete
|
|
9
|
-
*
|
|
8
|
+
* @returns Promise that resolves when initialization is complete. Native setup
|
|
9
|
+
* failures are logged and do not reject the promise.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
@@ -61,29 +61,6 @@ export declare function setDeviceId(deviceId: string | null): Promise<void>;
|
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
63
|
export declare function getSessionId(): Promise<number | null>;
|
|
64
|
-
/**
|
|
65
|
-
* Interface for session replay properties that should be attached to Amplitude events.
|
|
66
|
-
* These properties help correlate events with session recordings.
|
|
67
|
-
*/
|
|
68
|
-
export interface SessionReplayProperties {
|
|
69
|
-
[key: string]: string | boolean | null;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* When you send events to Amplitude, call this function to get the most up-to-date session replay properties for the event.
|
|
73
|
-
* Collect Session Replay properties to send with other event properties.
|
|
74
|
-
*
|
|
75
|
-
* @returns Promise that resolves to an object containing session replay metadata
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```typescript
|
|
79
|
-
* const sessionReplayProperties = await getSessionReplayProperties();
|
|
80
|
-
* analytics.track('Button Clicked', {
|
|
81
|
-
* buttonName: 'submit',
|
|
82
|
-
* ...sessionReplayProperties // Merge session replay properties
|
|
83
|
-
* });
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
export declare function getSessionReplayProperties(): Promise<SessionReplayProperties>;
|
|
87
64
|
/**
|
|
88
65
|
* Flush any pending session replay data to the server.
|
|
89
66
|
* Forces immediate upload of recorded session data that may be buffered locally.
|
|
@@ -100,13 +77,12 @@ export declare function flush(): Promise<void>;
|
|
|
100
77
|
/**
|
|
101
78
|
* Start session replay recording.
|
|
102
79
|
* Begins capturing user interactions and screen content for replay.
|
|
103
|
-
* If autoStart is enabled in the configuration, this is called automatically during initialization.
|
|
104
80
|
*
|
|
105
81
|
* @returns Promise that resolves when recording starts
|
|
106
82
|
*
|
|
107
83
|
* @example
|
|
108
84
|
* ```typescript
|
|
109
|
-
* //
|
|
85
|
+
* // Recording starts only after this explicit call.
|
|
110
86
|
* await start();
|
|
111
87
|
* ```
|
|
112
88
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,mBAAmB,EAA+B,MAAM,yBAAyB,CAAC;AAC7G,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AA6BrD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBrE;AAED;;;;;;;;;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E,UAAU,CAAC,OAAO,yBAAyB,CAAC,GACtD,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -5,7 +5,6 @@ export interface Spec extends TurboModule {
|
|
|
5
5
|
setSessionId(sessionId: number): Promise<void>;
|
|
6
6
|
setDeviceId(deviceId: string | null): Promise<void>;
|
|
7
7
|
getSessionId(): Promise<number>;
|
|
8
|
-
getSessionReplayProperties(): Promise<UnsafeObject>;
|
|
9
8
|
start(): Promise<void>;
|
|
10
9
|
stop(): Promise<void>;
|
|
11
10
|
flush(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeAmpSessionReplay.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeAmpSessionReplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAQ9E,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,
|
|
1
|
+
{"version":3,"file":"NativeAmpSessionReplay.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeAmpSessionReplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAQ9E,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;;AAOD,wBAAuE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.0-beta.
|
|
1
|
+
export declare const VERSION = "0.1.0-beta.4";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
init,
|
|
3
|
-
setSessionId,
|
|
4
|
-
getSessionId,
|
|
5
|
-
getSessionReplayProperties,
|
|
6
|
-
flush,
|
|
7
|
-
start,
|
|
8
|
-
stop,
|
|
9
|
-
setDeviceId,
|
|
10
|
-
} from './session-replay';
|
|
1
|
+
export { init, setSessionId, getSessionId, flush, start, stop, setDeviceId } from './session-replay';
|
|
11
2
|
export { type SessionReplayConfig, type MaskLevel, type PrivacyConfig } from './session-replay-config';
|
|
12
3
|
|
|
13
4
|
export { SessionReplayPlugin } from './plugin-session-replay';
|
package/src/native-module.ts
CHANGED
|
@@ -30,8 +30,6 @@ export const NativeSessionReplay = (SessionReplaySpec ??
|
|
|
30
30
|
export interface NativeSessionReplayConfig {
|
|
31
31
|
/** Your Amplitude API key for authentication and data routing */
|
|
32
32
|
apiKey: string;
|
|
33
|
-
/** Whether to automatically start recording when the module is initialized */
|
|
34
|
-
autoStart: boolean;
|
|
35
33
|
/** Device identifier that matches the device ID sent with Amplitude events */
|
|
36
34
|
deviceId: string | null;
|
|
37
35
|
/** Whether to enable remote configuration for dynamic settings updates */
|
|
@@ -50,10 +48,6 @@ export interface NativeSessionReplayConfig {
|
|
|
50
48
|
sessionId: number;
|
|
51
49
|
}
|
|
52
50
|
|
|
53
|
-
export interface NativeSessionReplayProperties {
|
|
54
|
-
[key: string]: string | number | boolean;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
51
|
/**
|
|
58
52
|
* Interface defining the native session replay module specification.
|
|
59
53
|
* This interface provides the contract for communication between JavaScript and
|
|
@@ -76,14 +70,6 @@ export interface NativeSessionReplaySpec {
|
|
|
76
70
|
*/
|
|
77
71
|
getSessionId(): Promise<number>;
|
|
78
72
|
|
|
79
|
-
/**
|
|
80
|
-
* Retrieves session replay properties that should be attached to Amplitude events.
|
|
81
|
-
* These properties help correlate events with session recordings.
|
|
82
|
-
* @returns Promise resolving to an object containing session replay metadata
|
|
83
|
-
* @note OLD ARCH: ideally we want to cache that on JS side to avoid bridge overhead
|
|
84
|
-
*/
|
|
85
|
-
getSessionReplayProperties(): Promise<NativeSessionReplayProperties>;
|
|
86
|
-
|
|
87
73
|
/**
|
|
88
74
|
* Updates the device identifier used for session replay tracking.
|
|
89
75
|
* @param deviceId - The device identifier string, or null to clear the device ID
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from '@amplitude/analytics-types';
|
|
7
7
|
|
|
8
8
|
import { SessionReplayPluginConfig, getDefaultSessionReplayPluginConfig } from './plugin-session-replay-config';
|
|
9
|
-
import { getSessionId,
|
|
9
|
+
import { getSessionId, privateInit, setSessionId, start, stop } from './session-replay';
|
|
10
10
|
import { createSessionReplayLogger } from './logger';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -72,11 +72,13 @@ export class SessionReplayPlugin implements EnrichmentPlugin<ReactNativeClient,
|
|
|
72
72
|
sampleRate: this.sessionReplayConfig.sampleRate,
|
|
73
73
|
enableRemoteConfig: this.sessionReplayConfig.enableRemoteConfig,
|
|
74
74
|
logLevel: this.sessionReplayConfig.logLevel,
|
|
75
|
-
autoStart: this.sessionReplayConfig.autoStart,
|
|
76
75
|
},
|
|
77
76
|
this.logger,
|
|
78
77
|
);
|
|
79
78
|
this.isInitialized = true;
|
|
79
|
+
if (this.sessionReplayConfig.autoStart) {
|
|
80
|
+
await start();
|
|
81
|
+
}
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
async execute(event: Event): Promise<Event | null> {
|
|
@@ -90,15 +92,6 @@ export class SessionReplayPlugin implements EnrichmentPlugin<ReactNativeClient,
|
|
|
90
92
|
if (this.config?.sessionId && this.config.sessionId !== (await getSessionId())) {
|
|
91
93
|
await setSessionId(this.config.sessionId);
|
|
92
94
|
}
|
|
93
|
-
// Treating config.sessionId as source of truth, if the event's session id doesn't match, the
|
|
94
|
-
// event is not of the current session (offline/late events). In that case, don't tag the events
|
|
95
|
-
if (this.config?.sessionId && this.config.sessionId === event.session_id) {
|
|
96
|
-
const sessionRecordingProperties = await getSessionReplayProperties();
|
|
97
|
-
event.event_properties = {
|
|
98
|
-
...event.event_properties,
|
|
99
|
-
...sessionRecordingProperties,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
95
|
return Promise.resolve(event);
|
|
103
96
|
}
|
|
104
97
|
|
|
@@ -134,26 +127,4 @@ export class SessionReplayPlugin implements EnrichmentPlugin<ReactNativeClient,
|
|
|
134
127
|
this.config = null;
|
|
135
128
|
this.isInitialized = false;
|
|
136
129
|
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Get session replay properties for manual event correlation.
|
|
140
|
-
* When you send events to Amplitude, call this method to get the most up-to-date session replay properties for the event.
|
|
141
|
-
*
|
|
142
|
-
* @returns Promise that resolves to an object containing session replay metadata
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* ```typescript
|
|
146
|
-
* const sessionReplayProperties = await plugin.getSessionReplayProperties();
|
|
147
|
-
* analytics.track('Button Clicked', {
|
|
148
|
-
* buttonName: 'submit',
|
|
149
|
-
* ...sessionReplayProperties
|
|
150
|
-
* });
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
async getSessionReplayProperties() {
|
|
154
|
-
if (!this.isInitialized) {
|
|
155
|
-
return {};
|
|
156
|
-
}
|
|
157
|
-
return getSessionReplayProperties();
|
|
158
|
-
}
|
|
159
130
|
}
|
|
@@ -27,12 +27,6 @@ export interface SessionReplayConfig {
|
|
|
27
27
|
*/
|
|
28
28
|
apiKey: string;
|
|
29
29
|
|
|
30
|
-
/**
|
|
31
|
-
* Whether to automatically start recording when the SDK is initialized
|
|
32
|
-
* @default true
|
|
33
|
-
*/
|
|
34
|
-
autoStart?: boolean;
|
|
35
|
-
|
|
36
30
|
/**
|
|
37
31
|
* Device identifier that matches the device ID sent with Amplitude events
|
|
38
32
|
* Must match the Device ID passed as event properties to Amplitude
|
|
@@ -107,7 +101,6 @@ export type SessionReplayConfigInternal = Omit<SessionReplayConfig, 'maskLevel'>
|
|
|
107
101
|
|
|
108
102
|
export const getDefaultConfig: () => Required<Omit<SessionReplayConfigInternal, 'apiKey'>> = () => {
|
|
109
103
|
return {
|
|
110
|
-
autoStart: true,
|
|
111
104
|
deviceId: null,
|
|
112
105
|
enableRemoteConfig: true,
|
|
113
106
|
logLevel: LogLevel.Warn,
|
package/src/session-replay.ts
CHANGED
|
@@ -32,12 +32,12 @@ let isInitialized = false;
|
|
|
32
32
|
let logger = createSessionReplayLogger();
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* Configure the SDK
|
|
35
|
+
* Configure the SDK. Call `start()` explicitly to begin collecting replays.
|
|
36
36
|
* This function must be called before any other session replay operations.
|
|
37
37
|
*
|
|
38
38
|
* @param config - Configuration object containing API key, device ID, session ID, and other options
|
|
39
|
-
* @returns Promise that resolves when initialization is complete
|
|
40
|
-
*
|
|
39
|
+
* @returns Promise that resolves when initialization is complete. Native setup
|
|
40
|
+
* failures are logged and do not reject the promise.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
43
|
* ```typescript
|
|
@@ -139,38 +139,6 @@ export async function getSessionId(): Promise<number | null> {
|
|
|
139
139
|
return await NativeSessionReplay.getSessionId();
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
/**
|
|
143
|
-
* Interface for session replay properties that should be attached to Amplitude events.
|
|
144
|
-
* These properties help correlate events with session recordings.
|
|
145
|
-
*/
|
|
146
|
-
export interface SessionReplayProperties {
|
|
147
|
-
[key: string]: string | boolean | null;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* When you send events to Amplitude, call this function to get the most up-to-date session replay properties for the event.
|
|
152
|
-
* Collect Session Replay properties to send with other event properties.
|
|
153
|
-
*
|
|
154
|
-
* @returns Promise that resolves to an object containing session replay metadata
|
|
155
|
-
*
|
|
156
|
-
* @example
|
|
157
|
-
* ```typescript
|
|
158
|
-
* const sessionReplayProperties = await getSessionReplayProperties();
|
|
159
|
-
* analytics.track('Button Clicked', {
|
|
160
|
-
* buttonName: 'submit',
|
|
161
|
-
* ...sessionReplayProperties // Merge session replay properties
|
|
162
|
-
* });
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
export async function getSessionReplayProperties(): Promise<SessionReplayProperties> {
|
|
166
|
-
if (!isInitialized) {
|
|
167
|
-
logger.warn('SessionReplay is not initialized');
|
|
168
|
-
return {};
|
|
169
|
-
}
|
|
170
|
-
const properties = await NativeSessionReplay.getSessionReplayProperties();
|
|
171
|
-
return properties as SessionReplayProperties;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
142
|
/**
|
|
175
143
|
* Flush any pending session replay data to the server.
|
|
176
144
|
* Forces immediate upload of recorded session data that may be buffered locally.
|
|
@@ -194,13 +162,12 @@ export async function flush(): Promise<void> {
|
|
|
194
162
|
/**
|
|
195
163
|
* Start session replay recording.
|
|
196
164
|
* Begins capturing user interactions and screen content for replay.
|
|
197
|
-
* If autoStart is enabled in the configuration, this is called automatically during initialization.
|
|
198
165
|
*
|
|
199
166
|
* @returns Promise that resolves when recording starts
|
|
200
167
|
*
|
|
201
168
|
* @example
|
|
202
169
|
* ```typescript
|
|
203
|
-
* //
|
|
170
|
+
* // Recording starts only after this explicit call.
|
|
204
171
|
* await start();
|
|
205
172
|
* ```
|
|
206
173
|
*/
|
|
@@ -15,7 +15,6 @@ export interface Spec extends TurboModule {
|
|
|
15
15
|
setSessionId(sessionId: number): Promise<void>;
|
|
16
16
|
setDeviceId(deviceId: string | null): Promise<void>;
|
|
17
17
|
getSessionId(): Promise<number>;
|
|
18
|
-
getSessionReplayProperties(): Promise<UnsafeObject>;
|
|
19
18
|
start(): Promise<void>;
|
|
20
19
|
stop(): Promise<void>;
|
|
21
20
|
flush(): Promise<void>;
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.0-beta.
|
|
1
|
+
export const VERSION = '0.1.0-beta.4';
|