@amplitude/session-replay-react-native 0.0.1-beta.3 → 0.1.0-beta.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 (52) hide show
  1. package/AmplitudeSessionReplayReactNative.podspec +3 -3
  2. package/README.md +13 -0
  3. package/android/build.gradle +24 -18
  4. package/android/src/main/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeModule.kt +16 -11
  5. package/android/src/newarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativePackage.kt +40 -0
  6. package/android/src/newarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeSpec.kt +7 -0
  7. package/android/src/{main → oldarch}/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativePackage.kt +2 -1
  8. package/android/src/oldarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeSpec.kt +20 -0
  9. package/ios/AMPNativeSessionReplay.mm +20 -0
  10. package/lib/commonjs/index.js +0 -7
  11. package/lib/commonjs/index.js.map +1 -1
  12. package/lib/commonjs/native-module.js +10 -1
  13. package/lib/commonjs/native-module.js.map +1 -1
  14. package/lib/commonjs/session-replay-config.js +27 -18
  15. package/lib/commonjs/session-replay-config.js.map +1 -1
  16. package/lib/commonjs/session-replay.js +52 -4
  17. package/lib/commonjs/session-replay.js.map +1 -1
  18. package/lib/commonjs/specs/NativeAmpSessionReplay.js +22 -0
  19. package/lib/commonjs/specs/NativeAmpSessionReplay.js.map +1 -0
  20. package/lib/commonjs/version.js +1 -2
  21. package/lib/commonjs/version.js.map +1 -1
  22. package/lib/module/index.js +0 -1
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/module/native-module.js +10 -2
  25. package/lib/module/native-module.js.map +1 -1
  26. package/lib/module/session-replay-config.js +24 -17
  27. package/lib/module/session-replay-config.js.map +1 -1
  28. package/lib/module/session-replay.js +52 -4
  29. package/lib/module/session-replay.js.map +1 -1
  30. package/lib/module/specs/NativeAmpSessionReplay.js +18 -0
  31. package/lib/module/specs/NativeAmpSessionReplay.js.map +1 -0
  32. package/lib/module/version.js +1 -2
  33. package/lib/module/version.js.map +1 -1
  34. package/lib/typescript/amp-mask-view.d.ts +1 -1
  35. package/lib/typescript/amp-mask-view.d.ts.map +1 -1
  36. package/lib/typescript/index.d.ts +1 -1
  37. package/lib/typescript/index.d.ts.map +1 -1
  38. package/lib/typescript/native-module.d.ts.map +1 -1
  39. package/lib/typescript/session-replay-config.d.ts +31 -16
  40. package/lib/typescript/session-replay-config.d.ts.map +1 -1
  41. package/lib/typescript/session-replay.d.ts.map +1 -1
  42. package/lib/typescript/specs/NativeAmpSessionReplay.d.ts +15 -0
  43. package/lib/typescript/specs/NativeAmpSessionReplay.d.ts.map +1 -0
  44. package/lib/typescript/version.d.ts +1 -1
  45. package/lib/typescript/version.d.ts.map +1 -1
  46. package/package.json +27 -20
  47. package/src/index.tsx +1 -1
  48. package/src/native-module.ts +16 -10
  49. package/src/session-replay-config.ts +39 -17
  50. package/src/session-replay.ts +42 -7
  51. package/src/specs/NativeAmpSessionReplay.ts +29 -0
  52. package/src/version.ts +1 -2
@@ -16,8 +16,8 @@ Pod::Spec.new do |s|
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
 
19
- s.dependency 'AmplitudeSessionReplay', '>=0.4.0'
20
- s.dependency 'AmplitudeCore', '>=1.1.0'
19
+ s.dependency 'AmplitudeSessionReplay', '>=0.11.1'
20
+ s.dependency 'AmplitudeCore', '>=1.4.2'
21
21
 
22
22
  # This code is to support RN prior to 0.71.0. Should be removed when we drop support for RN < 0.71.0.
23
23
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
@@ -42,4 +42,4 @@ Pod::Spec.new do |s|
42
42
  s.dependency "ReactCommon/turbomodule/core"
43
43
  end
44
44
  end
45
- end
45
+ end
package/README.md CHANGED
@@ -8,6 +8,19 @@ Amplitude Session Replay for React Native
8
8
  npm install @amplitude/session-replay-react-native
