@amplitude/session-replay-react-native 0.0.1-beta.2 → 0.1.0-beta.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.
Files changed (33) hide show
  1. package/AmplitudeSessionReplayReactNative.podspec +3 -3
  2. package/android/build.gradle +2 -18
  3. package/android/src/main/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeModule.kt +6 -5
  4. package/lib/commonjs/index.js +0 -7
  5. package/lib/commonjs/index.js.map +1 -1
  6. package/lib/commonjs/session-replay-config.js +27 -18
  7. package/lib/commonjs/session-replay-config.js.map +1 -1
  8. package/lib/commonjs/session-replay.js +52 -4
  9. package/lib/commonjs/session-replay.js.map +1 -1
  10. package/lib/commonjs/version.js +1 -2
  11. package/lib/commonjs/version.js.map +1 -1
  12. package/lib/module/index.js +0 -1
  13. package/lib/module/index.js.map +1 -1
  14. package/lib/module/session-replay-config.js +24 -17
  15. package/lib/module/session-replay-config.js.map +1 -1
  16. package/lib/module/session-replay.js +52 -4
  17. package/lib/module/session-replay.js.map +1 -1
  18. package/lib/module/version.js +1 -2
  19. package/lib/module/version.js.map +1 -1
  20. package/lib/typescript/amp-mask-view.d.ts +1 -1
  21. package/lib/typescript/amp-mask-view.d.ts.map +1 -1
  22. package/lib/typescript/index.d.ts +1 -1
  23. package/lib/typescript/index.d.ts.map +1 -1
  24. package/lib/typescript/session-replay-config.d.ts +31 -16
  25. package/lib/typescript/session-replay-config.d.ts.map +1 -1
  26. package/lib/typescript/session-replay.d.ts.map +1 -1
  27. package/lib/typescript/version.d.ts +1 -1
  28. package/lib/typescript/version.d.ts.map +1 -1
  29. package/package.json +19 -20
  30. package/src/index.tsx +1 -1
  31. package/src/session-replay-config.ts +39 -17
  32. package/src/session-replay.ts +42 -7
  33. 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
