@mixpanel/react-native-session-replay 1.0.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
15
15
 
16
16
  s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
17
17
  s.private_header_files = "ios/**/*.h"
18
- s.dependency 'MixpanelSessionReplay', '1.2.0'
18
+ s.dependency 'MixpanelSessionReplay', '1.5.1'
19
19
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20
20
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
21
21
  if respond_to?(:install_modules_dependencies, true)
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Mixpanel React Native Session Replay
2
2
 
3
+ ##### _June 10, 2026_ - [v1.3.0](https://github.com/mixpanel/mixpanel-react-native-session-replay/releases/tag/v1.3.0)
4
+
3
5
  Official React Native turbo module for Mixpanel Session Replay. Capture and analyze user interactions in your mobile app by bridging Mixpanel's native iOS and Android session replay SDKs to React Native.
4
6
 
5
7
  ## Features
@@ -79,7 +79,7 @@ dependencies {
79
79
  implementation "com.mixpanel.android:mixpanel-android:8.0.2"
80
80
 
81
81
  // Mixpanel Android Session Replay SDK dependency
82
- implementation "com.mixpanel.android:mixpanel-android-session-replay:1.0.5"
82
+ implementation "com.mixpanel.android:mixpanel-android-session-replay:1.4.0"
83
83
  }
84
84
 
