@amplitude/session-replay-react-native 0.1.0-beta.4 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +1 -17
  2. package/android/src/main/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeModule.kt +102 -23
  3. package/android/src/oldarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeSpec.kt +2 -0
  4. package/ios/AMPNativeSessionReplay.mm +4 -0
  5. package/ios/NativeSessionReplay.swift +41 -23
  6. package/lib/commonjs/index.js +15 -3
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/commonjs/plugin-session-replay.js +22 -2
  9. package/lib/commonjs/plugin-session-replay.js.map +1 -1
  10. package/lib/commonjs/session-replay.js +36 -5
  11. package/lib/commonjs/session-replay.js.map +1 -1
  12. package/lib/commonjs/specs/NativeAmpSessionReplay.js.map +1 -1
  13. package/lib/commonjs/version.js +1 -1
  14. package/lib/commonjs/version.js.map +1 -1
  15. package/lib/module/index.js +2 -2
  16. package/lib/module/index.js.map +1 -1
  17. package/lib/module/plugin-session-replay.js +23 -3
  18. package/lib/module/plugin-session-replay.js.map +1 -1
  19. package/lib/module/session-replay.js +34 -5
  20. package/lib/module/session-replay.js.map +1 -1
  21. package/lib/module/specs/NativeAmpSessionReplay.js.map +1 -1
  22. package/lib/module/version.js +1 -1
  23. package/lib/module/version.js.map +1 -1
  24. package/lib/typescript/index.d.ts +2 -3
  25. package/lib/typescript/index.d.ts.map +1 -1
  26. package/lib/typescript/native-module.d.ts +9 -0
  27. package/lib/typescript/native-module.d.ts.map +1 -1
  28. package/lib/typescript/plugin-session-replay.d.ts +11 -0
  29. package/lib/typescript/plugin-session-replay.d.ts.map +1 -1
  30. package/lib/typescript/session-replay.d.ts +14 -0
  31. package/lib/typescript/session-replay.d.ts.map +1 -1
  32. package/lib/typescript/specs/NativeAmpSessionReplay.d.ts +2 -0
  33. package/lib/typescript/specs/NativeAmpSessionReplay.d.ts.map +1 -1
  34. package/lib/typescript/version.d.ts +1 -1
  35. package/lib/typescript/version.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/index.tsx +12 -4
  38. package/src/native-module.ts +11 -0
  39. package/src/plugin-session-replay.ts +22 -2
  40. package/src/session-replay.ts +34 -5
  41. package/src/specs/NativeAmpSessionReplay.ts +2 -0
  42. package/src/version.ts +1 -1
