@truewatchtech/react-native-session-replay 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FTSessionReplayReactNative.podspec +50 -0
- package/README.md +33 -0
- package/android/build.gradle +228 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +4 -0
- package/android/gradlew +185 -0
- package/android/gradlew.bat +89 -0
- package/android/settings.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/AndroidManifestNew.xml +3 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/FTSessionReplayImpl.java +119 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/NoopTextPropertiesResolver.java +23 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/ReactNativeSessionReplayExtensionSupport.java +57 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/ShadowNodeWrapper.java +84 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/TextPropertiesResolver.java +20 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/extensions/ReactDrawablesExt.java +155 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/DefaultMapper.java +78 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/Pair.java +11 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactEditTextMapper.java +136 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactNativeImageViewMapper.java +117 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactTextMapper.java +57 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactViewGroupMapper.java +22 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactViewModalMapper.java +21 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/resources/ReactDrawableCopier.java +35 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/ColorUtils.java +24 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/DrawableUtils.java +34 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactNativeUtils.java +18 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/ReflectionUtils.java +43 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/FabricTextViewUtils.java +69 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/LegacyTextViewUtils.java +97 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/TextViewUtils.java +184 -0
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/views/FTPrivacyView.java +113 -0
- package/android/src/newarch/java/com/ft/sdk/reactnative/sessionreplay/FTSessionReplayModule.java +20 -0
- package/android/src/newarch/java/com/ft/sdk/reactnative/sessionreplay/views/FTPrivacyViewManager.java +87 -0
- package/android/src/oldarch/java/com/ft/sdk/reactnative/sessionreplay/FTSessionReplayModule.java +25 -0
- package/android/src/oldarch/java/com/ft/sdk/reactnative/sessionreplay/views/FTPrivacyViewManager.java +70 -0
- package/android/src/rn69/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +100 -0
- package/android/src/rn75/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +27 -0
- package/android/src/rn75/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +116 -0
- package/android/src/rn76/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +38 -0
- package/android/src/rn76/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +117 -0
- package/android/src/rn79/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +38 -0
- package/android/src/rn79/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +132 -0
- package/android/src/rn80/java/com/ft/sdk/reactnative/sessionreplay/extensions/ComputedBorderRadiusExt.java +58 -0
- package/android/src/rn80/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +190 -0
- package/android/src/rnlegacy/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +120 -0
- package/android/src/rnpost74/java/com/ft/sdk/reactnative/sessionreplay/FTSessionReplayPackage.java +58 -0
- package/android/src/rnpre74/java/com/ft/sdk/reactnative/sessionreplay/FTSessionReplayPackage.java +30 -0
- package/ios/FTPrivacyViewFabric.h +22 -0
- package/ios/FTPrivacyViewFabric.mm +84 -0
- package/ios/FTPrivacyViewPaper.h +17 -0
- package/ios/FTPrivacyViewPaper.mm +85 -0
- package/ios/FTRCTFabricWrapper.h +13 -0
- package/ios/FTRCTFabricWrapper.mm +113 -0
- package/ios/FTRCTTextPropertiesWrapper.h +24 -0
- package/ios/FTRCTTextPropertiesWrapper.mm +28 -0
- package/ios/FTRCTTextViewRecorder.h +33 -0
- package/ios/FTRCTTextViewRecorder.m +172 -0
- package/ios/FTReactNativeSessionReplay.h +13 -0
- package/ios/FTReactNativeSessionReplay.mm +85 -0
- package/ios/FTSessionReplayReactNative.xcodeproj/project.pbxproj +304 -0
- package/lib/commonjs/components/SessionReplayView/HideView.js +19 -0
- package/lib/commonjs/components/SessionReplayView/HideView.js.map +1 -0
- package/lib/commonjs/components/SessionReplayView/MaskAllView.js +25 -0
- package/lib/commonjs/components/SessionReplayView/MaskAllView.js.map +1 -0
- package/lib/commonjs/components/SessionReplayView/MaskNoneView.js +23 -0
- package/lib/commonjs/components/SessionReplayView/MaskNoneView.js.map +1 -0
- package/lib/commonjs/components/SessionReplayView/PrivacyView.js +28 -0
- package/lib/commonjs/components/SessionReplayView/PrivacyView.js.map +1 -0
- package/lib/commonjs/components/SessionReplayView/index.js +29 -0
- package/lib/commonjs/components/SessionReplayView/index.js.map +1 -0
- package/lib/commonjs/ft_session_replay.js +69 -0
- package/lib/commonjs/ft_session_replay.js.map +1 -0
- package/lib/commonjs/index.js +50 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/specs/FTPrivacyViewNative.js +29 -0
- package/lib/commonjs/specs/FTPrivacyViewNative.js.map +1 -0
- package/lib/commonjs/specs/FTPrivacyViewNativeComponent.js +10 -0
- package/lib/commonjs/specs/FTPrivacyViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/NativeFTReactNativeSessionReplay.js +10 -0
- package/lib/commonjs/specs/NativeFTReactNativeSessionReplay.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/components/SessionReplayView/HideView.js +12 -0
- package/lib/module/components/SessionReplayView/HideView.js.map +1 -0
- package/lib/module/components/SessionReplayView/MaskAllView.js +18 -0
- package/lib/module/components/SessionReplayView/MaskAllView.js.map +1 -0
- package/lib/module/components/SessionReplayView/MaskNoneView.js +16 -0
- package/lib/module/components/SessionReplayView/MaskNoneView.js.map +1 -0
- package/lib/module/components/SessionReplayView/PrivacyView.js +21 -0
- package/lib/module/components/SessionReplayView/PrivacyView.js.map +1 -0
- package/lib/module/components/SessionReplayView/index.js +23 -0
- package/lib/module/components/SessionReplayView/index.js.map +1 -0
- package/lib/module/ft_session_replay.js +67 -0
- package/lib/module/ft_session_replay.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/specs/FTPrivacyViewNative.js +24 -0
- package/lib/module/specs/FTPrivacyViewNative.js.map +1 -0
- package/lib/module/specs/FTPrivacyViewNativeComponent.js +3 -0
- package/lib/module/specs/FTPrivacyViewNativeComponent.js.map +1 -0
- package/lib/module/specs/NativeFTReactNativeSessionReplay.js +5 -0
- package/lib/module/specs/NativeFTReactNativeSessionReplay.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/components/SessionReplayView/HideView.d.ts +7 -0
- package/lib/typescript/components/SessionReplayView/MaskAllView.d.ts +8 -0
- package/lib/typescript/components/SessionReplayView/MaskNoneView.d.ts +7 -0
- package/lib/typescript/components/SessionReplayView/PrivacyView.d.ts +12 -0
- package/lib/typescript/components/SessionReplayView/index.d.ts +22 -0
- package/lib/typescript/ft_session_replay.d.ts +61 -0
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/specs/FTPrivacyViewNative.d.ts +2 -0
- package/lib/typescript/specs/FTPrivacyViewNativeComponent.d.ts +10 -0
- package/lib/typescript/specs/NativeFTReactNativeSessionReplay.d.ts +11 -0
- package/lib/typescript/types.d.ts +8 -0
- package/package.json +97 -0
- package/scripts/set-ios-rn-version.js +47 -0
- package/src/components/SessionReplayView/HideView.tsx +15 -0
- package/src/components/SessionReplayView/MaskAllView.tsx +35 -0
- package/src/components/SessionReplayView/MaskNoneView.tsx +26 -0
- package/src/components/SessionReplayView/PrivacyView.tsx +40 -0
- package/src/components/SessionReplayView/index.ts +26 -0
- package/src/ft_session_replay.tsx +78 -0
- package/src/index.tsx +19 -0
- package/src/specs/FTPrivacyViewNative.ts +32 -0
- package/src/specs/FTPrivacyViewNativeComponent.ts +14 -0
- package/src/specs/NativeFTReactNativeSessionReplay.ts +13 -0
- package/src/types.ts +9 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PrivacyView } from './PrivacyView';
|
|
2
|
+
import { MaskAllView } from './MaskAllView';
|
|
3
|
+
import { MaskNoneView } from './MaskNoneView';
|
|
4
|
+
import { HideView } from './HideView';
|
|
5
|
+
export declare const FTSessionReplayView: {
|
|
6
|
+
/**
|
|
7
|
+
* Privacy view component - Low-level configurable component for fine-grained privacy control
|
|
8
|
+
*/
|
|
9
|
+
Privacy: typeof PrivacyView;
|
|
10
|
+
/**
|
|
11
|
+
* Mask all view component - Masks all text, inputs and images
|
|
12
|
+
*/
|
|
13
|
+
MaskAll: typeof MaskAllView;
|
|
14
|
+
/**
|
|
15
|
+
* Mask none view component - Displays most content as-is
|
|
16
|
+
*/
|
|
17
|
+
MaskNone: typeof MaskNoneView;
|
|
18
|
+
/**
|
|
19
|
+
* Hide view component - Completely hides the view and its content
|
|
20
|
+
*/
|
|
21
|
+
Hide: typeof HideView;
|
|
22
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Privacy level for content masking in session replay. Deprecated, recommend using fine-grained privacy levels for settings
|
|
3
|
+
*/
|
|
4
|
+
export declare enum SessionReplayPrivacy {
|
|
5
|
+
MASK = 0,
|
|
6
|
+
ALLOW = 1,
|
|
7
|
+
MASK_USER_INPUT = 2
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Available privacy levels for touch masking in session replay.
|
|
11
|
+
*/
|
|
12
|
+
export declare enum TouchPrivacyLevel {
|
|
13
|
+
SHOW = "SHOW",
|
|
14
|
+
HIDE = "HIDE"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Available privacy levels for image masking in session replay
|
|
18
|
+
*/
|
|
19
|
+
export declare enum ImagePrivacyLevel {
|
|
20
|
+
MASK_NON_BUNDLED_ONLY = "MASK_NON_BUNDLED_ONLY",
|
|
21
|
+
MASK_ALL = "MASK_ALL",
|
|
22
|
+
MASK_NONE = "MASK_NONE"
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Available privacy levels for text and input masking in session replay
|
|
26
|
+
*/
|
|
27
|
+
export declare enum TextAndInputPrivacyLevel {
|
|
28
|
+
MASK_SENSITIVE_INPUTS = "MASK_SENSITIVE_INPUTS",
|
|
29
|
+
MASK_ALL_INPUTS = "MASK_ALL_INPUTS",
|
|
30
|
+
MASK_ALL = "MASK_ALL"
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Set Session Replay configuration.
|
|
34
|
+
* @param sampleRate Sampling rate
|
|
35
|
+
* @param sessionReplayOnErrorSampleRate error session sampling rate. For sessions not sampled, if ERROR is hit, collect data 1 minute before the error occurs
|
|
36
|
+
* @param privacy Privacy level for content masking in session replay
|
|
37
|
+
* @param touchPrivacy Privacy level for touch masking in session replay
|
|
38
|
+
* @param textAndInputPrivacy Privacy level for text and input masking in session replay
|
|
39
|
+
* @param imagePrivacy Privacy level for image masking in session replay
|
|
40
|
+
* @param enableLinkRUMKeys Enable linking RUM data with session replay data. The value is an array of RUM global context keys. When the keys exist in RUM global context, the corresponding values will be linked to session replay data.
|
|
41
|
+
* @returns a Promise.
|
|
42
|
+
*/
|
|
43
|
+
export interface FTSessionReplayConfig {
|
|
44
|
+
sampleRate?: number;
|
|
45
|
+
sessionReplayOnErrorSampleRate?: number;
|
|
46
|
+
privacy?: SessionReplayPrivacy;
|
|
47
|
+
touchPrivacy?: TouchPrivacyLevel;
|
|
48
|
+
textAndInputPrivacy?: TextAndInputPrivacyLevel;
|
|
49
|
+
imagePrivacy?: ImagePrivacyLevel;
|
|
50
|
+
enableLinkRUMKeys?: string[];
|
|
51
|
+
}
|
|
52
|
+
type FTReactNativeSessionReplayType = {
|
|
53
|
+
/**
|
|
54
|
+
* Set Session Replay configuration and enable session replay
|
|
55
|
+
* @param config Session Replay configuration parameters.
|
|
56
|
+
* @returns a Promise.
|
|
57
|
+
*/
|
|
58
|
+
sessionReplayConfig(config: FTSessionReplayConfig): Promise<void>;
|
|
59
|
+
};
|
|
60
|
+
export declare const FTReactNativeSessionReplay: FTReactNativeSessionReplayType;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FTSessionReplayConfig, SessionReplayPrivacy, FTReactNativeSessionReplay, TouchPrivacyLevel, TextAndInputPrivacyLevel, ImagePrivacyLevel } from './ft_session_replay';
|
|
2
|
+
import { FTSessionReplayView } from './components/SessionReplayView';
|
|
3
|
+
export { FTSessionReplayConfig, SessionReplayPrivacy, FTReactNativeSessionReplay, TouchPrivacyLevel, TextAndInputPrivacyLevel, ImagePrivacyLevel, FTSessionReplayView, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
export interface FTPrivacyViewNativeProps extends ViewProps {
|
|
3
|
+
textAndInputPrivacy?: string;
|
|
4
|
+
imagePrivacy?: string;
|
|
5
|
+
touchPrivacy?: string;
|
|
6
|
+
hide?: boolean;
|
|
7
|
+
nativeID?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: HostComponent<FTPrivacyViewNativeProps>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
/**
|
|
4
|
+
* Set Session Replay configuration and enable session replay
|
|
5
|
+
* @param config Session Replay configuration parameters.
|
|
6
|
+
* @returns a Promise.
|
|
7
|
+
*/
|
|
8
|
+
sessionReplayConfig(config: Object): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: Spec | null;
|
|
11
|
+
export default _default;
|
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@truewatchtech/react-native-session-replay",
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "Session Replay package for TrueWatch React Native SDK",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"scripts/set-ios-rn-version.js",
|
|
16
|
+
"FTSessionReplayReactNative.podspec",
|
|
17
|
+
"!android/.project",
|
|
18
|
+
"!android/build",
|
|
19
|
+
"!android/.gradle",
|
|
20
|
+
"!android/.idea",
|
|
21
|
+
"!android/.settings",
|
|
22
|
+
"!ios/build",
|
|
23
|
+
"!ios/RCTVersion.h",
|
|
24
|
+
"!ios/**/xcuserdata",
|
|
25
|
+
"!ios/**/*.xcuserstate",
|
|
26
|
+
"!**/__tests__",
|
|
27
|
+
"!**/__fixtures__",
|
|
28
|
+
"!**/__mocks__"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"typescript": "yarn run -T tsc --noEmit",
|
|
32
|
+
"lint": "yarn run -T eslint \"**/*.{js,ts,tsx}\"",
|
|
33
|
+
"prepare": "yarn run -T bob build",
|
|
34
|
+
"prepack": "yarn run -T check-version && yarn prepare",
|
|
35
|
+
"postinstall": "node scripts/set-ios-rn-version.js"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"truewatch",
|
|
39
|
+
"react-native",
|
|
40
|
+
"session-replay",
|
|
41
|
+
"ios",
|
|
42
|
+
"android"
|
|
43
|
+
],
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/TrueWatchTech/datakit-react-native.git"
|
|
47
|
+
},
|
|
48
|
+
"author": "Brandon <brandonfaustine@gmail.com> (https://github.com/Br4ndonZhang)",
|
|
49
|
+
"license": "Apache-2.0",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/TrueWatchTech/datakit-react-native/issues"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://github.com/TrueWatchTech/datakit-react-native.git#readme",
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"registry": "https://registry.npmjs.org/"
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=18"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"react": ">=16.13.1",
|
|
62
|
+
"react-native": ">=0.63.4 <1.0"
|
|
63
|
+
},
|
|
64
|
+
"react-native-builder-bob": {
|
|
65
|
+
"source": "src",
|
|
66
|
+
"output": "lib",
|
|
67
|
+
"targets": [
|
|
68
|
+
"commonjs",
|
|
69
|
+
"module",
|
|
70
|
+
[
|
|
71
|
+
"typescript",
|
|
72
|
+
{
|
|
73
|
+
"tsc": "../../node_modules/.bin/tsc"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"codegenConfig": {
|
|
79
|
+
"name": "FTSessionReplayReactNative",
|
|
80
|
+
"type": "all",
|
|
81
|
+
"jsSrcsDir": "./src/specs",
|
|
82
|
+
"android": {
|
|
83
|
+
"javaPackageName": "com.ft.sdk.reactnative.sessionreplay"
|
|
84
|
+
},
|
|
85
|
+
"ios": {
|
|
86
|
+
"componentProvider": {
|
|
87
|
+
"FTPrivacyView": "FTPrivacyViewFabric"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"dependencies": {
|
|
92
|
+
"@babel/runtime": "^7.16.5"
|
|
93
|
+
},
|
|
94
|
+
"directories": {
|
|
95
|
+
"lib": "lib"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
function getReactNativeVersion() {
|
|
11
|
+
try {
|
|
12
|
+
// eslint-disable-next-line global-require
|
|
13
|
+
return require('react-native/package.json').version;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
'Failed to find React Native. Ensure it is installed in your project.'
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const rnVersion = getReactNativeVersion();
|
|
22
|
+
|
|
23
|
+
const outputDir = path.resolve(__dirname, '../ios');
|
|
24
|
+
const outputFile = path.join(outputDir, 'RCTVersion.h');
|
|
25
|
+
|
|
26
|
+
if (!fs.existsSync(outputDir)) {
|
|
27
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const [major, minor, patch] = rnVersion.split('.').map(Number);
|
|
31
|
+
|
|
32
|
+
const headerContent = `#ifndef RCTVersion_h
|
|
33
|
+
#define RCTVersion_h
|
|
34
|
+
|
|
35
|
+
#define RCT_VERSION_MAJOR ${major || 0}
|
|
36
|
+
#define RCT_VERSION_MINOR ${minor || 0}
|
|
37
|
+
#define RCT_VERSION_PATCH ${patch || 0}
|
|
38
|
+
|
|
39
|
+
#endif /* RCTVersion_h */
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
fs.writeFileSync(outputFile, headerContent, 'utf8');
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error(`Failed to write RCTVersion.h: ${error.message}`);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
import { PrivacyView } from './PrivacyView';
|
|
4
|
+
|
|
5
|
+
type HideViewProps = ViewProps & {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function HideView({ children, ...props }: HideViewProps) {
|
|
10
|
+
return (
|
|
11
|
+
<PrivacyView {...props} hide={true}>
|
|
12
|
+
{children as any}
|
|
13
|
+
</PrivacyView>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
import { PrivacyView } from './PrivacyView';
|
|
4
|
+
import {
|
|
5
|
+
ImagePrivacyLevel,
|
|
6
|
+
TextAndInputPrivacyLevel,
|
|
7
|
+
TouchPrivacyLevel,
|
|
8
|
+
} from '../../ft_session_replay';
|
|
9
|
+
|
|
10
|
+
type MaskAllViewProps = ViewProps & {
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
showTouch?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function MaskAllView({
|
|
16
|
+
children,
|
|
17
|
+
showTouch = false,
|
|
18
|
+
...props
|
|
19
|
+
}: MaskAllViewProps) {
|
|
20
|
+
const touchPrivacy = showTouch
|
|
21
|
+
? TouchPrivacyLevel.SHOW
|
|
22
|
+
: TouchPrivacyLevel.HIDE;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<PrivacyView
|
|
26
|
+
{...props}
|
|
27
|
+
textAndInputPrivacy={TextAndInputPrivacyLevel.MASK_ALL}
|
|
28
|
+
imagePrivacy={ImagePrivacyLevel.MASK_ALL}
|
|
29
|
+
touchPrivacy={touchPrivacy}
|
|
30
|
+
hide={false}
|
|
31
|
+
>
|
|
32
|
+
{children as any}
|
|
33
|
+
</PrivacyView>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
import { PrivacyView } from './PrivacyView';
|
|
4
|
+
import {
|
|
5
|
+
ImagePrivacyLevel,
|
|
6
|
+
TextAndInputPrivacyLevel,
|
|
7
|
+
TouchPrivacyLevel,
|
|
8
|
+
} from '../../ft_session_replay';
|
|
9
|
+
|
|
10
|
+
type MaskNoneViewProps = ViewProps & {
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function MaskNoneView({ children, ...props }: MaskNoneViewProps) {
|
|
15
|
+
return (
|
|
16
|
+
<PrivacyView
|
|
17
|
+
{...props}
|
|
18
|
+
textAndInputPrivacy={TextAndInputPrivacyLevel.MASK_SENSITIVE_INPUTS}
|
|
19
|
+
imagePrivacy={ImagePrivacyLevel.MASK_NONE}
|
|
20
|
+
touchPrivacy={TouchPrivacyLevel.SHOW}
|
|
21
|
+
hide={false}
|
|
22
|
+
>
|
|
23
|
+
{children as any}
|
|
24
|
+
</PrivacyView>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import FTPrivacyViewNative from '../../specs/FTPrivacyViewNative';
|
|
3
|
+
import type { ViewProps } from 'react-native';
|
|
4
|
+
import type {
|
|
5
|
+
ImagePrivacyLevel,
|
|
6
|
+
TextAndInputPrivacyLevel,
|
|
7
|
+
TouchPrivacyLevel,
|
|
8
|
+
} from '../../ft_session_replay';
|
|
9
|
+
|
|
10
|
+
export interface PrivacyViewProps extends ViewProps {
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
textAndInputPrivacy?: TextAndInputPrivacyLevel;
|
|
13
|
+
imagePrivacy?: ImagePrivacyLevel;
|
|
14
|
+
touchPrivacy?: TouchPrivacyLevel;
|
|
15
|
+
hide?: boolean;
|
|
16
|
+
nativeID?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function PrivacyView({
|
|
20
|
+
children,
|
|
21
|
+
textAndInputPrivacy,
|
|
22
|
+
imagePrivacy,
|
|
23
|
+
touchPrivacy,
|
|
24
|
+
nativeID,
|
|
25
|
+
hide,
|
|
26
|
+
...props
|
|
27
|
+
}: PrivacyViewProps) {
|
|
28
|
+
return (
|
|
29
|
+
<FTPrivacyViewNative
|
|
30
|
+
{...props}
|
|
31
|
+
textAndInputPrivacy={textAndInputPrivacy}
|
|
32
|
+
imagePrivacy={imagePrivacy}
|
|
33
|
+
touchPrivacy={touchPrivacy}
|
|
34
|
+
hide={hide}
|
|
35
|
+
nativeID={nativeID}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</FTPrivacyViewNative>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PrivacyView } from './PrivacyView';
|
|
2
|
+
import { MaskAllView } from './MaskAllView';
|
|
3
|
+
import { MaskNoneView } from './MaskNoneView';
|
|
4
|
+
import { HideView } from './HideView';
|
|
5
|
+
|
|
6
|
+
export const FTSessionReplayView = {
|
|
7
|
+
/**
|
|
8
|
+
* Privacy view component - Low-level configurable component for fine-grained privacy control
|
|
9
|
+
*/
|
|
10
|
+
Privacy: PrivacyView,
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Mask all view component - Masks all text, inputs and images
|
|
14
|
+
*/
|
|
15
|
+
MaskAll: MaskAllView,
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Mask none view component - Displays most content as-is
|
|
19
|
+
*/
|
|
20
|
+
MaskNone: MaskNoneView,
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Hide view component - Completely hides the view and its content
|
|
24
|
+
*/
|
|
25
|
+
Hide: HideView,
|
|
26
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// import { NativeModules } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Privacy level for content masking in session replay. Deprecated, recommend using fine-grained privacy levels for settings
|
|
4
|
+
*/
|
|
5
|
+
export enum SessionReplayPrivacy {
|
|
6
|
+
MASK = 0,
|
|
7
|
+
ALLOW = 1,
|
|
8
|
+
MASK_USER_INPUT = 2,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Available privacy levels for touch masking in session replay.
|
|
13
|
+
*/
|
|
14
|
+
export enum TouchPrivacyLevel {
|
|
15
|
+
SHOW = 'SHOW',
|
|
16
|
+
HIDE = 'HIDE',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Available privacy levels for image masking in session replay
|
|
21
|
+
*/
|
|
22
|
+
export enum ImagePrivacyLevel {
|
|
23
|
+
MASK_NON_BUNDLED_ONLY = 'MASK_NON_BUNDLED_ONLY',
|
|
24
|
+
MASK_ALL = 'MASK_ALL',
|
|
25
|
+
MASK_NONE = 'MASK_NONE',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Available privacy levels for text and input masking in session replay
|
|
30
|
+
*/
|
|
31
|
+
export enum TextAndInputPrivacyLevel {
|
|
32
|
+
MASK_SENSITIVE_INPUTS = 'MASK_SENSITIVE_INPUTS',
|
|
33
|
+
MASK_ALL_INPUTS = 'MASK_ALL_INPUTS',
|
|
34
|
+
MASK_ALL = 'MASK_ALL',
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Set Session Replay configuration.
|
|
38
|
+
* @param sampleRate Sampling rate
|
|
39
|
+
* @param sessionReplayOnErrorSampleRate error session sampling rate. For sessions not sampled, if ERROR is hit, collect data 1 minute before the error occurs
|
|
40
|
+
* @param privacy Privacy level for content masking in session replay
|
|
41
|
+
* @param touchPrivacy Privacy level for touch masking in session replay
|
|
42
|
+
* @param textAndInputPrivacy Privacy level for text and input masking in session replay
|
|
43
|
+
* @param imagePrivacy Privacy level for image masking in session replay
|
|
44
|
+
* @param enableLinkRUMKeys Enable linking RUM data with session replay data. The value is an array of RUM global context keys. When the keys exist in RUM global context, the corresponding values will be linked to session replay data.
|
|
45
|
+
* @returns a Promise.
|
|
46
|
+
*/
|
|
47
|
+
export interface FTSessionReplayConfig {
|
|
48
|
+
sampleRate?: number;
|
|
49
|
+
sessionReplayOnErrorSampleRate?: number;
|
|
50
|
+
privacy?: SessionReplayPrivacy;
|
|
51
|
+
touchPrivacy?: TouchPrivacyLevel;
|
|
52
|
+
textAndInputPrivacy?: TextAndInputPrivacyLevel;
|
|
53
|
+
imagePrivacy?: ImagePrivacyLevel;
|
|
54
|
+
enableLinkRUMKeys?: string[];
|
|
55
|
+
}
|
|
56
|
+
type FTReactNativeSessionReplayType = {
|
|
57
|
+
/**
|
|
58
|
+
* Set Session Replay configuration and enable session replay
|
|
59
|
+
* @param config Session Replay configuration parameters.
|
|
60
|
+
* @returns a Promise.
|
|
61
|
+
*/
|
|
62
|
+
sessionReplayConfig(config: FTSessionReplayConfig): Promise<void>;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
class FTReactNativeSessionReplayWrapper
|
|
66
|
+
implements FTReactNativeSessionReplayType
|
|
67
|
+
{
|
|
68
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
69
|
+
private sessionReplay: FTReactNativeSessionReplayType =
|
|
70
|
+
require('./specs/NativeFTReactNativeSessionReplay').default;
|
|
71
|
+
/* eslint-enable @typescript-eslint/no-var-requires */
|
|
72
|
+
|
|
73
|
+
sessionReplayConfig(config: FTSessionReplayConfig): Promise<void> {
|
|
74
|
+
return this.sessionReplay.sessionReplayConfig(config);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export const FTReactNativeSessionReplay: FTReactNativeSessionReplayType =
|
|
78
|
+
new FTReactNativeSessionReplayWrapper();
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FTSessionReplayConfig,
|
|
3
|
+
SessionReplayPrivacy,
|
|
4
|
+
FTReactNativeSessionReplay,
|
|
5
|
+
TouchPrivacyLevel,
|
|
6
|
+
TextAndInputPrivacyLevel,
|
|
7
|
+
ImagePrivacyLevel,
|
|
8
|
+
} from './ft_session_replay';
|
|
9
|
+
import { FTSessionReplayView } from './components/SessionReplayView';
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
FTSessionReplayConfig,
|
|
13
|
+
SessionReplayPrivacy,
|
|
14
|
+
FTReactNativeSessionReplay,
|
|
15
|
+
TouchPrivacyLevel,
|
|
16
|
+
TextAndInputPrivacyLevel,
|
|
17
|
+
ImagePrivacyLevel,
|
|
18
|
+
FTSessionReplayView,
|
|
19
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { UIManager } from 'react-native';
|
|
2
|
+
import { requireNativeComponent } from 'react-native';
|
|
3
|
+
import type { FTPrivacyViewNativeProps } from '../types';
|
|
4
|
+
|
|
5
|
+
const isNewArchitectureEnabled = () => {
|
|
6
|
+
return UIManager.getViewManagerConfig?.('FTPrivacyView') === undefined;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const getNativeComponent = () => {
|
|
10
|
+
if (isNewArchitectureEnabled()) {
|
|
11
|
+
try {
|
|
12
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
13
|
+
const NewArchComponent =
|
|
14
|
+
require('./FTPrivacyViewNativeComponent').default;
|
|
15
|
+
/* eslint-enable @typescript-eslint/no-var-requires */
|
|
16
|
+
if (NewArchComponent) {
|
|
17
|
+
return NewArchComponent;
|
|
18
|
+
}
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.debug(
|
|
21
|
+
'Fabric component not available, falling back to Paper:',
|
|
22
|
+
error instanceof Error ? error.message : String(error)
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return requireNativeComponent<FTPrivacyViewNativeProps>('FTPrivacyView');
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const FTPrivacyViewNative = getNativeComponent();
|
|
31
|
+
|
|
32
|
+
export default FTPrivacyViewNative;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
2
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface FTPrivacyViewNativeProps extends ViewProps {
|
|
5
|
+
textAndInputPrivacy?: string;
|
|
6
|
+
imagePrivacy?: string;
|
|
7
|
+
touchPrivacy?: string;
|
|
8
|
+
hide?: boolean;
|
|
9
|
+
nativeID?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default codegenNativeComponent<FTPrivacyViewNativeProps>(
|
|
13
|
+
'FTPrivacyView'
|
|
14
|
+
) as HostComponent<FTPrivacyViewNativeProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
+
import type { TurboModule } from 'react-native';
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
/**
|
|
7
|
+
* Set Session Replay configuration and enable session replay
|
|
8
|
+
* @param config Session Replay configuration parameters.
|
|
9
|
+
* @returns a Promise.
|
|
10
|
+
*/
|
|
11
|
+
sessionReplayConfig(config: Object): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export default TurboModuleRegistry.get<Spec>('FTReactNativeSessionReplay');
|
package/src/types.ts
ADDED