@mixpanel/react-native-session-replay 1.0.1 → 1.2.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 (20) hide show
  1. package/MixpanelReactNativeSessionReplay.podspec +1 -1
  2. package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeMixpanelReactNativeSessionReplaySpec.java +9 -1
  3. package/android/app/build/generated/source/codegen/jni/MixpanelReactNativeSessionReplaySpec-generated.cpp +14 -2
  4. package/android/app/build/generated/source/codegen/jni/react/renderer/components/MixpanelReactNativeSessionReplaySpec/MixpanelReactNativeSessionReplaySpecJSI-generated.cpp +15 -2
  5. package/android/app/build/generated/source/codegen/jni/react/renderer/components/MixpanelReactNativeSessionReplaySpec/MixpanelReactNativeSessionReplaySpecJSI.h +23 -5
  6. package/android/build.gradle +1 -1
  7. package/android/generated/java/com/mpsessionreplay/NativeMpSessionReplaySpec.java +49 -0
  8. package/android/generated/jni/CMakeLists.txt +36 -0
  9. package/android/generated/jni/RNMpSessionReplaySpec-generated.cpp +50 -0
  10. package/android/generated/jni/RNMpSessionReplaySpec.h +31 -0
  11. package/android/generated/jni/react/renderer/components/RNMpSessionReplaySpec/RNMpSessionReplaySpecJSI-generated.cpp +51 -0
  12. package/android/generated/jni/react/renderer/components/RNMpSessionReplaySpec/RNMpSessionReplaySpecJSI.h +98 -0
  13. package/android/src/main/java/com/mixpanelreactnativesessionreplay/MixpanelReactNativeSessionReplayModule.kt +1 -1
  14. package/ios/MixpanelSwiftSessionReplay.swift +1 -1
  15. package/lib/module/index.js +26 -1
  16. package/lib/module/index.js.map +1 -1
  17. package/lib/typescript/src/index.d.ts +21 -1
  18. package/lib/typescript/src/index.d.ts.map +1 -1
  19. package/package.json +1 -1
  20. package/src/index.tsx +29 -0
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
15
15
 
16
16
  s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
17
17
  s.private_header_files = "ios/**/*.h"
18
- s.dependency 'MixpanelSessionReplay', '1.2.0'
18
+ s.dependency 'MixpanelSessionReplay', '1.3.2'
19
19
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20
20
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
21
21
  if respond_to?(:install_modules_dependencies, true)
@@ -38,7 +38,7 @@ public abstract class NativeMixpanelReactNativeSessionReplaySpec extends ReactCo
38
38
 
39
39
  @ReactMethod
40
40
  @DoNotStrip
41
- public abstract void startRecording(Promise promise);
41
+ public abstract void startRecording(double recordingSessionsPercent, Promise promise);
42
42
 
43
43
  @ReactMethod
44
44
  @DoNotStrip
@@ -51,4 +51,12 @@ public abstract class NativeMixpanelReactNativeSessionReplaySpec extends ReactCo
51
51
  @ReactMethod
52
52
  @DoNotStrip
53
53
  public abstract void identify(String distinctId, Promise promise);
54
+
55
+ @ReactMethod
56
+ @DoNotStrip
57
+ public abstract void getReplayId(Promise promise);
58
+
59
+ @ReactMethod
60
+ @DoNotStrip
61
+ public abstract void flush(Promise promise);
54
62
  }
@@ -19,7 +19,7 @@ static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionRepla
19
19
 
20
20
  static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_startRecording(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
21
  static jmethodID cachedMethodId = nullptr;
22
- return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "startRecording", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
22
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "startRecording", "(DLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
23
23
  }
24
24
 
25
25
  static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_stopRecording(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
@@ -37,13 +37,25 @@ static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionRepla
37
37
  return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "identify", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
38
38
  }
39
39
 
40
+ static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_getReplayId(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
41
+ static jmethodID cachedMethodId = nullptr;
42
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "getReplayId", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
43
+ }
44
+
45
+ static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_flush(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
46
+ static jmethodID cachedMethodId = nullptr;
47
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "flush", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
48
+ }
49
+
40
50
  NativeMixpanelReactNativeSessionReplaySpecJSI::NativeMixpanelReactNativeSessionReplaySpecJSI(const JavaTurboModule::InitParams &params)