package/README.md CHANGED
@@ -38,23 +38,7 @@ const config: SessionReplayConfig = {
38
38
  await init(config);
39
39
  ```
40
40
 
41
- ### Session Replay React Native Plugin
42
-
43
- Add the session replay plugin to your Amplitude instance as follows
44
-
45
- ```js
46
- import { SessionReplayPlugin, SessionReplaPluginConfig } from '@amplitude/session-replay-react-native';
47
-
48
- // ...
49
-
50
- const config: SessionReplaPluginConfig = {
51
- enableRemoteConfig: true, // default true
52
- sampleRate: 1, // default 0
53
- logLevel: LogLevel.Warn, // default LogLevel.Warn
54
- };
55
- await init('YOUR_API_KEY').promise;
56
- await add(new SessionReplayPlugin(config)).promise;
57
- ```
41
+ To use Amplitude Session Replay with Amplitude Analytics, use the [`@amplitude/plugin-session-replay-react-native`](https://www.npmjs.com/package/@amplitude/plugin-session-replay-react-native) plugin package.
58
42
 
59
43
  ## Masking views
60
44
 
@@ -15,7 +15,20 @@ import com.facebook.react.bridge.ReadableMap
15
15
  // one, so it stays on the overrides below.
16
16
  class SessionReplayReactNativeModule(private val reactContext: ReactApplicationContext) :
17
17
  SessionReplayReactNativeSpec(reactContext) {
18
- private lateinit var sessionReplay: SessionReplay
18
+ private data class NativeConfig(
19
+ val apiKey: String,
20
+ val deviceId: String?,
21
+ val sessionId: Long,
22
+ val serverZone: String,
23
+ val sampleRate: Double,
24
+ val enableRemoteConfig: Boolean,
25
+ val optOut: Boolean,
26
+ val maskLevel: MaskLevel,
27
+ )
28
+
29
+ private var sessionReplay: SessionReplay? = null
30
+ private var nativeConfig: NativeConfig? = null
31
+ private var shouldStart = false
19
32
 
20
33
  override fun getName(): String {
21
34
  return NAME
@@ -61,23 +74,19 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
61
74
  Opt Out: $optOut
62
75
  """.trimIndent())
63
76
 
64
- sessionReplay = SessionReplay(
77
+ nativeConfig = NativeConfig(
65
78
  apiKey = apiKey,
66
- context = reactContext.applicationContext,
67
- deviceId = deviceId ?: "",
79
+ deviceId = deviceId,
68
80
  sessionId = sessionId,
69
- optOut = optOut,
81
+ serverZone = serverZone,
70
82
  sampleRate = sampleRate,
71
- logger = LogcatLogger.logger,
72
83
  enableRemoteConfig = enableRemoteConfig,
73
- serverZone = when (serverZone) {
74
- "EU" -> ServerZone.EU
75
- else -> ServerZone.US
76
- },
77
- autoStart = false,
78
- privacyConfig = PrivacyConfig(maskLevel = maskLevel),
84
+ optOut = optOut,
85
+ maskLevel = maskLevel,
79
86
  )
80
-
87
+ rebootSessionReplay(requireNotNull(nativeConfig))
88
+ shouldStart = false
89
+
81
90
  promise.resolve(null)
82
91
  } catch (e: Exception) {
83
92
  promise.reject("SETUP_ERROR", e.message, e)
@@ -87,7 +96,8 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
87
96
  @ReactMethod
88
97
  override fun setSessionId(sessionId: Double, promise: Promise) {
89
98
  try {
90
- sessionReplay.setSessionId(sessionId.toLong())
99
+ nativeConfig = requireNotNull(nativeConfig).copy(sessionId = sessionId.toLong())
100
+ sessionReplay?.setSessionId(sessionId.toLong())
91
101
  promise.resolve(null)
92
102
  } catch (e: Exception) {
93
103
  promise.reject("SET_SESSION_ID_ERROR", e.message, e)
@@ -97,17 +107,45 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
97
107
  @ReactMethod
98
108
  override fun setDeviceId(deviceId: String?, promise: Promise) {
99
109
  try {
100
- sessionReplay.setDeviceId(deviceId ?: "")
110
+ nativeConfig = requireNotNull(nativeConfig).copy(deviceId = deviceId)
111
+ sessionReplay?.setDeviceId(deviceId ?: "")
101
112
  promise.resolve(null)
102
113
  } catch (e: Exception) {
103
114
  promise.reject("SET_DEVICE_ID_ERROR", e.message, e)
104
115
  }
105
116
  }
106
117
 
118
+ @ReactMethod
119
+ override fun setOptOut(optOut: Boolean, promise: Promise) {
120
+ try {
121
+ val currentConfig = requireNotNull(nativeConfig)
122
+ if (currentConfig.optOut == optOut) {
123
+ promise.resolve(null)
124
+ return
125
+ }
126
+
127
+ // session-replay-android has no public runtime opt-out setter, so retain
128
+ // the bridge config and skip constructing the native SDK while opted out.
129
+ // Create the next instance before shutting the current one down so a
130
+ // constructor failure leaves native state unchanged (and retryable).
131
+ val updatedConfig = currentConfig.copy(optOut = optOut)
132
+ rebootSessionReplay(updatedConfig)
133
+ nativeConfig = updatedConfig
134
+ if (shouldStart && !optOut) {
135
+ sessionReplay?.start()
136
+ }
137
+ promise.resolve(null)
138
+ } catch (e: Exception) {
139
+ promise.reject("SET_OPT_OUT_ERROR", e.message, e)
140
+ }
141
+ }
142
+
107
143
  @ReactMethod
108
144
  override fun getSessionId(promise: Promise) {
109
145
  try {
110
- promise.resolve(sessionReplay.getSessionId().toDouble())
146
+ val sessionId = sessionReplay?.getSessionId() ?: nativeConfig?.sessionId
147
+ ?: throw IllegalStateException("SessionReplay is not initialized")
148
+ promise.resolve(sessionId.toDouble())
111
149
  } catch (e: Exception) {
112
150
  promise.reject("GET_SESSION_ID_ERROR", e.message, e)
113
151
  }
@@ -116,7 +154,8 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
116
154
  @ReactMethod
117
155
  override fun start(promise: Promise) {
118
156
  try {
119
- sessionReplay.start()
157
+ shouldStart = true
158
+ sessionReplay?.start()
120
159
  promise.resolve(null)
121
160
  } catch (e: Exception) {
122
161
  promise.reject("START_ERROR", e.message, e)
@@ -126,7 +165,8 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
126
165
  @ReactMethod
127
166
  override fun stop(promise: Promise) {
128
167
  try {
129
- sessionReplay.stop()
168
+ shouldStart = false
169
+ sessionReplay?.stop()
130
170
  promise.resolve(null)
131
171
  } catch (e: Exception) {
132
172
  promise.reject("STOP_ERROR", e.message, e)
@@ -136,7 +176,7 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
136
176
  @ReactMethod
137
177
  override fun flush(promise: Promise) {
138
178
  try {
139
- sessionReplay.flush()
179
+ sessionReplay?.flush()
140
180
  promise.resolve(null)
141
181
  } catch (e: Exception) {
142
182
  promise.reject("FLUSH_ERROR", e.message, e)
@@ -144,14 +184,53 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
144
184
  }
145
185
 
146
186
  @ReactMethod
147
- fun teardown() {
148
- sessionReplay.shutdown()
187
+ override fun teardown(promise: Promise) {
188
+ try {
189
+ sessionReplay?.shutdown()
190
+ sessionReplay = null
191
+ nativeConfig = null
192
+ shouldStart = false
193
+ promise.resolve(null)
194
+ } catch (e: Exception) {
195
+ promise.reject("TEARDOWN_ERROR", e.message, e)
196
+ }
149
197
  }
150
198
 
151
199
  override fun invalidate() {
152
- if (::sessionReplay.isInitialized) {
153
- sessionReplay.shutdown()
200
+ sessionReplay?.shutdown()
201
+ sessionReplay = null
202
+ nativeConfig = null
203
+ shouldStart = false
204
+ }
205
+
206
+ private fun rebootSessionReplay(config: NativeConfig) {
207
+ val nextSessionReplay = if (config.optOut) {
208
+ LogcatLogger.logger.debug("skipping SessionReplay init because optOut=true")
209
+ null
210
+ } else {
211
+ createSessionReplay(config)
154
212
  }
213
+ sessionReplay?.shutdown()
214
+ sessionReplay = nextSessionReplay
215
+ }
216
+
217
+ private fun createSessionReplay(config: NativeConfig): SessionReplay {
218
+ return SessionReplay(
219
+ apiKey = config.apiKey,
220
+ context = reactContext.applicationContext,
221
+ deviceId = config.deviceId ?: "",
222
+ sessionId = config.sessionId,
223
+ optOut = config.optOut,
224
+ sampleRate = config.sampleRate,
225
+ logger = LogcatLogger.logger,
226
+ enableRemoteConfig = config.enableRemoteConfig,
227
+ serverZone = when (config.serverZone) {
228
+ "EU" -> ServerZone.EU
229
+ else -> ServerZone.US
230
+ },
231
+ autoStart = false,
232
+ privacyConfig = PrivacyConfig(maskLevel = config.maskLevel),
233
+ )
155
234
  }
156
235
 
157
236
  companion object {
@@ -12,8 +12,10 @@ abstract class SessionReplayReactNativeSpec(reactContext: ReactApplicationContex
12
12
  abstract fun setup(config: ReadableMap, promise: Promise)
13
13
  abstract fun setSessionId(sessionId: Double, promise: Promise)
14
14
  abstract fun setDeviceId(deviceId: String?, promise: Promise)
15
+ abstract fun setOptOut(optOut: Boolean, promise: Promise)
15
16
  abstract fun getSessionId(promise: Promise)
16
17
  abstract fun start(promise: Promise)
17
18
  abstract fun stop(promise: Promise)
18
19
  abstract fun flush(promise: Promise)
20
+ abstract fun teardown(promise: Promise)
19
21
  }
@@ -10,12 +10,16 @@ RCT_EXTERN_METHOD(setSessionId:(nonnull NSNumber)sessionId resolve:(RCTPromiseRe
10
10
 
11
11
  RCT_EXTERN_METHOD(setDeviceId:(NSString)deviceId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
12
12
 
13
+ RCT_EXTERN_METHOD(setOptOut:(BOOL)optOut resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
14
+
13
15
  RCT_EXTERN_METHOD(setup:(NSDictionary *)config resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
14
16
 
15
17
  RCT_EXTERN_METHOD(start:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
16
18
 
17
19
  RCT_EXTERN_METHOD(stop:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
18
20
 
21
+ RCT_EXTERN_METHOD(teardown:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
22
+
19
23
  @end
20
24
 
21
25
  #ifdef RCT_NEW_ARCH_ENABLED
@@ -8,8 +8,8 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
8
8
  "AMPNativeSessionReplay"
9
9
  }
10
10
 
11
- var sessionReplay: SessionReplay!
12
- var logger: CoreLogger!
11
+ var sessionReplay: SessionReplay?
12
+ var logger: CoreLogger?
13
13
 
14
14
  override init() {
15
15
  print("NativeSessionReplay init")
@@ -30,10 +30,10 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
30
30
  }
31
31
 
32
32
  let deviceId = config["deviceId"] as? String
33
+ let createdLogger = OSLogger(logLevel: LogLevel(rawValue: logLevel) ?? .warn)
34
+ logger = createdLogger
33
35
 
34
- logger = OSLogger(logLevel: LogLevel(rawValue: logLevel) ?? .warn)
35
-
36
- logger.log(message:
36
+ createdLogger.log(message:
37
37
  """
38
38
  setup:
39
39
  API Key: \(apiKey)
@@ -54,7 +54,7 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
54
54
  sessionId: sessionId.int64Value,
55
55
  optOut: optOut,
56
56
  sampleRate: Float(truncating: sampleRate),
57
- logger: logger,
57
+ logger: createdLogger,
58
58
  serverZone: serverZone == "EU" ? .EU : .US,
59
59
  maskLevel: .fromString(maskLevel),
60
60
  enableRemoteConfig: enableRemoteConfig
@@ -65,15 +65,22 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
65
65
 
66
66
  @objc(setSessionId:resolve:reject:)
67
67
  func setSessionId(_ sessionId: NSNumber, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
68
- logger.debug(message: "setSessionId: \(sessionId)")
69
- sessionReplay.sessionId = sessionId.int64Value
68
+ logger?.debug(message: "setSessionId: \(sessionId)")
69
+ sessionReplay?.sessionId = sessionId.int64Value
70
70
  resolve(nil)
71
71
  }
72
72
 
73
73
  @objc(setDeviceId:resolve:reject:)
74
74
  func setDeviceId(_ deviceId: NSString, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
75
- logger.debug(message: "setDeviceId: \(deviceId)")
76
- sessionReplay.deviceId = deviceId as String?
75
+ logger?.debug(message: "setDeviceId: \(deviceId)")
76
+ sessionReplay?.deviceId = deviceId as String?
77
+ resolve(nil)
78
+ }
79
+
80
+ @objc(setOptOut:resolve:reject:)
81
+ func setOptOut(_ optOut: Bool, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
82
+ logger?.debug(message: "setOptOut: \(optOut)")
83
+ sessionReplay?.optOut = optOut
77
84
  resolve(nil)
78
85
  }
79
86
 
@@ -82,41 +89,52 @@ class NativeSessionReplay: NSObject, RCTBridgeModule {
82
89
  _ resolve: RCTPromiseResolveBlock,
83
90
  reject: RCTPromiseRejectBlock
84
91
  ) {
85
- logger.debug(message: "getSessionId")
86
- resolve(NSNumber(value:sessionReplay.sessionId))
92
+ logger?.debug(message: "getSessionId")
93
+ if let sessionId = sessionReplay?.sessionId {
94
+ resolve(NSNumber(value: sessionId))
95
+ } else {
96
+ resolve(nil)
97
+ }
87
98
  }
88
99
 
89
100
  @objc(start:reject:)
90
101
  func start(_ resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
91
- logger.debug(message: "start")
92
- sessionReplay.start()
93
- print(sessionReplay.additionalEventProperties)
94
- print(
95
- "SessionId: \(sessionReplay.sessionId); DeviceId: \(sessionReplay.deviceId ?? "nil")"
96
- )
102
+ logger?.debug(message: "start")
103
+ sessionReplay?.start()
97
104
  resolve(nil)
98
105
  }
99
106
 
100
107
  @objc(stop:reject:)
101
108
  func stop(_ resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
102
- logger.debug(message: "stop")
103
- sessionReplay.stop()
109
+ logger?.debug(message: "stop")
110
+ sessionReplay?.stop()
104
111
  resolve(nil)
105
112
  }
106
113
 
107
114
  @objc(flush:reject:)
108
115
  func flush(_ resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
109
- logger.debug(message: "flush")
110
- sessionReplay.flush()
116
+ logger?.debug(message: "flush")
117
+ sessionReplay?.flush()
118
+ resolve(nil)
119
+ }
120
+
121
+ @objc(teardown:reject:)
122
+ func teardown(_ resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
123
+ logger?.debug(message: "teardown")
124
+ tearDownSessionReplay()
111
125
  resolve(nil)
112
126
  }
113
127
 
114
128
  @objc(invalidate)
115
129
  func invalidate() {
116
130
  print("invalidate")
117
- // could be nil here
131
+ tearDownSessionReplay()
132
+ }
133
+
134
+ private func tearDownSessionReplay() {
118
135
  sessionReplay?.stop()
119
136
  sessionReplay = nil
137
+ logger = nil
120
138
  }
121
139
  }
122
140
 
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "AmpMaskView", {
9
9
  return _ampMaskView.AmpMaskView;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "SessionReplayPlugin", {
12
+ Object.defineProperty(exports, "LogLevel", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _pluginSessionReplay.SessionReplayPlugin;
15
+ return _sessionReplayConfig.LogLevel;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "flush", {
@@ -39,6 +39,12 @@ Object.defineProperty(exports, "setDeviceId", {
39
39
  return _sessionReplay.setDeviceId;
40
40
  }
41
41
  });
42
+ Object.defineProperty(exports, "setOptOut", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _sessionReplay.setOptOut;
46
+ }
47
+ });
42
48
  Object.defineProperty(exports, "setSessionId", {
43
49
  enumerable: true,
44
50
  get: function () {
@@ -57,7 +63,13 @@ Object.defineProperty(exports, "stop", {
57
63
  return _sessionReplay.stop;
58
64
  }
59
65
  });
66
+ Object.defineProperty(exports, "teardown", {
67
+ enumerable: true,
68
+ get: function () {
69
+ return _sessionReplay.teardown;
70
+ }
71
+ });
60
72
  var _sessionReplay = require("./session-replay");
61
- var _pluginSessionReplay = require("./plugin-session-replay");
73
+ var _sessionReplayConfig = require("./session-replay-config");
62
74
  var _ampMaskView = require("./amp-mask-view");
63
75
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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
+ {"version":3,"names":["_sessionReplay","require","_sessionReplayConfig","_ampMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAYA,IAAAC,oBAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA","ignoreList":[]}
@@ -64,7 +64,8 @@ class SessionReplayPlugin {
64
64
  serverZone: config.serverZone,
65
65
  sampleRate: this.sessionReplayConfig.sampleRate,
66
66
  enableRemoteConfig: this.sessionReplayConfig.enableRemoteConfig,
67
- logLevel: this.sessionReplayConfig.logLevel
67
+ logLevel: this.sessionReplayConfig.logLevel,
68
+ optOut: config.optOut
68
69
  }, this.logger);
69
70
  this.isInitialized = true;
70
71
  if (this.sessionReplayConfig.autoStart) {
@@ -109,9 +110,28 @@ class SessionReplayPlugin {
109
110
  await (0, _sessionReplay.stop)();
110
111
  }
111
112
  }
113
+
114
+ /**
115
+ * Update whether session replay collection is disabled for the current user.
116
+ *
117
+ * @param optOut - Whether to opt out of session replay collection
118
+ * @returns Promise that resolves when the opt-out state is updated
119
+ */
120
+ async setOptOut(optOut) {
121
+ if (this.isInitialized) {
122
+ await (0, _sessionReplay.setOptOut)(optOut);
123
+ }
124
+ }
125
+
126
+ /**
127
+ * Amplitude SDK hook. `client.setOptOut()` fans this out through the plugin timeline.
128
+ */
129
+ async onOptOutChanged(optOut) {
130
+ await this.setOptOut(optOut);
131
+ }
112
132
  async teardown() {
113
133
  if (this.isInitialized) {
114
- await (0, _sessionReplay.stop)();
134
+ await (0, _sessionReplay.teardown)();
115
135
  }
116
136
  this.config = null;
117
137
  this.isInitialized = false;
@@ -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","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;IACL,CAAC;IAED,IAAI,CAACE,MAAM,CAACK,WAAW,CAAC,IAAI,CAACF,mBAAmB,CAACG,QAAQ,CAAC;IAC1D,IAAI,CAACN,MAAM,CAACO,GAAG,CAAC,4CAA4C,EAAE,IAAI,CAACJ,mBAAmB,CAAC;EACzF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMK,KAAKA,CAACV,MAAyB,EAAE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ACA;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
+ {"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","optOut","autoStart","start","execute","event","_this$config","Promise","resolve","getSessionId","setSessionId","stop","setOptOut","onOptOutChanged","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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AAY,2BAAY,EAAC,CAAC,CAAC,EAAE;MAC9E,MAAM,IAAAC,2BAAY,EAAC,IAAI,CAAC5B,MAAM,CAACe,SAAS,CAAC;IAC3C;IACA,OAAOU,OAAO,CAACC,OAAO,CAACH,KAAK,CAAC;EAC/B;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMF,KAAKA,CAAA,EAAkB;IAC3B,IAAI,IAAI,CAACpB,aAAa,EAAE;MACtB,MAAM,IAAAoB,oBAAK,EAAC,CAAC;IACf;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMQ,IAAIA,CAAA,EAAkB;IAC1B,IAAI,IAAI,CAAC5B,aAAa,EAAE;MACtB,MAAM,IAAA4B,mBAAI,EAAC,CAAC;IACd;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAMC,SAASA,CAACX,MAAe,EAAiB;IAC9C,IAAI,IAAI,CAAClB,aAAa,EAAE;MACtB,MAAM,IAAA6B,wBAAS,EAACX,MAAM,CAAC;IACzB;EACF;;EAEA;AACF;AACA;EACE,MAAMY,eAAeA,CAACZ,MAAe,EAAiB;IACpD,MAAM,IAAI,CAACW,SAAS,CAACX,MAAM,CAAC;EAC9B;EAEA,MAAMa,QAAQA,CAAA,EAAkB;IAC9B,IAAI,IAAI,CAAC/B,aAAa,EAAE;MACtB,MAAM,IAAA+B,uBAAQ,EAAC,CAAC;IAClB;IAEA,IAAI,CAAChC,MAAM,GAAG,IAAI;IAClB,IAAI,CAACC,aAAa,GAAG,KAAK;EAC5B;AACF;AAACgC,OAAA,CAAApC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -8,9 +8,11 @@ exports.getSessionId = getSessionId;
8
8
  exports.init = init;
9
9
  exports.privateInit = privateInit;
10
10
  exports.setDeviceId = setDeviceId;
11
+ exports.setOptOut = setOptOut;
11
12
  exports.setSessionId = setSessionId;
12
13
  exports.start = start;
13
14
  exports.stop = stop;
15
+ exports.teardown = teardown;
14
16
  var _nativeModule = require("./native-module");
15
17
  var _sessionReplayConfig = require("./session-replay-config");
16
18
  var _logger = require("./logger");
@@ -48,7 +50,6 @@ function normalizeConfig(config) {
48
50
  }
49
51
  return rest;
50
52
  }
51
- let fullConfig = null;
52
53
  let isInitialized = false;
53
54
  let logger = (0, _logger.createSessionReplayLogger)();
54
55
 
@@ -80,14 +81,14 @@ async function init(config) {
80
81
  // the default object wholesale. That's fine while `PrivacyConfig` only
81
82
  // carries `maskLevel`, but if it ever grows more fields a deeper merge will
82
83
  // be needed so partial user configs don't drop defaults.
83
- fullConfig = {
84
+ const resolvedConfig = {
84
85
  ...(0, _sessionReplayConfig.getDefaultConfig)(),
85
86
  ...normalizeConfig(config)
86
87
  };
87
- logger.setLogLevel(fullConfig.logLevel);
88
- logger.log(`initializing @amplitude/session-replay-react-native version: ${_version.VERSION} with config: `, fullConfig);
88
+ logger.setLogLevel(resolvedConfig.logLevel);
89
+ logger.log(`initializing @amplitude/session-replay-react-native version: ${_version.VERSION} with config: `, resolvedConfig);
89
90
  try {
90
- await _nativeModule.NativeSessionReplay.setup(nativeConfig(fullConfig));
91
+ await _nativeModule.NativeSessionReplay.setup(nativeConfig(resolvedConfig));
91
92
  logger.log('SessionReplay initialized');
92
93
  isInitialized = true;
93
94
  } catch (error) {
@@ -217,6 +218,36 @@ async function stop() {
217
218
  }
218
219
  await _nativeModule.NativeSessionReplay.stop();
219
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
+ }
220
251
  function nativeConfig(config) {
221
252
  // Resolve the effective mask level here — the single source of truth for the
222
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","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;AAC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AE2B;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
+ {"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,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,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,CAACR,MAA2B,EAAi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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;AAWA;AACA;AACA;AACA;AACA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACeC,gCAAmB,CAACC,GAAG,CAAO,wBAAwB,CAAC","ignoreList":[]}
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":[]}
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.VERSION = void 0;
7
- const VERSION = exports.VERSION = '0.1.0-beta.4';
7
+ const VERSION = exports.VERSION = '1.0.1';
8
8
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["VERSION","exports"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;;;;;AAAO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["VERSION","exports"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;;;;;AAAO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,OAAO","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- export { init, setSessionId, getSessionId, flush, start, stop, setDeviceId } from './session-replay';
2
- export { SessionReplayPlugin } from './plugin-session-replay';
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
@@ -1 +1 @@
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
+ {"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,5 +1,5 @@
1
1
  import { getDefaultSessionReplayPluginConfig } from './plugin-session-replay-config';
2
- import { getSessionId, privateInit, setSessionId, start, stop } from './session-replay';
2
+ import { getSessionId, privateInit, setOptOut, setSessionId, start, stop, teardown } from './session-replay';
3
3
  import { createSessionReplayLogger } from './logger';
4
4
 
5
5
  /**
@@ -59,7 +59,8 @@ 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
62
+ logLevel: this.sessionReplayConfig.logLevel,
63
+ optOut: config.optOut
63
64
  }, this.logger);
64
65
  this.isInitialized = true;
65
66
  if (this.sessionReplayConfig.autoStart) {
@@ -104,9 +105,28 @@ export class SessionReplayPlugin {
104
105
  await stop();
105
106
  }
106
107
  }
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) {
116
+ if (this.isInitialized) {
117
+ await setOptOut(optOut);
118
+ }
119
+ }
120
+
121
+ /**
122
+ * Amplitude SDK hook. `client.setOptOut()` fans this out through the plugin timeline.
123
+ */
124
+ async onOptOutChanged(optOut) {
125
+ await this.setOptOut(optOut);
126
+ }
107
127
  async teardown() {
108
128
  if (this.isInitialized) {
109
- await stop();
129
+ await teardown();
110
130
  }
111
131
  this.config = null;
112
132
  this.isInitialized = false;
@@ -1 +1 @@
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,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,GAAGd,mCAAmC,CAAC,CAAC;MACxC,GAAGU;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,MAAMR,WAAW,CACf;MACEkB,MAAM,EAAEV,MAAM,CAACU,MAAM;MACrBC,QAAQ,EAAEX,MAAM,CAACW,QAAQ;MACzBC,SAAS,EAAEZ,MAAM,CAACY,SAAS;MAC3BC,UAAU,EAAEb,MAAM,CAACa,UAAyB;MAC5CC,UAAU,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AAa,GAAG,KAAK;EAC5B;AACF","ignoreList":[]}
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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A;AACA;EACE,MAAMC,IAAIA,CAAA,EAAkB;IAC1B,IAAI,IAAI,CAACO,aAAa,EAAE;MACtB,MAAMP,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":[]}
@@ -35,7 +35,6 @@ 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
 
@@ -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
- fullConfig = {
69
+ const resolvedConfig = {
71
70
  ...getDefaultConfig(),
72
71
  ...normalizeConfig(config)
73
72
  };
74
- logger.setLogLevel(fullConfig.logLevel);
75
- logger.log(`initializing @amplitude/session-replay-react-native version: ${VERSION} with config: `, fullConfig);
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(fullConfig));
76
+ await NativeSessionReplay.setup(nativeConfig(resolvedConfig));
78
77
  logger.log('SessionReplay initialized');
79
78
  isInitialized = true;
80
79
  } catch (error) {
@@ -204,6 +203,36 @@ export async function stop() {
204
203
  }
205
204
  await NativeSessionReplay.stop();
206
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
+ }
207
236
  function nativeConfig(config) {
208
237
  // Resolve the effective mask level here — the single source of truth for the
209
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","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;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AIA,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
+ {"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,S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;EACF;EACA,MAAMb,mBAAmB,CAAC4B,IAAI,CAAC,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,SAASA,CAACC,MAAe,EAAiB;EAC9D,IAAI,CAACpB,aAAa,EAAE;IAClBC,MAAM,CAACE,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMb,mBAAmB,CAAC6B,SAAS,CAACC,MAAM,CAAC;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,QAAQA,CAAA,EAAkB;EAC9C,IAAI,CAACrB,aAAa,EAAE;IAClBC,MAAM,CAACE,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMb,mBAAmB,CAAC+B,QAAQ,CAAC,CAAC;EACpCrB,aAAa,GAAG,KAAK;EACrBC,MAAM,GAAGT,yBAAyB,CAAC,CAAC;AACtC;AAEA,SAASiB,YAAYA,CAACd,MAAmC,EAA6B;EACpF;EACA;EACA;EACA;EACA;EACA;EACA,MAAM;IAAEE,aAAa;IAAE,GAAGC;EAAK,CAAC,GAAGH,MAAM;EACzC,MAAM2B,iBAAyD,GAAGzB,aAAa,CAACD,SAAS,IAAI,QAAQ;EACrG,OAAO;IACL,GAAGE,IAAI;IACPQ,QAAQ,EAAER,IAAI,CAACQ,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;;AAWA;AACA;AACA;AACA;AACA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,wBAAwB,CAAC","ignoreList":[]}
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":[]}
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.1.0-beta.4';
1
+ export const VERSION = '1.0.1';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,OAAO","ignoreList":[]}
@@ -1,6 +1,5 @@
1
- export { init, setSessionId, getSessionId, flush, start, stop, setDeviceId } from './session-replay';
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 { SessionReplayPlugin } from './plugin-session-replay';
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,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"}
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"}
@@ -55,6 +55,11 @@ export interface NativeSessionReplaySpec {
55
55
  * @note OLD ARCH: combine those into one method to avoid bridge overhead
56
56
  */
57
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>;
58
63
  /**
59
64
  * Initializes the native session replay module with the provided configuration.
60
65
  * This method must be called before any other session replay operations.
@@ -71,5 +76,9 @@ export interface NativeSessionReplaySpec {
71
76
  * Ends the current recording session and processes any captured data.
72
77
  */
73
78
  stop(): Promise<void>;
79
+ /**
80
+ * Shuts down the native session replay instance and releases its resources.
81
+ */
82
+ teardown(): Promise<void>;
74
83
  }
75
84
  //# sourceMappingURL=native-module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"native-module.d.ts","sourceRoot":"","sources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AC;IAEvB;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtB;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B"}
@@ -56,6 +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
+ /**
60
+ * Update whether session replay collection is disabled for the current user.
61
+ *
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.
68
+ */
69
+ onOptOutChanged(optOut: boolean): Promise<void>;
59
70
  teardown(): Promise<void>;
60
71
  }
61
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,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,GA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AI,CAAC;IAM/C;;OAEG;IACG,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAQhC"}
@@ -100,5 +100,19 @@ export declare function start(): Promise<void>;
100
100
  * ```
101
101
  */
102
102
  export declare function stop(): Promise<void>;
103
+ /**
104
+ * Update whether session replay collection is disabled for the current user.
105
+ *
106
+ * @param optOut - Whether to opt out of session replay collection
107
+ * @returns Promise that resolves when the opt-out state is updated
108
+ */
109
+ export declare function setOptOut(optOut: boolean): Promise<void>;
110
+ /**
111
+ * Shut down the native SDK and clear all JavaScript lifecycle state.
112
+ * Call `init()` again before using any other session replay operation.
113
+ *
114
+ * @returns Promise that resolves when teardown is complete
115
+ */
116
+ export declare function teardown(): Promise<void>;
103
117
  export declare function privateInit(config: SessionReplayConfig, newLogger: ReturnType<typeof createSessionReplayLogger>): Promise<void>;
104
118
  //# sourceMappingURL=session-replay.d.ts.map
@@ -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;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMnE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAMxE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,IA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I,CAAC,CAM1C;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAM9D;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ9C;AAmBD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,UAAU,CAAC,OAAO,yBAAyB,CAAC,GACtD,OAAO,CAAC,IAAI,CAAC,CAGf"}
@@ -4,10 +4,12 @@ export interface Spec extends TurboModule {
4
4
  setup(config: UnsafeObject): Promise<void>;
5
5
  setSessionId(sessionId: number): Promise<void>;
6
6
  setDeviceId(deviceId: string | null): Promise<void>;
7
+ setOptOut(optOut: boolean): Promise<void>;
7
8
  getSessionId(): Promise<number>;
8
9
  start(): Promise<void>;
9
10
  stop(): Promise<void>;
10
11
  flush(): Promise<void>;
12
+ teardown(): Promise<void>;
11
13
  }
12
14
  declare const _default: Spec | null;
13
15
  export default _default;
@@ -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,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
+ {"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,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,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;IACvB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;;AAOD,wBAAuE"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-beta.4";
1
+ export declare const VERSION = "1.0.1";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,iBAAiB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amplitude/session-replay-react-native",
3
- "version": "0.1.0-beta.4",
3
+ "version": "1.0.1",
4
4
  "description": "Amplitude Session Replay for React Native",
5
5
  "keywords": [
6
6
  "analytics",
package/src/index.tsx CHANGED
@@ -1,7 +1,15 @@
1
- export { init, setSessionId, getSessionId, flush, start, stop, setDeviceId } from './session-replay';
1
+ export {
2
+ init,
3
+ setSessionId,
4
+ getSessionId,
5
+ flush,
6
+ start,
7
+ stop,
8
+ setDeviceId,
9
+ setOptOut,
10
+ teardown,
11
+ } from './session-replay';
2
12
  export { type SessionReplayConfig, type MaskLevel, type PrivacyConfig } from './session-replay-config';
3
-
4
- export { SessionReplayPlugin } from './plugin-session-replay';
5
- export type { SessionReplayPluginConfig } from './plugin-session-replay-config';
13
+ export { LogLevel } from './session-replay-config';
6
14
 
7
15
  export { AmpMaskView, type AmpMaskViewProps } from './amp-mask-view';
@@ -84,6 +84,12 @@ export interface NativeSessionReplaySpec {
84
84
  */
85
85
  setSessionId(sessionId: number): Promise<void>;
86
86
 
87
+ /**
88
+ * Updates whether session replay collection is disabled for the current user.
89
+ * @param optOut - Whether to opt out of session replay collection
90
+ */
91
+ setOptOut(optOut: boolean): Promise<void>;
92
+
87
93
  /**
88
94
  * Initializes the native session replay module with the provided configuration.
89
95
  * This method must be called before any other session replay operations.
@@ -102,4 +108,9 @@ export interface NativeSessionReplaySpec {
102
108
  * Ends the current recording session and processes any captured data.
103
109
  */
104
110
  stop(): Promise<void>;
111
+
112
+ /**
113
+ * Shuts down the native session replay instance and releases its resources.
114
+ */
115
+ teardown(): Promise<void>;
105
116
  }
@@ -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, privateInit, setSessionId, start, stop } from './session-replay';
9
+ import { getSessionId, privateInit, setOptOut, setSessionId, start, stop, teardown } from './session-replay';
10
10
  import { createSessionReplayLogger } from './logger';
11
11
 
12
12
  /**
@@ -72,6 +72,7 @@ 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
+ optOut: config.optOut,
75
76
  },
76
77
  this.logger,
77
78
  );
@@ -119,9 +120,28 @@ export class SessionReplayPlugin implements EnrichmentPlugin<ReactNativeClient,
119
120
  }
120
121
  }
121
122
 
123
+ /**
124
+ * Update whether session replay collection is disabled for the current user.
125
+ *
126
+ * @param optOut - Whether to opt out of session replay collection
127
+ * @returns Promise that resolves when the opt-out state is updated
128
+ */
129
+ async setOptOut(optOut: boolean): Promise<void> {
130
+ if (this.isInitialized) {
131
+ await setOptOut(optOut);
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Amplitude SDK hook. `client.setOptOut()` fans this out through the plugin timeline.
137
+ */
138
+ async onOptOutChanged(optOut: boolean): Promise<void> {
139
+ await this.setOptOut(optOut);
140
+ }
141
+
122
142
  async teardown(): Promise<void> {
123
143
  if (this.isInitialized) {
124
- await stop();
144
+ await teardown();
125
145
  }
126
146
 
127
147
  this.config = null;
@@ -27,7 +27,6 @@ function normalizeConfig(config: SessionReplayConfig): SessionReplayConfigIntern
27
27
  return rest;
28
28
  }
29
29
 
30
- let fullConfig: ResolvedSessionReplayConfig | null = null;
31
30
  let isInitialized = false;
32
31
  let logger = createSessionReplayLogger();
33
32
 
@@ -59,16 +58,16 @@ export async function init(config: SessionReplayConfig): Promise<void> {
59
58
  // the default object wholesale. That's fine while `PrivacyConfig` only
60
59
  // carries `maskLevel`, but if it ever grows more fields a deeper merge will
61
60
  // be needed so partial user configs don't drop defaults.
62
- fullConfig = {
61
+ const resolvedConfig: ResolvedSessionReplayConfig = {
63
62
  ...getDefaultConfig(),
64
63
  ...normalizeConfig(config),
65
64
  };
66
65
 
67
- logger.setLogLevel(fullConfig.logLevel);
68
- logger.log(`initializing @amplitude/session-replay-react-native version: ${VERSION} with config: `, fullConfig);
66
+ logger.setLogLevel(resolvedConfig.logLevel);
67
+ logger.log(`initializing @amplitude/session-replay-react-native version: ${VERSION} with config: `, resolvedConfig);
69
68
 
70
69
  try {
71
- await NativeSessionReplay.setup(nativeConfig(fullConfig));
70
+ await NativeSessionReplay.setup(nativeConfig(resolvedConfig));
72
71
  logger.log('SessionReplay initialized');
73
72
  isInitialized = true;
74
73
  } catch (error) {
@@ -199,6 +198,36 @@ export async function stop(): Promise<void> {
199
198
  await NativeSessionReplay.stop();
200
199
  }
201
200
 
201
+ /**
202
+ * Update whether session replay collection is disabled for the current user.
203
+ *
204
+ * @param optOut - Whether to opt out of session replay collection
205
+ * @returns Promise that resolves when the opt-out state is updated
206
+ */
207
+ export async function setOptOut(optOut: boolean): Promise<void> {
208
+ if (!isInitialized) {
209
+ logger.warn('SessionReplay is not initialized');
210
+ return;
211
+ }
212
+ await NativeSessionReplay.setOptOut(optOut);
213
+ }
214
+
215
+ /**
216
+ * Shut down the native SDK and clear all JavaScript lifecycle state.
217
+ * Call `init()` again before using any other session replay operation.
218
+ *
219
+ * @returns Promise that resolves when teardown is complete
220
+ */
221
+ export async function teardown(): Promise<void> {
222
+ if (!isInitialized) {
223
+ logger.warn('SessionReplay is not initialized');
224
+ return;
225
+ }
226
+ await NativeSessionReplay.teardown();
227
+ isInitialized = false;
228
+ logger = createSessionReplayLogger();
229
+ }
230
+
202
231
  function nativeConfig(config: ResolvedSessionReplayConfig): NativeSessionReplayConfig {
203
232
  // Resolve the effective mask level here — the single source of truth for the
204
233
  // default. `normalizeConfig()` already folded the deprecated top-level
@@ -14,10 +14,12 @@ export interface Spec extends TurboModule {
14
14
  setup(config: UnsafeObject): Promise<void>;
15
15
  setSessionId(sessionId: number): Promise<void>;
16
16
  setDeviceId(deviceId: string | null): Promise<void>;
17
+ setOptOut(optOut: boolean): Promise<void>;
17
18
  getSessionId(): Promise<number>;
18
19
  start(): Promise<void>;
19
20
  stop(): Promise<void>;
20
21
  flush(): Promise<void>;
22
+ teardown(): Promise<void>;
21
23
  }
22
24
 
23
25
  // Use non-enforcing `get` (returns null when the native module isn't linked)
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.0-beta.4';
1
+ export const VERSION = '1.0.1';