@mixpanel/react-native-session-replay 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MixpanelReactNativeSessionReplay.podspec +1 -1
- package/README.md +2 -0
- package/android/build.gradle +1 -1
- package/lib/module/index.js +177 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +102 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +2 -24
- package/src/index.tsx +194 -3
- package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeMixpanelReactNativeSessionReplaySpec.java +0 -62
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -36
- package/android/app/build/generated/source/codegen/jni/MixpanelReactNativeSessionReplaySpec-generated.cpp +0 -68
- package/android/app/build/generated/source/codegen/jni/MixpanelReactNativeSessionReplaySpec.h +0 -31
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/MixpanelReactNativeSessionReplaySpec/MixpanelReactNativeSessionReplaySpecJSI-generated.cpp +0 -67
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/MixpanelReactNativeSessionReplaySpec/MixpanelReactNativeSessionReplaySpecJSI.h +0 -125
- package/android/generated/java/com/mpsessionreplay/NativeMpSessionReplaySpec.java +0 -49
- package/android/generated/jni/CMakeLists.txt +0 -36
- package/android/generated/jni/RNMpSessionReplaySpec-generated.cpp +0 -50
- package/android/generated/jni/RNMpSessionReplaySpec.h +0 -31
- package/android/generated/jni/react/renderer/components/RNMpSessionReplaySpec/RNMpSessionReplaySpecJSI-generated.cpp +0 -51
- package/android/generated/jni/react/renderer/components/RNMpSessionReplaySpec/RNMpSessionReplaySpecJSI.h +0 -98
package/src/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Platform } from 'react-native';
|
|
1
|
+
import { Platform, processColor, type ColorValue } from 'react-native';
|
|
2
2
|
import MixpanelReactNativeSessionReplay from './NativeMixpanelReactNativeSessionReplay';
|
|
3
3
|
|
|
4
4
|
export enum MPSessionReplayMask {
|
|
@@ -14,6 +14,155 @@ export enum MPSessionReplayRemoteSettingsMode {
|
|
|
14
14
|
Fallback = 'fallback',
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Base URLs for Mixpanel's managed data residency regions.
|
|
19
|
+
*
|
|
20
|
+
* Pass one of these constants to {@link MPSessionReplayConfig.serverURL} to route
|
|
21
|
+
* session replay traffic to the matching region, or pass any other `https://` URL
|
|
22
|
+
* to send traffic through a custom endpoint (for example, a corporate proxy).
|
|
23
|
+
*/
|
|
24
|
+
export const MPDataResidency: Readonly<Record<'US' | 'EU' | 'IN', string>> = {
|
|
25
|
+
/** US data residency (default): `https://api.mixpanel.com`. */
|
|
26
|
+
US: 'https://api.mixpanel.com',
|
|
27
|
+
/** EU data residency: `https://api-eu.mixpanel.com`. */
|
|
28
|
+
EU: 'https://api-eu.mixpanel.com',
|
|
29
|
+
/** India data residency: `https://api-in.mixpanel.com`. */
|
|
30
|
+
IN: 'https://api-in.mixpanel.com',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Color configuration for the on-device debug mask overlay.
|
|
35
|
+
*
|
|
36
|
+
* Each color accepts any React Native [`ColorValue`](https://reactnative.dev/docs/colors)
|
|
37
|
+
* — for example `'red'`, `'#FF0000'`, `'rgba(255, 0, 0, 0.5)'`, or `0xFFFF0000`.
|
|
38
|
+
* Setting any of `maskColor`, `autoMaskColor`, or `unmaskColor` to `null` hides that
|
|
39
|
+
* category from the overlay.
|
|
40
|
+
*
|
|
41
|
+
* The overlay only renders when `__DEV__` is `true` — `debugOptions` is ignored in
|
|
42
|
+
* production bundles regardless of what is passed.
|
|
43
|
+
*/
|
|
44
|
+
export class MPDebugOverlayColors {
|
|
45
|
+
/**
|
|
46
|
+
* Color used to draw regions that are explicitly masked (sensitive views / text input).
|
|
47
|
+
* Set to `null` to hide masked regions from the overlay.
|
|
48
|
+
*
|
|
49
|
+
* - **Default:** `'red'`
|
|
50
|
+
*/
|
|
51
|
+
maskColor: ColorValue | null;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Color used to draw regions that are auto-masked (text, images, web views, maps).
|
|
55
|
+
* Set to `null` to hide auto-masked regions from the overlay.
|
|
56
|
+
*
|
|
57
|
+
* - **Default:** `'orange'`
|
|
58
|
+
*/
|
|
59
|
+
autoMaskColor: ColorValue | null;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Color used to draw regions explicitly excluded from masking (safe views).
|
|
63
|
+
* Set to `null` to hide unmask regions from the overlay.
|
|
64
|
+
*
|
|
65
|
+
* - **Default:** `'green'`
|
|
66
|
+
*/
|
|
67
|
+
unmaskColor: ColorValue | null;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Opacity of the overlay, from `0.0` (fully transparent) to `1.0` (fully opaque).
|
|
71
|
+
*
|
|
72
|
+
* - **Default:** `0.5`
|
|
73
|
+
*/
|
|
74
|
+
alpha: number;
|
|
75
|
+
|
|
76
|
+
constructor({
|
|
77
|
+
maskColor = 'red',
|
|
78
|
+
autoMaskColor = 'orange',
|
|
79
|
+
unmaskColor = 'green',
|
|
80
|
+
alpha = 0.5,
|
|
81
|
+
}: Partial<MPDebugOverlayColors> = {}) {
|
|
82
|
+
this.maskColor = maskColor;
|
|
83
|
+
this.autoMaskColor = autoMaskColor;
|
|
84
|
+
this.unmaskColor = unmaskColor;
|
|
85
|
+
this.alpha = alpha;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Configuration for Session Replay debug features.
|
|
91
|
+
*
|
|
92
|
+
* When `overlayColors` is non-null, the SDK renders a visual overlay on top of the app
|
|
93
|
+
* showing which regions are masked, auto-masked, or explicitly unmasked. Set
|
|
94
|
+
* `overlayColors` to `null` to disable the overlay while keeping `MPDebugOptions`
|
|
95
|
+
* available for future debug features.
|
|
96
|
+
*
|
|
97
|
+
* Debug features only render when `__DEV__` is `true`. In production bundles
|
|
98
|
+
* (`__DEV__ === false`), `debugOptions` is dropped before reaching the native SDK so
|
|
99
|
+
* the overlay never ships to end users.
|
|
100
|
+
*/
|
|
101
|
+
export class MPDebugOptions {
|
|
102
|
+
/**
|
|
103
|
+
* Color configuration for the debug mask overlay. When `null`, the overlay is disabled.
|
|
104
|
+
*
|
|
105
|
+
* - **Default:** `new MPDebugOverlayColors()` (overlay enabled with default colors)
|
|
106
|
+
*/
|
|
107
|
+
overlayColors: MPDebugOverlayColors | null;
|
|
108
|
+
|
|
109
|
+
constructor({
|
|
110
|
+
overlayColors = new MPDebugOverlayColors(),
|
|
111
|
+
}: Partial<MPDebugOptions> = {}) {
|
|
112
|
+
this.overlayColors = overlayColors;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function processOverlayColor(color: ColorValue | null): number | null {
|
|
117
|
+
if (color === null || color === undefined) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
// `processColor` returns the ARGB integer in the form expected by each native platform:
|
|
121
|
+
// a signed 32-bit Int on Android (kotlinx.serialization Int) and an unsigned 32-bit
|
|
122
|
+
// value on iOS (Swift Int is 64-bit, so it decodes without overflow). Invalid color
|
|
123
|
+
// strings yield `undefined` — treat those the same as `null` (hide the category).
|
|
124
|
+
const processed = processColor(color);
|
|
125
|
+
if (typeof processed !== 'number') {
|
|
126
|
+
console.warn(
|
|
127
|
+
`MixpanelSessionReplay: invalid debug overlay color ${JSON.stringify(color)} — that category will be hidden from the overlay.`
|
|
128
|
+
);
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
return processed;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function serializeDebugOptions(
|
|
135
|
+
debugOptions: MPDebugOptions | null
|
|
136
|
+
): object | null {
|
|
137
|
+
if (debugOptions === null) {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
// Hard-gate debug features on `__DEV__` so they are never sent to native in
|
|
141
|
+
// production bundles. The Android SDK already restricts the overlay to debuggable
|
|
142
|
+
// builds, but the iOS SDK ships as a release XCFramework and would otherwise
|
|
143
|
+
// render the overlay in production if a customer forgot to gate the call site.
|
|
144
|
+
if (!__DEV__) {
|
|
145
|
+
if (debugOptions.overlayColors !== null) {
|
|
146
|
+
console.warn(
|
|
147
|
+
'MixpanelSessionReplay: `debugOptions` is ignored in production builds (__DEV__ is false).'
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
const overlayColors = debugOptions.overlayColors;
|
|
153
|
+
return {
|
|
154
|
+
overlayColors:
|
|
155
|
+
overlayColors === null
|
|
156
|
+
? null
|
|
157
|
+
: {
|
|
158
|
+
maskColor: processOverlayColor(overlayColors.maskColor),
|
|
159
|
+
autoMaskColor: processOverlayColor(overlayColors.autoMaskColor),
|
|
160
|
+
unmaskColor: processOverlayColor(overlayColors.unmaskColor),
|
|
161
|
+
alpha: overlayColors.alpha,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
17
166
|
export class MPSessionReplayConfig {
|
|
18
167
|
/**
|
|
19
168
|
* Determines whether replay events will only be flushed to the server when the device has a WiFi connection.
|
|
@@ -94,6 +243,38 @@ export class MPSessionReplayConfig {
|
|
|
94
243
|
*/
|
|
95
244
|
remoteSettingsMode: MPSessionReplayRemoteSettingsMode;
|
|
96
245
|
|
|
246
|
+
/**
|
|
247
|
+
* Enables on-device debug features such as the visual mask overlay.
|
|
248
|
+
*
|
|
249
|
+
* When non-null, the SDK renders a colored overlay on top of the app showing which
|
|
250
|
+
* regions are masked, auto-masked, or explicitly unmasked — useful for verifying
|
|
251
|
+
* masking coverage during development. Pass `new MPDebugOptions()` to enable the
|
|
252
|
+
* overlay with default colors, or customize via `MPDebugOverlayColors`.
|
|
253
|
+
*
|
|
254
|
+
* `debugOptions` is only honored when `__DEV__` is `true`. In production bundles
|
|
255
|
+
* it is dropped before reaching the native SDK, so it is safe to leave the option
|
|
256
|
+
* set unconditionally — the overlay will not render for end users.
|
|
257
|
+
*
|
|
258
|
+
* - **Default:** `null` (disabled)
|
|
259
|
+
*/
|
|
260
|
+
debugOptions: MPDebugOptions | null;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Base URL used to send session replay data to Mixpanel.
|
|
264
|
+
*
|
|
265
|
+
* Use one of the {@link MPDataResidency} constants to target a managed region
|
|
266
|
+
* (`MPDataResidency.US`, `MPDataResidency.EU`, `MPDataResidency.IN`), or pass any
|
|
267
|
+
* fully-qualified `https://` URL to route traffic through a custom endpoint such
|
|
268
|
+
* as a corporate proxy.
|
|
269
|
+
*
|
|
270
|
+
* The URL must use `https://`. The underlying native SDKs validate the URL
|
|
271
|
+
* during `initialize` — invalid URLs cause `initialize` to reject with an error
|
|
272
|
+
* on both platforms.
|
|
273
|
+
*
|
|
274
|
+
* - **Default:** `MPDataResidency.US` (`https://api.mixpanel.com`)
|
|
275
|
+
*/
|
|
276
|
+
serverURL: string;
|
|
277
|
+
|
|
97
278
|
constructor({
|
|
98
279
|
wifiOnly = true,
|
|
99
280
|
autoStartRecording = true,
|
|
@@ -107,6 +288,8 @@ export class MPSessionReplayConfig {
|
|
|
107
288
|
flushInterval = 10,
|
|
108
289
|
enableLogging = false,
|
|
109
290
|
remoteSettingsMode = MPSessionReplayRemoteSettingsMode.Disabled,
|
|
291
|
+
debugOptions = null,
|
|
292
|
+
serverURL = MPDataResidency.US,
|
|
110
293
|
}: Partial<MPSessionReplayConfig> = {}) {
|
|
111
294
|
this.wifiOnly = wifiOnly;
|
|
112
295
|
this.autoStartRecording = autoStartRecording;
|
|
@@ -115,6 +298,8 @@ export class MPSessionReplayConfig {
|
|
|
115
298
|
this.flushInterval = flushInterval;
|
|
116
299
|
this.enableLogging = enableLogging;
|
|
117
300
|
this.remoteSettingsMode = remoteSettingsMode;
|
|
301
|
+
this.debugOptions = debugOptions;
|
|
302
|
+
this.serverURL = serverURL;
|
|
118
303
|
}
|
|
119
304
|
|
|
120
305
|
private transformMaskValueForPlatform(value: string): string {
|
|
@@ -147,9 +332,15 @@ export class MPSessionReplayConfig {
|
|
|
147
332
|
flushInterval: this.flushInterval,
|
|
148
333
|
enableLogging: this.enableLogging,
|
|
149
334
|
remoteSettingsMode: transformedRemoteSettingsMode,
|
|
150
|
-
|
|
335
|
+
debugOptions: serializeDebugOptions(this.debugOptions),
|
|
336
|
+
// The native SDKs spell the server URL field differently — Android's
|
|
337
|
+
// kotlinx.serialization expects `serverUrl`, iOS's Codable expects `serverURL`.
|
|
151
338
|
...Platform.select({
|
|
152
|
-
ios: {
|
|
339
|
+
ios: {
|
|
340
|
+
enableSessionReplayOniOS26AndLater: true,
|
|
341
|
+
serverURL: this.serverURL,
|
|
342
|
+
},
|
|
343
|
+
android: { serverUrl: this.serverURL },
|
|
153
344
|
default: {},
|
|
154
345
|
}),
|
|
155
346
|
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
-
*
|
|
5
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
-
* once the code is regenerated.
|
|
7
|
-
*
|
|
8
|
-
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
-
*
|
|
10
|
-
* @nolint
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
package com.facebook.fbreact.specs;
|
|
14
|
-
|
|
15
|
-
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
-
import com.facebook.react.bridge.Promise;
|
|
17
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
19
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
20
|
-
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
21
|
-
import javax.annotation.Nonnull;
|
|
22
|
-
|
|
23
|
-
public abstract class NativeMixpanelReactNativeSessionReplaySpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
24
|
-
public static final String NAME = "MixpanelReactNativeSessionReplay";
|
|
25
|
-
|
|
26
|
-
public NativeMixpanelReactNativeSessionReplaySpec(ReactApplicationContext reactContext) {
|
|
27
|
-
super(reactContext);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Override
|
|
31
|
-
public @Nonnull String getName() {
|
|
32
|
-
return NAME;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@ReactMethod
|
|
36
|
-
@DoNotStrip
|
|
37
|
-
public abstract void initialize(String token, String distinctId, String configJSON, Promise promise);
|
|
38
|
-
|
|
39
|
-
@ReactMethod
|
|
40
|
-
@DoNotStrip
|
|
41
|
-
public abstract void startRecording(double recordingSessionsPercent, Promise promise);
|
|
42
|
-
|
|
43
|
-
@ReactMethod
|
|
44
|
-
@DoNotStrip
|
|
45
|
-
public abstract void stopRecording(Promise promise);
|
|
46
|
-
|
|
47
|
-
@ReactMethod
|
|
48
|
-
@DoNotStrip
|
|
49
|
-
public abstract void isRecording(Promise promise);
|
|
50
|
-
|
|
51
|
-
@ReactMethod
|
|
52
|
-
@DoNotStrip
|
|
53
|
-
public abstract void identify(String distinctId, Promise promise);
|
|
54
|
-
|
|
55
|
-
@ReactMethod
|
|
56
|
-
@DoNotStrip
|
|
57
|
-
public abstract void getReplayId(Promise promise);
|
|
58
|
-
|
|
59
|
-
@ReactMethod
|
|
60
|
-
@DoNotStrip
|
|
61
|
-
public abstract void flush(Promise promise);
|
|
62
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
#
|
|
3
|
-
# This source code is licensed under the MIT license found in the
|
|
4
|
-
# LICENSE file in the root directory of this source tree.
|
|
5
|
-
|
|
6
|
-
cmake_minimum_required(VERSION 3.13)
|
|
7
|
-
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
-
|
|
9
|
-
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/MixpanelReactNativeSessionReplaySpec/*.cpp)
|
|
10
|
-
|
|
11
|
-
add_library(
|
|
12
|
-
react_codegen_MixpanelReactNativeSessionReplaySpec
|
|
13
|
-
OBJECT
|
|
14
|
-
${react_codegen_SRCS}
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
target_include_directories(react_codegen_MixpanelReactNativeSessionReplaySpec PUBLIC . react/renderer/components/MixpanelReactNativeSessionReplaySpec)
|
|
18
|
-
|
|
19
|
-
target_link_libraries(
|
|
20
|
-
react_codegen_MixpanelReactNativeSessionReplaySpec
|
|
21
|
-
fbjni
|
|
22
|
-
jsi
|
|
23
|
-
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
-
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
-
reactnative
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
target_compile_options(
|
|
29
|
-
react_codegen_MixpanelReactNativeSessionReplaySpec
|
|
30
|
-
PRIVATE
|
|
31
|
-
-DLOG_TAG=\"ReactNative\"
|
|
32
|
-
-fexceptions
|
|
33
|
-
-frtti
|
|
34
|
-
-std=c++20
|
|
35
|
-
-Wall
|
|
36
|
-
)
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
-
*
|
|
5
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
-
* once the code is regenerated.
|
|
7
|
-
*
|
|
8
|
-
* @generated by codegen project: GenerateModuleJniCpp.js
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
#include "MixpanelReactNativeSessionReplaySpec.h"
|
|
12
|
-
|
|
13
|
-
namespace facebook::react {
|
|
14
|
-
|
|
15
|
-
static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_initialize(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
16
|
-
static jmethodID cachedMethodId = nullptr;
|
|
17
|
-
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "initialize", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_startRecording(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
21
|
-
static jmethodID cachedMethodId = nullptr;
|
|
22
|
-
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "startRecording", "(DLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_stopRecording(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
26
|
-
static jmethodID cachedMethodId = nullptr;
|
|
27
|
-
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "stopRecording", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_isRecording(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
31
|
-
static jmethodID cachedMethodId = nullptr;
|
|
32
|
-
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "isRecording", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
static facebook::jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_identify(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
36
|
-
static jmethodID cachedMethodId = nullptr;
|
|
37
|
-
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "identify", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
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
|
-
|
|
50
|
-
NativeMixpanelReactNativeSessionReplaySpecJSI::NativeMixpanelReactNativeSessionReplaySpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
51
|
-
: JavaTurboModule(params) {
|
|
52
|
-
methodMap_["initialize"] = MethodMetadata {3, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_initialize};
|
|
53
|
-
methodMap_["startRecording"] = MethodMetadata {1, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_startRecording};
|
|
54
|
-
methodMap_["stopRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_stopRecording};
|
|
55
|
-
methodMap_["isRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_isRecording};
|
|
56
|
-
methodMap_["identify"] = MethodMetadata {1, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_identify};
|
|
57
|
-
methodMap_["getReplayId"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_getReplayId};
|
|
58
|
-
methodMap_["flush"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplaySpecJSI_flush};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
std::shared_ptr<TurboModule> MixpanelReactNativeSessionReplaySpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
62
|
-
if (moduleName == "MixpanelReactNativeSessionReplay") {
|
|
63
|
-
return std::make_shared<NativeMixpanelReactNativeSessionReplaySpecJSI>(params);
|
|
64
|
-
}
|
|
65
|
-
return nullptr;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
} // namespace facebook::react
|
package/android/app/build/generated/source/codegen/jni/MixpanelReactNativeSessionReplaySpec.h
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
-
*
|
|
5
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
-
* once the code is regenerated.
|
|
7
|
-
*
|
|
8
|
-
* @generated by codegen project: GenerateModuleJniH.js
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
#pragma once
|
|
12
|
-
|
|
13
|
-
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
-
#include <ReactCommon/TurboModule.h>
|
|
15
|
-
#include <jsi/jsi.h>
|
|
16
|
-
|
|
17
|
-
namespace facebook::react {
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* JNI C++ class for module 'NativeMixpanelReactNativeSessionReplay'
|
|
21
|
-
*/
|
|
22
|
-
class JSI_EXPORT NativeMixpanelReactNativeSessionReplaySpecJSI : public JavaTurboModule {
|
|
23
|
-
public:
|
|
24
|
-
NativeMixpanelReactNativeSessionReplaySpecJSI(const JavaTurboModule::InitParams ¶ms);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
JSI_EXPORT
|
|
29
|
-
std::shared_ptr<TurboModule> MixpanelReactNativeSessionReplaySpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
-
|
|
31
|
-
} // namespace facebook::react
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
-
* once the code is regenerated.
|
|
6
|
-
*
|
|
7
|
-
* @generated by codegen project: GenerateModuleCpp.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
#include "MixpanelReactNativeSessionReplaySpecJSI.h"
|
|
11
|
-
|
|
12
|
-
namespace facebook::react {
|
|
13
|
-
|
|
14
|
-
static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_initialize(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
-
return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->initialize(
|
|
16
|
-
rt,
|
|
17
|
-
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
18
|
-
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
|
|
19
|
-
count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt)
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_startRecording(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
23
|
-
return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->startRecording(
|
|
24
|
-
rt,
|
|
25
|
-
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_stopRecording(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
29
|
-
return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->stopRecording(
|
|
30
|
-
rt
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_isRecording(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
34
|
-
return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->isRecording(
|
|
35
|
-
rt
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
static jsi::Value __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_identify(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
39
|
-
return static_cast<NativeMixpanelReactNativeSessionReplayCxxSpecJSI *>(&turboModule)->identify(
|
|
40
|
-
rt,
|
|
41
|
-
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
|
|
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
|
-
}
|
|
54
|
-
|
|
55
|
-
NativeMixpanelReactNativeSessionReplayCxxSpecJSI::NativeMixpanelReactNativeSessionReplayCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
56
|
-
: TurboModule("MixpanelReactNativeSessionReplay", jsInvoker) {
|
|
57
|
-
methodMap_["initialize"] = MethodMetadata {3, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_initialize};
|
|
58
|
-
methodMap_["startRecording"] = MethodMetadata {1, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_startRecording};
|
|
59
|
-
methodMap_["stopRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_stopRecording};
|
|
60
|
-
methodMap_["isRecording"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_isRecording};
|
|
61
|
-
methodMap_["identify"] = MethodMetadata {1, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_identify};
|
|
62
|
-
methodMap_["getReplayId"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_getReplayId};
|
|
63
|
-
methodMap_["flush"] = MethodMetadata {0, __hostFunction_NativeMixpanelReactNativeSessionReplayCxxSpecJSI_flush};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} // namespace facebook::react
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
-
* once the code is regenerated.
|
|
6
|
-
*
|
|
7
|
-
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
#pragma once
|
|
11
|
-
|
|
12
|
-
#include <ReactCommon/TurboModule.h>
|
|
13
|
-
#include <react/bridging/Bridging.h>
|
|
14
|
-
|
|
15
|
-
namespace facebook::react {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class JSI_EXPORT NativeMixpanelReactNativeSessionReplayCxxSpecJSI : public TurboModule {
|
|
19
|
-
protected:
|
|
20
|
-
NativeMixpanelReactNativeSessionReplayCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
-
|
|
22
|
-
public:
|
|
23
|
-
virtual jsi::Value initialize(jsi::Runtime &rt, jsi::String token, jsi::String distinctId, jsi::String configJSON) = 0;
|
|
24
|
-
virtual jsi::Value startRecording(jsi::Runtime &rt, double recordingSessionsPercent) = 0;
|
|
25
|
-
virtual jsi::Value stopRecording(jsi::Runtime &rt) = 0;
|
|
26
|
-
virtual jsi::Value isRecording(jsi::Runtime &rt) = 0;
|
|
27
|
-
virtual jsi::Value identify(jsi::Runtime &rt, jsi::String distinctId) = 0;
|
|
28
|
-
virtual jsi::Value getReplayId(jsi::Runtime &rt) = 0;
|
|
29
|
-
virtual jsi::Value flush(jsi::Runtime &rt) = 0;
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
template <typename T>
|
|
34
|
-
class JSI_EXPORT NativeMixpanelReactNativeSessionReplayCxxSpec : public TurboModule {
|
|
35
|
-
public:
|
|
36
|
-
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
37
|
-
return delegate_.create(rt, propName);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
41
|
-
return delegate_.getPropertyNames(runtime);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
static constexpr std::string_view kModuleName = "MixpanelReactNativeSessionReplay";
|
|
45
|
-
|
|
46
|
-
protected:
|
|
47
|
-
NativeMixpanelReactNativeSessionReplayCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
48
|
-
: TurboModule(std::string{NativeMixpanelReactNativeSessionReplayCxxSpec::kModuleName}, jsInvoker),
|
|
49
|
-
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
private:
|
|
53
|
-
class Delegate : public NativeMixpanelReactNativeSessionReplayCxxSpecJSI {
|
|
54
|
-
public:
|
|
55
|
-
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
56
|
-
NativeMixpanelReactNativeSessionReplayCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
jsi::Value initialize(jsi::Runtime &rt, jsi::String token, jsi::String distinctId, jsi::String configJSON) override {
|
|
61
|
-
static_assert(
|
|
62
|
-
bridging::getParameterCount(&T::initialize) == 4,
|
|
63
|
-
"Expected initialize(...) to have 4 parameters");
|
|
64
|
-
|
|
65
|
-
return bridging::callFromJs<jsi::Value>(
|
|
66
|
-
rt, &T::initialize, jsInvoker_, instance_, std::move(token), std::move(distinctId), std::move(configJSON));
|
|
67
|
-
}
|
|
68
|
-
jsi::Value startRecording(jsi::Runtime &rt, double recordingSessionsPercent) override {
|
|
69
|
-
static_assert(
|
|
70
|
-
bridging::getParameterCount(&T::startRecording) == 2,
|
|
71
|
-
"Expected startRecording(...) to have 2 parameters");
|
|
72
|
-
|
|
73
|
-
return bridging::callFromJs<jsi::Value>(
|
|
74
|
-
rt, &T::startRecording, jsInvoker_, instance_, std::move(recordingSessionsPercent));
|
|
75
|
-
}
|
|
76
|
-
jsi::Value stopRecording(jsi::Runtime &rt) override {
|
|
77
|
-
static_assert(
|
|
78
|
-
bridging::getParameterCount(&T::stopRecording) == 1,
|
|
79
|
-
"Expected stopRecording(...) to have 1 parameters");
|
|
80
|
-
|
|
81
|
-
return bridging::callFromJs<jsi::Value>(
|
|
82
|
-
rt, &T::stopRecording, jsInvoker_, instance_);
|
|
83
|
-
}
|
|
84
|
-
jsi::Value isRecording(jsi::Runtime &rt) override {
|
|
85
|
-
static_assert(
|
|
86
|
-
bridging::getParameterCount(&T::isRecording) == 1,
|
|
87
|
-
"Expected isRecording(...) to have 1 parameters");
|
|
88
|
-
|
|
89
|
-
return bridging::callFromJs<jsi::Value>(
|
|
90
|
-
rt, &T::isRecording, jsInvoker_, instance_);
|
|
91
|
-
}
|
|
92
|
-
jsi::Value identify(jsi::Runtime &rt, jsi::String distinctId) override {
|
|
93
|
-
static_assert(
|
|
94
|
-
bridging::getParameterCount(&T::identify) == 2,
|
|
95
|
-
"Expected identify(...) to have 2 parameters");
|
|
96
|
-
|
|
97
|
-
return bridging::callFromJs<jsi::Value>(
|
|
98
|
-
rt, &T::identify, jsInvoker_, instance_, std::move(distinctId));
|
|
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
|
-
}
|
|
116
|
-
|
|
117
|
-
private:
|
|
118
|
-
friend class NativeMixpanelReactNativeSessionReplayCxxSpec;
|
|
119
|
-
T *instance_;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
Delegate delegate_;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
} // namespace facebook::react
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
-
*
|
|
5
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
-
* once the code is regenerated.
|
|
7
|
-
*
|
|
8
|
-
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
-
*
|
|
10
|
-
* @nolint
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
package com.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
|
-
}
|