9
9
  ```
10
10
 
11
+ ## React Native New Architecture
12
+
13
+ This SDK supports both the New Architecture (Bridgeless / TurboModules) and the
14
+ legacy architecture. On the New Architecture the native module is exposed as a
15
+ TurboModule; on the legacy architecture it continues to work as a standard bridge
16
+ module. No configuration is required — the correct implementation is selected
17
+ automatically based on how your app is built.
18
+
19
+ `peerDependencies` are intentionally left unconstrained (`react-native: "*"`) so
20
+ the SDK keeps working on older React Native versions on the legacy architecture.
21
+ The TurboModule code path is compiled only when the New Architecture is enabled,
22
+ which itself requires React Native 0.74 or newer.
23
+
11
24
  ## Usage
12
25
 
13
26
  ### Session Replay React Native Standalone SDK
@@ -1,19 +1,3 @@
1
- buildscript {
2
- // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
- def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["SessionReplayReactNative_kotlinVersion"]
4
-
5
- repositories {
6
- google()
7
- mavenCentral()
8
- }
9
-
10
- dependencies {
11
- classpath "com.android.tools.build:gradle:7.2.1"
12
- // noinspection DifferentKotlinGradleVersion
13
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
- }
15
- }
16
-
17
1
  def reactNativeArchitectures() {
18
2
  def value = rootProject.getProperties().get("reactNativeArchitectures")
19
3
  return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
@@ -58,6 +42,18 @@ android {
58
42
  }
59
43
  }
60
44
 
45
+ // New Arch compiles src/newarch (codegen spec + BaseReactPackage); Old Arch
46
+ // compiles src/oldarch (hand-written spec + plain ReactPackage).
47
+ sourceSets {
48
+ main {
49
+ if (isNewArchitectureEnabled()) {
50
+ java.srcDirs += ['src/newarch/java']
51
+ } else {
52
+ java.srcDirs += ['src/oldarch/java']
53
+ }
54
+ }
55
+ }
56
+
61
57
  compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
62
58
 
63
59
  defaultConfig {
@@ -90,8 +86,8 @@ repositories {
90
86
  def kotlin_version = getExtOrDefault("kotlinVersion")
91
87
 
92
88
  dependencies {
93
- implementation("com.amplitude:session-replay-android:[0.22.0,0.23.0)")
94
- implementation("com.amplitude:analytics-android:[1.22.4,1.23.0)")
89
+ implementation("com.amplitude:session-replay-android:[0.24.0,0.25.0)")
90
+ implementation("com.amplitude:analytics-android:[1.25.0,1.26.0)")
95
91
 
96
92
  // For < 0.71, this will be from the local maven repo
97
93
  // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
@@ -99,3 +95,13 @@ dependencies {
99
95
  implementation "com.facebook.react:react-native:+"
100
96
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
101
97
  }
98
+
99
+ // Codegen for the TurboModule spec (New Architecture only). Generates
100
+ // NativeAmpSessionReplaySpec from src/specs/NativeAmpSessionReplay.ts.
101
+ if (isNewArchitectureEnabled()) {
102
+ react {
103
+ jsRootDir = file("../src/specs/")
104
+ libraryName = "AmpSessionReplaySpec"
105
+ codegenJavaPackageName = "com.amplitude.sessionreplayreactnative"
106
+ }
107
+ }
@@ -7,23 +7,24 @@ import com.amplitude.common.Logger
7
7
  import com.amplitude.common.android.LogcatLogger
8
8
  import com.amplitude.core.ServerZone
9
9
  import com.facebook.react.bridge.ReactApplicationContext
10
- import com.facebook.react.bridge.ReactContextBaseJavaModule
11
10
  import com.facebook.react.bridge.ReactMethod
12
11
  import com.facebook.react.bridge.Promise
13
12
  import com.facebook.react.bridge.WritableMap
14
13
  import com.facebook.react.bridge.WritableNativeMap
15
14
  import com.facebook.react.bridge.ReadableMap
16
15
 
16
+ // `@ReactMethod` is required on the legacy architecture and ignored on the new
17
+ // one, so it stays on the overrides below.
17
18
  class SessionReplayReactNativeModule(private val reactContext: ReactApplicationContext) :
18
- ReactContextBaseJavaModule(reactContext) {
19
+ SessionReplayReactNativeSpec(reactContext) {
19
20
  private lateinit var sessionReplay: SessionReplay
20
21
 
21
22
  override fun getName(): String {
22
- return "AMPNativeSessionReplay"
23
+ return NAME
23
24
  }
24
25
 
25
26
  @ReactMethod
26
- fun setup(config: ReadableMap, promise: Promise) {
27
+ override fun setup(config: ReadableMap, promise: Promise) {
27
28
  try {
28
29
  val apiKey = config.getString("apiKey") ?: throw IllegalArgumentException("apiKey is required")
29
30
  val deviceId = config.getString("deviceId")
@@ -88,7 +89,7 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
88
89
  }
89
90
 
90
91
  @ReactMethod
91
- fun setSessionId(sessionId: Double, promise: Promise) {
92
+ override fun setSessionId(sessionId: Double, promise: Promise) {
92
93
  try {
93
94
  sessionReplay.setSessionId(sessionId.toLong())
94
95
  promise.resolve(null)
@@ -98,7 +99,7 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
98
99
  }
99
100
 
100
101
  @ReactMethod
101
- fun setDeviceId(deviceId: String?, promise: Promise) {
102
+ override fun setDeviceId(deviceId: String?, promise: Promise) {
102
103
  try {
103
104
  sessionReplay.setDeviceId(deviceId ?: "")
104
105
  promise.resolve(null)
@@ -108,7 +109,7 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
108
109
  }
109
110
 
110
111
  @ReactMethod
111
- fun getSessionId(promise: Promise) {
112
+ override fun getSessionId(promise: Promise) {
112
113
  try {
113
114
  promise.resolve(sessionReplay.getSessionId().toDouble())
114
115
  } catch (e: Exception) {
@@ -117,7 +118,7 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
117
118
  }
118
119
 
119
120
  @ReactMethod
120
- fun getSessionReplayProperties(promise: Promise) {
121
+ override fun getSessionReplayProperties(promise: Promise) {
121
122
  try {
122
123
  val properties: Map<String, Any> = sessionReplay.getSessionReplayProperties()
123
124
  val map: WritableMap = WritableNativeMap()
@@ -141,7 +142,7 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
141
142
  }
142
143
 
143
144
  @ReactMethod
144
- fun start(promise: Promise) {
145
+ override fun start(promise: Promise) {
145
146
  try {
146
147
  sessionReplay.start()
147
148
  promise.resolve(null)
@@ -151,7 +152,7 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
151
152
  }
152
153
 
153
154
  @ReactMethod
154
- fun stop(promise: Promise) {
155
+ override fun stop(promise: Promise) {
155
156
  try {
156
157
  sessionReplay.stop()
157
158
  promise.resolve(null)
@@ -161,7 +162,7 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
161
162
  }
162
163
 
163
164
  @ReactMethod
164
- fun flush(promise: Promise) {
165
+ override fun flush(promise: Promise) {
165
166
  try {
166
167
  sessionReplay.flush()
167
168
  promise.resolve(null)
@@ -180,4 +181,8 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
180
181
  sessionReplay.shutdown()
181
182
  }
182
183
  }
184
+
185
+ companion object {
186
+ const val NAME = "AMPNativeSessionReplay"
187
+ }
183
188
  }
@@ -0,0 +1,40 @@
1
+ package com.amplitude.sessionreplayreactnative
2
+
3
+ import com.facebook.react.BaseReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfo
7
+ import com.facebook.react.module.model.ReactModuleInfoProvider
8
+ import com.facebook.react.uimanager.ViewManager
9
+
10
+ // BaseReactPackage (RN >= 0.74) registers the module as a TurboModule. It lives in
11
+ // the newarch source set so it is compiled only when the New Architecture is
12
+ // enabled; legacy-arch apps on older RN never reference it.
13
+ class SessionReplayReactNativePackage : BaseReactPackage() {
14
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
15
+ return if (name == SessionReplayReactNativeModule.NAME) {
16
+ SessionReplayReactNativeModule(reactContext)
17
+ } else {
18
+ null
19
+ }
20
+ }
21
+
22
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
23
+ return ReactModuleInfoProvider {
24
+ mapOf(
25
+ SessionReplayReactNativeModule.NAME to ReactModuleInfo(
26
+ SessionReplayReactNativeModule.NAME, // name
27
+ SessionReplayReactNativeModule.NAME, // className
28
+ false, // canOverrideExistingModule
29
+ false, // needsEagerInit
30
+ false, // isCxxModule
31
+ true, // isTurboModule
32
+ ),
33
+ )
34
+ }
35
+ }
36
+
37
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
38
+ return listOf(SessionReplayReactNativeViewManager())
39
+ }
40
+ }
@@ -0,0 +1,7 @@
1
+ package com.amplitude.sessionreplayreactnative
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext
4
+
5
+ // Codegen-generated base (from src/specs/NativeAmpSessionReplay.ts); makes the module a TurboModule.
6
+ abstract class SessionReplayReactNativeSpec(reactContext: ReactApplicationContext) :
7
+ NativeAmpSessionReplaySpec(reactContext)
@@ -5,7 +5,8 @@ import com.facebook.react.bridge.NativeModule
5
5
  import com.facebook.react.bridge.ReactApplicationContext
6
6
  import com.facebook.react.uimanager.ViewManager
7
7
 
8
-
8
+ // Plain ReactPackage using only APIs present in every supported RN version, so
9
+ // older legacy-arch apps keep building unchanged (no peerDependencies floor).
9
10
  class SessionReplayReactNativePackage : ReactPackage {
10
11
  override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
11
12
  return listOf(SessionReplayReactNativeModule(reactContext))
@@ -0,0 +1,20 @@
1
+ package com.amplitude.sessionreplayreactnative
2
+
3
+ import com.facebook.react.bridge.Promise
4
+ import com.facebook.react.bridge.ReactApplicationContext
5
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
6
+ import com.facebook.react.bridge.ReadableMap
7
+
8
+ // Legacy-arch counterpart of the codegen spec: same method signatures so the
9
+ // module's `override`s compile against both bases.
10
+ abstract class SessionReplayReactNativeSpec(reactContext: ReactApplicationContext) :
11
+ ReactContextBaseJavaModule(reactContext) {
12
+ abstract fun setup(config: ReadableMap, promise: Promise)
13
+ abstract fun setSessionId(sessionId: Double, promise: Promise)
14
+ abstract fun setDeviceId(deviceId: String?, promise: Promise)
15
+ abstract fun getSessionId(promise: Promise)
16
+ abstract fun getSessionReplayProperties(promise: Promise)
17
+ abstract fun start(promise: Promise)
18
+ abstract fun stop(promise: Promise)
19
+ abstract fun flush(promise: Promise)
20
+ }
@@ -19,3 +19,23 @@ RCT_EXTERN_METHOD(start:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseReject
19
19
  RCT_EXTERN_METHOD(stop:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
20
20
 
21
21
  @end
22
+
23
+ #ifdef RCT_NEW_ARCH_ENABLED
24
+ // Bind the Swift module to the codegen TurboModule interface. A named category is
25
+ // required because a Swift class cannot gain protocol conformance via an anonymous
26
+ // class extension.
27
+ #import <AmpSessionReplaySpec/AmpSessionReplaySpec.h>
28
+
29
+ @interface AMPNativeSessionReplay (TurboModule) <RCTTurboModule>
30
+ @end
31
+
32
+ @implementation AMPNativeSessionReplay (TurboModule)
33
+
34
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
35
+ (const facebook::react::ObjCTurboModule::InitParams &)params
36
+ {
37
+ return std::make_shared<facebook::react::NativeAmpSessionReplaySpecJSI>(params);
38
+ }
39
+
40
+ @end
41
+ #endif
@@ -9,12 +9,6 @@ Object.defineProperty(exports, "AmpMaskView", {
9
9
  return _ampMaskView.AmpMaskView;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "MaskLevel", {
13
- enumerable: true,
14
- get: function () {
15
- return _sessionReplayConfig.MaskLevel;
16
- }
17
- });
18
12
  Object.defineProperty(exports, "SessionReplayPlugin", {
19
13
  enumerable: true,
20
14
  get: function () {
@@ -70,7 +64,6 @@ Object.defineProperty(exports, "stop", {
70
64
  }
71
65
  });
72
66
  var _sessionReplay = require("./session-replay");
73
- var _sessionReplayConfig = require("./session-replay-config");
74
67
  var _pluginSessionReplay = require("./plugin-session-replay");
75
68
  var _ampMaskView = require("./amp-mask-view");
76
69
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_sessionReplay","require","_sessionReplayConfig","_pluginSessionReplay","_ampMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAUA,IAAAC,oBAAA,GAAAD,OAAA;AAEA,IAAAE,oBAAA,GAAAF,OAAA;AAGA,IAAAG,YAAA,GAAAH,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_sessionReplay","require","_pluginSessionReplay","_ampMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAYA,IAAAC,oBAAA,GAAAD,OAAA;AAGA,IAAAE,YAAA,GAAAF,OAAA","ignoreList":[]}
@@ -5,11 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.NativeSessionReplay = void 0;
7
7
  var _reactNative = require("react-native");
8
+ var _NativeAmpSessionReplay = _interopRequireDefault(require("./specs/NativeAmpSessionReplay"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
10
  const LINKING_ERROR = `The package '@amplitude/session-replay-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
