@amplitude/plugin-session-replay-react-native 0.2.0 → 0.2.2

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 (41) hide show
  1. package/README.md +6 -1
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/amplitude/pluginsessionreplayreactnative/PluginSessionReplayReactNativeModule.kt +3 -3
  4. package/ios/PluginSessionReplayReactNative.mm +1 -1
  5. package/ios/PluginSessionReplayReactNative.swift +5 -5
  6. package/lib/commonjs/{AmpMaskView.js → app-mask-view.js} +1 -1
  7. package/lib/commonjs/app-mask-view.js.map +1 -0
  8. package/lib/commonjs/index.js +9 -2
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/session-replay-config.js +14 -0
  11. package/lib/commonjs/session-replay-config.js.map +1 -0
  12. package/lib/commonjs/session-replay.js +10 -3
  13. package/lib/commonjs/session-replay.js.map +1 -1
  14. package/lib/commonjs/version.js +1 -1
  15. package/lib/module/{AmpMaskView.js → app-mask-view.js} +1 -1
  16. package/lib/module/app-mask-view.js.map +1 -0
  17. package/lib/module/index.js +2 -1
  18. package/lib/module/index.js.map +1 -1
  19. package/lib/module/session-replay-config.js +7 -0
  20. package/lib/module/session-replay-config.js.map +1 -0
  21. package/lib/module/session-replay.js +10 -3
  22. package/lib/module/session-replay.js.map +1 -1
  23. package/lib/module/version.js +1 -1
  24. package/lib/typescript/{AmpMaskView.d.ts → app-mask-view.d.ts} +1 -1
  25. package/lib/typescript/app-mask-view.d.ts.map +1 -0
  26. package/lib/typescript/index.d.ts +2 -1
  27. package/lib/typescript/index.d.ts.map +1 -1
  28. package/lib/typescript/session-replay-config.d.ts +9 -0
  29. package/lib/typescript/session-replay-config.d.ts.map +1 -0
  30. package/lib/typescript/session-replay.d.ts +3 -1
  31. package/lib/typescript/session-replay.d.ts.map +1 -1
  32. package/lib/typescript/version.d.ts +1 -1
  33. package/package.json +2 -2
  34. package/src/index.tsx +3 -1
  35. package/src/session-replay-config.tsx +11 -0
  36. package/src/session-replay.ts +16 -3
  37. package/src/version.ts +1 -1
  38. package/lib/commonjs/AmpMaskView.js.map +0 -1
  39. package/lib/module/AmpMaskView.js.map +0 -1
  40. package/lib/typescript/AmpMaskView.d.ts.map +0 -1
  41. /package/src/{AmpMaskView.tsx → app-mask-view.tsx} +0 -0
package/README.md CHANGED
@@ -16,11 +16,16 @@ import { SessionReplayPlugin } from '@amplitude/plugin-session-replay-react-nati
16
16
 
17
17
  // ...
18
18
 
19
+ const config: SessionReplayConfig = {
20
+ enableRemoteConfig: true, // default true
21
+ sampleRate: 1, // default 0
22
+ };
19
23
  await init('YOUR_API_KEY').promise;
20
- await add(new SessionReplayPlugin()).promise;
24
+ await add(new SessionReplayPlugin(config)).promise;
21
25
 