41
51
  : JavaTurboModule(params) {
42
52
  methodMap_["initialize"] = MethodMetadata {3, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_initialize};
43
- methodMap_["startRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_startRecording};
53
+ methodMap_["startRecording"] = MethodMetadata {1, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_startRecording};
44
54
  methodMap_["stopRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_stopRecording};
45
55
  methodMap_["isRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_isRecording};
46
56
  methodMap_["identify"] = MethodMetadata {1, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_identify};
57
+ methodMap_["getReplayId"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_getReplayId};
58
+ methodMap_["flush"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_flush};
47
59
  }
48
60
 
49
61
  std::shared_ptr<TurboModule> MixpanelReactNativeSessionReplaySpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
@@ -21,7 +21,8 @@ static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJS
21
21
  }
22
22
  static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_startRecording(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
23
23
  return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->startRecording(
24
- rt
24
+ rt,
25
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
25
26
  );
26
27
  }
27
28
  static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_stopRecording(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
@@ -40,14 +41,26 @@ static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJS
40
41
  count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
41
42
  );
42
43
  }
44
+ static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_getReplayId(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
45
+ return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->getReplayId(
46
+ rt
47
+ );
48
+ }
49
+ static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_flush(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
50
+ return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->flush(
51
+ rt
52
+ );
53
+ }
43
54
 
44
55
  NativeMixpanelReactNativeSessionReplayCxxSpecJSI::NativeMixpanelReactNativeSessionReplayCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
45
56
  : TurboModule("MixpanelReactNativeSessionReplay", jsInvoker) {
46
57
  methodMap_["initialize"] = MethodMetadata {3, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_initialize};
47
- methodMap_["startRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_startRecording};
58
+ methodMap_["startRecording"] = MethodMetadata {1, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_startRecording};
48
59
  methodMap_["stopRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_stopRecording};
49
60
  methodMap_["isRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_isRecording};
50
61
  methodMap_["identify"] = MethodMetadata {1, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_identify};
62
+ methodMap_["getReplayId"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_getReplayId};
63
+ methodMap_["flush"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_flush};
51
64
  }
52
65
 
53
66
 
@@ -21,10 +21,12 @@ protected:
21
21
 
22
22
  public:
23
23
  virtual jsi::Value initialize(jsi::Runtime &rt, jsi::String token, jsi::String distinctId, jsi::String configJSON) = 0;
24
- virtual jsi::Value startRecording(jsi::Runtime &rt) = 0;
24
+ virtual jsi::Value startRecording(jsi::Runtime &rt, double recordingSessionsPercent) = 0;
25
25
  virtual jsi::Value stopRecording(jsi::Runtime &rt) = 0;
26
26
  virtual jsi::Value isRecording(jsi::Runtime &rt) = 0;
27
27
  virtual jsi::Value identify(jsi::Runtime &rt, jsi::String distinctId) = 0;
28
+ virtual jsi::Value getReplayId(jsi::Runtime &rt) = 0;
29
+ virtual jsi::Value flush(jsi::Runtime &rt) = 0;
28
30
 
29
31
  };
30
32
 
@@ -63,13 +65,13 @@ private:
63
65
  return bridging::callFromJs<jsi::Value>(
64
66
  rt, &T::initialize, jsInvoker_, instance_, std::move(token), std::move(distinctId), std::move(configJSON));
65
67
  }
66
- jsi::Value startRecording(jsi::Runtime &rt) override {
68
+ jsi::Value startRecording(jsi::Runtime &rt, double recordingSessionsPercent) override {
67
69
  static_assert(
68
- bridging::getParameterCount(&T::startRecording) == 1,
69
- "Expected startRecording(...) to have 1 parameters");
70
+ bridging::getParameterCount(&T::startRecording) == 2,
71
+ "Expected startRecording(...) to have 2 parameters");
70
72
 
71
73
  return bridging::callFromJs<jsi::Value>(
72
- rt, &T::startRecording, jsInvoker_, instance_);
74
+ rt, &T::startRecording, jsInvoker_, instance_, std::move(recordingSessionsPercent));
73
75
  }
74
76
  jsi::Value stopRecording(jsi::Runtime &rt) override {
75
77
  static_assert(
@@ -95,6 +97,22 @@ private:
95
97
  return bridging::callFromJs<jsi::Value>(
96
98
  rt, &T::identify, jsInvoker_, instance_, std::move(distinctId));
97
99
  }
100
+ jsi::Value getReplayId(jsi::Runtime &rt) override {
101
+ static_assert(
102
+ bridging::getParameterCount(&T::getReplayId) == 1,
103
+ "Expected getReplayId(...) to have 1 parameters");
104
+
105
+ return bridging::callFromJs<jsi::Value>(
106
+ rt, &T::getReplayId, jsInvoker_, instance_);
107
+ }
108
+ jsi::Value flush(jsi::Runtime &rt) override {
109
+ static_assert(
110
+ bridging::getParameterCount(&T::flush) == 1,
111
+ "Expected flush(...) to have 1 parameters");
112
+
113
+ return bridging::callFromJs<jsi::Value>(
114
+ rt, &T::flush, jsInvoker_, instance_);
115
+ }
98
116
 
99
117
  private:
100
118
  friend class NativeMixpanelReactNativeSessionReplayCxxSpec;
@@ -79,7 +79,7 @@ dependencies {
79
79
  implementation "com.mixpanel.android:mixpanel-android:8.0.2"
80
80
 
81
81
  // Mixpanel Android Session Replay SDK dependency
82
- implementation "com.mixpanel.android:mixpanel-android-session-replay:1.0.5"
82
+ implementation "com.mixpanel.android:mixpanel-android-session-replay:1.1.2"
83
83
  }
84
84
 
85
85
  react {
@@ -0,0 +1,49 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJavaSpec.js
9
+ *
10
+ * @nolint
11
+ */
12
+
13
+ package com.mpsessionreplay;
14
+
15
+ import com.facebook.proguard.annotations.DoNotStrip;
16
+ import com.facebook.react.bridge.ReactApplicationContext;
17
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
18
+ import com.facebook.react.bridge.ReactMethod;
19
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
20
+ import javax.annotation.Nonnull;
21
+
22
+ public abstract class NativeMpSessionReplaySpec extends ReactContextBaseJavaModule implements TurboModule {
23
+ public static final String NAME = "MpSessionReplay";
24
+
25
+ public NativeMpSessionReplaySpec(ReactApplicationContext reactContext) {
26
+ super(reactContext);
27
+ }
28
+
29
+ @Override
30
+ public @Nonnull String getName() {
31
+ return NAME;
32
+ }
33
+
34
+ @ReactMethod
35
+ @DoNotStrip
36
+ public abstract void startRecording();
37
+
38
+ @ReactMethod
39
+ @DoNotStrip
40
+ public abstract void stopRecording();
41
+
42
+ @ReactMethod
43
+ @DoNotStrip
44
+ public abstract void initialize(String token, String distinctId, String configJSON);
45
+
46
+ @ReactMethod
47
+ @DoNotStrip
48
+ public abstract void captureScreenshot();
49
+ }
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNMpSessionReplaySpec/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_RNMpSessionReplaySpec
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_RNMpSessionReplaySpec PUBLIC . react/renderer/components/RNMpSessionReplaySpec)
18
+
19
+ target_link_libraries(
20
+ react_codegen_RNMpSessionReplaySpec
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_options(
29
+ react_codegen_RNMpSessionReplaySpec
30
+ PRIVATE
31
+ -DLOG_TAG=\"ReactNative\"
32
+ -fexceptions
33
+ -frtti
34
+ -std=c++20
35
+ -Wall
36
+ )
@@ -0,0 +1,50 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "RNMpSessionReplaySpec.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeMpSessionReplaySpecJSI_startRecording(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
+ static jmethodID cachedMethodId = nullptr;
17
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "startRecording", "()V", args, count, cachedMethodId);
18
+ }
19
+
20
+ static facebook::jsi::Value __hostFunction_NativeMpSessionReplaySpecJSI_stopRecording(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
+ static jmethodID cachedMethodId = nullptr;
22
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "stopRecording", "()V", args, count, cachedMethodId);
23
+ }
24
+
25
+ static facebook::jsi::Value __hostFunction_NativeMpSessionReplaySpecJSI_initialize(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
26
+ static jmethodID cachedMethodId = nullptr;
27
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "initialize", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, count, cachedMethodId);
28
+ }
29
+
30
+ static facebook::jsi::Value __hostFunction_NativeMpSessionReplaySpecJSI_captureScreenshot(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
31
+ static jmethodID cachedMethodId = nullptr;
32
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "captureScreenshot", "()V", args, count, cachedMethodId);
33
+ }
34
+
35
+ NativeMpSessionReplaySpecJSI::NativeMpSessionReplaySpecJSI(const JavaTurboModule::InitParams &params)
36
+ : JavaTurboModule(params) {
37
+ methodMap_["startRecording"] = MethodMetadata {0, __hostFunction_NativeMpSessionReplaySpecJSI_startRecording};
38
+ methodMap_["stopRecording"] = MethodMetadata {0, __hostFunction_NativeMpSessionReplaySpecJSI_stopRecording};
39
+ methodMap_["initialize"] = MethodMetadata {3, __hostFunction_NativeMpSessionReplaySpecJSI_initialize};
40
+ methodMap_["captureScreenshot"] = MethodMetadata {0, __hostFunction_NativeMpSessionReplaySpecJSI_captureScreenshot};
41
+ }
42
+
43
+ std::shared_ptr<TurboModule> RNMpSessionReplaySpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
44
+ if (moduleName == "MpSessionReplay") {
45
+ return std::make_shared<NativeMpSessionReplaySpecJSI>(params);
46
+ }
47
+ return nullptr;
48
+ }
49
+
50
+ } // namespace facebook::react
@@ -0,0 +1,31 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ /**
20
+ * JNI C++ class for module 'NativeMpSessionReplay'
21
+ */
22
+ class JSI_EXPORT NativeMpSessionReplaySpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeMpSessionReplaySpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> RNMpSessionReplaySpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
+
31
+ } // namespace facebook::react
@@ -0,0 +1,51 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleCpp.js
8
+ */
9
+
10
+ #include "RNMpSessionReplaySpecJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+ static jsi::Value __hostFunction_NativeMpSessionReplayCxxSpecJSI_startRecording(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
+ static_cast<NativeMpSessionReplayCxxSpecJSI *>(&turboModule)->startRecording(
16
+ rt
17
+ );
18
+ return jsi::Value::undefined();
19
+ }
20
+ static jsi::Value __hostFunction_NativeMpSessionReplayCxxSpecJSI_stopRecording(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
21
+ static_cast<NativeMpSessionReplayCxxSpecJSI *>(&turboModule)->stopRecording(
22
+ rt
23
+ );
24
+ return jsi::Value::undefined();
25
+ }
26
+ static jsi::Value __hostFunction_NativeMpSessionReplayCxxSpecJSI_initialize(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
27
+ static_cast<NativeMpSessionReplayCxxSpecJSI *>(&turboModule)->initialize(
28
+ rt,
29
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
30
+ count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
31
+ count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt)
32
+ );
33
+ return jsi::Value::undefined();
34
+ }
35
+ static jsi::Value __hostFunction_NativeMpSessionReplayCxxSpecJSI_captureScreenshot(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
36
+ static_cast<NativeMpSessionReplayCxxSpecJSI *>(&turboModule)->captureScreenshot(
37
+ rt
38
+ );
39
+ return jsi::Value::undefined();
40
+ }
41
+
42
+ NativeMpSessionReplayCxxSpecJSI::NativeMpSessionReplayCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
43
+ : TurboModule("MpSessionReplay", jsInvoker) {
44
+ methodMap_["startRecording"] = MethodMetadata {0, __hostFunction_NativeMpSessionReplayCxxSpecJSI_startRecording};
45
+ methodMap_["stopRecording"] = MethodMetadata {0, __hostFunction_NativeMpSessionReplayCxxSpecJSI_stopRecording};
46
+ methodMap_["initialize"] = MethodMetadata {3, __hostFunction_NativeMpSessionReplayCxxSpecJSI_initialize};
47
+ methodMap_["captureScreenshot"] = MethodMetadata {0, __hostFunction_NativeMpSessionReplayCxxSpecJSI_captureScreenshot};
48
+ }
49
+
50
+
51
+ } // namespace facebook::react
@@ -0,0 +1,98 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleH.js
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #include <ReactCommon/TurboModule.h>
13
+ #include <react/bridging/Bridging.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+ class JSI_EXPORT NativeMpSessionReplayCxxSpecJSI : public TurboModule {
19
+ protected:
20
+ NativeMpSessionReplayCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
+
22
+ public:
23
+ virtual void startRecording(jsi::Runtime &rt) = 0;
24
+ virtual void stopRecording(jsi::Runtime &rt) = 0;
25
+ virtual void initialize(jsi::Runtime &rt, jsi::String token, jsi::String distinctId, jsi::String configJSON) = 0;
26
+ virtual void captureScreenshot(jsi::Runtime &rt) = 0;
27
+
28
+ };
29
+
30
+ template <typename T>
31
+ class JSI_EXPORT NativeMpSessionReplayCxxSpec : public TurboModule {
32
+ public:
33
+ jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
34
+ return delegate_.create(rt, propName);
35
+ }
36
+
37
+ std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
38
+ return delegate_.getPropertyNames(runtime);
39
+ }
40
+
41
+ static constexpr std::string_view kModuleName = "MpSessionReplay";
42
+
43
+ protected:
44
+ NativeMpSessionReplayCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
45
+ : TurboModule(std::string{NativeMpSessionReplayCxxSpec::kModuleName}, jsInvoker),
46
+ delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
47
+
48
+
49
+ private:
50
+ class Delegate : public NativeMpSessionReplayCxxSpecJSI {
51
+ public:
52
+ Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
53
+ NativeMpSessionReplayCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
54
+
55
+ }
56
+
57
+ void startRecording(jsi::Runtime &rt) override {
58
+ static_assert(
59
+ bridging::getParameterCount(&T::startRecording) == 1,
60
+ "Expected startRecording(...) to have 1 parameters");
61
+
62
+ return bridging::callFromJs<void>(
63
+ rt, &T::startRecording, jsInvoker_, instance_);
64
+ }
65
+ void stopRecording(jsi::Runtime &rt) override {
66
+ static_assert(
67
+ bridging::getParameterCount(&T::stopRecording) == 1,
68
+ "Expected stopRecording(...) to have 1 parameters");
69
+
70
+ return bridging::callFromJs<void>(
71
+ rt, &T::stopRecording, jsInvoker_, instance_);
72
+ }
73
+ void initialize(jsi::Runtime &rt, jsi::String token, jsi::String distinctId, jsi::String configJSON) override {
74
+ static_assert(
75
+ bridging::getParameterCount(&T::initialize) == 4,
76
+ "Expected initialize(...) to have 4 parameters");
77
+
78
+ return bridging::callFromJs<void>(
79
+ rt, &T::initialize, jsInvoker_, instance_, std::move(token), std::move(distinctId), std::move(configJSON));
80
+ }
81
+ void captureScreenshot(jsi::Runtime &rt) override {
82
+ static_assert(
83
+ bridging::getParameterCount(&T::captureScreenshot) == 1,
84
+ "Expected captureScreenshot(...) to have 1 parameters");
85
+
86
+ return bridging::callFromJs<void>(
87
+ rt, &T::captureScreenshot, jsInvoker_, instance_);
88
+ }
89
+
90
+ private:
91
+ friend class NativeMpSessionReplayCxxSpec;
92
+ T *instance_;
93
+ };
94
+
95
+ Delegate delegate_;
96
+ };
97
+
98
+ } // namespace facebook::react
@@ -307,7 +307,7 @@ class MixpanelReactNativeSessionReplayModule(reactContext: ReactApplicationConte
307
307
 
308
308
  companion object {
309
309
  const val NAME = "MixpanelReactNativeSessionReplay"
310
- const val LIB_VERSION = "1.0.1"
310
+ const val LIB_VERSION = "1.2.0"
311
311
  const val MP_LIB = "react-native-sr"
312
312
  }
313
313
  }