9
11
  ios: "- You have run 'pod install'\n",
10
12
  default: ''
11
13
  }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
12
- const NativeSessionReplay = exports.NativeSessionReplay = _reactNative.NativeModules.AMPNativeSessionReplay ? _reactNative.NativeModules.AMPNativeSessionReplay : new Proxy({}, {
14
+
15
+ // JS callers use the rich, hand-written types below for full type safety; the
16
+ // codegen `Spec` is intentionally loose (`UnsafeObject`) at the native boundary.
17
+ // The spec resolves the native module via `TurboModuleRegistry.get` (both
18
+ // architectures). When the module isn't linked it resolves to null, so we fall
19
+ // back to a proxy that throws a descriptive linking error on first use rather
20
+ // than crashing app startup at import time.
21
+ const NativeSessionReplay = exports.NativeSessionReplay = _NativeAmpSessionReplay.default ?? new Proxy({}, {
13
22
  get() {
14
23
  throw new Error(LINKING_ERROR);
15
24
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","NativeSessionReplay","exports","NativeModules","AMPNativeSessionReplay","Proxy","get","Error"],"sourceRoot":"../../src","sources":["native-module.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,iGAAiG,GACjGC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAE1B,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGE,0BAAa,CAACC,sBAAsB,GAClED,0BAAa,CAACC,sBAAsB,GACpC,IAAIC,KAAK,CACR,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACX,aAAa,CAAC;EAChC;AACF,CACF,CAA6B;;AAEjC;AACA;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_NativeAmpSessionReplay","_interopRequireDefault","e","__esModule","default","LINKING_ERROR","Platform","select","ios","NativeSessionReplay","exports","SessionReplaySpec","Proxy","get","Error"],"sourceRoot":"../../src","sources":["native-module.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA+D,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/D,MAAMG,aAAa,GACjB,iGAAiG,GACjGC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEJ,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAIE,+BAAiB,IACnD,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAwC;;AAE1C;AACA;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -9,37 +9,46 @@ Object.defineProperty(exports, "LogLevel", {
9
9
  return _analyticsTypes.LogLevel;
10
10
  }
11
11
  });
12
- exports.getDefaultConfig = exports.MaskLevel = void 0;
12
+ exports.getDefaultConfig = void 0;
13
13
  var _analyticsTypes = require("@amplitude/analytics-types");
14
14
  /**
15
- * Masking levels for sensitive content in session replay
15
+ * Masking levels for sensitive content in session replay.
16
+ *
17
+ * Declared as a string-literal union (rather than an `enum`) to match the
18
+ * Session Replay browser SDK and avoid the const-enum inlining pitfalls of
19
+ * string enums under aggressive compilers.
20
+ *
21
+ * - `light`: mask only inputs that are always sensitive (password, etc.).
22
+ * - `medium`: mask all `<TextInput>` fields.
23
+ * - `conservative`: mask all `<TextInput>` fields and all `<Text>` content.
16
24
  */
17
- let MaskLevel = exports.MaskLevel = /*#__PURE__*/function (MaskLevel) {
18
- /**
19
- * Light masking - minimal content is masked
20
- */
21
- MaskLevel["Light"] = "light";
22
- /**
23
- * Medium masking - balanced approach to content masking
24
- */
25
- MaskLevel["Medium"] = "medium";
26
- /**
27
- * Conservative masking - maximum content masking for privacy
28
- */
29
- MaskLevel["Conservative"] = "conservative";
30
- return MaskLevel;
31
- }({});
25
+
32
26
  /**
33
27
  * Configuration for Session Replay React Native SDK
34
28
  */
29
+
30
+ /**
31
+ * Internal config shape used by the SDK after the public `SessionReplayConfig`
32
+ * is normalized at the input boundary. The deprecated top-level `maskLevel` is
33
+ * folded into `privacyConfig` by `normalizeConfig`, so nothing past that point
34
+ * needs to know the deprecated field ever existed.
35
+ *
36
+ * Not exported from `index.tsx` on purpose — this is an implementation detail
37
+ * of the session replay module.
38
+ */
39
+
35
40
  const getDefaultConfig = () => {
36
41
  return {
37
42
  autoStart: true,
38
43
  deviceId: null,
39
44
  enableRemoteConfig: true,
40
45
  logLevel: _analyticsTypes.LogLevel.Warn,
41
- maskLevel: MaskLevel.Medium,
42
46
  optOut: false,
47
+ // Intentionally left without a `maskLevel`: the effective default
48
+ // (`'medium'`) is resolved once at the native boundary in `nativeConfig()`.
49
+ // Baking it in here would make the deprecated top-level `maskLevel`
50
+ // unreachable through the `?? 'medium'` fallback (silent privacy downgrade).
51
+ privacyConfig: {},
43
52
  sampleRate: 0,
44
53
  serverZone: 'US',
45
54
  sessionId: -1
@@ -1 +1 @@
1
- {"version":3,"names":["_analyticsTypes","require","MaskLevel","exports","getDefaultConfig","autoStart","deviceId","enableRemoteConfig","logLevel","LogLevel","Warn","maskLevel","Medium","optOut","sampleRate","serverZone","sessionId"],"sourceRoot":"../../src","sources":["session-replay-config.ts"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA;AACA;AACA;AAFA,IAGYC,SAAS,GAAAC,OAAA,CAAAD,SAAA,0BAATA,SAAS;EACnB;AACF;AACA;EAHYA,SAAS;EAKnB;AACF;AACA;EAPYA,SAAS;EASnB;AACF;AACA;EAXYA,SAAS;EAAA,OAATA,SAAS;AAAA;AAerB;AACA;AACA;AAmEO,MAAME,gBAAqE,GAAGA,CAAA,KAAM;EACzF,OAAO;IACLC,SAAS,EAAE,IAAI;IACfC,QAAQ,EAAE,IAAI;IACdC,kBAAkB,EAAE,IAAI;IACxBC,QAAQ,EAAEC,wBAAQ,CAACC,IAAI;IACvBC,SAAS,EAAET,SAAS,CAACU,MAAM;IAC3BC,MAAM,EAAE,KAAK;IACbC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,IAAI;IAChBC,SAAS,EAAE,CAAC;EACd,CAAC;AACH,CAAC;AAACb,OAAA,CAAAC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_analyticsTypes","require","getDefaultConfig","autoStart","deviceId","enableRemoteConfig","logLevel","LogLevel","Warn","optOut","privacyConfig","sampleRate","serverZone","sessionId","exports"],"sourceRoot":"../../src","sources":["session-replay-config.ts"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;;AA2EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGO,MAAMC,gBAA6E,GAAGA,CAAA,KAAM;EACjG,OAAO;IACLC,SAAS,EAAE,IAAI;IACfC,QAAQ,EAAE,IAAI;IACdC,kBAAkB,EAAE,IAAI;IACxBC,QAAQ,EAAEC,wBAAQ,CAACC,IAAI;IACvBC,MAAM,EAAE,KAAK;IACb;IACA;IACA;IACA;IACAC,aAAa,EAAE,CAAC,CAAC;IACjBC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,IAAI;IAChBC,SAAS,EAAE,CAAC;EACd,CAAC;AACH,CAAC;AAACC,OAAA,CAAAZ,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -18,6 +18,37 @@ var _logger = require("./logger");
18
18
  var _version = require("./version");
19
19
  // @refresh reset
20
20
 
21
+ /**
22
+ * Translates the public `SessionReplayConfig` into the internal shape by
23
+ * folding the deprecated top-level `maskLevel` into `privacyConfig`. After
24
+ * this step, the rest of the SDK only ever sees `privacyConfig`.
25
+ *
26
+ * `privacyConfig` wins when explicitly set; otherwise translate the
27
+ * deprecated `maskLevel`; otherwise leave the field out so the default
28
+ * supplied by `getDefaultConfig()` survives the shallow merge in `init()`.
29
+ */
30
+ function normalizeConfig(config) {
31
+ const {
32
+ maskLevel,
33
+ privacyConfig,
34
+ ...rest
35
+ } = config;
36
+ if (privacyConfig !== undefined) {
37
+ return {
38
+ ...rest,
39
+ privacyConfig
40
+ };
41
+ }
42
+ if (maskLevel !== undefined) {
43
+ return {
44
+ ...rest,
45
+ privacyConfig: {
46
+ maskLevel
47
+ }
48
+ };
49
+ }
50
+ return rest;
51
+ }
21
52
  let fullConfig = null;
22
53
  let isInitialized = false;
23
54
  let logger = (0, _logger.createSessionReplayLogger)();
@@ -45,9 +76,14 @@ async function init(config) {
45
76
  logger.warn('SessionReplay is already initialized');
46
77
  return;
47
78
  }
79
+
80
+ // TODO: this is a shallow merge — a user-supplied `privacyConfig` replaces
81
+ // the default object wholesale. That's fine while `PrivacyConfig` only
82
+ // carries `maskLevel`, but if it ever grows more fields a deeper merge will
83
+ // be needed so partial user configs don't drop defaults.
48
84
  fullConfig = {
49
85
  ...(0, _sessionReplayConfig.getDefaultConfig)(),
50
- ...config
86
+ ...normalizeConfig(config)
51
87
  };
52
88
  logger.setLogLevel(fullConfig.logLevel);
53
89
  logger.log(`initializing @amplitude/session-replay-react-native version: ${_version.VERSION} with config: `, fullConfig);
@@ -213,10 +249,22 @@ async function stop() {
213
249
  await _nativeModule.NativeSessionReplay.stop();
214
250
  }
215
251
  function nativeConfig(config) {
252
+ // Resolve the effective mask level here — the single source of truth for the
253
+ // default. `normalizeConfig()` already folded the deprecated top-level
254
+ // `maskLevel` into `privacyConfig`, but `privacyConfig.maskLevel` can still be
255
+ // `undefined` (no user value and no baked-in default), so fall back to
256
+ // `'medium'`. Strip `privacyConfig` from the spread because the native bridge
257
+ // only takes a flat `maskLevel` string.
258
+ const {
259
+ privacyConfig,
260
+ ...rest
261
+ } = config;
262
+ const resolvedMaskLevel = privacyConfig.maskLevel ?? 'medium';
216
263
  return {
217
- ...config,
218
- logLevel: config.logLevel,
219
- maskLevel: config.maskLevel.toString()
264
+ ...rest,
265
+ logLevel: rest.logLevel,
266
+ // TODO(SDKRN-15): Migrate native bridge to accept the full privacyConfig object instead of a flat maskLevel string.
267
+ maskLevel: resolvedMaskLevel
220
268
  };
221
269
  }
222
270
  async function privateInit(config, newLogger) {
@@ -1 +1 @@
1
- {"version":3,"names":["_nativeModule","require","_sessionReplayConfig","_logger","_version","fullConfig","isInitialized","logger","createSessionReplayLogger","init","config","warn","getDefaultConfig","setLogLevel","logLevel","log","VERSION","NativeSessionReplay","setup","nativeConfig","error","setSessionId","sessionId","setDeviceId","deviceId","getSessionId","getSessionReplayProperties","properties","flush","start","stop","maskLevel","toString","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;;AAOA,IAAII,UAAgD,GAAG,IAAI;AAC3D,IAAIC,aAAa,GAAG,KAAK;AACzB,IAAIC,MAAM,GAAG,IAAAC,iCAAyB,EAAC,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,IAAIA,CAACC,MAA2B,EAAiB;EACrE,IAAIJ,aAAa,EAAE;IACjBC,MAAM,CAACI,IAAI,CAAC,sCAAsC,CAAC;IACnD;EACF;EAEAN,UAAU,GAAG;IACX,GAAG,IAAAO,qCAAgB,EAAC,CAAC;IACrB,GAAGF;EACL,CAAC;EAEDH,MAAM,CAACM,WAAW,CAACR,UAAU,CAACS,QAAQ,CAAC;EACvCP,MAAM,CAACQ,GAAG,CAAC,gEAAgEC,gBAAO,gBAAgB,EAAEX,UAAU,CAAC;EAE/G,IAAI;IACF,MAAMY,iCAAmB,CAACC,KAAK,CAACC,YAAY,CAACd,UAAU,CAAC,CAAC;IACzDE,MAAM,CAACQ,GAAG,CAAC,2BAA2B,CAAC;IACvCT,aAAa,GAAG,IAAI;EACtB,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ACA;AACA;AACA;AACA;AACO,eAAeC,KAAKA,CAAA,EAAkB;EAC3C,IAAI,CAACtB,aAAa,EAAE;IAClBC,MAAM,CAACI,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMM,iCAAmB,CAACW,KAAK,CAAC,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,KAAKA,CAAA,EAAkB;EAC3C,IAAI,CAACvB,aAAa,EAAE;IAClBC,MAAM,CAACI,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMM,iCAAmB,CAACY,KAAK,CAAC,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,IAAIA,CAAA,EAAkB;EAC1C,IAAI,CAACxB,aAAa,EAAE;IAClBC,MAAM,CAACI,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMM,iCAAmB,CAACa,IAAI,CAAC,CAAC;AAClC;AAEA,SAASX,YAAYA,CAACT,MAAqC,EAA6B;EACtF,OAAO;IACL,GAAGA,MAAM;IACTI,QAAQ,EAAEJ,MAAM,CAACI,QAAiD;IAClEiB,SAAS,EAAErB,MAAM,CAACqB,SAAS,CAACC,QAAQ,CAAC;EACvC,CAAC;AACH;AAEO,eAAeC,WAAWA,CAC/BvB,MAA2B,EAC3BwB,SAAuD,EACxC;EACf3B,MAAM,GAAG2B,SAAS;EAClB,OAAOzB,IAAI,CAACC,MAAM,CAAC;AACrB","ignoreList":[]}
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","getSessionReplayProperties","properties","flush","start","stop","resolvedMaskLevel","privateInit","newLogger"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":";;;;;;;;;;;;;;AAEA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AALA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,eAAeA,CAACC,MAA2B,EAA+B;EACjF,MAAM;IAAEC,SAAS;IAAEC,aAAa;IAAE,GAAGC;EAAK,CAAC,GAAGH,MAAM;EACpD,IAAIE,aAAa,KAAKE,SAAS,EAAE;IAC/B,OAAO;MAAE,GAAGD,IAAI;MAAED;IAAc,CAAC;EACnC;EACA,IAAID,SAAS,KAAKG,SAAS,EAAE;IAC3B,OAAO;MAAE,GAAGD,IAAI;MAAED,aAAa,EAAE;QAAED;MAAU;IAAE,CAAC;EAClD;EACA,OAAOE,IAAI;AACb;AAEA,IAAIE,UAA8C,GAAG,IAAI;AACzD,IAAIC,aAAa,GAAG,KAAK;AACzB,IAAIC,MAAM,GAAG,IAAAC,iCAAyB,EAAC,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,IAAIA,CAACT,MAA2B,EAAiB;EACrE,IAAIM,aAAa,EAAE;IACjBC,MAAM,CAACG,IAAI,CAAC,sCAAsC,CAAC;IACnD;EACF;;EAEA;EACA;EACA;EACA;EACAL,UAAU,GAAG;IACX,GAAG,IAAAM,qCAAgB,EAAC,CAAC;IACrB,GAAGZ,eAAe,CAACC,MAAM;EAC3B,CAAC;EAEDO,MAAM,CAACK,WAAW,CAACP,UAAU,CAACQ,QAAQ,CAAC;EACvCN,MAAM,CAACO,GAAG,CAAC,gEAAgEC,gBAAO,gBAAgB,EAAEV,UAAU,CAAC;EAE/G,IAAI;IACF,MAAMW,iCAAmB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ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ // The codegen types live in a Flow-typed file that eslint-plugin-import cannot parse.
9
+ // eslint-disable-next-line import/namespace
10
+ // Codegen TurboModule spec for the imperative Session Replay module.
11
+ //
12
+ // The config crosses the bridge as an untyped object: the native side already
13
+ // reads a ReadableMap / NSDictionary, and app-boundary type safety lives in the
14
+ // public `SessionReplayConfig`. See native-module.ts for the typed facade that
15
+ // JS callers actually use.
16
+ // Use non-enforcing `get` (returns null when the native module isn't linked)
17
+ // so importing the package never crashes app startup. The typed facade in
18
+ // native-module.ts throws a friendly linking error lazily on first use instead.
19
+ // Works on both architectures: JSI on the New Architecture, legacy NativeModules
20
+ // fallback on the old one.
21
+ var _default = exports.default = _reactNative.TurboModuleRegistry.get('AMPNativeSessionReplay');
22
+ //# sourceMappingURL=NativeAmpSessionReplay.js.map
@@ -0,0 +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;AAYA;AACA;AACA;AACA;AACA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACeC,gCAAmB,CAACC,GAAG,CAAO,wBAAwB,CAAC","ignoreList":[]}
@@ -4,6 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.VERSION = void 0;
7
- // Autogenerated by `yarn version-file`. DO NOT EDIT
8
- const VERSION = exports.VERSION = '0.0.1-beta.3';
7
+ const VERSION = exports.VERSION = '0.1.0-beta.1';
9
8
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["VERSION","exports"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;;;;;AAAA;AACO,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,cAAc","ignoreList":[]}
@@ -1,5 +1,4 @@
1
1
  export { init, setSessionId, getSessionId, getSessionReplayProperties, flush, start, stop, setDeviceId } from './session-replay';
2
- export { MaskLevel } from './session-replay-config';
3
2
  export { SessionReplayPlugin } from './plugin-session-replay';
4
3
  export { AmpMaskView } from './amp-mask-view';
5
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["init","setSessionId","getSessionId","getSessionReplayProperties","flush","start","stop","setDeviceId","MaskLevel","SessionReplayPlugin","AmpMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SACEA,IAAI,EACJC,YAAY,EACZC,YAAY,EACZC,0BAA0B,EAC1BC,KAAK,EACLC,KAAK,EACLC,IAAI,EACJC,WAAW,QACN,kBAAkB;AACzB,SAAmCC,SAAS,QAAQ,yBAAyB;AAE7E,SAASC,mBAAmB,QAAQ,yBAAyB;AAG7D,SAASC,WAAW,QAAQ,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["init","setSessionId","getSessionId","getSessionReplayProperties","flush","start","stop","setDeviceId","SessionReplayPlugin","AmpMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SACEA,IAAI,EACJC,YAAY,EACZC,YAAY,EACZC,0BAA0B,EAC1BC,KAAK,EACLC,KAAK,EACLC,IAAI,EACJC,WAAW,QACN,kBAAkB;AAGzB,SAASC,mBAAmB,QAAQ,yBAAyB;AAG7D,SAASC,WAAW,QAAQ,iBAAiB","ignoreList":[]}
@@ -1,9 +1,17 @@
1
- import { NativeModules, Platform } from 'react-native';
1
+ import { Platform } from 'react-native';
2
+ import SessionReplaySpec from './specs/NativeAmpSessionReplay';
2
3
  const LINKING_ERROR = `The package '@amplitude/session-replay-react-native' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
3
4
  ios: "- You have run 'pod install'\n",
4
5
  default: ''
5
6
  }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
6
- export const NativeSessionReplay = NativeModules.AMPNativeSessionReplay ? NativeModules.AMPNativeSessionReplay : new Proxy({}, {
7
+
8
+ // JS callers use the rich, hand-written types below for full type safety; the
9
+ // codegen `Spec` is intentionally loose (`UnsafeObject`) at the native boundary.
10
+ // The spec resolves the native module via `TurboModuleRegistry.get` (both
11
+ // architectures). When the module isn't linked it resolves to null, so we fall
12
+ // back to a proxy that throws a descriptive linking error on first use rather
13
+ // than crashing app startup at import time.
14
+ export const NativeSessionReplay = SessionReplaySpec ?? new Proxy({}, {
7
15
  get() {
8
16
  throw new Error(LINKING_ERROR);
9
17
  }
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","NativeSessionReplay","AMPNativeSessionReplay","Proxy","get","Error"],"sourceRoot":"../../src","sources":["native-module.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,iGAAiG,GACjGD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,OAAO,MAAMC,mBAAmB,GAAGN,aAAa,CAACO,sBAAsB,GAClEP,aAAa,CAACO,sBAAsB,GACpC,IAAIC,KAAK,CACR,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CACF,CAA6B;;AAEjC;AACA;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["Platform","SessionReplaySpec","LINKING_ERROR","select","ios","default","NativeSessionReplay","Proxy","get","Error"],"sourceRoot":"../../src","sources":["native-module.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,iBAAiB,MAAM,gCAAgC;AAE9D,MAAMC,aAAa,GACjB,iGAAiG,GACjGF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAIL,iBAAiB,IACnD,IAAIM,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAwC;;AAE1C;AACA;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}