@truewatchtech/react-native-mobile 0.4.0-alpha.4 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FTMobileReactNativeSDK.podspec +31 -2
- package/android/build.gradle +7 -19
- package/android/src/main/java/com/ft/sdk/reactnative/FTMobileImpl.java +472 -5
- package/android/src/main/java/com/ft/sdk/reactnative/FTRUMImpl.java +12 -0
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTLogModule.java +7 -14
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTMobileModule.java +46 -12
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTRUMModule.java +12 -13
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTTraceModule.java +6 -8
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTMobileModule.java +34 -2
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTRUMModule.java +5 -0
- package/android/src/rnpost74/java/com/ft/sdk/reactnative/FTMobilePackage.java +14 -3
- package/android/src/rnpre74/java/com/ft/sdk/reactnative/FTMobilePackage.java +0 -3
- package/ios/FTMobileReactNative.h +9 -5
- package/ios/FTMobileReactNative.mm +625 -0
- package/ios/FTReactNativeLog.h +8 -3
- package/ios/FTReactNativeLog.mm +79 -0
- package/ios/FTReactNativeRUM.h +8 -3
- package/ios/{FTReactNativeRUM.m → FTReactNativeRUM.mm} +143 -84
- package/ios/FTReactNativeTrace.h +8 -2
- package/ios/FTReactNativeTrace.mm +74 -0
- package/ios/FtMobileAgent.xcodeproj/project.pbxproj +17 -1
- package/lib/commonjs/ft_logger.js +14 -13
- package/lib/commonjs/ft_logger.js.map +1 -1
- package/lib/commonjs/ft_mobile_agent.js +155 -6
- package/lib/commonjs/ft_mobile_agent.js.map +1 -1
- package/lib/commonjs/ft_rum.js +55 -21
- package/lib/commonjs/ft_rum.js.map +1 -1
- package/lib/commonjs/ft_tracing.js +29 -10
- package/lib/commonjs/ft_tracing.js.map +1 -1
- package/lib/commonjs/index.js +24 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/rum/FTRumActionTracking.js +10 -4
- package/lib/commonjs/rum/FTRumActionTracking.js.map +1 -1
- package/lib/commonjs/rum/FTRumErrorTracking.js +4 -4
- package/lib/commonjs/rum/FTRumErrorTracking.js.map +1 -1
- package/lib/commonjs/specs/NativeFTMobileReactNative.js +10 -0
- package/lib/commonjs/specs/NativeFTMobileReactNative.js.map +1 -0
- package/lib/commonjs/specs/NativeFTReactNativeLog.js +10 -0
- package/lib/commonjs/specs/NativeFTReactNativeLog.js.map +1 -0
- package/lib/commonjs/specs/NativeFTReactNativeRUM.js +10 -0
- package/lib/commonjs/specs/NativeFTReactNativeRUM.js.map +1 -0
- package/lib/commonjs/specs/NativeFTReactNativeTrace.js +10 -0
- package/lib/commonjs/specs/NativeFTReactNativeTrace.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/ft_logger.js +14 -12
- package/lib/module/ft_logger.js.map +1 -1
- package/lib/module/ft_mobile_agent.js +161 -5
- package/lib/module/ft_mobile_agent.js.map +1 -1
- package/lib/module/ft_rum.js +54 -16
- package/lib/module/ft_rum.js.map +1 -1
- package/lib/module/ft_tracing.js +29 -9
- package/lib/module/ft_tracing.js.map +1 -1
- package/lib/module/index.js +3 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/rum/FTRumActionTracking.js +10 -4
- package/lib/module/rum/FTRumActionTracking.js.map +1 -1
- package/lib/module/rum/FTRumErrorTracking.js +4 -4
- package/lib/module/rum/FTRumErrorTracking.js.map +1 -1
- package/lib/module/specs/NativeFTMobileReactNative.js +5 -0
- package/lib/module/specs/NativeFTMobileReactNative.js.map +1 -0
- package/lib/module/specs/NativeFTReactNativeLog.js +5 -0
- package/lib/module/specs/NativeFTReactNativeLog.js.map +1 -0
- package/lib/module/specs/NativeFTReactNativeRUM.js +5 -0
- package/lib/module/specs/NativeFTReactNativeRUM.js.map +1 -0
- package/lib/module/specs/NativeFTReactNativeTrace.js +5 -0
- package/lib/module/specs/NativeFTReactNativeTrace.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/ft_logger.d.ts +6 -6
- package/lib/typescript/ft_mobile_agent.d.ts +169 -14
- package/lib/typescript/ft_rum.d.ts +32 -8
- package/lib/typescript/ft_tracing.d.ts +6 -6
- package/lib/typescript/index.d.ts +3 -4
- package/lib/typescript/specs/NativeFTMobileReactNative.d.ts +75 -0
- package/lib/typescript/specs/NativeFTReactNativeLog.d.ts +23 -0
- package/lib/typescript/specs/NativeFTReactNativeRUM.d.ts +89 -0
- package/lib/typescript/specs/NativeFTReactNativeTrace.d.ts +24 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +26 -93
- package/scripts/replace-react-require.js +37 -38
- package/src/ft_logger.tsx +72 -40
- package/src/ft_mobile_agent.tsx +378 -91
- package/src/ft_rum.tsx +227 -121
- package/src/ft_tracing.tsx +58 -37
- package/src/index.tsx +58 -18
- package/src/rum/FTRumActionTracking.tsx +212 -204
- package/src/rum/FTRumErrorTracking.tsx +70 -71
- package/src/specs/NativeFTMobileReactNative.ts +83 -0
- package/src/specs/NativeFTReactNativeLog.ts +29 -0
- package/src/specs/NativeFTReactNativeRUM.ts +104 -0
- package/src/specs/NativeFTReactNativeTrace.ts +26 -0
- package/src/version.ts +1 -1
- package/LICENSE +0 -201
- package/android/.project +0 -17
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/gradlew +0 -185
- package/android/local.properties +0 -8
- package/android/src/main/java/com/ft/sdk/InnerClassProxy.java +0 -8
- package/android/src/main/java/com/ft/sdk/reactnative/FTSessionReplayImpl.java +0 -60
- package/android/src/main/java/com/ft/sdk/reactnative/extensions/ReactDrawablesExt.java +0 -155
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/NoopTextPropertiesResolver.java +0 -23
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/ReactNativeSessionReplayExtensionSupport.java +0 -57
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/ShadowNodeWrapper.java +0 -84
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/TextPropertiesResolver.java +0 -20
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/DefaultMapper.java +0 -78
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/Pair.java +0 -11
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactEditTextMapper.java +0 -136
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactNativeImageViewMapper.java +0 -117
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactTextMapper.java +0 -57
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactViewGroupMapper.java +0 -22
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactViewModalMapper.java +0 -21
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/resources/ReactDrawableCopier.java +0 -35
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/DrawableUtils.java +0 -34
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/ReflectionUtils.java +0 -43
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/FabricTextViewUtils.java +0 -69
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/LegacyTextViewUtils.java +0 -97
- package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/TextViewUtils.java +0 -184
- package/android/src/main/java/com/ft/sdk/reactnative/utils/ColorUtils.java +0 -24
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTSessionReplayModule.java +0 -30
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTSessionReplayModule.java +0 -25
- package/android/src/rn69/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -100
- package/android/src/rn75/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +0 -27
- package/android/src/rn75/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -116
- package/android/src/rn76/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +0 -38
- package/android/src/rn76/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -117
- package/android/src/rn79/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +0 -38
- package/android/src/rn79/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -132
- package/android/src/rn80/java/com/ft/sdk/reactnative/sessionreplay/extensions/ComputedBorderRadiusExt.java +0 -58
- package/android/src/rn80/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -190
- package/android/src/rnlegacy/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -120
- package/ios/.idea/.name +0 -1
- package/ios/.idea/ios.iml +0 -2
- package/ios/.idea/modules.xml +0 -8
- package/ios/.idea/vcs.xml +0 -6
- package/ios/.idea/xcode.xml +0 -4
- package/ios/FTMobileReactNative.m +0 -184
- package/ios/FTRCTTextViewRecorder.h +0 -33
- package/ios/FTRCTTextViewRecorder.m +0 -120
- package/ios/FTReactNativeLog.m +0 -60
- package/ios/FTReactNativeSessionReplay.h +0 -6
- package/ios/FTReactNativeSessionReplay.mm +0 -44
- package/ios/FTReactNativeTrace.m +0 -56
- package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
- package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/xcuserdata/Brandon.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/xcuserdata/Brandon.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
- package/ios/FtMobileAgent.xcodeproj/xcuserdata/Brandon.xcuserdatad/xcschemes/FtMobileAgent.xcscheme +0 -56
- package/ios/FtMobileAgent.xcodeproj/xcuserdata/Brandon.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/ios/RCTVersion.h +0 -8
- package/lib/commonjs/ft_session_replay.js +0 -34
- package/lib/commonjs/ft_session_replay.js.map +0 -1
- package/lib/module/ft_session_replay.js +0 -29
- package/lib/module/ft_session_replay.js.map +0 -1
- package/lib/typescript/ft_session_replay.d.ts +0 -27
- package/src/ft_session_replay.tsx +0 -34
package/src/ft_rum.tsx
CHANGED
|
@@ -1,33 +1,73 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
2
|
-
import { FTRumErrorTracking} from './rum/FTRumErrorTracking';
|
|
3
|
-
import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
1
|
+
// import { NativeModules } from 'react-native';
|
|
2
|
+
import { FTRumErrorTracking } from './rum/FTRumErrorTracking';
|
|
3
|
+
import { FTRumActionTracking } from './rum/FTRumActionTracking';
|
|
4
|
+
import { bridgeContextManager } from './ft_mobile_agent';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Error monitoring type.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
/* eslint-disable no-bitwise */
|
|
10
|
+
export enum ErrorMonitorType {
|
|
11
|
+
all = 0xffffffff,
|
|
12
|
+
battery = 1 << 1,
|
|
13
|
+
memory = 1 << 2,
|
|
14
|
+
cpu = 1 << 3,
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Page monitoring supplement type
|
|
18
|
+
*/
|
|
19
|
+
export enum DeviceMetricsMonitorType {
|
|
20
|
+
all = 0xffffffff,
|
|
21
|
+
battery = 1 << 1,
|
|
22
|
+
memory = 1 << 2,
|
|
23
|
+
cpu = 1 << 3,
|
|
24
|
+
fps = 1 << 4,
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Device information monitoring cycle.
|
|
28
|
+
*/
|
|
29
|
+
export enum DetectFrequency {
|
|
30
|
+
normal,
|
|
31
|
+
frequent,
|
|
32
|
+
rare,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export enum FTRUMCacheDiscard {
|
|
36
|
+
discard,
|
|
37
|
+
discardOldest,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export enum IOSCrashMonitoringType {
|
|
41
|
+
/** Monitor Mach kernel exceptions. */
|
|
42
|
+
machException = 0x01,
|
|
43
|
+
|
|
44
|
+
/** Monitor fatal signals. */
|
|
45
|
+
signal = 0x02,
|
|
46
|
+
|
|
47
|
+
/** Monitor uncaught C++ exceptions. */
|
|
48
|
+
cppException = 0x04,
|
|
49
|
+
|
|
50
|
+
/** Monitor uncaught Objective-C NSExceptions. */
|
|
51
|
+
nsException = 0x08,
|
|
52
|
+
|
|
53
|
+
/** Track and inject system information. */
|
|
54
|
+
system = 0x40,
|
|
55
|
+
|
|
56
|
+
/** Track and inject application state information. */
|
|
57
|
+
applicationState = 0x80,
|
|
28
58
|
|
|
29
|
-
|
|
59
|
+
/** All crash monitor types. */
|
|
60
|
+
all = machException |
|
|
61
|
+
signal |
|
|
62
|
+
cppException |
|
|
63
|
+
nsException |
|
|
64
|
+
applicationState |
|
|
65
|
+
system,
|
|
30
66
|
|
|
67
|
+
/** High compatibility crash monitor types (excludes Mach exceptions). */
|
|
68
|
+
highCompatibility = all & ~machException,
|
|
69
|
+
}
|
|
70
|
+
/* eslint-enable no-bitwise */
|
|
31
71
|
/**
|
|
32
72
|
* Set RUM tracking conditions.
|
|
33
73
|
* @param androidAppId appId, apply during monitoring
|
|
@@ -50,29 +90,35 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
50
90
|
* @param globalContext custom global parameters
|
|
51
91
|
* @param rumCacheLimitCount RUM max cache size, default 100_000
|
|
52
92
|
* @param rumDiscardStrategy RUM data discard strategy
|
|
93
|
+
* @param enableTraceWebView Set whether to enable WebView data collection, default true
|
|
94
|
+
* @param allowWebViewHost Set specific hosts or domains allowed to collect WebView data, nil means collect all
|
|
95
|
+
* @param iosCrashMonitoringType iOS crash monitoring type , default is highCompatibility, which does not include Mach exceptions for better compatibility. you must enable system crash monitoring to get crash stack traces and crash information.
|
|
53
96
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
97
|
+
export interface FTRUMConfig {
|
|
98
|
+
androidAppId: string;
|
|
99
|
+
iOSAppId: string;
|
|
100
|
+
sampleRate?: number;
|
|
101
|
+
sessionOnErrorSampleRate?: number;
|
|
102
|
+
enableAutoTrackUserAction?: boolean;
|
|
103
|
+
enableAutoTrackError?: boolean;
|
|
104
|
+
enableTrackNativeCrash?: boolean;
|
|
105
|
+
enableTrackNativeAppANR?: boolean;
|
|
106
|
+
enableTrackNativeFreeze?: boolean;
|
|
107
|
+
nativeFreezeDurationMs?: number;
|
|
108
|
+
enableNativeUserAction?: boolean;
|
|
109
|
+
enableNativeUserView?: boolean;
|
|
110
|
+
enableNativeUserResource?: boolean;
|
|
111
|
+
enableResourceHostIP?: boolean;
|
|
112
|
+
errorMonitorType?: ErrorMonitorType;
|
|
113
|
+
deviceMonitorType?: DeviceMetricsMonitorType;
|
|
114
|
+
detectFrequency?: DetectFrequency;
|
|
115
|
+
globalContext?: object;
|
|
116
|
+
rumCacheLimitCount?: number;
|
|
117
|
+
rumDiscardStrategy?: FTRUMCacheDiscard;
|
|
118
|
+
enableTraceWebView?: boolean;
|
|
119
|
+
allowWebViewHost?: Array<string>;
|
|
120
|
+
iosCrashMonitoringType?: IOSCrashMonitoringType;
|
|
121
|
+
}
|
|
76
122
|
/**
|
|
77
123
|
* RUM Resource data.
|
|
78
124
|
* @param url request URL
|
|
@@ -82,14 +128,14 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
82
128
|
* @param responseBody response content
|
|
83
129
|
* @param resourceStatus response status code
|
|
84
130
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
131
|
+
export interface FTRUMResource {
|
|
132
|
+
url: string;
|
|
133
|
+
httpMethod: string;
|
|
134
|
+
requestHeader: object;
|
|
135
|
+
responseHeader?: object;
|
|
136
|
+
responseBody?: string;
|
|
137
|
+
resourceStatus?: number;
|
|
138
|
+
}
|
|
93
139
|
/**
|
|
94
140
|
* RUM Resource performance metrics.
|
|
95
141
|
* @param duration resource load time
|
|
@@ -100,22 +146,22 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
100
146
|
* @param resource_trans resource content transfer time
|
|
101
147
|
* @param resource_first_byte resource first byte time
|
|
102
148
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
149
|
+
export interface FTRUMResourceMetrics {
|
|
150
|
+
duration?: number;
|
|
151
|
+
resource_dns?: number;
|
|
152
|
+
resource_tcp?: number;
|
|
153
|
+
resource_ssl?: number;
|
|
154
|
+
resource_ttfb?: number;
|
|
155
|
+
resource_trans?: number;
|
|
156
|
+
resource_first_byte?: number;
|
|
157
|
+
}
|
|
158
|
+
type FTReactNativeRUMType = {
|
|
113
159
|
/**
|
|
114
160
|
* Set RUM tracking conditions and enable RUM collection.
|
|
115
161
|
* @param config rum configuration parameters.
|
|
116
162
|
* @returns a Promise.
|
|
117
163
|
*/
|
|
118
|
-
|
|
164
|
+
setConfig(config: FTRUMConfig): Promise<void>;
|
|
119
165
|
/**
|
|
120
166
|
* Start RUM Action.
|
|
121
167
|
* RUM will bind Resource, Error, LongTask events that may be triggered by this Action.
|
|
@@ -126,35 +172,43 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
126
172
|
* @param property event context (optional)
|
|
127
173
|
* @returns a Promise.
|
|
128
174
|
*/
|
|
129
|
-
|
|
130
|
-
|
|
175
|
+
startAction(
|
|
176
|
+
actionName: string,
|
|
177
|
+
actionType: string,
|
|
178
|
+
property?: object
|
|
179
|
+
): Promise<void>;
|
|
180
|
+
/**
|
|
131
181
|
* Add Action event. This type of data cannot be associated with Error, Resource, LongTask data, and has no discard logic.
|
|
132
182
|
* @param actionName action name
|
|
133
183
|
* @param actionType action type
|
|
134
184
|
* @param property event context (optional)
|
|
135
185
|
* @returns a Promise.
|
|
136
186
|
*/
|
|
137
|
-
|
|
187
|
+
addAction(
|
|
188
|
+
actionName: string,
|
|
189
|
+
actionType: string,
|
|
190
|
+
property?: object
|
|
191
|
+
): Promise<void>;
|
|
138
192
|
/**
|
|
139
193
|
* view load duration.
|
|
140
194
|
* @param viewName view name
|
|
141
195
|
* @param loadTime view load duration
|
|
142
196
|
* @returns a Promise.
|
|
143
197
|
*/
|
|
144
|
-
|
|
198
|
+
onCreateView(viewName: string, loadTime: number): Promise<void>;
|
|
145
199
|
/**
|
|
146
200
|
* view start.
|
|
147
201
|
* @param viewName page name
|
|
148
202
|
* @param property event context (optional)
|
|
149
203
|
* @returns a Promise.
|
|
150
204
|
*/
|
|
151
|
-
|
|
205
|
+
startView(viewName: string, property?: object): Promise<void>;
|
|
152
206
|
/**
|
|
153
207
|
* view end.
|
|
154
208
|
* @param property event context (optional)
|
|
155
209
|
* @returns a Promise.
|
|
156
210
|
*/
|
|
157
|
-
|
|
211
|
+
stopView(property?: object): Promise<void>;
|
|
158
212
|
/**
|
|
159
213
|
* Exception capture and log collection.
|
|
160
214
|
* @param stack stack log
|
|
@@ -162,7 +216,7 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
162
216
|
* @param property event context (optional)
|
|
163
217
|
* @returns a Promise.
|
|
164
218
|
*/
|
|
165
|
-
|
|
219
|
+
addError(stack: string, message: string, property?: object): Promise<void>;
|
|
166
220
|
/**
|
|
167
221
|
* Exception capture and log collection.
|
|
168
222
|
* @param type error type
|
|
@@ -171,21 +225,26 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
171
225
|
* @param property event context (optional)
|
|
172
226
|
* @returns a Promise.
|
|
173
227
|
*/
|
|
174
|
-
|
|
228
|
+
addErrorWithType(
|
|
229
|
+
type: string,
|
|
230
|
+
stack: string,
|
|
231
|
+
message: string,
|
|
232
|
+
property?: object
|
|
233
|
+
): Promise<void>;
|
|
175
234
|
/**
|
|
176
235
|
* Start resource request.
|
|
177
236
|
* @param key unique id
|
|
178
237
|
* @param property event context (optional)
|
|
179
238
|
* @returns a Promise.
|
|
180
239
|
*/
|
|
181
|
-
|
|
240
|
+
startResource(key: string, property?: object): Promise<void>;
|
|
182
241
|
/**
|
|
183
242
|
* End resource request.
|
|
184
243
|
* @param key unique id
|
|
185
244
|
* @param property event context (optional)
|
|
186
245
|
* @returns a Promise.
|
|
187
246
|
*/
|
|
188
|
-
|
|
247
|
+
stopResource(key: string, property?: object): Promise<void>;
|
|
189
248
|
/**
|
|
190
249
|
* Send resource data metrics.
|
|
191
250
|
* @param key unique id
|
|
@@ -193,53 +252,100 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
193
252
|
* @param metrics resource performance data
|
|
194
253
|
* @returns a Promise.
|
|
195
254
|
*/
|
|
196
|
-
|
|
197
|
-
|
|
255
|
+
addResource(
|
|
256
|
+
key: string,
|
|
257
|
+
resource: FTRUMResource,
|
|
258
|
+
metrics?: FTRUMResourceMetrics
|
|
259
|
+
): Promise<void>;
|
|
260
|
+
};
|
|
198
261
|
|
|
199
|
-
|
|
200
|
-
|
|
262
|
+
class FTReactNativeRUMWrapper implements FTReactNativeRUMType {
|
|
263
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
264
|
+
private rum: FTReactNativeRUMType = require('./specs/NativeFTReactNativeRUM')
|
|
265
|
+
.default;
|
|
201
266
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
startAction(actionName:string,actionType:string,property?:object): Promise<void>{
|
|
213
|
-
return this.rum.startAction(actionName,actionType,property);
|
|
214
|
-
}
|
|
215
|
-
addAction(actionName: string, actionType: string, property?: object): Promise<void> {
|
|
216
|
-
return this.rum.addAction(actionName,actionType,property);
|
|
217
|
-
}
|
|
218
|
-
onCreateView(viewName:string,loadTime:number): Promise<void>{
|
|
219
|
-
return this.rum.onCreateView(viewName,loadTime);
|
|
220
|
-
}
|
|
221
|
-
startView(viewName: string, property?:object): Promise<void>{
|
|
222
|
-
return this.rum.startView(viewName,property);
|
|
223
|
-
}
|
|
224
|
-
stopView(property?:object): Promise<void>{
|
|
225
|
-
return this.rum.stopView(property);
|
|
226
|
-
}
|
|
227
|
-
addError(stack: string, message: string,property?:object): Promise<void>{
|
|
228
|
-
return this.rum.addError(stack,message,property);
|
|
229
|
-
}
|
|
230
|
-
addErrorWithType(type:string,stack: string, message: string,property?:object): Promise<void>{
|
|
231
|
-
return this.rum.addErrorWithType(type,stack,message,property);
|
|
267
|
+
setConfig(config: FTRUMConfig): Promise<void> {
|
|
268
|
+
console.log('FTRUMConfig');
|
|
269
|
+
if (config.enableAutoTrackError) {
|
|
270
|
+
FTRumErrorTracking.startTracking();
|
|
271
|
+
}
|
|
272
|
+
if (config.enableAutoTrackUserAction) {
|
|
273
|
+
FTRumActionTracking.startTracking();
|
|
274
|
+
}
|
|
275
|
+
return this.rum.setConfig(config);
|
|
232
276
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
277
|
+
startAction(
|
|
278
|
+
actionName: string,
|
|
279
|
+
actionType: string,
|
|
280
|
+
property?: object
|
|
281
|
+
): Promise<void> {
|
|
282
|
+
// Automatically merge bridge context properties with local properties
|
|
283
|
+
const mergedProperties =
|
|
284
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
285
|
+
return this.rum.startAction(actionName, actionType, mergedProperties);
|
|
286
|
+
}
|
|
287
|
+
addAction(
|
|
288
|
+
actionName: string,
|
|
289
|
+
actionType: string,
|
|
290
|
+
property?: object
|
|
291
|
+
): Promise<void> {
|
|
292
|
+
// Automatically merge bridge context properties with local properties
|
|
293
|
+
const mergedProperties =
|
|
294
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
295
|
+
return this.rum.addAction(actionName, actionType, mergedProperties);
|
|
296
|
+
}
|
|
297
|
+
onCreateView(viewName: string, loadTime: number): Promise<void> {
|
|
298
|
+
return this.rum.onCreateView(viewName, loadTime);
|
|
299
|
+
}
|
|
300
|
+
startView(viewName: string, property?: object): Promise<void> {
|
|
301
|
+
// Automatically merge bridge context properties with local properties
|
|
302
|
+
const mergedProperties =
|
|
303
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
304
|
+
return this.rum.startView(viewName, mergedProperties);
|
|
305
|
+
}
|
|
306
|
+
stopView(property?: object): Promise<void> {
|
|
307
|
+
// Automatically merge bridge context properties with local properties
|
|
308
|
+
const mergedProperties =
|
|
309
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
310
|
+
return this.rum.stopView(mergedProperties);
|
|
311
|
+
}
|
|
312
|
+
addError(stack: string, message: string, property?: object): Promise<void> {
|
|
313
|
+
// Automatically merge bridge context properties with local properties
|
|
314
|
+
const mergedProperties =
|
|
315
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
316
|
+
return this.rum.addError(stack, message, mergedProperties);
|
|
317
|
+
}
|
|
318
|
+
addErrorWithType(
|
|
319
|
+
type: string,
|
|
320
|
+
stack: string,
|
|
321
|
+
message: string,
|
|
322
|
+
property?: object
|
|
323
|
+
): Promise<void> {
|
|
324
|
+
// Automatically merge bridge context properties with local properties
|
|
325
|
+
const mergedProperties =
|
|
326
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
327
|
+
return this.rum.addErrorWithType(type, stack, message, mergedProperties);
|
|
328
|
+
}
|
|
329
|
+
startResource(key: string, property?: object): Promise<void> {
|
|
330
|
+
// Automatically merge bridge context properties with local properties
|
|
331
|
+
const mergedProperties =
|
|
332
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
333
|
+
return this.rum.startResource(key, mergedProperties);
|
|
334
|
+
}
|
|
335
|
+
stopResource(key: string, property?: object): Promise<void> {
|
|
336
|
+
// Automatically merge bridge context properties with local properties
|
|
337
|
+
const mergedProperties =
|
|
338
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
339
|
+
return this.rum.stopResource(key, mergedProperties);
|
|
340
|
+
}
|
|
341
|
+
addResource(
|
|
342
|
+
key: string,
|
|
343
|
+
resource: FTRUMResource,
|
|
344
|
+
metrics: FTRUMResourceMetrics = {}
|
|
345
|
+
): Promise<void> {
|
|
346
|
+
return this.rum.addResource(key, resource, metrics);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
245
349
|
|
|
350
|
+
export const FTReactNativeRUM: FTReactNativeRUMType =
|
|
351
|
+
new FTReactNativeRUMWrapper();
|
package/src/ft_tracing.tsx
CHANGED
|
@@ -1,17 +1,36 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
1
|
+
// import { NativeModules } from 'react-native';
|
|
2
2
|
//FTReactNativeTrace
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Trace types for use.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export enum TraceType {
|
|
8
|
+
//
|
|
9
|
+
// datadog trace
|
|
10
|
+
//
|
|
11
|
+
// x-datadog-trace-id
|
|
12
|
+
// x-datadog-parent-id
|
|
13
|
+
// x-datadog-sampling-priority
|
|
14
|
+
// x-datadog-origin
|
|
15
|
+
//
|
|
16
|
+
ddTrace,
|
|
17
|
+
//
|
|
18
|
+
// zipkin multi header
|
|
19
|
+
//
|
|
20
|
+
// X-B3-TraceId
|
|
21
|
+
// X-B3-SpanId
|
|
22
|
+
// X-B3-Sampled
|
|
23
|
+
//
|
|
24
|
+
zipkinMulti,
|
|
25
|
+
/// zipkin single header,b3
|
|
26
|
+
zipkinSingle,
|
|
27
|
+
// w3c, traceparent
|
|
28
|
+
traceparent,
|
|
29
|
+
// skywalking 8.0+, sw-8
|
|
30
|
+
skywalking,
|
|
31
|
+
// jaeger, header uber-trace-id
|
|
32
|
+
jaeger,
|
|
33
|
+
}
|
|
15
34
|
/**
|
|
16
35
|
* Configure trace.
|
|
17
36
|
* @param sampleRate sampling rate
|
|
@@ -19,60 +38,62 @@ import { NativeModules } from 'react-native';
|
|
|
19
38
|
* @param enableLinkRUMData whether to link with RUM data
|
|
20
39
|
* @param enableNativeAutoTrace whether to enable automatic tracing
|
|
21
40
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
export interface FTTraceConfig {
|
|
42
|
+
sampleRate?: number;
|
|
43
|
+
traceType?: TraceType;
|
|
44
|
+
enableLinkRUMData?: boolean;
|
|
45
|
+
enableNativeAutoTrace?: boolean;
|
|
46
|
+
}
|
|
28
47
|
|
|
29
|
-
|
|
48
|
+
type FTReactNativeTraceType = {
|
|
30
49
|
/**
|
|
31
50
|
* Configure trace to enable distributed tracing.
|
|
32
51
|
* @param config trace configuration parameters.
|
|
33
52
|
* @returns a Promise.
|
|
34
53
|
*/
|
|
35
|
-
|
|
54
|
+
setConfig(config: FTTraceConfig): Promise<void>;
|
|
36
55
|
/**
|
|
37
56
|
* Get trace HTTP request header data.
|
|
38
57
|
* @param url request URL
|
|
39
58
|
* @returns trace request header parameters
|
|
40
59
|
* @deprecated use getTraceHeaderFields() replace.
|
|
41
60
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
61
|
+
getTraceHeader(key: string, url: string): Promise<object>;
|
|
62
|
+
/**
|
|
44
63
|
* Get trace HTTP request header data.
|
|
45
64
|
* @param url request URL
|
|
46
65
|
* @returns trace request header parameters
|
|
47
66
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
67
|
+
getTraceHeaderFields(url: string, key?: string): Promise<object>;
|
|
68
|
+
};
|
|
50
69
|
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
class FTReactNativeTraceWrapper implements FTReactNativeTraceType {
|
|
71
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
72
|
+
private trace: FTReactNativeTraceType =
|
|
73
|
+
require('./specs/NativeFTReactNativeTrace').default;
|
|
74
|
+
/* eslint-enable @typescript-eslint/no-var-requires */
|
|
53
75
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
76
|
+
setConfig(config: FTTraceConfig): Promise<void> {
|
|
77
|
+
return this.trace.setConfig(config);
|
|
78
|
+
}
|
|
57
79
|
/**
|
|
58
80
|
* Get trace HTTP request header data.
|
|
59
81
|
* @param key unique id
|
|
60
82
|
* @param url request URL
|
|
61
83
|
* @returns a Promise.
|
|
62
84
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
85
|
+
getTraceHeader(key: string, url: string): Promise<object> {
|
|
86
|
+
return this.trace.getTraceHeaderFields(url, key);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
67
89
|
* Get trace HTTP request header data.
|
|
68
90
|
* @param url request URL
|
|
69
91
|
* @param key unique id
|
|
70
92
|
* @returns a Promise.
|
|
71
93
|
*/
|
|
72
|
-
|
|
73
|
-
return this.trace.getTraceHeaderFields(url,key);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
94
|
+
getTraceHeaderFields(url: string, key?: string): Promise<object> {
|
|
95
|
+
return this.trace.getTraceHeaderFields(url, key);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export const FTReactNativeTrace: FTReactNativeTraceType =
|
|
99
|
+
new FTReactNativeTraceWrapper();
|
package/src/index.tsx
CHANGED
|
@@ -1,19 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import {
|
|
2
|
+
FTMobileConfig,
|
|
3
|
+
FTMobileReactNative,
|
|
4
|
+
EnvType,
|
|
5
|
+
FTDBCacheDiscard,
|
|
6
|
+
FTRemoteConfigResult,
|
|
7
|
+
FTRemoteConfigOverrideRule,
|
|
8
|
+
FTRemoteConfigOverrideMatch,
|
|
9
|
+
FTRemoteConfigOverrideValues,
|
|
10
|
+
} from './ft_mobile_agent';
|
|
11
|
+
import {
|
|
12
|
+
FTLogConfig,
|
|
13
|
+
FTReactNativeLog,
|
|
14
|
+
FTLogStatus,
|
|
15
|
+
FTLogCacheDiscard,
|
|
16
|
+
} from './ft_logger';
|
|
17
|
+
import {
|
|
18
|
+
FTRUMConfig,
|
|
19
|
+
FTRUMResource,
|
|
20
|
+
FTReactNativeRUM,
|
|
21
|
+
ErrorMonitorType,
|
|
22
|
+
DeviceMetricsMonitorType,
|
|
23
|
+
DetectFrequency,
|
|
24
|
+
FTRUMResourceMetrics,
|
|
25
|
+
FTRUMCacheDiscard,
|
|
26
|
+
IOSCrashMonitoringType,
|
|
27
|
+
} from './ft_rum';
|
|
28
|
+
import { FTTraceConfig, FTReactNativeTrace, TraceType } from './ft_tracing';
|
|
29
|
+
import { FTRumActionTracking } from './rum/FTRumActionTracking';
|
|
30
|
+
import { FTRumErrorTracking } from './rum/FTRumErrorTracking';
|
|
19
31
|
|
|
32
|
+
export {
|
|
33
|
+
FTMobileReactNative,
|
|
34
|
+
FTMobileConfig,
|
|
35
|
+
EnvType,
|
|
36
|
+
FTDBCacheDiscard,
|
|
37
|
+
FTRemoteConfigResult,
|
|
38
|
+
FTRemoteConfigOverrideRule,
|
|
39
|
+
FTRemoteConfigOverrideMatch,
|
|
40
|
+
FTRemoteConfigOverrideValues,
|
|
41
|
+
FTLogConfig,
|
|
42
|
+
FTReactNativeLog,
|
|
43
|
+
FTLogStatus,
|
|
44
|
+
FTLogCacheDiscard,
|
|
45
|
+
FTRUMConfig,
|
|
46
|
+
FTReactNativeRUM,
|
|
47
|
+
FTRUMResource,
|
|
48
|
+
ErrorMonitorType,
|
|
49
|
+
DeviceMetricsMonitorType,
|
|
50
|
+
DetectFrequency,
|
|
51
|
+
FTRUMResourceMetrics,
|
|
52
|
+
FTRUMCacheDiscard,
|
|
53
|
+
IOSCrashMonitoringType,
|
|
54
|
+
FTTraceConfig,
|
|
55
|
+
FTReactNativeTrace,
|
|
56
|
+
TraceType,
|
|
57
|
+
FTRumActionTracking,
|
|
58
|
+
FTRumErrorTracking,
|
|
59
|
+
};
|