@@ -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"]
@@ -90,8 +74,8 @@ repositories {
90
74
  def kotlin_version = getExtOrDefault("kotlinVersion")
91
75
 
92
76
  dependencies {
93
- implementation("com.amplitude:session-replay-android:[0.20.6]")
94
- implementation("com.amplitude:analytics-android:1.21.1")
77
+ implementation("com.amplitude:session-replay-android:[0.24.0,0.25.0)")
78
+ implementation("com.amplitude:analytics-android:[1.25.0,1.26.0)")
95
79
 
96
80
  // For < 0.71, this will be from the local maven repo
97
81
  // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
@@ -65,12 +65,13 @@ class SessionReplayReactNativeModule(private val reactContext: ReactApplicationC
65
65
  """.trimIndent())
66
66
 
67
67
  sessionReplay = SessionReplay(
68
- apiKey,
69
- reactContext.applicationContext,
70
- deviceId ?: "",
71
- sessionId,
72
- logger = LogcatLogger.logger,
68
+ apiKey = apiKey,
69
+ context = reactContext.applicationContext,
70
+ deviceId = deviceId ?: "",
71
+ sessionId = sessionId,
72
+ optOut = optOut,
73
73
  sampleRate = sampleRate,
74
+ logger = LogcatLogger.logger,
74
75
  enableRemoteConfig = enableRemoteConfig,
75
76
  serverZone = when (serverZone) {
76
77
  "EU" -> ServerZone.EU
@@ -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":[]}
@@ -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,CAAC,CAAC,OAAOc,KAAK,EAAE;IACdb,MAAM,CAACa,KAAK,CAAC,kCAAkC,EAAEA,KAAK,CAAC;EACzD;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,YAAYA,CAACC,SAAiB,EAAiB;EACnE,IAAI,CAAChB,aAAa,EAAE;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;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;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","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.2';
7
+ const VERSION = exports.VERSION = '0.1.0-beta.0';
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,36 +1,43 @@
1
1
  import { LogLevel } from '@amplitude/analytics-types';
2
2
 
3
3
  /**
4
- * Masking levels for sensitive content in session replay
4
+ * Masking levels for sensitive content in session replay.
5
+ *
6
+ * Declared as a string-literal union (rather than an `enum`) to match the
7
+ * Session Replay browser SDK and avoid the const-enum inlining pitfalls of
8
+ * string enums under aggressive compilers.
9
+ *
10
+ * - `light`: mask only inputs that are always sensitive (password, etc.).
11
+ * - `medium`: mask all `<TextInput>` fields.
12
+ * - `conservative`: mask all `<TextInput>` fields and all `<Text>` content.
5
13
  */
6
- export let MaskLevel = /*#__PURE__*/function (MaskLevel) {
7
- /**
8
- * Light masking - minimal content is masked
9
- */
10
- MaskLevel["Light"] = "light";
11
- /**
12
- * Medium masking - balanced approach to content masking
13
- */
14
- MaskLevel["Medium"] = "medium";
15
- /**
16
- * Conservative masking - maximum content masking for privacy
17
- */
18
- MaskLevel["Conservative"] = "conservative";
19
- return MaskLevel;
20
- }({});
21
14
 
22
15
  /**
23
16
  * Configuration for Session Replay React Native SDK
24
17
  */
25
18
 
19
+ /**
20
+ * Internal config shape used by the SDK after the public `SessionReplayConfig`
21
+ * is normalized at the input boundary. The deprecated top-level `maskLevel` is
22
+ * folded into `privacyConfig` by `normalizeConfig`, so nothing past that point
23
+ * needs to know the deprecated field ever existed.
24
+ *
25
+ * Not exported from `index.tsx` on purpose — this is an implementation detail
26
+ * of the session replay module.
27
+ */
28
+
26
29
  export const getDefaultConfig = () => {
27
30
  return {
28
31
  autoStart: true,
29
32
  deviceId: null,
30
33
  enableRemoteConfig: true,
31
34
  logLevel: LogLevel.Warn,
32
- maskLevel: MaskLevel.Medium,
33
35
  optOut: false,
36
+ // Intentionally left without a `maskLevel`: the effective default
37
+ // (`'medium'`) is resolved once at the native boundary in `nativeConfig()`.
38
+ // Baking it in here would make the deprecated top-level `maskLevel`
39
+ // unreachable through the `?? 'medium'` fallback (silent privacy downgrade).
40
+ privacyConfig: {},
34
41
  sampleRate: 0,
35
42
  serverZone: 'US',
36
43
  sessionId: -1
@@ -1 +1 @@
1
- {"version":3,"names":["LogLevel","MaskLevel","getDefaultConfig","autoStart","deviceId","enableRemoteConfig","logLevel","Warn","maskLevel","Medium","optOut","sampleRate","serverZone","sessionId"],"sourceRoot":"../../src","sources":["session-replay-config.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,4BAA4B;;AAErD;AACA;AACA;AACA,WAAYC,SAAS,0BAATA,SAAS;EACnB;AACF;AACA;EAHYA,SAAS;EAKnB;AACF;AACA;EAPYA,SAAS;EASnB;AACF;AACA;EAXYA,SAAS;EAAA,OAATA,SAAS;AAAA;;AAerB;AACA;AACA;;AAmEA,OAAO,MAAMC,gBAAqE,GAAGA,CAAA,KAAM;EACzF,OAAO;IACLC,SAAS,EAAE,IAAI;IACfC,QAAQ,EAAE,IAAI;IACdC,kBAAkB,EAAE,IAAI;IACxBC,QAAQ,EAAEN,QAAQ,CAACO,IAAI;IACvBC,SAAS,EAAEP,SAAS,CAACQ,MAAM;IAC3BC,MAAM,EAAE,KAAK;IACbC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,IAAI;IAChBC,SAAS,EAAE,CAAC;EACd,CAAC;AACH,CAAC;AACD,SAASb,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["LogLevel","getDefaultConfig","autoStart","deviceId","enableRemoteConfig","logLevel","Warn","optOut","privacyConfig","sampleRate","serverZone","sessionId"],"sourceRoot":"../../src","sources":["session-replay-config.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,4BAA4B;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;;AA2EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,MAAMC,gBAA6E,GAAGA,CAAA,KAAM;EACjG,OAAO;IACLC,SAAS,EAAE,IAAI;IACfC,QAAQ,EAAE,IAAI;IACdC,kBAAkB,EAAE,IAAI;IACxBC,QAAQ,EAAEL,QAAQ,CAACM,IAAI;IACvBC,MAAM,EAAE,KAAK;IACb;IACA;IACA;IACA;IACAC,aAAa,EAAE,CAAC,CAAC;IACjBC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,IAAI;IAChBC,SAAS,EAAE,CAAC;EACd,CAAC;AACH,CAAC;AACD,SAASX,QAAQ","ignoreList":[]}
@@ -4,6 +4,37 @@ import { NativeSessionReplay } from './native-module';
4
4
  import { getDefaultConfig } from './session-replay-config';
5
5
  import { createSessionReplayLogger } from './logger';
6
6
  import { VERSION } from './version';
7
+ /**
8
+ * Translates the public `SessionReplayConfig` into the internal shape by
9
+ * folding the deprecated top-level `maskLevel` into `privacyConfig`. After
10
+ * this step, the rest of the SDK only ever sees `privacyConfig`.
11
+ *
12
+ * `privacyConfig` wins when explicitly set; otherwise translate the
13
+ * deprecated `maskLevel`; otherwise leave the field out so the default
14
+ * supplied by `getDefaultConfig()` survives the shallow merge in `init()`.
15
+ */
16
+ function normalizeConfig(config) {
17
+ const {
18
+ maskLevel,
19
+ privacyConfig,
20
+ ...rest
21
+ } = config;
22
+ if (privacyConfig !== undefined) {
23
+ return {
24
+ ...rest,
25
+ privacyConfig
26
+ };
27
+ }
28
+ if (maskLevel !== undefined) {
29
+ return {
30
+ ...rest,
31
+ privacyConfig: {
32
+ maskLevel
33
+ }
34
+ };
35
+ }
36
+ return rest;
37
+ }
7
38
  let fullConfig = null;
8
39
  let isInitialized = false;
9
40
  let logger = createSessionReplayLogger();
@@ -31,9 +62,14 @@ export async function init(config) {
31
62
  logger.warn('SessionReplay is already initialized');
32
63
  return;
33
64
  }
65
+
66
+ // TODO: this is a shallow merge — a user-supplied `privacyConfig` replaces
67
+ // the default object wholesale. That's fine while `PrivacyConfig` only
68
+ // carries `maskLevel`, but if it ever grows more fields a deeper merge will
69
+ // be needed so partial user configs don't drop defaults.
34
70
  fullConfig = {
35
71
  ...getDefaultConfig(),
36
- ...config
72
+ ...normalizeConfig(config)
37
73
  };
38
74
  logger.setLogLevel(fullConfig.logLevel);
39
75
  logger.log(`initializing @amplitude/session-replay-react-native version: ${VERSION} with config: `, fullConfig);
@@ -199,10 +235,22 @@ export async function stop() {
199
235
  await NativeSessionReplay.stop();
200
236
  }
201
237
  function nativeConfig(config) {
238
+ // Resolve the effective mask level here — the single source of truth for the
239
+ // default. `normalizeConfig()` already folded the deprecated top-level
240
+ // `maskLevel` into `privacyConfig`, but `privacyConfig.maskLevel` can still be
241
+ // `undefined` (no user value and no baked-in default), so fall back to
242
+ // `'medium'`. Strip `privacyConfig` from the spread because the native bridge
243
+ // only takes a flat `maskLevel` string.
244
+ const {
245
+ privacyConfig,
246
+ ...rest
247
+ } = config;
248
+ const resolvedMaskLevel = privacyConfig.maskLevel ?? 'medium';
202
249
  return {
203
- ...config,
204
- logLevel: config.logLevel,
205
- maskLevel: config.maskLevel.toString()
250
+ ...rest,
251
+ logLevel: rest.logLevel,
252
+ // TODO(SDKRN-15): Migrate native bridge to accept the full privacyConfig object instead of a flat maskLevel string.
253
+ maskLevel: resolvedMaskLevel
206
254
  };
207
255
  }
208
256
  export async function privateInit(config, newLogger) {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeSessionReplay","getDefaultConfig","createSessionReplayLogger","VERSION","fullConfig","isInitialized","logger","init","config","warn","setLogLevel","logLevel","log","setup","nativeConfig","error","setSessionId","sessionId","setDeviceId","deviceId","getSessionId","getSessionReplayProperties","properties","flush","start","stop","maskLevel","toString","privateInit","newLogger"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":"AAAA;;AAEA,SAASA,mBAAmB,QAAwC,iBAAiB;AACrF,SAASC,gBAAgB,QAA6B,yBAAyB;AAC/E,SAASC,yBAAyB,QAAQ,UAAU;AACpD,SAASC,OAAO,QAAQ,WAAW;AAEnC,IAAIC,UAAgD,GAAG,IAAI;AAC3D,IAAIC,aAAa,GAAG,KAAK;AACzB,IAAIC,MAAM,GAAGJ,yBAAyB,CAAC,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AI,CAAC,CAAC;AAClC;AAEA,SAASX,YAAYA,CAACN,MAAqC,EAA6B;EACtF,OAAO;IACL,GAAGA,MAAM;IACTG,QAAQ,EAAEH,MAAM,CAACG,QAAiD;IAClEe,SAAS,EAAElB,MAAM,CAACkB,SAAS,CAACC,QAAQ,CAAC;EACvC,CAAC;AACH;AAEA,OAAO,eAAeC,WAAWA,CAC/BpB,MAA2B,EAC3BqB,SAAuD,EACxC;EACfvB,MAAM,GAAGuB,SAAS;EAClB,OAAOtB,IAAI,CAACC,MAAM,CAAC;AACrB","ignoreList":[]}
1
+ {"version":3,"names":["NativeSessionReplay","getDefaultConfig","createSessionReplayLogger","VERSION","normalizeConfig","config","maskLevel","privacyConfig","rest","undefined","fullConfig","isInitialized","logger","init","warn","setLogLevel","logLevel","log","setup","nativeConfig","error","setSessionId","sessionId","setDeviceId","deviceId","getSessionId","getSessionReplayProperties","properties","flush","start","stop","resolvedMaskLevel","privateInit","newLogger"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":"AAAA;;AAEA,SAASA,mBAAmB,QAAwC,iBAAiB;AACrF,SAASC,gBAAgB,QAA0D,yBAAyB;AAC5G,SAASC,yBAAyB,QAAQ,UAAU;AACpD,SAASC,OAAO,QAAQ,WAAW;AAInC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CAACC,MAA2B,EAA+B;EACjF,MAAM;IAAEC,SAAS;IAAEC,aAAa;IAAE,GAAGC;EAAK,CAAC,GAAGH,MAAM;EACpD,IAAIE,aAAa,KAAKE,SAAS,EAAE;IAC/B,OAAO;MAAE,GAAGD,IAAI;MAAED;IAAc,CAAC;EACnC;EACA,IAAID,SAAS,KAAKG,SAAS,EAAE;IAC3B,OAAO;MAAE,GAAGD,IAAI;MAAED,aAAa,EAAE;QAAED;MAAU;IAAE,CAAC;EAClD;EACA,OAAOE,IAAI;AACb;AAEA,IAAIE,UAA8C,GAAG,IAAI;AACzD,IAAIC,aAAa,GAAG,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AIA,CAAA,EAAkB;EAC1C,IAAI,CAACnB,aAAa,EAAE;IAClBC,MAAM,CAACE,IAAI,CAAC,kCAAkC,CAAC;IAC/C;EACF;EACA,MAAMd,mBAAmB,CAAC8B,IAAI,CAAC,CAAC;AAClC;AAEA,SAASX,YAAYA,CAACd,MAAmC,EAA6B;EACpF;EACA;EACA;EACA;EACA;EACA;EACA,MAAM;IAAEE,aAAa;IAAE,GAAGC;EAAK,CAAC,GAAGH,MAAM;EACzC,MAAM0B,iBAAyD,GAAGxB,aAAa,CAACD,SAAS,IAAI,QAAQ;EACrG,OAAO;IACL,GAAGE,IAAI;IACPQ,QAAQ,EAAER,IAAI,CAACQ,QAAiD;IAChE;IACAV,SAAS,EAAEyB;EACb,CAAC;AACH;AAEA,OAAO,eAAeC,WAAWA,CAC/B3B,MAA2B,EAC3B4B,SAAuD,EACxC;EACfrB,MAAM,GAAGqB,SAAS;EAClB,OAAOpB,IAAI,CAACR,MAAM,CAAC;AACrB","ignoreList":[]}
@@ -1,3 +1,2 @@
1
- // Autogenerated by `yarn version-file`. DO NOT EDIT
2
- export const VERSION = '0.0.1-beta.2';
1
+ export const VERSION = '0.1.0-beta.0';
3
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,cAAc","ignoreList":[]}
@@ -2,6 +2,6 @@ import { type ViewProps } from 'react-native';
2
2
  interface AmpMaskViewProps extends ViewProps {
3
3
  mask: 'amp-mask' | 'amp-unmask' | 'amp-block';
4
4
  }
5
- export declare const AmpMaskView: import("react-native").HostComponent<AmpMaskViewProps>;
5
+ export declare const AmpMaskView: import("react-native/types").HostComponent<AmpMaskViewProps>;
6
6
  export {};
7
7
  //# sourceMappingURL=amp-mask-view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"amp-mask-view.d.ts","sourceRoot":"","sources":["../../src/amp-mask-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,UAAU,gBAAiB,SAAQ,SAAS;IAC1C,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,WAAW,CAAC;CAC/C;AAED,eAAO,MAAM,WAAW,wDAAmE,CAAC"}
1
+ {"version":3,"file":"amp-mask-view.d.ts","sourceRoot":"","sources":["../../src/amp-mask-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,UAAU,gBAAiB,SAAQ,SAAS;IAC1C,IAAI,EAAE,UAAU,GAAG,YAAY,GAAG,WAAW,CAAC;CAC/C;AAED,eAAO,MAAM,WAAW,8DAAmE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export { init, setSessionId, getSessionId, getSessionReplayProperties, flush, start, stop, setDeviceId, } from './session-replay';
2
- export { type SessionReplayConfig, MaskLevel } from './session-replay-config';
2
+ export { type SessionReplayConfig, type MaskLevel, type PrivacyConfig } from './session-replay-config';
3
3
  export { SessionReplayPlugin } from './plugin-session-replay';
4
4
  export type { SessionReplayPluginConfig } from './plugin-session-replay-config';
5
5
  export { AmpMaskView } from './amp-mask-view';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,0BAA0B,EAC1B,KAAK,EACL,KAAK,EACL,IAAI,EACJ,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,mBAAmB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,0BAA0B,EAC1B,KAAK,EACL,KAAK,EACL,IAAI,EACJ,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEvG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,20 +1,18 @@
1
1
  import { LogLevel } from '@amplitude/analytics-types';
2
2
  /**
3
- * Masking levels for sensitive content in session replay
3
+ * Masking levels for sensitive content in session replay.
4
+ *
5
+ * Declared as a string-literal union (rather than an `enum`) to match the
6
+ * Session Replay browser SDK and avoid the const-enum inlining pitfalls of
7
+ * string enums under aggressive compilers.
8
+ *
9
+ * - `light`: mask only inputs that are always sensitive (password, etc.).
10
+ * - `medium`: mask all `<TextInput>` fields.
11
+ * - `conservative`: mask all `<TextInput>` fields and all `<Text>` content.
4
12
  */
5
- export declare enum MaskLevel {
6
- /**
7
- * Light masking - minimal content is masked
8
- */
9
- Light = "light",
10
- /**
11
- * Medium masking - balanced approach to content masking
12
- */
13
- Medium = "medium",
14
- /**
15
- * Conservative masking - maximum content masking for privacy
16
- */
17
- Conservative = "conservative"
13
+ export type MaskLevel = 'light' | 'medium' | 'conservative';
14
+ export interface PrivacyConfig {
15
+ maskLevel?: MaskLevel;
18
16
  }
19
17
  /**
20
18
  * Configuration for Session Replay React Native SDK
@@ -48,9 +46,16 @@ export interface SessionReplayConfig {
48
46
  logLevel?: LogLevel;
49
47
  /**
50
48
  * Level of masking applied to sensitive content
51
- * @default MaskLevel.Medium
49
+ * @default 'medium'
50
+ * @deprecated Use `privacyConfig.maskLevel` instead.
52
51
  */
53
52
  maskLevel?: MaskLevel;
53
+ /**
54
+ * Privacy configuration for session replay.
55
+ * When `maskLevel` is omitted it resolves to `'medium'` at the native boundary.
56
+ * @default {}
57
+ */
58
+ privacyConfig?: PrivacyConfig;
54
59
  /**
55
60
  * Whether to opt out of session replay collection
56
61
  * @default false
@@ -75,6 +80,16 @@ export interface SessionReplayConfig {
75
80
  */
76
81
  sessionId?: number;
77
82
  }
78
- export declare const getDefaultConfig: () => Required<Omit<SessionReplayConfig, 'apiKey'>>;
83
+ /**
84
+ * Internal config shape used by the SDK after the public `SessionReplayConfig`
85
+ * is normalized at the input boundary. The deprecated top-level `maskLevel` is
86
+ * folded into `privacyConfig` by `normalizeConfig`, so nothing past that point
87
+ * needs to know the deprecated field ever existed.
88
+ *
89
+ * Not exported from `index.tsx` on purpose — this is an implementation detail
90
+ * of the session replay module.
91
+ */
92
+ export type SessionReplayConfigInternal = Omit<SessionReplayConfig, 'maskLevel'>;
93
+ export declare const getDefaultConfig: () => Required<Omit<SessionReplayConfigInternal, 'apiKey'>>;
79
94
  export { LogLevel };
80
95
  //# sourceMappingURL=session-replay-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay-config.d.ts","sourceRoot":"","sources":["../../src/session-replay-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD;;GAEG;AACH,oBAAY,SAAS;IACnB;;OAEG;IACH,KAAK,UAAU;IACf;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,YAAY,iBAAiB;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC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CACxC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAOnF;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAM3C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAM3C;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAM1C;AAmBD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,UAAU,CAAC,OAAO,yBAAyB,CAAC,GACtD,OAAO,CAAC,IAAI,CAAC,CAGf"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.1-beta.2";
1
+ export declare const VERSION = "0.1.0-beta.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,iBAAiB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amplitude/session-replay-react-native",
3
- "version": "0.0.1-beta.2",
3
+ "version": "0.1.0-beta.0",
4
4
  "description": "Amplitude Session Replay for React Native",
5
5
  "keywords": [
6
6
  "analytics",
@@ -25,23 +25,6 @@
25
25
  "type": "git",
26
26
  "url": "git+https://github.com/amplitude/Amplitude-TypeScript.git"
27
27
  },
28
- "scripts": {
29
- "build": "bob build",
30
- "clean": "rimraf node_modules lib coverage",
31
- "fix": "yarn fix:eslint & yarn fix:prettier",
32
- "fix:eslint": "eslint '{src,test}/**/*.ts' --fix",
33
- "fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
34
- "lint": "yarn lint:prettier && yarn lint:eslint",
35
- "lint:eslint": "eslint '{src,test}/**/*.ts'",
36
- "lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
37
- "test": "jest",
38
- "typecheck": "tsc -p ./tsconfig.json",
39
- "version": "yarn version-file && yarn build",
40
- "version-file": "node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" > src/version.ts",
41
- "typescript": "tsc --noEmit",
42
- "example": "yarn workspace @amplitude/plugin-session-replay-react-native-example",
43
- "pods": "cd example && pod-install --quiet"
44
- },
45
28
  "source": "src/index",
46
29
  "files": [
47
30
  "src",
@@ -92,5 +75,21 @@
92
75
  ]
93
76
  ]
94
77
  },
95
- "private": false
96
- }
78
+ "scripts": {
79
+ "build": "bob build",
80
+ "clean": "rimraf node_modules lib coverage",
81
+ "fix": "pnpm fix:eslint & pnpm fix:prettier",
82
+ "fix:eslint": "eslint '{src,test}/**/*.ts' --fix",
83
+ "fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
84
+ "lint": "pnpm lint:prettier && pnpm lint:eslint",
85
+ "lint:eslint": "eslint '{src,test}/**/*.ts'",
86
+ "lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
87
+ "test": "jest",
88
+ "typecheck": "tsc -p ./tsconfig.json",
89
+ "version": "pnpm version-file && pnpm build",
90
+ "version-file": "node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" > src/version.ts",
91
+ "typescript": "tsc --noEmit",
92
+ "example": "yarn workspace @amplitude/plugin-session-replay-react-native-example",
93
+ "pods": "cd example && pod-install --quiet"
94
+ }
95
+ }
package/src/index.tsx CHANGED
@@ -8,7 +8,7 @@ export {
8
8
  stop,
9
9
  setDeviceId,
10
10
  } from './session-replay';
11
- export { type SessionReplayConfig, MaskLevel } from './session-replay-config';
11
+ export { type SessionReplayConfig, type MaskLevel, type PrivacyConfig } from './session-replay-config';
12
12
 
13
13
  export { SessionReplayPlugin } from './plugin-session-replay';
14
14
  export type { SessionReplayPluginConfig } from './plugin-session-replay-config';
@@ -1,21 +1,20 @@
1
1
  import { LogLevel } from '@amplitude/analytics-types';
2
2
 
3
3
  /**
4
- * Masking levels for sensitive content in session replay
4
+ * Masking levels for sensitive content in session replay.
5
+ *
6
+ * Declared as a string-literal union (rather than an `enum`) to match the
7
+ * Session Replay browser SDK and avoid the const-enum inlining pitfalls of
8
+ * string enums under aggressive compilers.
9
+ *
10
+ * - `light`: mask only inputs that are always sensitive (password, etc.).
11
+ * - `medium`: mask all `<TextInput>` fields.
12
+ * - `conservative`: mask all `<TextInput>` fields and all `<Text>` content.
5
13
  */
6
- export enum MaskLevel {
7
- /**
8
- * Light masking - minimal content is masked
9
- */
10
- Light = 'light',
11
- /**
12
- * Medium masking - balanced approach to content masking
13
- */
14
- Medium = 'medium',
15
- /**
16
- * Conservative masking - maximum content masking for privacy
17
- */
18
- Conservative = 'conservative',
14
+ export type MaskLevel = 'light' | 'medium' | 'conservative';
15
+
16
+ export interface PrivacyConfig {
17
+ maskLevel?: MaskLevel;
19
18
  }
20
19
 
21
20
  /**
@@ -55,10 +54,18 @@ export interface SessionReplayConfig {
55
54
 
56
55
  /**
57
56
  * Level of masking applied to sensitive content
58
- * @default MaskLevel.Medium
57
+ * @default 'medium'
58
+ * @deprecated Use `privacyConfig.maskLevel` instead.
59
59
  */
60
60
  maskLevel?: MaskLevel;
61
61
 
62
+ /**
63
+ * Privacy configuration for session replay.
64
+ * When `maskLevel` is omitted it resolves to `'medium'` at the native boundary.
65
+ * @default {}
66
+ */
67
+ privacyConfig?: PrivacyConfig;
68
+
62
69
  /**
63
70
  * Whether to opt out of session replay collection
64
71
  * @default false
@@ -87,14 +94,29 @@ export interface SessionReplayConfig {
87
94
  sessionId?: number;
88
95
  }
89
96
 
90
- export const getDefaultConfig: () => Required<Omit<SessionReplayConfig, 'apiKey'>> = () => {
97
+ /**
98
+ * Internal config shape used by the SDK after the public `SessionReplayConfig`
99
+ * is normalized at the input boundary. The deprecated top-level `maskLevel` is
100
+ * folded into `privacyConfig` by `normalizeConfig`, so nothing past that point
101
+ * needs to know the deprecated field ever existed.
102
+ *
103
+ * Not exported from `index.tsx` on purpose — this is an implementation detail
104
+ * of the session replay module.
105
+ */
106
+ export type SessionReplayConfigInternal = Omit<SessionReplayConfig, 'maskLevel'>;
107
+
108
+ export const getDefaultConfig: () => Required<Omit<SessionReplayConfigInternal, 'apiKey'>> = () => {
91
109
  return {
92
110
  autoStart: true,
93
111
  deviceId: null,
94
112
  enableRemoteConfig: true,
95
113
  logLevel: LogLevel.Warn,
96
- maskLevel: MaskLevel.Medium,
97
114
  optOut: false,
115
+ // Intentionally left without a `maskLevel`: the effective default
116
+ // (`'medium'`) is resolved once at the native boundary in `nativeConfig()`.
117
+ // Baking it in here would make the deprecated top-level `maskLevel`
118
+ // unreachable through the `?? 'medium'` fallback (silent privacy downgrade).
119
+ privacyConfig: {},
98
120
  sampleRate: 0,
99
121
  serverZone: 'US',
100
122
  sessionId: -1,
@@ -1,11 +1,33 @@
1
1
  // @refresh reset
2
2
 
3
3
  import { NativeSessionReplay, type NativeSessionReplayConfig } from './native-module';
4
- import { getDefaultConfig, SessionReplayConfig } from './session-replay-config';
4
+ import { getDefaultConfig, SessionReplayConfig, SessionReplayConfigInternal } from './session-replay-config';
5
5
  import { createSessionReplayLogger } from './logger';
6
6
  import { VERSION } from './version';
7
7
 
8
- let fullConfig: Required<SessionReplayConfig> | null = null;
8
+ type ResolvedSessionReplayConfig = Required<SessionReplayConfigInternal>;
9
+
10
+ /**
11
+ * Translates the public `SessionReplayConfig` into the internal shape by
12
+ * folding the deprecated top-level `maskLevel` into `privacyConfig`. After
13
+ * this step, the rest of the SDK only ever sees `privacyConfig`.
14
+ *
15
+ * `privacyConfig` wins when explicitly set; otherwise translate the
16
+ * deprecated `maskLevel`; otherwise leave the field out so the default
17
+ * supplied by `getDefaultConfig()` survives the shallow merge in `init()`.
18
+ */
19
+ function normalizeConfig(config: SessionReplayConfig): SessionReplayConfigInternal {
20
+ const { maskLevel, privacyConfig, ...rest } = config;
21
+ if (privacyConfig !== undefined) {
22
+ return { ...rest, privacyConfig };
23
+ }
24
+ if (maskLevel !== undefined) {
25
+ return { ...rest, privacyConfig: { maskLevel } };
26
+ }
27
+ return rest;
28
+ }
29
+
30
+ let fullConfig: ResolvedSessionReplayConfig | null = null;
9
31
  let isInitialized = false;
10
32
  let logger = createSessionReplayLogger();
11
33
 
@@ -33,9 +55,13 @@ export async function init(config: SessionReplayConfig): Promise<void> {
33
55
  return;
34
56
  }
35
57
 
58
+ // TODO: this is a shallow merge — a user-supplied `privacyConfig` replaces
59
+ // the default object wholesale. That's fine while `PrivacyConfig` only
60
+ // carries `maskLevel`, but if it ever grows more fields a deeper merge will
61
+ // be needed so partial user configs don't drop defaults.
36
62
  fullConfig = {
37
63
  ...getDefaultConfig(),
38
- ...config,
64
+ ...normalizeConfig(config),
39
65
  };
40
66
 
41
67
  logger.setLogLevel(fullConfig.logLevel);
@@ -206,11 +232,20 @@ export async function stop(): Promise<void> {
206
232
  await NativeSessionReplay.stop();
207
233
  }
208
234
 
209
- function nativeConfig(config: Required<SessionReplayConfig>): NativeSessionReplayConfig {
235
+ function nativeConfig(config: ResolvedSessionReplayConfig): NativeSessionReplayConfig {
236
+ // Resolve the effective mask level here — the single source of truth for the
237
+ // default. `normalizeConfig()` already folded the deprecated top-level
238
+ // `maskLevel` into `privacyConfig`, but `privacyConfig.maskLevel` can still be
239
+ // `undefined` (no user value and no baked-in default), so fall back to
240
+ // `'medium'`. Strip `privacyConfig` from the spread because the native bridge
241
+ // only takes a flat `maskLevel` string.
242
+ const { privacyConfig, ...rest } = config;
243
+ const resolvedMaskLevel: NativeSessionReplayConfig['maskLevel'] = privacyConfig.maskLevel ?? 'medium';
210
244
  return {
211
- ...config,
212
- logLevel: config.logLevel as NativeSessionReplayConfig['logLevel'],
213
- maskLevel: config.maskLevel.toString() as NativeSessionReplayConfig['maskLevel'],
245
+ ...rest,
246
+ logLevel: rest.logLevel as NativeSessionReplayConfig['logLevel'],
247
+ // TODO(SDKRN-15): Migrate native bridge to accept the full privacyConfig object instead of a flat maskLevel string.
248
+ maskLevel: resolvedMaskLevel,
214
249
  };
215
250
  }
216
251
 
package/src/version.ts CHANGED
@@ -1,2 +1 @@
1
- // Autogenerated by `yarn version-file`. DO NOT EDIT
2
- export const VERSION = '0.0.1-beta.2';
1
+ export const VERSION = '0.1.0-beta.0';