85
85
  react {
@@ -307,7 +307,7 @@ class MixpanelReactNativeSessionReplayModule(reactContext: ReactApplicationConte
307
307
 
308
308
  companion object {
309
309
  const val NAME = "MixpanelReactNativeSessionReplay"
310
- const val LIB_VERSION = "1.0.1"
310
+ const val LIB_VERSION = "1.2.0"
311
311
  const val MP_LIB = "react-native-sr"
312
312
  }
313
313
  }
@@ -3,7 +3,7 @@ import MixpanelSessionReplay
3
3
  import UIKit
4
4
 
5
5
  @objc public class MixpanelSwiftSessionReplay: NSObject {
6
- static let libVersion = "1.0.1"
6
+ static let libVersion = "1.2.0"
7
7
  static let mpLib = "react-native-sr"
8
8
 
9
9
  @objc public static func startRecording(recordingSessionsPercent: Double = 100.0) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { Platform } from 'react-native';
3
+ import { Platform, processColor } from 'react-native';
4
4
  import MixpanelReactNativeSessionReplay from "./NativeMixpanelReactNativeSessionReplay.js";
5
5
  export let MPSessionReplayMask = /*#__PURE__*/function (MPSessionReplayMask) {
6
6
  MPSessionReplayMask["Text"] = "text";
@@ -9,6 +9,145 @@ export let MPSessionReplayMask = /*#__PURE__*/function (MPSessionReplayMask) {
9
9
  MPSessionReplayMask["Image"] = "image";
10
10
  return MPSessionReplayMask;
11
11
  }({});
12
+ export let MPSessionReplayRemoteSettingsMode = /*#__PURE__*/function (MPSessionReplayRemoteSettingsMode) {
13
+ MPSessionReplayRemoteSettingsMode["Disabled"] = "disabled";
14
+ MPSessionReplayRemoteSettingsMode["Strict"] = "strict";
15
+ MPSessionReplayRemoteSettingsMode["Fallback"] = "fallback";
16
+ return MPSessionReplayRemoteSettingsMode;
17
+ }({});
18
+
19
+ /**
20
+ * Base URLs for Mixpanel's managed data residency regions.
21
+ *
22
+ * Pass one of these constants to {@link MPSessionReplayConfig.serverURL} to route
23
+ * session replay traffic to the matching region, or pass any other `https://` URL
24
+ * to send traffic through a custom endpoint (for example, a corporate proxy).
25
+ */
26
+ export const MPDataResidency = {
27
+ /** US data residency (default): `https://api.mixpanel.com`. */
28
+ US: 'https://api.mixpanel.com',
29
+ /** EU data residency: `https://api-eu.mixpanel.com`. */
30
+ EU: 'https://api-eu.mixpanel.com',
31
+ /** India data residency: `https://api-in.mixpanel.com`. */
32
+ IN: 'https://api-in.mixpanel.com'
33
+ };
34
+
35
+ /**
36
+ * Color configuration for the on-device debug mask overlay.
37
+ *
38
+ * Each color accepts any React Native [`ColorValue`](https://reactnative.dev/docs/colors)
39
+ * — for example `'red'`, `'#FF0000'`, `'rgba(255, 0, 0, 0.5)'`, or `0xFFFF0000`.
40
+ * Setting any of `maskColor`, `autoMaskColor`, or `unmaskColor` to `null` hides that
41
+ * category from the overlay.
42
+ *
43
+ * The overlay only renders when `__DEV__` is `true` — `debugOptions` is ignored in
44
+ * production bundles regardless of what is passed.
45
+ */
46
+ export class MPDebugOverlayColors {
47
+ /**
48
+ * Color used to draw regions that are explicitly masked (sensitive views / text input).
49
+ * Set to `null` to hide masked regions from the overlay.
50
+ *
51
+ * - **Default:** `'red'`
52
+ */
53
+
54
+ /**
55
+ * Color used to draw regions that are auto-masked (text, images, web views, maps).
56
+ * Set to `null` to hide auto-masked regions from the overlay.
57
+ *
58
+ * - **Default:** `'orange'`
59
+ */
60
+
61
+ /**
62
+ * Color used to draw regions explicitly excluded from masking (safe views).
63
+ * Set to `null` to hide unmask regions from the overlay.
64
+ *
65
+ * - **Default:** `'green'`
66
+ */
67
+
68
+ /**
69
+ * Opacity of the overlay, from `0.0` (fully transparent) to `1.0` (fully opaque).
70
+ *
71
+ * - **Default:** `0.5`
72
+ */
73
+
74
+ constructor({
75
+ maskColor = 'red',
76
+ autoMaskColor = 'orange',
77
+ unmaskColor = 'green',
78
+ alpha = 0.5
79
+ } = {}) {
80
+ this.maskColor = maskColor;
81
+ this.autoMaskColor = autoMaskColor;
82
+ this.unmaskColor = unmaskColor;
83
+ this.alpha = alpha;
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Configuration for Session Replay debug features.
89
+ *
90
+ * When `overlayColors` is non-null, the SDK renders a visual overlay on top of the app
91
+ * showing which regions are masked, auto-masked, or explicitly unmasked. Set
92
+ * `overlayColors` to `null` to disable the overlay while keeping `MPDebugOptions`
93
+ * available for future debug features.
94
+ *
95
+ * Debug features only render when `__DEV__` is `true`. In production bundles
96
+ * (`__DEV__ === false`), `debugOptions` is dropped before reaching the native SDK so
97
+ * the overlay never ships to end users.
98
+ */
99
+ export class MPDebugOptions {
100
+ /**
101
+ * Color configuration for the debug mask overlay. When `null`, the overlay is disabled.
102
+ *
103
+ * - **Default:** `new MPDebugOverlayColors()` (overlay enabled with default colors)
104
+ */
105
+
106
+ constructor({
107
+ overlayColors = new MPDebugOverlayColors()
108
+ } = {}) {
109
+ this.overlayColors = overlayColors;
110
+ }
111
+ }
112
+ function processOverlayColor(color) {
113
+ if (color === null || color === undefined) {
114
+ return null;
115
+ }
116
+ // `processColor` returns the ARGB integer in the form expected by each native platform:
117
+ // a signed 32-bit Int on Android (kotlinx.serialization Int) and an unsigned 32-bit
118
+ // value on iOS (Swift Int is 64-bit, so it decodes without overflow). Invalid color
119
+ // strings yield `undefined` — treat those the same as `null` (hide the category).
120
+ const processed = processColor(color);
121
+ if (typeof processed !== 'number') {
122
+ console.warn(`MixpanelSessionReplay: invalid debug overlay color ${JSON.stringify(color)} — that category will be hidden from the overlay.`);
123
+ return null;
124
+ }
125
+ return processed;
126
+ }
127
+ function serializeDebugOptions(debugOptions) {
128
+ if (debugOptions === null) {
129
+ return null;
130
+ }
131
+ // Hard-gate debug features on `__DEV__` so they are never sent to native in
132
+ // production bundles. The Android SDK already restricts the overlay to debuggable
133
+ // builds, but the iOS SDK ships as a release XCFramework and would otherwise
134
+ // render the overlay in production if a customer forgot to gate the call site.
135
+ if (!__DEV__) {
136
+ if (debugOptions.overlayColors !== null) {
137
+ console.warn('MixpanelSessionReplay: `debugOptions` is ignored in production builds (__DEV__ is false).');
138
+ }
139
+ return null;
140
+ }
141
+ const overlayColors = debugOptions.overlayColors;
142
+ return {
143
+ overlayColors: overlayColors === null ? null : {
144
+ maskColor: processOverlayColor(overlayColors.maskColor),
145
+ autoMaskColor: processOverlayColor(overlayColors.autoMaskColor),
146
+ unmaskColor: processOverlayColor(overlayColors.unmaskColor),
147
+ alpha: overlayColors.alpha
148
+ }
149
+ };
150
+ }
12
151
  export class MPSessionReplayConfig {
13
152
  /**
14
153
  * Determines whether replay events will only be flushed to the server when the device has a WiFi connection.
@@ -67,13 +206,61 @@ export class MPSessionReplayConfig {
67
206
  * - **Default:** `false`
68
207
  */
69
208
 
209
+ /**
210
+ * Controls how remote configuration settings are fetched and applied.
211
+ *
212
+ * Remote settings enable server-side control over session replay parameters such as sampling rate.
213
+ * This setting determines the SDK's behavior when fetching these settings and how failures are handled.
214
+ *
215
+ * - **`disabled`** (default): Remote config is fetched to check if session replay is enabled, but SDK config
216
+ * settings from the server are not used. The SDK uses only the app-provided configuration.
217
+ * - **`strict`**: Remote config is required. If the fetch fails or times out, the SDK will not initialize.
218
+ * - **`fallback`**: Remote config is fetched and merged with local config. On fetch failure, the SDK falls back
219
+ * to cached config (if available) or uses the local config.
220
+ *
221
+ * - **Default:** `disabled`
222
+ */
223
+
224
+ /**
225
+ * Enables on-device debug features such as the visual mask overlay.
226
+ *
227
+ * When non-null, the SDK renders a colored overlay on top of the app showing which
228
+ * regions are masked, auto-masked, or explicitly unmasked — useful for verifying
229
+ * masking coverage during development. Pass `new MPDebugOptions()` to enable the
230
+ * overlay with default colors, or customize via `MPDebugOverlayColors`.
231
+ *
232
+ * `debugOptions` is only honored when `__DEV__` is `true`. In production bundles
233
+ * it is dropped before reaching the native SDK, so it is safe to leave the option
234
+ * set unconditionally — the overlay will not render for end users.
235
+ *
236
+ * - **Default:** `null` (disabled)
237
+ */
238
+
239
+ /**
240
+ * Base URL used to send session replay data to Mixpanel.
241
+ *
242
+ * Use one of the {@link MPDataResidency} constants to target a managed region
243
+ * (`MPDataResidency.US`, `MPDataResidency.EU`, `MPDataResidency.IN`), or pass any
244
+ * fully-qualified `https://` URL to route traffic through a custom endpoint such
245
+ * as a corporate proxy.
246
+ *
247
+ * The URL must use `https://`. The underlying native SDKs validate the URL
248
+ * during `initialize` — invalid URLs cause `initialize` to reject with an error
249
+ * on both platforms.
250
+ *
251
+ * - **Default:** `MPDataResidency.US` (`https://api.mixpanel.com`)
252
+ */
253
+
70
254
  constructor({
71
255
  wifiOnly = true,
72
256
  autoStartRecording = true,
73
257
  recordingSessionsPercent = 100,
74
258
  autoMaskedViews = [MPSessionReplayMask.Image, MPSessionReplayMask.Text, MPSessionReplayMask.Web, MPSessionReplayMask.Map],
75
259
  flushInterval = 10,
76
- enableLogging = false
260
+ enableLogging = false,
261
+ remoteSettingsMode = MPSessionReplayRemoteSettingsMode.Disabled,
262
+ debugOptions = null,
263
+ serverURL = MPDataResidency.US
77
264
  } = {}) {
78
265
  this.wifiOnly = wifiOnly;
79
266
  this.autoStartRecording = autoStartRecording;
@@ -81,6 +268,9 @@ export class MPSessionReplayConfig {
81
268
  this.autoMaskedViews = autoMaskedViews;
82
269
  this.flushInterval = flushInterval;
83
270
  this.enableLogging = enableLogging;
271
+ this.remoteSettingsMode = remoteSettingsMode;
272
+ this.debugOptions = debugOptions;
273
+ this.serverURL = serverURL;
84
274
  }
85
275
  transformMaskValueForPlatform(value) {
86
276
  if (Platform.OS === 'android') {
@@ -93,6 +283,7 @@ export class MPSessionReplayConfig {
93
283
  toJSON() {
94
284
  // Transform autoMaskedViews for platform-specific requirements
95
285
  const transformedAutoMaskedViews = this.autoMaskedViews.filter(mask => !(Platform.OS === 'android' && mask === MPSessionReplayMask.Map)).map(mask => this.transformMaskValueForPlatform(mask));
286
+ const transformedRemoteSettingsMode = Platform.OS === 'android' ? this.remoteSettingsMode.toUpperCase() : this.remoteSettingsMode;
96
287
  const config = {
97
288
  wifiOnly: this.wifiOnly,
98
289
  recordingSessionsPercent: this.recordingSessionsPercent,
@@ -100,10 +291,17 @@ export class MPSessionReplayConfig {
100
291
  autoStartRecording: this.autoStartRecording,
101
292
  flushInterval: this.flushInterval,
102
293
  enableLogging: this.enableLogging,
103
- // iOS-specific config to enable session replay on iOS 26 and later
294
+ remoteSettingsMode: transformedRemoteSettingsMode,
295
+ debugOptions: serializeDebugOptions(this.debugOptions),
296
+ // The native SDKs spell the server URL field differently — Android's
297
+ // kotlinx.serialization expects `serverUrl`, iOS's Codable expects `serverURL`.
104
298
  ...Platform.select({
105
299
  ios: {
106
- enableSessionReplayOniOS26AndLater: true
300
+ enableSessionReplayOniOS26AndLater: true,
301
+ serverURL: this.serverURL
302
+ },
303
+ android: {
304
+ serverUrl: this.serverURL
107
305
  },
108
306
  default: {}
109
307
  })
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","MixpanelReactNativeSessionReplay","MPSessionReplayMask","MPSessionReplayConfig","constructor","wifiOnly","autoStartRecording","recordingSessionsPercent","autoMaskedViews","Image","Text","Web","Map","flushInterval","enableLogging","transformMaskValueForPlatform","value","OS","charAt","toUpperCase","slice","toJSON","transformedAutoMaskedViews","filter","mask","map","config","select","ios","enableSessionReplayOniOS26AndLater","default","JSON","stringify","initialize","token","distinctId","Error","undefined","json","startRecording","stopRecording","isRecording","identify","getReplayId","flush","MPSessionReplayView","MPSessionReplay"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,gCAAgC,MAAM,6CAA0C;AAEvF,WAAYC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAO/B,OAAO,MAAMC,qBAAqB,CAAC;EACjC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAGEC,WAAWA,CAAC;IACVC,QAAQ,GAAG,IAAI;IACfC,kBAAkB,GAAG,IAAI;IACzBC,wBAAwB,GAAG,GAAG;IAC9BC,eAAe,GAAG,CAChBN,mBAAmB,CAACO,KAAK,EACzBP,mBAAmB,CAACQ,IAAI,EACxBR,mBAAmB,CA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AACA;AACA;AACA;AACA;AACA,eAAeC,WAAWA,CAAA,EAAqB;EAC7C,OAAOxC,gCAAgC,CAACwC,WAAW,CAAC,CAAC;AACvD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeC,QAAQA,CAACP,UAAkB,EAAiB;EACzD,IAAI,CAACA,UAAU,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;IACjD,MAAM,IAAIC,KAAK,CAAC,6CAA6C,CAAC;EAChE;EAEA,OAAOnC,gCAAgC,CAACyC,QAAQ,CAACP,UAAU,CAAC;AAC9D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeQ,WAAWA,CAAA,EAA2B;EACnD,OAAO1C,gCAAgC,CAAC0C,WAAW,CAAC,CAAC;AACvD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeC,KAAKA,CAAA,EAAkB;EACpC,OAAO3C,gCAAgC,CAAC2C,KAAK,CAAC,CAAC;AACjD;AAEA,SAASC,mBAAmB,QAAQ,gCAA6B;AAEjE,OAAO,MAAMC,eAAe,GAAG;EAC7Bb,UAAU;EACVM,cAAc;EACdC,aAAa;EACbC,WAAW;EACXC,QAAQ;EACRC,WAAW;EACXC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Platform","processColor","MixpanelReactNativeSessionReplay","MPSessionReplayMask","MPSessionReplayRemoteSettingsMode","MPDataResidency","US","EU","IN","MPDebugOverlayColors","constructor","maskColor","autoMaskColor","unmaskColor","alpha","MPDebugOptions","overlayColors","processOverlayColor","color","undefined","processed","console","warn","JSON","stringify","serializeDebugOptions","debugOptions","__DEV__","MPSessionReplayConfig","wifiOnly","autoStartRecording","recordingSessionsPercent","autoMaskedViews","Image","Text","Web","Map","flushInterval","enableLogging","remoteSettingsMode","Disabled","serverURL","transformMaskValueForPlatform","value","OS","charAt","toUpperCase","slice","toJSON","transformedAutoMaskedViews","filter","mask","map","transformedRemoteSettingsMode","config","select","ios","enableSessionReplayOniOS26AndLater","android","serverUrl","default","initialize","token","distinctId","Error","json","startRecording","stopRecording","isRecording","identify","getReplayId","flush","MPSessionReplayView","MPSessionReplay"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,YAAY,QAAyB,cAAc;AACtE,OAAOC,gCAAgC,MAAM,6CAA0C;AAEvF,WAAYC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAO/B,WAAYC,iCAAiC,0BAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAA,OAAjCA,iCAAiC;AAAA;;AAM7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAA6D,GAAG;EAC3E;EACAC,EAAE,EAAE,0BAA0B;EAC9B;EACAC,EAAE,EAAE,6BAA6B;EACjC;EACAC,EAAE,EAAE;AACN,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,CAAC;EAChC;AACF;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;;EAGEC,WAAWA,CAAC;IACVC,SAAS,GAAG,KAAK;IACjBC,aAAa,GAAG,QAAQ;IACxBC,WAAW,GAAG,OAAO;IACrBC,KAAK,GAAG;EACqB,CAAC,GAAG,CAAC,CAAC,EAAE;IACrC,IAAI,CAACH,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACC,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,KAAK,GAAGA,KAAK;EACpB;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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BAAqB,CAAC;EACjC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGElB,WAAWA,CAAC;IACVmB,QAAQ,GAAG,IAAI;IACfC,kBAAkB,GAAG,IAAI;IACzBC,wBAAwB,GAAG,GAAG;IAC9BC,eAAe,GAAG,CAChB7B,mBAAmB,CAAC8B,KAAK,EACzB9B,mBAAmB,CAAC+B,IAAI,EACxB/B,mBAAmB,CAACgC,GAAG,EACvBhC,mBAAmB,CAACiC,GAAG,CACxB;IACDC,aAAa,GAAG,EAAE;IAClBC,aAAa,GAAG,KAAK;IACrBC,kBAAkB,GAAGnC,iCAAiC,CAACoC,QAAQ;IAC/Dd,YAAY,GAAG,IAAI;IACnBe,SAAS,GAAGpC,eAAe,CAACC;EACE,CAAC,GAAG,CAAC,CAAC,EAAE;IACtC,IAAI,CAACuB,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,kBAAkB,GAAGA,kBAAkB;IAC5C,IAAI,CAACC,wBAAwB,GAAGA,wBAAwB;IACxD,IAAI,CAACC,eAAe,GAAGA,eAAe;IACtC,IAAI,CAACK,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACC,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACC,kBAAkB,GAAGA,kBAAkB;IAC5C,IAAI,CAACb,YAAY,G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jE,gCAAgC,CAACiE,aAAa,CAAC,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAeC,WAAWA,CAAA,EAAqB;EAC7C,OAAOlE,gCAAgC,CAACkE,WAAW,CAAC,CAAC;AACvD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeC,QAAQA,CAACN,UAAkB,EAAiB;EACzD,IAAI,CAACA,UAAU,IAAI,OAAOA,UAAU,KAAK,QAAQ,EAAE;IACjD,MAAM,IAAIC,KAAK,CAAC,6CAA6C,CAAC;EAChE;EAEA,OAAO9D,gCAAgC,CAACmE,QAAQ,CAACN,UAAU,CAAC;AAC9D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeO,WAAWA,CAAA,EAA2B;EACnD,OAAOpE,gCAAgC,CAACoE,WAAW,CAAC,CAAC;AACvD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeC,KAAKA,CAAA,EAAkB;EACpC,OAAOrE,gCAAgC,CAACqE,KAAK,CAAC,CAAC;AACjD;AAEA,SAASC,mBAAmB,QAAQ,gCAA6B;AAEjE,OAAO,MAAMC,eAAe,GAAG;EAC7BZ,UAAU;EACVK,cAAc;EACdC,aAAa;EACbC,WAAW;EACXC,QAAQ;EACRC,WAAW;EACXC;AACF,CAAC","ignoreList":[]}
@@ -1,9 +1,85 @@
1
+ import { type ColorValue } from 'react-native';
1
2
  export declare enum MPSessionReplayMask {
2
3
  Text = "text",
3
4
  Web = "web",
4
5
  Map = "map",
5
6
  Image = "image"
6
7
  }
8
+ export declare enum MPSessionReplayRemoteSettingsMode {
9
+ Disabled = "disabled",
10
+ Strict = "strict",
11
+ Fallback = "fallback"
12
+ }
13
+ /**
14
+ * Base URLs for Mixpanel's managed data residency regions.
15
+ *
16
+ * Pass one of these constants to {@link MPSessionReplayConfig.serverURL} to route
17
+ * session replay traffic to the matching region, or pass any other `https://` URL
18
+ * to send traffic through a custom endpoint (for example, a corporate proxy).
19
+ */
20
+ export declare const MPDataResidency: Readonly<Record<'US' | 'EU' | 'IN', string>>;
21
+ /**
22
+ * Color configuration for the on-device debug mask overlay.
23
+ *
24
+ * Each color accepts any React Native [`ColorValue`](https://reactnative.dev/docs/colors)
25
+ * — for example `'red'`, `'#FF0000'`, `'rgba(255, 0, 0, 0.5)'`, or `0xFFFF0000`.
26
+ * Setting any of `maskColor`, `autoMaskColor`, or `unmaskColor` to `null` hides that
27
+ * category from the overlay.
28
+ *
29
+ * The overlay only renders when `__DEV__` is `true` — `debugOptions` is ignored in
30
+ * production bundles regardless of what is passed.
31
+ */
32
+ export declare class MPDebugOverlayColors {
33
+ /**
34
+ * Color used to draw regions that are explicitly masked (sensitive views / text input).
35
+ * Set to `null` to hide masked regions from the overlay.
36
+ *
37
+ * - **Default:** `'red'`
38
+ */
39
+ maskColor: ColorValue | null;
40
+ /**
41
+ * Color used to draw regions that are auto-masked (text, images, web views, maps).
42
+ * Set to `null` to hide auto-masked regions from the overlay.
43
+ *
44
+ * - **Default:** `'orange'`
45
+ */
46
+ autoMaskColor: ColorValue | null;
47
+ /**
48
+ * Color used to draw regions explicitly excluded from masking (safe views).
49
+ * Set to `null` to hide unmask regions from the overlay.
50
+ *
51
+ * - **Default:** `'green'`
52
+ */
53
+ unmaskColor: ColorValue | null;
54
+ /**
55
+ * Opacity of the overlay, from `0.0` (fully transparent) to `1.0` (fully opaque).
56
+ *
57
+ * - **Default:** `0.5`
58
+ */
59
+ alpha: number;
60
+ constructor({ maskColor, autoMaskColor, unmaskColor, alpha, }?: Partial<MPDebugOverlayColors>);
61
+ }
62
+ /**
63
+ * Configuration for Session Replay debug features.
64
+ *
65
+ * When `overlayColors` is non-null, the SDK renders a visual overlay on top of the app
66
+ * showing which regions are masked, auto-masked, or explicitly unmasked. Set
67
+ * `overlayColors` to `null` to disable the overlay while keeping `MPDebugOptions`
68
+ * available for future debug features.
69
+ *
70
+ * Debug features only render when `__DEV__` is `true`. In production bundles
71
+ * (`__DEV__ === false`), `debugOptions` is dropped before reaching the native SDK so
72
+ * the overlay never ships to end users.
73
+ */
74
+ export declare class MPDebugOptions {
75
+ /**
76
+ * Color configuration for the debug mask overlay. When `null`, the overlay is disabled.
77
+ *
78
+ * - **Default:** `new MPDebugOverlayColors()` (overlay enabled with default colors)
79
+ */
80
+ overlayColors: MPDebugOverlayColors | null;
81
+ constructor({ overlayColors, }?: Partial<MPDebugOptions>);
82
+ }
7
83
  export declare class MPSessionReplayConfig {
8
84
  /**
9
85
  * Determines whether replay events will only be flushed to the server when the device has a WiFi connection.
@@ -62,7 +138,52 @@ export declare class MPSessionReplayConfig {
62
138
  * - **Default:** `false`
63
139
  */
64
140
  enableLogging: boolean;
65
- constructor({ wifiOnly, autoStartRecording, recordingSessionsPercent, autoMaskedViews, flushInterval, enableLogging, }?: Partial<MPSessionReplayConfig>);
141
+ /**
142
+ * Controls how remote configuration settings are fetched and applied.
143
+ *
144
+ * Remote settings enable server-side control over session replay parameters such as sampling rate.
145
+ * This setting determines the SDK's behavior when fetching these settings and how failures are handled.
146
+ *
147
+ * - **`disabled`** (default): Remote config is fetched to check if session replay is enabled, but SDK config
148
+ * settings from the server are not used. The SDK uses only the app-provided configuration.
149
+ * - **`strict`**: Remote config is required. If the fetch fails or times out, the SDK will not initialize.
150
+ * - **`fallback`**: Remote config is fetched and merged with local config. On fetch failure, the SDK falls back
151
+ * to cached config (if available) or uses the local config.
152
+ *
153
+ * - **Default:** `disabled`
154
+ */
155
+ remoteSettingsMode: MPSessionReplayRemoteSettingsMode;
156
+ /**
157
+ * Enables on-device debug features such as the visual mask overlay.
158
+ *
159
+ * When non-null, the SDK renders a colored overlay on top of the app showing which
160
+ * regions are masked, auto-masked, or explicitly unmasked — useful for verifying
161
+ * masking coverage during development. Pass `new MPDebugOptions()` to enable the
162
+ * overlay with default colors, or customize via `MPDebugOverlayColors`.
163
+ *
164
+ * `debugOptions` is only honored when `__DEV__` is `true`. In production bundles
165
+ * it is dropped before reaching the native SDK, so it is safe to leave the option
166
+ * set unconditionally — the overlay will not render for end users.
167
+ *
168
+ * - **Default:** `null` (disabled)
169
+ */
170
+ debugOptions: MPDebugOptions | null;
171
+ /**
172
+ * Base URL used to send session replay data to Mixpanel.
173
+ *
174
+ * Use one of the {@link MPDataResidency} constants to target a managed region
175
+ * (`MPDataResidency.US`, `MPDataResidency.EU`, `MPDataResidency.IN`), or pass any
176
+ * fully-qualified `https://` URL to route traffic through a custom endpoint such
177
+ * as a corporate proxy.
178
+ *
179
+ * The URL must use `https://`. The underlying native SDKs validate the URL
180
+ * during `initialize` — invalid URLs cause `initialize` to reject with an error
181
+ * on both platforms.
182
+ *
183
+ * - **Default:** `MPDataResidency.US` (`https://api.mixpanel.com`)
184
+ */
185
+ serverURL: string;
186
+ constructor({ wifiOnly, autoStartRecording, recordingSessionsPercent, autoMaskedViews, flushInterval, enableLogging, remoteSettingsMode, debugOptions, serverURL, }?: Partial<MPSessionReplayConfig>);
66
187
  private transformMaskValueForPlatform;
67
188
  toJSON(): string;
68
189
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAGA,oBAAY,mBAAmB;IAC7B,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,KAAK,UAAU;CAChB;AAED,qBAAa,qBAAqB;IAChC;;;;;;;OAOG;IACH,QAAQ,EAAE,OAAO,CAAC;IAElB;;;;;;;;;;OAUG;IACH,wBAAwB,EAAE,MAAM,CAAC;IAEjC;;;;;OAKG;IACH,eAAe,EAAE,mBAAmB,EAAE,CAAC;IAEvC;;;;;;;;OAQG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAE5B;;;;;;;;OAQG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;;OAOG;IACH,aAAa,EAAE,OAAO,CAAC;gBAEX,EACV,QAAe,EACf,kBAAyB,EACzB,wBAA8B,EAC9B,eAKC,EAC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A+D,EAC/D,YAAmB,EACnB,SAA8B,GAC/B,GAAE,OAAO,CAAC,qBAAqB,CAAM;IAYtC,OAAO,CAAC,6BAA6B;IASrC,MAAM,IAAI,MAAM;CAyCjB;AAED;;;;;;;;;;;GAWG;AACH,iBAAe,UAAU,CACvB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED;;;;;;;;;GASG;AACH,iBAAe,cAAc,CAC3B,wBAAwB,GAAE,MAAY,GACrC,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;;;GAIG;AACH,iBAAe,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5C;AAED;;;;GAIG;AACH,iBAAe,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAE7C;AAED;;;;;;;;;GASG;AACH,iBAAe,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzD;AAED;;;;;;;GAOG;AACH,iBAAe,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAEnD;AAED;;;;;;;GAOG;AACH,iBAAe,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpC;AAED,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,eAAO,MAAM,eAAe;;;;;;;;CAQ3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mixpanel/react-native-session-replay",
3
- "version": "1.0.1",
3
+ "version": "1.3.0",
4
4
  "description": "Official React Native turbo module for Mixpanel Session Replay",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -37,8 +37,7 @@
37
37
  "typecheck": "tsc",
38
38
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
39
39
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
40
- "prepare": "bob build",
41
- "release": "release-it --only-version"
40
+ "prepare": "bob build"
42
41
  },
43
42
  "keywords": [
44
43
  "react-native",
@@ -74,7 +73,6 @@
74
73
  "@react-native-community/cli": "15.0.0-alpha.2",
75
74
  "@react-native/babel-preset": "0.79.2",
76
75
  "@react-native/eslint-config": "^0.78.0",
77
- "@release-it/conventional-changelog": "^9.0.2",
78
76
  "@types/jest": "^29.5.5",
79
77
  "@types/react": "^19.0.0",
80
78
  "commitlint": "^19.6.1",
@@ -87,7 +85,6 @@
87
85
  "react": "19.0.0",
88
86
  "react-native": "0.79.2",
89
87
  "react-native-builder-bob": "^0.40.13",
90
- "release-it": "^17.10.0",
91
88
  "turbo": "^1.10.7",
92
89
  "typescript": "^5.8.3"
93
90
  },
@@ -111,25 +108,6 @@
111
108
  "@commitlint/config-conventional"
112
109
  ]
113
110
  },
114
- "release-it": {
115
- "git": {
116
- "commitMessage": "chore: release ${version}",
117
- "tagName": "v${version}"
118
- },
119
- "npm": {
120
- "publish": true
121
- },
122
- "github": {
123
- "release": true
124
- },
125
- "plugins": {
126
- "@release-it/conventional-changelog": {
127
- "preset": {
128
- "name": "angular"
129
- }
130
- }
131
- }
132
- },
133
111
  "prettier": {
134
112
  "quoteProps": "consistent",
135
113
  "singleQuote": true,
package/src/index.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { Platform } from 'react-native';
1
+ import { Platform, processColor, type ColorValue } from 'react-native';
2
2
  import MixpanelReactNativeSessionReplay from './NativeMixpanelReactNativeSessionReplay';
3
3
 
4
4
  export enum MPSessionReplayMask {
@@ -8,6 +8,161 @@ export enum MPSessionReplayMask {
8
8
  Image = 'image',
9
9
  }
10
10
 
11
+ export enum MPSessionReplayRemoteSettingsMode {
12
+ Disabled = 'disabled',
13
+ Strict = 'strict',
14
+ Fallback = 'fallback',
15
+ }
16
+
17
+ /**
18
+ * Base URLs for Mixpanel's managed data residency regions.
19
+ *
20
+ * Pass one of these constants to {@link MPSessionReplayConfig.serverURL} to route
21
+ * session replay traffic to the matching region, or pass any other `https://` URL
22
+ * to send traffic through a custom endpoint (for example, a corporate proxy).
23
+ */
24
+ export const MPDataResidency: Readonly<Record<'US' | 'EU' | 'IN', string>> = {
25
+ /** US data residency (default): `https://api.mixpanel.com`. */
26
+ US: 'https://api.mixpanel.com',
27
+ /** EU data residency: `https://api-eu.mixpanel.com`. */
28
+ EU: 'https://api-eu.mixpanel.com',
29
+ /** India data residency: `https://api-in.mixpanel.com`. */
30
+ IN: 'https://api-in.mixpanel.com',
31
+ };
32
+
33
+ /**
34
+ * Color configuration for the on-device debug mask overlay.
35
+ *
36
+ * Each color accepts any React Native [`ColorValue`](https://reactnative.dev/docs/colors)
37
+ * — for example `'red'`, `'#FF0000'`, `'rgba(255, 0, 0, 0.5)'`, or `0xFFFF0000`.
38
+ * Setting any of `maskColor`, `autoMaskColor`, or `unmaskColor` to `null` hides that
39
+ * category from the overlay.
40
+ *
41
+ * The overlay only renders when `__DEV__` is `true` — `debugOptions` is ignored in
42
+ * production bundles regardless of what is passed.
43
+ */
44
+ export class MPDebugOverlayColors {
45
+ /**
46
+ * Color used to draw regions that are explicitly masked (sensitive views / text input).
47
+ * Set to `null` to hide masked regions from the overlay.
48
+ *
49
+ * - **Default:** `'red'`
50
+ */
51
+ maskColor: ColorValue | null;
52
+
53
+ /**
54
+ * Color used to draw regions that are auto-masked (text, images, web views, maps).
55
+ * Set to `null` to hide auto-masked regions from the overlay.
56
+ *
57
+ * - **Default:** `'orange'`
58
+ */
59
+ autoMaskColor: ColorValue | null;
60
+
61
+ /**
62
+ * Color used to draw regions explicitly excluded from masking (safe views).
63
+ * Set to `null` to hide unmask regions from the overlay.
64
+ *
65
+ * - **Default:** `'green'`
66
+ */
67
+ unmaskColor: ColorValue | null;
68
+
69
+ /**
70
+ * Opacity of the overlay, from `0.0` (fully transparent) to `1.0` (fully opaque).
71
+ *
72
+ * - **Default:** `0.5`
73
+ */
74
+ alpha: number;
75
+
76
+ constructor({
77
+ maskColor = 'red',
78
+ autoMaskColor = 'orange',
79
+ unmaskColor = 'green',
80
+ alpha = 0.5,
81
+ }: Partial<MPDebugOverlayColors> = {}) {
82
+ this.maskColor = maskColor;
83
+ this.autoMaskColor = autoMaskColor;
84
+ this.unmaskColor = unmaskColor;
85
+ this.alpha = alpha;
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Configuration for Session Replay debug features.
91
+ *
92
+ * When `overlayColors` is non-null, the SDK renders a visual overlay on top of the app
93
+ * showing which regions are masked, auto-masked, or explicitly unmasked. Set
94
+ * `overlayColors` to `null` to disable the overlay while keeping `MPDebugOptions`
95
+ * available for future debug features.
96
+ *
97
+ * Debug features only render when `__DEV__` is `true`. In production bundles
98
+ * (`__DEV__ === false`), `debugOptions` is dropped before reaching the native SDK so
99
+ * the overlay never ships to end users.
100
+ */
101
+ export class MPDebugOptions {
102
+ /**
103
+ * Color configuration for the debug mask overlay. When `null`, the overlay is disabled.
104
+ *
105
+ * - **Default:** `new MPDebugOverlayColors()` (overlay enabled with default colors)
106
+ */
107
+ overlayColors: MPDebugOverlayColors | null;
108
+
109
+ constructor({
110
+ overlayColors = new MPDebugOverlayColors(),
111
+ }: Partial<MPDebugOptions> = {}) {
112
+ this.overlayColors = overlayColors;
113
+ }
114
+ }
115
+
116
+ function processOverlayColor(color: ColorValue | null): number | null {
117
+ if (color === null || color === undefined) {
118
+ return null;
119
+ }
120
+ // `processColor` returns the ARGB integer in the form expected by each native platform:
121
+ // a signed 32-bit Int on Android (kotlinx.serialization Int) and an unsigned 32-bit
122
+ // value on iOS (Swift Int is 64-bit, so it decodes without overflow). Invalid color
123
+ // strings yield `undefined` — treat those the same as `null` (hide the category).
124
+ const processed = processColor(color);
125
+ if (typeof processed !== 'number') {
126
+ console.warn(
127
+ `MixpanelSessionReplay: invalid debug overlay color ${JSON.stringify(color)} — that category will be hidden from the overlay.`
128
+ );
129
+ return null;
130
+ }
131
+ return processed;
132
+ }
133
+
134
+ function serializeDebugOptions(
135
+ debugOptions: MPDebugOptions | null
136
+ ): object | null {
137
+ if (debugOptions === null) {
138
+ return null;
139
+ }
140
+ // Hard-gate debug features on `__DEV__` so they are never sent to native in
141
+ // production bundles. The Android SDK already restricts the overlay to debuggable
142
+ // builds, but the iOS SDK ships as a release XCFramework and would otherwise
143
+ // render the overlay in production if a customer forgot to gate the call site.
144
+ if (!__DEV__) {
145
+ if (debugOptions.overlayColors !== null) {
146
+ console.warn(
147
+ 'MixpanelSessionReplay: `debugOptions` is ignored in production builds (__DEV__ is false).'
148
+ );
149
+ }
150
+ return null;
151
+ }
152
+ const overlayColors = debugOptions.overlayColors;
153
+ return {
154
+ overlayColors:
155
+ overlayColors === null
156
+ ? null
157
+ : {
158
+ maskColor: processOverlayColor(overlayColors.maskColor),
159
+ autoMaskColor: processOverlayColor(overlayColors.autoMaskColor),
160
+ unmaskColor: processOverlayColor(overlayColors.unmaskColor),
161
+ alpha: overlayColors.alpha,
162
+ },
163
+ };
164
+ }
165
+
11
166
  export class MPSessionReplayConfig {
12
167
  /**
13
168
  * Determines whether replay events will only be flushed to the server when the device has a WiFi connection.
@@ -72,6 +227,54 @@ export class MPSessionReplayConfig {
72
227
  */
73
228
  enableLogging: boolean;
74
229
 
230
+ /**
231
+ * Controls how remote configuration settings are fetched and applied.
232
+ *
233
+ * Remote settings enable server-side control over session replay parameters such as sampling rate.
234
+ * This setting determines the SDK's behavior when fetching these settings and how failures are handled.
235
+ *
236
+ * - **`disabled`** (default): Remote config is fetched to check if session replay is enabled, but SDK config
237
+ * settings from the server are not used. The SDK uses only the app-provided configuration.
238
+ * - **`strict`**: Remote config is required. If the fetch fails or times out, the SDK will not initialize.
239
+ * - **`fallback`**: Remote config is fetched and merged with local config. On fetch failure, the SDK falls back
240
+ * to cached config (if available) or uses the local config.
241
+ *
242
+ * - **Default:** `disabled`
243
+ */
244
+ remoteSettingsMode: MPSessionReplayRemoteSettingsMode;
245
+
246
+ /**
247
+ * Enables on-device debug features such as the visual mask overlay.
248
+ *
249
+ * When non-null, the SDK renders a colored overlay on top of the app showing which
250
+ * regions are masked, auto-masked, or explicitly unmasked — useful for verifying
251
+ * masking coverage during development. Pass `new MPDebugOptions()` to enable the
252
+ * overlay with default colors, or customize via `MPDebugOverlayColors`.
253
+ *
254
+ * `debugOptions` is only honored when `__DEV__` is `true`. In production bundles
255
+ * it is dropped before reaching the native SDK, so it is safe to leave the option
256
+ * set unconditionally — the overlay will not render for end users.
257
+ *
258
+ * - **Default:** `null` (disabled)
259
+ */
260
+ debugOptions: MPDebugOptions | null;
261
+
262
+ /**
263
+ * Base URL used to send session replay data to Mixpanel.
264
+ *
265
+ * Use one of the {@link MPDataResidency} constants to target a managed region
266
+ * (`MPDataResidency.US`, `MPDataResidency.EU`, `MPDataResidency.IN`), or pass any
267
+ * fully-qualified `https://` URL to route traffic through a custom endpoint such
268
+ * as a corporate proxy.
269
+ *
270
+ * The URL must use `https://`. The underlying native SDKs validate the URL
271
+ * during `initialize` — invalid URLs cause `initialize` to reject with an error
272
+ * on both platforms.
273
+ *
274
+ * - **Default:** `MPDataResidency.US` (`https://api.mixpanel.com`)
275
+ */
276
+ serverURL: string;
277
+
75
278
  constructor({
76
279
  wifiOnly = true,
77
280
  autoStartRecording = true,
@@ -84,6 +287,9 @@ export class MPSessionReplayConfig {
84
287
  ],
85
288
  flushInterval = 10,
86
289
  enableLogging = false,
290
+ remoteSettingsMode = MPSessionReplayRemoteSettingsMode.Disabled,
291
+ debugOptions = null,
292
+ serverURL = MPDataResidency.US,
87
293
  }: Partial<MPSessionReplayConfig> = {}) {
88
294
  this.wifiOnly = wifiOnly;
89
295
  this.autoStartRecording = autoStartRecording;
@@ -91,6 +297,9 @@ export class MPSessionReplayConfig {
91
297
  this.autoMaskedViews = autoMaskedViews;
92
298
  this.flushInterval = flushInterval;
93
299
  this.enableLogging = enableLogging;
300
+ this.remoteSettingsMode = remoteSettingsMode;
301
+ this.debugOptions = debugOptions;
302
+ this.serverURL = serverURL;
94
303
  }
95
304
 
96
305
  private transformMaskValueForPlatform(value: string): string {
@@ -110,6 +319,10 @@ export class MPSessionReplayConfig {
110
319
  !(Platform.OS === 'android' && mask === MPSessionReplayMask.Map)
111
320
  )
112
321
  .map((mask) => this.transformMaskValueForPlatform(mask));
322
+ const transformedRemoteSettingsMode =
323
+ Platform.OS === 'android'
324
+ ? this.remoteSettingsMode.toUpperCase()
325
+ : this.remoteSettingsMode;
113
326
 
114
327
  const config = {
115
328
  wifiOnly: this.wifiOnly,
@@ -118,9 +331,16 @@ export class MPSessionReplayConfig {
118
331
  autoStartRecording: this.autoStartRecording,
119
332
  flushInterval: this.flushInterval,
120
333
  enableLogging: this.enableLogging,
121
- // iOS-specific config to enable session replay on iOS 26 and later
334
+ remoteSettingsMode: transformedRemoteSettingsMode,
335
+ debugOptions: serializeDebugOptions(this.debugOptions),
336
+ // The native SDKs spell the server URL field differently — Android's
337
+ // kotlinx.serialization expects `serverUrl`, iOS's Codable expects `serverURL`.
122
338
  ...Platform.select({
123
- ios: { enableSessionReplayOniOS26AndLater: true },
339
+ ios: {
340
+ enableSessionReplayOniOS26AndLater: true,
341
+ serverURL: this.serverURL,
342
+ },
343
+ android: { serverUrl: this.serverURL },
124
344
  default: {},
125
345
  }),
126
346
  };
@@ -1,54 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJavaSpec.js
9
- *
10
- * @nolint
11
- */
12
-
13
- package com.facebook.fbreact.specs;
14
-
15
- import com.facebook.proguard.annotations.DoNotStrip;
16
- import com.facebook.react.bridge.Promise;
17
- import com.facebook.react.bridge.ReactApplicationContext;
18
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
19
- import com.facebook.react.bridge.ReactMethod;
20
- import com.facebook.react.turbomodule.core.interfaces.TurboModule;
21
- import javax.annotation.Nonnull;
22
-
23
- public abstract class NativeMixpanelReactNativeSessionReplaySpec extends ReactContextBaseJavaModule implements TurboModule {
24
- public static final String NAME = "MixpanelReactNativeSessionReplay";
25
-
26
- public NativeMixpanelReactNativeSessionReplaySpec(ReactApplicationContext reactContext) {
27
- super(reactContext);
28
- }
29
-
30
- @Override
31
- public @Nonnull String getName() {
32
- return NAME;
33
- }
34
-
35
- @ReactMethod
36
- @DoNotStrip
37
- public abstract void initialize(String token, String distinctId, String configJSON, Promise promise);
38
-
39
- @ReactMethod
40
- @DoNotStrip
41
- public abstract void startRecording(Promise promise);
42
-
43
- @ReactMethod
44
- @DoNotStrip
45
- public abstract void stopRecording(Promise promise);
46
-
47
- @ReactMethod
48
- @DoNotStrip
49
- public abstract void isRecording(Promise promise);
50
-
51
- @ReactMethod
52
- @DoNotStrip
53
- public abstract void identify(String distinctId, Promise promise);
54
- }
@@ -1,36 +0,0 @@
1
- # Copyright (c) Meta Platforms, Inc. and affiliates.
2
- #
3
- # This source code is licensed under the MIT license found in the
4
- # LICENSE file in the root directory of this source tree.
5
-
6
- cmake_minimum_required(VERSION 3.13)
7
- set(CMAKE_VERBOSE_MAKEFILE on)
8
-
9
- file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/MixpanelReactNativeSessionReplaySpec/*.cpp)
10
-
11
- add_library(
12
- react_codegen_MixpanelReactNativeSessionReplaySpec
13
- OBJECT
14
- ${react_codegen_SRCS}
15
- )
16
-
17
- target_include_directories(react_codegen_MixpanelReactNativeSessionReplaySpec PUBLIC . react/renderer/components/MixpanelReactNativeSessionReplaySpec)
18
-
19
- target_link_libraries(
20
- react_codegen_MixpanelReactNativeSessionReplaySpec
21
- fbjni
22
- jsi
23
- # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
- # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
- reactnative
26
- )
27
-
28
- target_compile_options(
29
- react_codegen_MixpanelReactNativeSessionReplaySpec
30
- PRIVATE
31
- -DLOG_TAG=\"ReactNative\"
32
- -fexceptions
33
- -frtti
34
- -std=c++20
35
- -Wall
36
- )
@@ -1,56 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJniCpp.js
9
- */
10
-
11
- #include "MixpanelReactNativeSessionReplaySpec.h"
12
-
13
- namespace facebook::react {
14
-
15
- static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_initialize(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
- static jmethodID cachedMethodId = nullptr;
17
- return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "initialize", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
18
- }
19
-
20
- static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_startRecording(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
- static jmethodID cachedMethodId = nullptr;
22
- return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "startRecording", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
23
- }
24
-
25
- static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_stopRecording(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
26
- static jmethodID cachedMethodId = nullptr;
27
- return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "stopRecording", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
28
- }
29
-
30
- static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_isRecording(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
31
- static jmethodID cachedMethodId = nullptr;
32
- return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "isRecording", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
33
- }
34
-
35
- static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_identify(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
36
- static jmethodID cachedMethodId = nullptr;
37
- return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "identify", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
38
- }
39
-
40
- NativeMixpanelReactNativeSessionReplaySpecJSI::NativeMixpanelReactNativeSessionReplaySpecJSI(const JavaTurboModule::InitParams &params)
41
- : JavaTurboModule(params) {
42
- methodMap_["initialize"] = MethodMetadata {3, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_initialize};
43
- methodMap_["startRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_startRecording};
44
- methodMap_["stopRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_stopRecording};
45
- methodMap_["isRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_isRecording};
46
- methodMap_["identify"] = MethodMetadata {1, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_identify};
47
- }
48
-
49
- std::shared_ptr<TurboModule> MixpanelReactNativeSessionReplaySpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
50
- if (moduleName == "MixpanelReactNativeSessionReplay") {
51
- return std::make_shared<NativeMixpanelReactNativeSessionReplaySpecJSI>(params);
52
- }
53
- return nullptr;
54
- }
55
-
56
- } // namespace facebook::react
@@ -1,31 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJniH.js
9
- */
10
-
11
- #pragma once
12
-
13
- #include <ReactCommon/JavaTurboModule.h>
14
- #include <ReactCommon/TurboModule.h>
15
- #include <jsi/jsi.h>
16
-
17
- namespace facebook::react {
18
-
19
- /**
20
- * JNI C++ class for module 'NativeMixpanelReactNativeSessionReplay'
21
- */
22
- class JSI_EXPORT NativeMixpanelReactNativeSessionReplaySpecJSI : public JavaTurboModule {
23
- public:
24
- NativeMixpanelReactNativeSessionReplaySpecJSI(const JavaTurboModule::InitParams &params);
25
- };
26
-
27
-
28
- JSI_EXPORT
29
- std::shared_ptr<TurboModule> MixpanelReactNativeSessionReplaySpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
-
31
- } // namespace facebook::react
@@ -1,54 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleCpp.js
8
- */
9
-
10
- #include "MixpanelReactNativeSessionReplaySpecJSI.h"
11
-
12
- namespace facebook::react {
13
-
14
- static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_initialize(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
- return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->initialize(
16
- rt,
17
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
18
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
19
- count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt)
20
- );
21
- }
22
- static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_startRecording(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
23
- return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->startRecording(
24
- rt
25
- );
26
- }
27
- static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_stopRecording(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
28
- return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->stopRecording(
29
- rt
30
- );
31
- }
32
- static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_isRecording(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
33
- return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->isRecording(
34
- rt
35
- );
36
- }
37
- static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_identify(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
38
- return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->identify(
39
- rt,
40
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
41
- );
42
- }
43
-
44
- NativeMixpanelReactNativeSessionReplayCxxSpecJSI::NativeMixpanelReactNativeSessionReplayCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
45
- : TurboModule("MixpanelReactNativeSessionReplay", jsInvoker) {
46
- methodMap_["initialize"] = MethodMetadata {3, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_initialize};
47
- methodMap_["startRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_startRecording};
48
- methodMap_["stopRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_stopRecording};
49
- methodMap_["isRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_isRecording};
50
- methodMap_["identify"] = MethodMetadata {1, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_identify};
51
- }
52
-
53
-
54
- } // namespace facebook::react
@@ -1,107 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GenerateModuleH.js
8
- */
9
-
10
- #pragma once
11
-
12
- #include <ReactCommon/TurboModule.h>
13
- #include <react/bridging/Bridging.h>
14
-
15
- namespace facebook::react {
16
-
17
-
18
- class JSI_EXPORT NativeMixpanelReactNativeSessionReplayCxxSpecJSI : public TurboModule {
19
- protected:
20
- NativeMixpanelReactNativeSessionReplayCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
-
22
- public:
23
- virtual jsi::Value initialize(jsi::Runtime &rt, jsi::String token, jsi::String distinctId, jsi::String configJSON) = 0;
24
- virtual jsi::Value startRecording(jsi::Runtime &rt) = 0;
25
- virtual jsi::Value stopRecording(jsi::Runtime &rt) = 0;
26
- virtual jsi::Value isRecording(jsi::Runtime &rt) = 0;
27
- virtual jsi::Value identify(jsi::Runtime &rt, jsi::String distinctId) = 0;
28
-
29
- };
30
-
31
- template <typename T>
32
- class JSI_EXPORT NativeMixpanelReactNativeSessionReplayCxxSpec : public TurboModule {
33
- public:
34
- jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
35
- return delegate_.create(rt, propName);
36
- }
37
-
38
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
39
- return delegate_.getPropertyNames(runtime);
40
- }
41
-
42
- static constexpr std::string_view kModuleName = "MixpanelReactNativeSessionReplay";
43
-
44
- protected:
45
- NativeMixpanelReactNativeSessionReplayCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
46
- : TurboModule(std::string{NativeMixpanelReactNativeSessionReplayCxxSpec::kModuleName}, jsInvoker),
47
- delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
48
-
49
-
50
- private:
51
- class Delegate : public NativeMixpanelReactNativeSessionReplayCxxSpecJSI {
52
- public:
53
- Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
54
- NativeMixpanelReactNativeSessionReplayCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
55
-
56
- }
57
-
58
- jsi::Value initialize(jsi::Runtime &rt, jsi::String token, jsi::String distinctId, jsi::String configJSON) override {
59
- static_assert(
60
- bridging::getParameterCount(&T::initialize) == 4,
61
- "Expected initialize(...) to have 4 parameters");
62
-
63
- return bridging::callFromJs<jsi::Value>(
64
- rt, &T::initialize, jsInvoker_, instance_, std::move(token), std::move(distinctId), std::move(configJSON));
65
- }
66
- jsi::Value startRecording(jsi::Runtime &rt) override {
67
- static_assert(
68
- bridging::getParameterCount(&T::startRecording) == 1,
69
- "Expected startRecording(...) to have 1 parameters");
70
-
71
- return bridging::callFromJs<jsi::Value>(
72
- rt, &T::startRecording, jsInvoker_, instance_);
73
- }
74
- jsi::Value stopRecording(jsi::Runtime &rt) override {
75
- static_assert(
76
- bridging::getParameterCount(&T::stopRecording) == 1,
77
- "Expected stopRecording(...) to have 1 parameters");
78
-
79
- return bridging::callFromJs<jsi::Value>(
80
- rt, &T::stopRecording, jsInvoker_, instance_);
81
- }
82
- jsi::Value isRecording(jsi::Runtime &rt) override {
83
- static_assert(
84
- bridging::getParameterCount(&T::isRecording) == 1,
85
- "Expected isRecording(...) to have 1 parameters");
86
-
87
- return bridging::callFromJs<jsi::Value>(
88
- rt, &T::isRecording, jsInvoker_, instance_);
89
- }
90
- jsi::Value identify(jsi::Runtime &rt, jsi::String distinctId) override {
91
- static_assert(
92
- bridging::getParameterCount(&T::identify) == 2,
93
- "Expected identify(...) to have 2 parameters");
94
-
95
- return bridging::callFromJs<jsi::Value>(
96
- rt, &T::identify, jsInvoker_, instance_, std::move(distinctId));
97
- }
98
-
99
- private:
100
- friend class NativeMixpanelReactNativeSessionReplayCxxSpec;
101
- T *instance_;
102
- };
103
-
104
- Delegate delegate_;
105
- };
106
-
107
- } // namespace facebook::react