@@ -3,7 +3,7 @@ import MixpanelSessionReplay
3
3
  import UIKit
4
4
 
5
5
  @objc public class MixpanelSwiftSessionReplay: NSObject {
6
- static let libVersion = "1.0.1"
6
+ static let libVersion = "1.2.0"
7
7
  static let mpLib = "react-native-sr"
8
8
 
9
9
  @objc public static func startRecording(recordingSessionsPercent: Double = 100.0) {
@@ -9,6 +9,12 @@ export let MPSessionReplayMask = /*#__PURE__*/function (MPSessionReplayMask) {
9
9
  MPSessionReplayMask["Image"] = "image";
10
10
  return MPSessionReplayMask;
11
11
  }({});
12
+ export let MPSessionReplayRemoteSettingsMode = /*#__PURE__*/function (MPSessionReplayRemoteSettingsMode) {
13
+ MPSessionReplayRemoteSettingsMode["Disabled"] = "disabled";
14
+ MPSessionReplayRemoteSettingsMode["Strict"] = "strict";
15
+ MPSessionReplayRemoteSettingsMode["Fallback"] = "fallback";
16
+ return MPSessionReplayRemoteSettingsMode;
17
+ }({});
12
18
  export class MPSessionReplayConfig {
13
19
  /**
14
20
  * Determines whether replay events will only be flushed to the server when the device has a WiFi connection.
@@ -67,13 +73,29 @@ export class MPSessionReplayConfig {
67
73
  * - **Default:** `false`
68
74
  */
69
75
 
76
+ /**
77
+ * Controls how remote configuration settings are fetched and applied.
78
+ *
79
+ * Remote settings enable server-side control over session replay parameters such as sampling rate.
80
+ * This setting determines the SDK's behavior when fetching these settings and how failures are handled.
81
+ *
82
+ * - **`disabled`** (default): Remote config is fetched to check if session replay is enabled, but SDK config
83
+ * settings from the server are not used. The SDK uses only the app-provided configuration.
84
+ * - **`strict`**: Remote config is required. If the fetch fails or times out, the SDK will not initialize.
85
+ * - **`fallback`**: Remote config is fetched and merged with local config. On fetch failure, the SDK falls back
86
+ * to cached config (if available) or uses the local config.
87
+ *
88
+ * - **Default:** `disabled`
89
+ */
90
+
70
91
  constructor({
71
92
  wifiOnly = true,
72
93
  autoStartRecording = true,
73
94
  recordingSessionsPercent = 100,
74
95
  autoMaskedViews = [MPSessionReplayMask.Image, MPSessionReplayMask.Text, MPSessionReplayMask.Web, MPSessionReplayMask.Map],
75
96
  flushInterval = 10,
76
- enableLogging = false
97
+ enableLogging = false,
98
+ remoteSettingsMode = MPSessionReplayRemoteSettingsMode.Disabled
77
99
  } = {}) {
78
100
  this.wifiOnly = wifiOnly;
79
101
  this.autoStartRecording = autoStartRecording;
@@ -81,6 +103,7 @@ export class MPSessionReplayConfig {
81
103
  this.autoMaskedViews = autoMaskedViews;
82
104
  this.flushInterval = flushInterval;
83
105
  this.enableLogging = enableLogging;
106
+ this.remoteSettingsMode = remoteSettingsMode;
84
107
  }
85
108
  transformMaskValueForPlatform(value) {
86
109
  if (Platform.OS === 'android') {
@@ -93,6 +116,7 @@ export class MPSessionReplayConfig {
93
116
  toJSON() {
94
117
  // Transform autoMaskedViews for platform-specific requirements
95
118
  const transformedAutoMaskedViews = this.autoMaskedViews.filter(mask => !(Platform.OS === 'android' && mask === MPSessionReplayMask.Map)).map(mask => this.transformMaskValueForPlatform(mask));
119
+ const transformedRemoteSettingsMode = Platform.OS === 'android' ? this.remoteSettingsMode.toUpperCase() : this.remoteSettingsMode;
96
120
  const config = {
97
121
  wifiOnly: this.wifiOnly,
98
122
  recordingSessionsPercent: this.recordingSessionsPercent,
@@ -100,6 +124,7 @@ export class MPSessionReplayConfig {
100
124
  autoStartRecording: this.autoStartRecording,
101
125
  flushInterval: this.flushInterval,
102
126
  enableLogging: this.enableLogging,
127
+ remoteSettingsMode: transformedRemoteSettingsMode,
103
128
  // iOS-specific config to enable session replay on iOS 26 and later
104
129
  ...Platform.select({
105
130
  ios: {
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","MixpanelReactNativeSessionReplay","MPSessionReplayMask","MPSessionReplayConfig","constructor","wifiOnly","autoStartRecording","recordingSessionsPercent","autoMaskedViews","Image","Text","Web","Map","flushInterval","enableLogging","transformMaskValueForPlatform","value","OS","charAt","toUpperCase","slice","toJSON","transformedAutoMaskedViews","filter","mask","map","config","select","ios","enableSessionReplayOniOS26AndLater","default","JSON","stringify","initialize","token","distinctId","Error","undefined","json","startRecording","stopRecording","isRecording","identify","getReplayId","flush","MPSessionReplayView","MPSessionReplay"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,Q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KAAKA,CAAA,EAAkB;EACpC,OAAO3C,gCAAgC,CAAC2C,KAAK,CAAC,CAAC;AACjD;AAEA,SAASC,mBAAmB,QAAQ,gCAA6B;AAEjE,OAAO,MAAMC,eAAe,GAAG;EAC7Bb,UAAU;EACVM,cAAc;EACdC,aAAa;EACbC,WAAW;EACXC,QAAQ;EACRC,WAAW;EACXC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Platform","MixpanelReactNativeSessionReplay","MPSessionReplayMask","MPSessionReplayRemoteSettingsMode","MPSessionReplayConfig","constructor","wifiOnly","autoStartRecording","recordingSessionsPercent","autoMaskedViews","Image","Text","Web","Map","flushInterval","enableLogging","remoteSettingsMode","Disabled","transformMaskValueForPlatform","value","OS","charAt","toUpperCase","slice","toJSON","transformedAutoMaskedViews","filter","mask","map","transformedRemoteSettingsMode","config","select","ios","enableSessionReplayOniOS26AndLater","default","JSON","stringify","initialize","token","distinctId","Error","undefined","json","startRecording","stopRecording","isRecording","identify","getReplayId","flush","MPSessionReplayView","MPSessionReplay"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,gCAAgC,MAAM,6CAA0C;AAEvF,WAAYC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAO/B,WAAYC,iCAAiC,0BAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAjCA,iCAAiC;EAAA,OAAjCA,iCAAiC;AAAA;AAM7C,OAAO,MAAMC,qBAAqB,CAAC;EACjC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AAC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AAC;AACjD;AAEA,SAASC,mBAAmB,QAAQ,gCAA6B;AAEjE,OAAO,MAAMC,eAAe,GAAG;EAC7Bb,UAAU;EACVM,cAAc;EACdC,aAAa;EACbC,WAAW;EACXC,QAAQ;EACRC,WAAW;EACXC;AACF,CAAC","ignoreList":[]}
@@ -4,6 +4,11 @@ export declare enum MPSessionReplayMask {
4
4
  Map = "map",
5
5
  Image = "image"
6
6
  }
7
+ export declare enum MPSessionReplayRemoteSettingsMode {
8
+ Disabled = "disabled",
9
+ Strict = "strict",
10
+ Fallback = "fallback"
11
+ }
7
12
  export declare class MPSessionReplayConfig {
8
13
  /**
9
14
  * Determines whether replay events will only be flushed to the server when the device has a WiFi connection.
@@ -62,7 +67,22 @@ export declare class MPSessionReplayConfig {
62
67
  * - **Default:** `false`
63
68
  */
64
69
  enableLogging: boolean;
65
- constructor({ wifiOnly, autoStartRecording, recordingSessionsPercent, autoMaskedViews, flushInterval, enableLogging, }?: Partial<MPSessionReplayConfig>);
70
+ /**
71
+ * Controls how remote configuration settings are fetched and applied.
72
+ *
73
+ * Remote settings enable server-side control over session replay parameters such as sampling rate.
74
+ * This setting determines the SDK's behavior when fetching these settings and how failures are handled.
75
+ *
76
+ * - **`disabled`** (default): Remote config is fetched to check if session replay is enabled, but SDK config
77
+ * settings from the server are not used. The SDK uses only the app-provided configuration.
78
+ * - **`strict`**: Remote config is required. If the fetch fails or times out, the SDK will not initialize.
79
+ * - **`fallback`**: Remote config is fetched and merged with local config. On fetch failure, the SDK falls back
80
+ * to cached config (if available) or uses the local config.
81
+ *
82
+ * - **Default:** `disabled`
83
+ */
84
+ remoteSettingsMode: MPSessionReplayRemoteSettingsMode;
85
+ constructor({ wifiOnly, autoStartRecording, recordingSessionsPercent, autoMaskedViews, flushInterval, enableLogging, remoteSettingsMode, }?: Partial<MPSessionReplayConfig>);
66
86
  private transformMaskValueForPlatform;
67
87
  toJSON(): string;
68
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sour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MAAY,GACrC,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;;;GAIG;AACH,iBAAe,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5C;AAED;;;;GAIG;AACH,iBAAe,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAE7C;AAED;;;;;;;;;GASG;AACH,iBAAe,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzD;AAED;;;;;;;GAOG;AACH,iBAAe,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAEnD;AAED;;;;;;;GAOG;AACH,iBAAe,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpC;AAED,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,eAAO,MAAM,eAAe;;;;;;;;CAQ3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mixpanel/react-native-session-replay",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "Official React Native turbo module for Mixpanel Session Replay",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
package/src/index.tsx CHANGED
@@ -8,6 +8,12 @@ export enum MPSessionReplayMask {
8
8
  Image = 'image',
9
9
  }
10
10
 
11
+ export enum MPSessionReplayRemoteSettingsMode {
12
+ Disabled = 'disabled',
13
+ Strict = 'strict',
14
+ Fallback = 'fallback',
15
+ }
16
+
11
17
  export class MPSessionReplayConfig {
12
18
  /**
13
19
  * Determines whether replay events will only be flushed to the server when the device has a WiFi connection.
@@ -72,6 +78,22 @@ export class MPSessionReplayConfig {
72
78
  */
73
79
  enableLogging: boolean;
74
80
 
81
+ /**
82
+ * Controls how remote configuration settings are fetched and applied.
83
+ *
84
+ * Remote settings enable server-side control over session replay parameters such as sampling rate.
85
+ * This setting determines the SDK's behavior when fetching these settings and how failures are handled.
86
+ *
87
+ * - **`disabled`** (default): Remote config is fetched to check if session replay is enabled, but SDK config
88
+ * settings from the server are not used. The SDK uses only the app-provided configuration.
89
+ * - **`strict`**: Remote config is required. If the fetch fails or times out, the SDK will not initialize.
90
+ * - **`fallback`**: Remote config is fetched and merged with local config. On fetch failure, the SDK falls back
91
+ * to cached config (if available) or uses the local config.
92
+ *
93
+ * - **Default:** `disabled`
94
+ */
95
+ remoteSettingsMode: MPSessionReplayRemoteSettingsMode;
96
+
75
97
  constructor({
76
98
  wifiOnly = true,
77
99
  autoStartRecording = true,
@@ -84,6 +106,7 @@ export class MPSessionReplayConfig {
84
106
  ],
85
107
  flushInterval = 10,
86
108
  enableLogging = false,
109
+ remoteSettingsMode = MPSessionReplayRemoteSettingsMode.Disabled,
87
110
  }: Partial<MPSessionReplayConfig> = {}) {
88
111
  this.wifiOnly = wifiOnly;
89
112
  this.autoStartRecording = autoStartRecording;
@@ -91,6 +114,7 @@ export class MPSessionReplayConfig {
91
114
  this.autoMaskedViews = autoMaskedViews;
92
115
  this.flushInterval = flushInterval;
93
116
  this.enableLogging = enableLogging;
117
+ this.remoteSettingsMode = remoteSettingsMode;
94
118
  }
95
119
 
96
120
  private transformMaskValueForPlatform(value: string): string {
@@ -110,6 +134,10 @@ export class MPSessionReplayConfig {
110
134
  !(Platform.OS === 'android' && mask === MPSessionReplayMask.Map)
111
135
  )
112
136
  .map((mask) => this.transformMaskValueForPlatform(mask));
137
+ const transformedRemoteSettingsMode =
138
+ Platform.OS === 'android'
139
+ ? this.remoteSettingsMode.toUpperCase()
140
+ : this.remoteSettingsMode;
113
141
 
114
142
  const config = {
115
143
  wifiOnly: this.wifiOnly,
@@ -118,6 +146,7 @@ export class MPSessionReplayConfig {
118
146
  autoStartRecording: this.autoStartRecording,
119
147
  flushInterval: this.flushInterval,
120
148
  enableLogging: this.enableLogging,
149
+ remoteSettingsMode: transformedRemoteSettingsMode,
121
150
  // iOS-specific config to enable session replay on iOS 26 and later
122
151
  ...Platform.select({
123
152
  ios: { enableSessionReplayOniOS26AndLater: true },