22
26
  ```
23
27
 
28
+
24
29
  ## Masking views
25
30
  To maks certain views, add the `AmpMaskView` tag with the mask property `amp-mask` around the section to be masked
26
31
 
@@ -90,7 +90,7 @@ repositories {
90
90
  def kotlin_version = getExtOrDefault("kotlinVersion")
91
91
 
92
92
  dependencies {
93
- implementation("com.amplitude:session-replay-android:[0.15.2, 1.0.0]")
93
+ implementation("com.amplitude:session-replay-android:[0.15.3, 1.0.0]")
94
94
 
95
95
  // For < 0.71, this will be from the local maven repo
96
96
  // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
@@ -19,7 +19,7 @@ class PluginSessionReplayReactNativeModule(private val reactContext: ReactApplic
19
19
  }
20
20
 
21
21
  @ReactMethod
22
- fun setup(apiKey: String, deviceId: String?, sessionId: Double) {
22
+ fun setup(apiKey: String, deviceId: String?, sessionId: Double, sampleRate: Double, enableRemoteConfig: Boolean) {
23
23
  LogcatLogger.logger.logMode = Logger.LogMode.DEBUG
24
24
  sessionReplay = SessionReplay(
25
25
  apiKey,
@@ -27,8 +27,8 @@ class PluginSessionReplayReactNativeModule(private val reactContext: ReactApplic
27
27
  deviceId ?: "",
28
28
  sessionId.toLong(),
29
29
  logger = LogcatLogger.logger,
30
- sampleRate = 1.0,
31
- enableRemoteConfig = false,
30
+ sampleRate = sampleRate,
31
+ enableRemoteConfig = enableRemoteConfig,
32
32
  )
33
33
  }
34
34
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  @interface RCT_EXTERN_MODULE(PluginSessionReplayReactNative, NSObject)
4
4
 
5
- RCT_EXTERN_METHOD(setup:(NSString)apiKey deviceId:(NSString)deviceId sessionId:(nonnull NSNumber)sessionId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
5
+ RCT_EXTERN_METHOD(setup:(NSString)apiKey deviceId:(NSString)deviceId sessionId:(nonnull NSNumber)sessionId sampleRate:(float)sampleRate enableRemoteConfig:(BOOL)enableRemoteConfig resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
6
6
 
7
7
  RCT_EXTERN_METHOD(setSessionId:(nonnull NSNumber) resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
8
8
 
@@ -6,15 +6,15 @@ class PluginSessionReplayReactNative: NSObject {
6
6
 
7
7
  var sessionReplay: SessionReplay!
8
8
 
9
- @objc(setup:deviceId:sessionId:resolve:reject:)
10
- func setup(_ apiKey: String, deviceId: String, sessionId: NSNumber, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
11
- print("setup: \(apiKey) \(deviceId) \(sessionId)")
9
+ @objc(setup:deviceId:sessionId:sampleRate:enableRemoteConfig:resolve:reject:)
10
+ func setup(_ apiKey: String, deviceId: String, sessionId: NSNumber, sampleRate: Float, enableRemoteConfig: Bool, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
11
+ print("setup: API Key: \(apiKey) Device Id: \(deviceId) Session Id: \(sessionId) Sample Rate: \(sampleRate) Enable Remote Config: \(enableRemoteConfig)")
12
12
  sessionReplay = SessionReplay(apiKey:apiKey,
13
13
  deviceId: deviceId,
14
14
  sessionId: sessionId.int64Value,
15
- sampleRate: 1.0,
15
+ sampleRate: sampleRate,
16
16
  logger:ConsoleLogger(logLevel: LogLevelEnum.DEBUG.rawValue),
17
- enableRemoteConfig: false)
17
+ enableRemoteConfig: enableRemoteConfig)
18
18
  sessionReplay.start()
19
19
  resolve(nil)
20
20
  }
@@ -7,4 +7,4 @@ exports.AmpMaskView = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  const AmpMaskView = (0, _reactNative.requireNativeComponent)('RCTAmpMaskView');
9
9
  exports.AmpMaskView = AmpMaskView;
10
- //# sourceMappingURL=AmpMaskView.js.map
10
+ //# sourceMappingURL=app-mask-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AmpMaskView","requireNativeComponent"],"sourceRoot":"../../src","sources":["app-mask-view.tsx"],"mappings":";;;;;;AAAA;AAMO,MAAMA,WAAW,GACtB,IAAAC,mCAAsB,EAAmB,gBAAgB,CAAC;AAAC"}
@@ -6,7 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "AmpMaskView", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _AmpMaskView.AmpMaskView;
9
+ return _appMaskView.AmpMaskView;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "SessionReplayConfig", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _sessionReplayConfig.SessionReplayConfig;
10
16
  }
11
17
  });
12
18
  Object.defineProperty(exports, "SessionReplayPlugin", {
@@ -16,5 +22,6 @@ Object.defineProperty(exports, "SessionReplayPlugin", {
16
22
  }
17
23
  });
18
24
  var _sessionReplay = require("./session-replay");
19
- var _AmpMaskView = require("./AmpMaskView");
25
+ var _appMaskView = require("./app-mask-view");
26
+ var _sessionReplayConfig = require("./session-replay-config");
20
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAEA"}
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAEA;AAEA"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getDefaultConfig = void 0;
7
+ const getDefaultConfig = () => {
8
+ return {
9
+ sampleRate: 0,
10
+ enableRemoteConfig: true
11
+ };
12
+ };
13
+ exports.getDefaultConfig = getDefaultConfig;
14
+ //# sourceMappingURL=session-replay-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getDefaultConfig","sampleRate","enableRemoteConfig"],"sourceRoot":"../../src","sources":["session-replay-config.tsx"],"mappings":";;;;;;AAKO,MAAMA,gBAAgB,GAAG,MAAM;EAClC,OAAO;IACHC,UAAU,EAAE,CAAC;IACbC,kBAAkB,EAAE;EACxB,CAAC;AACL,CAAC;AAAA"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.SessionReplayPlugin = void 0;
7
7
  var _nativeModule = require("./native-module");
8
8
  var _version = require("./version");
9
+ var _sessionReplayConfig = require("./session-replay-config");
9
10
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
11
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
12
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
@@ -15,15 +16,21 @@ class SessionReplayPlugin {
15
16
  // @ts-ignore
16
17
 
17
18
  constructor() {
19
+ let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18
20
  _defineProperty(this, "name", '@amplitude/plugin-session-replay-react-native');
19
21
  _defineProperty(this, "type", 'enrichment');
20
22
  _defineProperty(this, "config", void 0);
21
- } // empty default constructor
22
-
23
+ _defineProperty(this, "sessionReplayConfig", void 0);
24
+ this.sessionReplayConfig = {
25
+ ...(0, _sessionReplayConfig.getDefaultConfig)(),
26
+ ...config
27
+ };
28
+ console.log('Initializing SessionReplayPlugin with config: ', this.sessionReplayConfig);
29
+ }
23
30
  async setup(config, _) {
24
31
  this.config = config;
25
32
  console.log(`Installing @amplitude/plugin-session-replay-react-native, version ${_version.VERSION}.`);
26
- await _nativeModule.PluginSessionReplayReactNative.setup(config.apiKey, config.deviceId, config.sessionId);
33
+ await _nativeModule.PluginSessionReplayReactNative.setup(config.apiKey, config.deviceId, config.sessionId, this.sessionReplayConfig.sampleRate ?? 1, this.sessionReplayConfig.enableRemoteConfig ?? true);
27
34
  }
28
35
  async execute(event) {
29
36
  // On event, synchronize the session id to the what's on the browserConfig (source of truth)
@@ -1 +1 @@
1
- {"version":3,"names":["SessionReplayPlugin","constructor","setup","config","_","console","log","VERSION","PluginSessionReplayReactNative","apiKey","deviceId","sessionId","execute","event","getSessionId","setSessionId","session_id","sessionRecordingProperties","getSessionReplayProperties","event_properties","Promise","resolve","teardown"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":";;;;;;AAOA;AACA;AAAoC;AAAA;AAAA;AAE7B,MAAMA,mBAAmB,CAAmE;EAGjG;;EAEA;;EAGAC,WAAW,GAAG;IAAA,8BAPP,+CAA+C;IAAA,8BAC/C,YAAY;IAAA;EAQnB,CAAC,CADC;;EAGF,MAAMC,KAAK,CAACC,MAAyB,EAAEC,CAAoB,EAAiB;IAC1E,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpBE,OAAO,CAACC,GAAG,CAAE,qEAAoEC,gBAAQ,GAAE,CAAC;IAC5F,MAAMC,4CAA8B,CAACN,KAAK,CAACC,MAAM,CAACM,MAAM,EAAEN,MAAM,CAACO,QAAQ,EAAEP,MAAM,CAACQ,SAAS,CAAC;EAC9F;EAEA,MAAMC,OAAO,CAACC,KAAY,EAAyB;IACjD;IACA;IACA;IACA,IAAI,IAAI,CAACV,MAAM,CAACQ,SAAS,IAAI,IAAI,CAACR,MAAM,CAACQ,SAAS,MAAM,MAAMH,4CAA8B,CAACM,YAAY,EAAE,CAAC,EAAE;MAC5G,MAAMN,4CAA8B,CAACO,YAAY,CAAC,IAAI,CAACZ,MAAM,CAACQ,SAAS,CAAC;IAC1E;IACA;IACA;IACA,IAAI,IAAI,CAACR,MAAM,CAACQ,SAAS,IAAI,IAAI,CAACR,MAAM,CAACQ,SAAS,KAAKE,KAAK,CAACG,UAAU,EAAE;MACvE,MAAMC,0BAA0B,GAAG,MAAMT,4CAA8B,CAACU,0BAA0B,EAAE;MACpGL,KAAK,CAACM,gBAAgB,GAAG;QACvB,GAAGN,KAAK,CAACM,gBAAgB;QACzB,GAAGF;MACL,CAAC;IACH;IACA,OAAOG,OAAO,CAACC,OAAO,CAACR,KAAK,CAAC;EAC/B;EAEA,MAAMS,QAAQ,GAAkB;IAC9B,MAAMd,4CAA8B,CAACc,QAAQ,EAAE;IAC/C;IACA;;IAEA;IACA,IAAI,CAACnB,MAAM,GAAG,IAAI;EACpB;EAEA,MAAMe,0BAA0B,GAAG;IACjC,OAAOV,4CAA8B,CAACU,0BAA0B,EAAE;EACpE;AACF;AAAC"}
1
+ {"version":3,"names":["SessionReplayPlugin","constructor","config","sessionReplayConfig","getDefaultConfig","console","log","setup","_","VERSION","PluginSessionReplayReactNative","apiKey","deviceId","sessionId","sampleRate","enableRemoteConfig","execute","event","getSessionId","setSessionId","session_id","sessionRecordingProperties","getSessionReplayProperties","event_properties","Promise","resolve","teardown"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":";;;;;;AAOA;AACA;AACA;AAAgF;AAAA;AAAA;AAEzE,MAAMA,mBAAmB,CAAmE;EAGjG;;EAEA;;EAKAC,WAAW,GAAmC;IAAA,IAAlCC,MAA2B,uEAAG,CAAC,CAAC;IAAA,8BATrC,+CAA+C;IAAA,8BAC/C,YAAY;IAAA;IAAA;IASjB,IAAI,CAACC,mBAAmB,GAAG;MACzB,GAAG,IAAAC,qCAAgB,GAAE;MACrB,GAAGF;IACL,CAAC;IACDG,OAAO,CAACC,GAAG,CAAC,gDAAgD,EAAE,IAAI,CAACH,mBAAmB,CAAC;EACzF;EAEA,MAAMI,KAAK,CAACL,MAAyB,EAAEM,CAAoB,EAAiB;IAC1E,IAAI,CAACN,MAAM,GAAGA,MAAM;IACpBG,OAAO,CAACC,GAAG,CAAE,qEAAoEG,gBAAQ,GAAE,CAAC;IAC5F,MAAMC,4CAA8B,CAACH,KAAK,CACxCL,MAAM,CAACS,MAAM,EACbT,MAAM,CAACU,QAAQ,EACfV,MAAM,CAACW,SAAS,EAChB,IAAI,CAACV,mBAAmB,CAACW,UAAU,IAAI,CAAC,EACxC,IAAI,CAACX,mBAAmB,CAACY,kBAAkB,IAAI,IAAI,CACpD;EACH;EAEA,MAAMC,OAAO,CAACC,KAAY,EAAyB;IACjD;IACA;IACA;IACA,IAAI,IAAI,CAACf,MAAM,CAACW,SAAS,IAAI,IAAI,CAACX,MAAM,CAACW,SAAS,MAAM,MAAMH,4CAA8B,CAACQ,YAAY,EAAE,CAAC,EAAE;MAC5G,MAAMR,4CAA8B,CAACS,YAAY,CAAC,IAAI,CAACjB,MAAM,CAACW,SAAS,CAAC;IAC1E;IACA;IACA;IACA,IAAI,IAAI,CAACX,MAAM,CAACW,SAAS,IAAI,IAAI,CAACX,MAAM,CAACW,SAAS,KAAKI,KAAK,CAACG,UAAU,EAAE;MACvE,MAAMC,0BAA0B,GAAG,MAAMX,4CAA8B,CAACY,0BAA0B,EAAE;MACpGL,KAAK,CAACM,gBAAgB,GAAG;QACvB,GAAGN,KAAK,CAACM,gBAAgB;QACzB,GAAGF;MACL,CAAC;IACH;IACA,OAAOG,OAAO,CAACC,OAAO,CAACR,KAAK,CAAC;EAC/B;EAEA,MAAMS,QAAQ,GAAkB;IAC9B,MAAMhB,4CAA8B,CAACgB,QAAQ,EAAE;IAC/C;IACA;;IAEA;IACA,IAAI,CAACxB,MAAM,GAAG,IAAI;EACpB;EAEA,MAAMoB,0BAA0B,GAAG;IACjC,OAAOZ,4CAA8B,CAACY,0BAA0B,EAAE;EACpE;AACF;AAAC"}
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.VERSION = void 0;
7
- const VERSION = '0.2.0';
7
+ const VERSION = '0.2.2';
8
8
  exports.VERSION = VERSION;
9
9
  //# sourceMappingURL=version.js.map
@@ -1,3 +1,3 @@
1
1
  import { requireNativeComponent } from 'react-native';
2
2
  export const AmpMaskView = requireNativeComponent('RCTAmpMaskView');
3
- //# sourceMappingURL=AmpMaskView.js.map
3
+ //# sourceMappingURL=app-mask-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["requireNativeComponent","AmpMaskView"],"sourceRoot":"../../src","sources":["app-mask-view.tsx"],"mappings":"AAAA,SAASA,sBAAsB,QAAwB,cAAc;AAMrE,OAAO,MAAMC,WAAW,GACtBD,sBAAsB,CAAmB,gBAAgB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { SessionReplayPlugin } from './session-replay';
2
- export { AmpMaskView } from './AmpMaskView';
2
+ export { AmpMaskView } from './app-mask-view';
3
+ export { SessionReplayConfig } from './session-replay-config';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SessionReplayPlugin","AmpMaskView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,kBAAkB;AAEtD,SAASC,WAAW,QAAQ,eAAe"}
1
+ {"version":3,"names":["SessionReplayPlugin","AmpMaskView","SessionReplayConfig"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,kBAAkB;AAEtD,SAASC,WAAW,QAAQ,iBAAiB;AAE7C,SAASC,mBAAmB,QAAQ,yBAAyB"}
@@ -0,0 +1,7 @@
1
+ export const getDefaultConfig = () => {
2
+ return {
3
+ sampleRate: 0,
4
+ enableRemoteConfig: true
5
+ };
6
+ };
7
+ //# sourceMappingURL=session-replay-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getDefaultConfig","sampleRate","enableRemoteConfig"],"sourceRoot":"../../src","sources":["session-replay-config.tsx"],"mappings":"AAKA,OAAO,MAAMA,gBAAgB,GAAG,MAAM;EAClC,OAAO;IACHC,UAAU,EAAE,CAAC;IACbC,kBAAkB,EAAE;EACxB,CAAC;AACL,CAAC"}
@@ -9,21 +9,28 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
9
9
 
10
10
  import { PluginSessionReplayReactNative } from './native-module';
11
11
  import { VERSION } from './version';
12
+ import { getDefaultConfig } from './session-replay-config';
12
13
  export class SessionReplayPlugin {
13
14
  // this.config is defined in setup() which will always be called first
14
15
 
15
16
  // @ts-ignore
16
17
 
17
18
  constructor() {
19
+ let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18
20
  _defineProperty(this, "name", '@amplitude/plugin-session-replay-react-native');
19
21
  _defineProperty(this, "type", 'enrichment');
20
22
  _defineProperty(this, "config", void 0);
21
- } // empty default constructor
22
-
23
+ _defineProperty(this, "sessionReplayConfig", void 0);
24
+ this.sessionReplayConfig = {
25
+ ...getDefaultConfig(),
26
+ ...config
27
+ };
28
+ console.log('Initializing SessionReplayPlugin with config: ', this.sessionReplayConfig);
29
+ }
23
30
  async setup(config, _) {
24
31
  this.config = config;
25
32
  console.log(`Installing @amplitude/plugin-session-replay-react-native, version ${VERSION}.`);
26
- await PluginSessionReplayReactNative.setup(config.apiKey, config.deviceId, config.sessionId);
33
+ await PluginSessionReplayReactNative.setup(config.apiKey, config.deviceId, config.sessionId, this.sessionReplayConfig.sampleRate ?? 1, this.sessionReplayConfig.enableRemoteConfig ?? true);
27
34
  }
28
35
  async execute(event) {
29
36
  // On event, synchronize the session id to the what's on the browserConfig (source of truth)
@@ -1 +1 @@
1
- {"version":3,"names":["PluginSessionReplayReactNative","VERSION","SessionReplayPlugin","constructor","setup","config","_","console","log","apiKey","deviceId","sessionId","execute","event","getSessionId","setSessionId","session_id","sessionRecordingProperties","getSessionReplayProperties","event_properties","Promise","resolve","teardown"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;;AAGA,SAASA,8BAA8B,QAAQ,iBAAiB;AAChE,SAASC,OAAO,QAAQ,WAAW;AAEnC,OAAO,MAAMC,mBAAmB,CAAmE;EAGjG;;EAEA;;EAGAC,WAAW,GAAG;IAAA,8BAPP,+CAA+C;IAAA,8BAC/C,YAAY;IAAA;EAQnB,CAAC,CADC;;EAGF,MAAMC,KAAK,CAACC,MAAyB,EAAEC,CAAoB,EAAiB;IAC1E,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpBE,OAAO,CAACC,GAAG,CAAE,qEAAoEP,OAAQ,GAAE,CAAC;IAC5F,MAAMD,8BAA8B,CAACI,KAAK,CAACC,MAAM,CAACI,MAAM,EAAEJ,MAAM,CAACK,QAAQ,EAAEL,MAAM,CAACM,SAAS,CAAC;EAC9F;EAEA,MAAMC,OAAO,CAACC,KAAY,EAAyB;IACjD;IACA;IACA;IACA,IAAI,IAAI,CAACR,MAAM,CAACM,SAAS,IAAI,IAAI,CAACN,MAAM,CAACM,SAAS,MAAM,MAAMX,8BAA8B,CAACc,YAAY,EAAE,CAAC,EAAE;MAC5G,MAAMd,8BAA8B,CAACe,YAAY,CAAC,IAAI,CAACV,MAAM,CAACM,SAAS,CAAC;IAC1E;IACA;IACA;IACA,IAAI,IAAI,CAACN,MAAM,CAACM,SAAS,IAAI,IAAI,CAACN,MAAM,CAACM,SAAS,KAAKE,KAAK,CAACG,UAAU,EAAE;MACvE,MAAMC,0BAA0B,GAAG,MAAMjB,8BAA8B,CAACkB,0BAA0B,EAAE;MACpGL,KAAK,CAACM,gBAAgB,GAAG;QACvB,GAAGN,KAAK,CAACM,gBAAgB;QACzB,GAAGF;MACL,CAAC;IACH;IACA,OAAOG,OAAO,CAACC,OAAO,CAACR,KAAK,CAAC;EAC/B;EAEA,MAAMS,QAAQ,GAAkB;IAC9B,MAAMtB,8BAA8B,CAACsB,QAAQ,EAAE;IAC/C;IACA;;IAEA;IACA,IAAI,CAACjB,MAAM,GAAG,IAAI;EACpB;EAEA,MAAMa,0BAA0B,GAAG;IACjC,OAAOlB,8BAA8B,CAACkB,0BAA0B,EAAE;EACpE;AACF"}
1
+ {"version":3,"names":["PluginSessionReplayReactNative","VERSION","getDefaultConfig","SessionReplayPlugin","constructor","config","sessionReplayConfig","console","log","setup","_","apiKey","deviceId","sessionId","sampleRate","enableRemoteConfig","execute","event","getSessionId","setSessionId","session_id","sessionRecordingProperties","getSessionReplayProperties","event_properties","Promise","resolve","teardown"],"sourceRoot":"../../src","sources":["session-replay.ts"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;;AAGA,SAASA,8BAA8B,QAAQ,iBAAiB;AAChE,SAASC,OAAO,QAAQ,WAAW;AACnC,SAA8BC,gBAAgB,QAAQ,yBAAyB;AAE/E,OAAO,MAAMC,mBAAmB,CAAmE;EAGjG;;EAEA;;EAKAC,WAAW,GAAmC;IAAA,IAAlCC,MAA2B,uEAAG,CAAC,CAAC;IAAA,8BATrC,+CAA+C;IAAA,8BAC/C,YAAY;IAAA;IAAA;IASjB,IAAI,CAACC,mBAAmB,GAAG;MACzB,GAAGJ,gBAAgB,EAAE;MACrB,GAAGG;IACL,CAAC;IACDE,OAAO,CAACC,GAAG,CAAC,gDAAgD,EAAE,IAAI,CAACF,mBAAmB,CAAC;EACzF;EAEA,MAAMG,KAAK,CAACJ,MAAyB,EAAEK,CAAoB,EAAiB;IAC1E,IAAI,CAACL,MAAM,GAAGA,MAAM;IACpBE,OAAO,CAACC,GAAG,CAAE,qEAAoEP,OAAQ,GAAE,CAAC;IAC5F,MAAMD,8BAA8B,CAACS,KAAK,CACxCJ,MAAM,CAACM,MAAM,EACbN,MAAM,CAACO,QAAQ,EACfP,MAAM,CAACQ,SAAS,EAChB,IAAI,CAACP,mBAAmB,CAACQ,UAAU,IAAI,CAAC,EACxC,IAAI,CAACR,mBAAmB,CAACS,kBAAkB,IAAI,IAAI,CACpD;EACH;EAEA,MAAMC,OAAO,CAACC,KAAY,EAAyB;IACjD;IACA;IACA;IACA,IAAI,IAAI,CAACZ,MAAM,CAACQ,SAAS,IAAI,IAAI,CAACR,MAAM,CAACQ,SAAS,MAAM,MAAMb,8BAA8B,CAACkB,YAAY,EAAE,CAAC,EAAE;MAC5G,MAAMlB,8BAA8B,CAACmB,YAAY,CAAC,IAAI,CAACd,MAAM,CAACQ,SAAS,CAAC;IAC1E;IACA;IACA;IACA,IAAI,IAAI,CAACR,MAAM,CAACQ,SAAS,IAAI,IAAI,CAACR,MAAM,CAACQ,SAAS,KAAKI,KAAK,CAACG,UAAU,EAAE;MACvE,MAAMC,0BAA0B,GAAG,MAAMrB,8BAA8B,CAACsB,0BAA0B,EAAE;MACpGL,KAAK,CAACM,gBAAgB,GAAG;QACvB,GAAGN,KAAK,CAACM,gBAAgB;QACzB,GAAGF;MACL,CAAC;IACH;IACA,OAAOG,OAAO,CAACC,OAAO,CAACR,KAAK,CAAC;EAC/B;EAEA,MAAMS,QAAQ,GAAkB;IAC9B,MAAM1B,8BAA8B,CAAC0B,QAAQ,EAAE;IAC/C;IACA;;IAEA;IACA,IAAI,CAACrB,MAAM,GAAG,IAAI;EACpB;EAEA,MAAMiB,0BAA0B,GAAG;IACjC,OAAOtB,8BAA8B,CAACsB,0BAA0B,EAAE;EACpE;AACF"}
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.2.0';
1
+ export const VERSION = '0.2.2';
2
2
  //# sourceMappingURL=version.js.map
@@ -4,4 +4,4 @@ interface AmpMaskViewProps extends ViewProps {
4
4
  }
5
5
  export declare const AmpMaskView: import("react-native").HostComponent<AmpMaskViewProps>;
6
6
  export {};
7
- //# sourceMappingURL=AmpMaskView.d.ts.map
7
+ //# sourceMappingURL=app-mask-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-mask-view.d.ts","sourceRoot":"","sources":["../../src/app-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,wDACoC,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { SessionReplayPlugin } from './session-replay';
2
- export { AmpMaskView } from './AmpMaskView';
2
+ export { AmpMaskView } from './app-mask-view';
3
+ export { SessionReplayConfig } from './session-replay-config';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface SessionReplayConfig {
2
+ sampleRate?: number;
3
+ enableRemoteConfig?: boolean;
4
+ }
5
+ export declare const getDefaultConfig: () => {
6
+ sampleRate: number;
7
+ enableRemoteConfig: boolean;
8
+ };
9
+ //# sourceMappingURL=session-replay-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-replay-config.d.ts","sourceRoot":"","sources":["../../src/session-replay-config.tsx"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,eAAO,MAAM,gBAAgB;;;CAK5B,CAAA"}
@@ -1,9 +1,11 @@
1
1
  import type { EnrichmentPlugin, Event, ReactNativeClient, ReactNativeConfig } from '@amplitude/analytics-types';
2
+ import { SessionReplayConfig } from './session-replay-config';
2
3
  export declare class SessionReplayPlugin implements EnrichmentPlugin<ReactNativeClient, ReactNativeConfig> {
3
4
  name: string;
4
5
  type: "enrichment";
5
6
  config: ReactNativeConfig;
6
- constructor();
7
+ sessionReplayConfig: SessionReplayConfig;
8
+ constructor(config?: SessionReplayConfig);
7
9
  setup(config: ReactNativeConfig, _: ReactNativeClient): Promise<void>;
8
10
  execute(event: Event): Promise<Event | null>;
9
11
  teardown(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAKhH,qBAAa,mBAAoB,YAAW,gBAAgB,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAChG,IAAI,SAAmD;IACvD,IAAI,eAAyB;IAI7B,MAAM,EAAE,iBAAiB,CAAC;;IAMpB,KAAK,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMrE,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAmB5C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IASzB,0BAA0B;CAGjC"}
1
+ {"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../src/session-replay.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAIhH,OAAO,EAAE,mBAAmB,EAAoB,MAAM,yBAAyB,CAAC;AAEhF,qBAAa,mBAAoB,YAAW,gBAAgB,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAChG,IAAI,SAAmD;IACvD,IAAI,eAAyB;IAI7B,MAAM,EAAE,iBAAiB,CAAC;IAE1B,mBAAmB,EAAE,mBAAmB,CAAC;gBAE7B,MAAM,GAAE,mBAAwB;IAQtC,KAAK,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAYrE,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAmB5C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IASzB,0BAA0B;CAGjC"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.0";
1
+ export declare const VERSION = "0.2.2";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amplitude/plugin-session-replay-react-native",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Amplitude Session Replay plugin for React Native",
5
5
  "keywords": [
6
6
  "analytics",
@@ -92,5 +92,5 @@
92
92
  ]
93
93
  ]
94
94
  },
95
- "gitHead": "2b09117a76f23d80de58d636e59911a2fda5d169"
95
+ "gitHead": "55e24be56076b9746eb3f8a7f45d1df8105d99e8"
96
96
  }
package/src/index.tsx CHANGED
@@ -1,3 +1,5 @@
1
1
  export { SessionReplayPlugin } from './session-replay';
2
2
 
3
- export { AmpMaskView } from './AmpMaskView';
3
+ export { AmpMaskView } from './app-mask-view';
4
+
5
+ export { SessionReplayConfig } from './session-replay-config';
@@ -0,0 +1,11 @@
1
+ export interface SessionReplayConfig {
2
+ sampleRate?: number;
3
+ enableRemoteConfig?: boolean;
4
+ }
5
+
6
+ export const getDefaultConfig = () => {
7
+ return {
8
+ sampleRate: 0,
9
+ enableRemoteConfig: true,
10
+ };
11
+ }
@@ -7,6 +7,7 @@ import type { EnrichmentPlugin, Event, ReactNativeClient, ReactNativeConfig } fr
7
7
 
8
8
  import { PluginSessionReplayReactNative } from './native-module';
9
9
  import { VERSION } from './version';
10
+ import { SessionReplayConfig, getDefaultConfig } from './session-replay-config';
10
11
 
11
12
  export class SessionReplayPlugin implements EnrichmentPlugin<ReactNativeClient, ReactNativeConfig> {
12
13
  name = '@amplitude/plugin-session-replay-react-native';
@@ -16,14 +17,26 @@ export class SessionReplayPlugin implements EnrichmentPlugin<ReactNativeClient,
16
17
  // @ts-ignore
17
18
  config: ReactNativeConfig;
18
19
 
19
- constructor() {
20
- // empty default constructor
20
+ sessionReplayConfig: SessionReplayConfig;
21
+
22
+ constructor(config: SessionReplayConfig = {}) {
23
+ this.sessionReplayConfig = {
24
+ ...getDefaultConfig(),
25
+ ...config,
26
+ };
27
+ console.log('Initializing SessionReplayPlugin with config: ', this.sessionReplayConfig);
21
28
  }
22
29
 
23
30
  async setup(config: ReactNativeConfig, _: ReactNativeClient): Promise<void> {
24
31
  this.config = config;
25
32
  console.log(`Installing @amplitude/plugin-session-replay-react-native, version ${VERSION}.`);
26
- await PluginSessionReplayReactNative.setup(config.apiKey, config.deviceId, config.sessionId);
33
+ await PluginSessionReplayReactNative.setup(
34
+ config.apiKey,
35
+ config.deviceId,
36
+ config.sessionId,
37
+ this.sessionReplayConfig.sampleRate ?? 1,
38
+ this.sessionReplayConfig.enableRemoteConfig ?? true,
39
+ );
27
40
  }
28
41
 
29
42
  async execute(event: Event): Promise<Event | null> {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.0';
1
+ export const VERSION = '0.2.2';
@@ -1 +0,0 @@
1
- {"version":3,"names":["AmpMaskView","requireNativeComponent"],"sourceRoot":"../../src","sources":["AmpMaskView.tsx"],"mappings":";;;;;;AAAA;AAMO,MAAMA,WAAW,GACtB,IAAAC,mCAAsB,EAAmB,gBAAgB,CAAC;AAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["requireNativeComponent","AmpMaskView"],"sourceRoot":"../../src","sources":["AmpMaskView.tsx"],"mappings":"AAAA,SAASA,sBAAsB,QAAwB,cAAc;AAMrE,OAAO,MAAMC,WAAW,GACtBD,sBAAsB,CAAmB,gBAAgB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AmpMaskView.d.ts","sourceRoot":"","sources":["../../src/AmpMaskView.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,wDACoC,CAAC"}
File without changes