@truewatchtech/react-native-mobile 0.3.15-alpha.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.
Files changed (102) hide show
  1. package/FTMobileReactNativeSDK.podspec +22 -0
  2. package/LICENSE +201 -0
  3. package/README.md +37 -0
  4. package/android/.project +17 -0
  5. package/android/.settings/org.eclipse.buildship.core.prefs +13 -0
  6. package/android/build.gradle +183 -0
  7. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  8. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  9. package/android/gradle.properties +5 -0
  10. package/android/gradlew +185 -0
  11. package/android/gradlew.bat +89 -0
  12. package/android/local.properties +8 -0
  13. package/android/src/main/AndroidManifest.xml +4 -0
  14. package/android/src/main/AndroidManifestNew.xml +4 -0
  15. package/android/src/main/java/com/ft/sdk/InnerClassProxy.java +8 -0
  16. package/android/src/main/java/com/ft/sdk/reactnative/FTLogImpl.java +133 -0
  17. package/android/src/main/java/com/ft/sdk/reactnative/FTMobileImpl.java +198 -0
  18. package/android/src/main/java/com/ft/sdk/reactnative/FTRUMImpl.java +267 -0
  19. package/android/src/main/java/com/ft/sdk/reactnative/FTTraceImpl.java +89 -0
  20. package/android/src/main/java/com/ft/sdk/reactnative/utils/ReactNativeUtils.java +59 -0
  21. package/android/src/newarch/java/com/ft/sdk/reactnative/FTLogModule.java +39 -0
  22. package/android/src/newarch/java/com/ft/sdk/reactnative/FTMobileModule.java +69 -0
  23. package/android/src/newarch/java/com/ft/sdk/reactnative/FTRUMModule.java +84 -0
  24. package/android/src/newarch/java/com/ft/sdk/reactnative/FTTraceModule.java +34 -0
  25. package/android/src/oldarch/java/com/ft/sdk/reactnative/FTLogModule.java +36 -0
  26. package/android/src/oldarch/java/com/ft/sdk/reactnative/FTMobileModule.java +69 -0
  27. package/android/src/oldarch/java/com/ft/sdk/reactnative/FTRUMModule.java +70 -0
  28. package/android/src/oldarch/java/com/ft/sdk/reactnative/FTTraceModule.java +30 -0
  29. package/android/src/rnpost74/java/com/ft/sdk/reactnative/FTMobilePackage.java +71 -0
  30. package/android/src/rnpre74/java/com/ft/sdk/reactnative/FTMobilePackage.java +33 -0
  31. package/ios/.idea/.name +1 -0
  32. package/ios/.idea/ios.iml +2 -0
  33. package/ios/.idea/modules.xml +8 -0
  34. package/ios/.idea/vcs.xml +6 -0
  35. package/ios/.idea/xcode.xml +4 -0
  36. package/ios/FTMobileReactNative.h +18 -0
  37. package/ios/FTMobileReactNative.m +183 -0
  38. package/ios/FTReactNativeLog.h +18 -0
  39. package/ios/FTReactNativeLog.m +60 -0
  40. package/ios/FTReactNativeRUM.h +19 -0
  41. package/ios/FTReactNativeRUM.m +173 -0
  42. package/ios/FTReactNativeTrace.h +20 -0
  43. package/ios/FTReactNativeTrace.m +58 -0
  44. package/ios/FTReactNativeUtils.h +16 -0
  45. package/ios/FTReactNativeUtils.m +32 -0
  46. package/ios/FtMobileAgent.xcodeproj/project.pbxproj +293 -0
  47. package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
  48. package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/xcuserdata/Brandon.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  49. package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/xcuserdata/Brandon.xcuserdatad/xcschemes/xcschememanagement.plist +5 -0
  50. package/ios/FtMobileAgent.xcodeproj/xcuserdata/Brandon.xcuserdatad/xcschemes/FtMobileAgent.xcscheme +56 -0
  51. package/ios/FtMobileAgent.xcodeproj/xcuserdata/Brandon.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  52. package/ios/RCTVersion.h +8 -0
  53. package/lib/commonjs/ft_logger.js +70 -0
  54. package/lib/commonjs/ft_logger.js.map +1 -0
  55. package/lib/commonjs/ft_mobile_agent.js +93 -0
  56. package/lib/commonjs/ft_mobile_agent.js.map +1 -0
  57. package/lib/commonjs/ft_rum.js +143 -0
  58. package/lib/commonjs/ft_rum.js.map +1 -0
  59. package/lib/commonjs/ft_tracing.js +61 -0
  60. package/lib/commonjs/ft_tracing.js.map +1 -0
  61. package/lib/commonjs/index.js +138 -0
  62. package/lib/commonjs/index.js.map +1 -0
  63. package/lib/commonjs/rum/FTRumActionTracking.js +214 -0
  64. package/lib/commonjs/rum/FTRumActionTracking.js.map +1 -0
  65. package/lib/commonjs/rum/FTRumErrorTracking.js +99 -0
  66. package/lib/commonjs/rum/FTRumErrorTracking.js.map +1 -0
  67. package/lib/commonjs/version.js +9 -0
  68. package/lib/commonjs/version.js.map +1 -0
  69. package/lib/module/ft_logger.js +64 -0
  70. package/lib/module/ft_logger.js.map +1 -0
  71. package/lib/module/ft_mobile_agent.js +88 -0
  72. package/lib/module/ft_mobile_agent.js.map +1 -0
  73. package/lib/module/ft_rum.js +138 -0
  74. package/lib/module/ft_rum.js.map +1 -0
  75. package/lib/module/ft_tracing.js +56 -0
  76. package/lib/module/ft_tracing.js.map +1 -0
  77. package/lib/module/index.js +8 -0
  78. package/lib/module/index.js.map +1 -0
  79. package/lib/module/rum/FTRumActionTracking.js +206 -0
  80. package/lib/module/rum/FTRumActionTracking.js.map +1 -0
  81. package/lib/module/rum/FTRumErrorTracking.js +92 -0
  82. package/lib/module/rum/FTRumErrorTracking.js.map +1 -0
  83. package/lib/module/version.js +3 -0
  84. package/lib/module/version.js.map +1 -0
  85. package/lib/typescript/ft_logger.d.ts +52 -0
  86. package/lib/typescript/ft_mobile_agent.d.ts +123 -0
  87. package/lib/typescript/ft_rum.d.ts +200 -0
  88. package/lib/typescript/ft_tracing.d.ts +47 -0
  89. package/lib/typescript/index.d.ts +7 -0
  90. package/lib/typescript/rum/FTRumActionTracking.d.ts +15 -0
  91. package/lib/typescript/rum/FTRumErrorTracking.d.ts +11 -0
  92. package/lib/typescript/version.d.ts +1 -0
  93. package/package.json +167 -0
  94. package/scripts/replace-react-require.js +52 -0
  95. package/src/ft_logger.tsx +77 -0
  96. package/src/ft_mobile_agent.tsx +162 -0
  97. package/src/ft_rum.tsx +247 -0
  98. package/src/ft_tracing.tsx +79 -0
  99. package/src/index.tsx +17 -0
  100. package/src/rum/FTRumActionTracking.tsx +232 -0
  101. package/src/rum/FTRumErrorTracking.tsx +110 -0
  102. package/src/version.ts +2 -0
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Set log level.
3
+ */
4
+ export declare enum FTLogStatus {
5
+ info = 0,
6
+ warning = 1,
7
+ error = 2,
8
+ critical = 3,
9
+ ok = 4
10
+ }
11
+ /**
12
+ * Log discard method.
13
+ */
14
+ export declare enum FTLogCacheDiscard {
15
+ discard = 0,
16
+ discardOldest = 1
17
+ }
18
+ /**
19
+ * Configure log output configuration.
20
+ * @param sampleRate sampling rate
21
+ * @param enableLinkRumData whether to link with RUM
22
+ * @param enableCustomLog whether to enable custom logs
23
+ * @param discardStrategy log discard strategy
24
+ * @param logLevelFilters log level filter
25
+ * @param globalContext custom global parameters
26
+ * @param logCacheLimitCount get maximum log entry count limit [1000,), default 5000
27
+ */
28
+ export interface FTLogConfig {
29
+ sampleRate?: number;
30
+ enableLinkRumData?: boolean;
31
+ enableCustomLog?: boolean;
32
+ discardStrategy?: FTLogCacheDiscard;
33
+ logLevelFilters?: Array<FTLogStatus>;
34
+ globalContext?: object;
35
+ logCacheLimitCount?: number;
36
+ }
37
+ declare class FTReactNativeLogWrapper {
38
+ private logger;
39
+ /**
40
+ *Configure log output configuration to enable log collection.
41
+ */
42
+ logConfig(config: FTLogConfig): Promise<void>;
43
+ /**
44
+ * Output log.
45
+ * @param content log content
46
+ * @param status log status
47
+ * @param property log context (optional)
48
+ */
49
+ logging(content: String, logStatus: FTLogStatus | String, property?: object): Promise<void>;
50
+ }
51
+ export declare const FTReactNativeLog: FTReactNativeLogWrapper;
52
+ export {};
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Environment.
3
+ */
4
+ export declare enum EnvType {
5
+ prod = 0,
6
+ gray = 1,
7
+ pre = 2,
8
+ common = 3,
9
+ local = 4
10
+ }
11
+ export declare enum FTDBCacheDiscard {
12
+ discard = 0,
13
+ discardOldest = 1
14
+ }
15
+ /**
16
+ * Configure SDK startup parameters.
17
+ * @param serverUrl data reporting address, deprecated, use [datakitUrl] instead
18
+ * @param datakitUrl datakit access URL address, example: http://10.0.0.1:9529, default port 9529. Choose one between datakit and dataway configuration
19
+ * @param datawayUrl dataway access URL address, example: http://10.0.0.1:9528, default port 9528, note: the device installing the SDK needs to be able to access this address. Note: choose one between datakit and dataway configuration
20
+ * @param clientToken dataway authentication token, needs to be configured together with [datawayUrl]
21
+ * @param debug set whether to allow log printing, default false
22
+ * @param env environment, default prod
23
+ * @param service set the name of the business or service it belongs to, default: `df_rum_ios`, `df_rum_android`
24
+ * @param autoSync whether data is automatically synchronized and uploaded, default: true
25
+ * @param syncPageSize number of synchronized items per request during data synchronization, minimum value 5, default: 10
26
+ * @param syncSleepTime interval time between each request during data synchronization, unit milliseconds, 0 < syncSleepTime < 100
27
+ * @param enableDataIntegerCompatible whether to enable data integer compatibility during data synchronization, enabled by default
28
+ * @param compressIntakeRequests whether to compress synchronized data
29
+ * @param globalContext custom global parameters
30
+ * @param groupIdentifiers iOS side sets the AppGroups Identifier array corresponding to the collected Widget Extension
31
+ * @param enableLimitWithDbSize set whether to enable using db to limit data size, after enabling, `FTLogConfig.logCacheLimitCount` and `FTRUMConfig.rumCacheLimitCount` will no longer take effect
32
+ * @param dbCacheLimit db cache limit size, minimum value 30MB, default 100MB, unit byte
33
+ * @param dbDiscardStrategy db data discard strategy
34
+ * @param dataModifier data modifier, modify individual fields {key:value}, after setting, the SDK will replace the original value with the set value according to the key
35
+ * @param lineDataModifier data modifier, modify single data {"measurement":measurement,"data":{key:value}}, after setting, the SDK will replace the original value with the set value according to the key
36
+ */
37
+ export interface FTMobileConfig {
38
+ /**
39
+ * @deprecated "serverUrl" parameter renamed to "datakitUrl"
40
+ */
41
+ serverUrl?: string;
42
+ datakitUrl?: string;
43
+ datawayUrl?: string;
44
+ clientToken?: string;
45
+ debug?: boolean;
46
+ envType?: EnvType;
47
+ env?: string;
48
+ service?: string;
49
+ autoSync?: boolean;
50
+ syncPageSize?: number;
51
+ syncSleepTime?: number;
52
+ enableDataIntegerCompatible?: boolean;
53
+ compressIntakeRequests?: boolean;
54
+ globalContext?: object;
55
+ groupIdentifiers?: Array<string>;
56
+ enableLimitWithDbSize?: boolean;
57
+ dbCacheLimit?: number;
58
+ dbDiscardStrategy?: FTDBCacheDiscard;
59
+ pkgInfo?: string;
60
+ dataModifier?: object;
61
+ lineDataModifier?: object;
62
+ }
63
+ type FTMobileReactNativeType = {
64
+ /**
65
+ * SDK initialization method.
66
+ * @param config SDK initialization configuration items.
67
+ * @returns a Promise.
68
+ */
69
+ sdkConfig(config: FTMobileConfig): Promise<void>;
70
+ /**
71
+ * Bind user.
72
+ * @param userId user ID.
73
+ * @param userName user name.
74
+ * @param userEmail user email
75
+ * @param extra additional user information
76
+ * @returns a Promise.
77
+ */
78
+ bindRUMUserData(userId: string, userName?: string, userEmail?: string, extra?: object): Promise<void>;
79
+ /**
80
+ * Unbind user.
81
+ * @returns a Promise.
82
+ */
83
+ unbindRUMUserData(): Promise<void>;
84
+ /**
85
+ * Add custom global parameters. Applies to RUM and Log data
86
+ * @param context custom global parameters.
87
+ * @returns a Promise.
88
+ */
89
+ appendGlobalContext(context: object): Promise<void>;
90
+ /**
91
+ * Add custom RUM global parameters. Applies to RUM data
92
+ * @param context custom RUM global parameters.
93
+ * @returns a Promise.
94
+ */
95
+ appendRUMGlobalContext(context: object): Promise<void>;
96
+ /**
97
+ * Add custom RUM and Log global parameters. Applies to Log data
98
+ * @param context custom Log global parameters.
99
+ * @returns a Promise.
100
+ */
101
+ appendLogGlobalContext(context: object): Promise<void>;
102
+ /**
103
+ * Actively synchronize data. When `FTMobileConfig.autoSync=false` is configured, you need to actively trigger this method to synchronize data.
104
+ * @returns a Promise.
105
+ */
106
+ flushSyncData(): Promise<void>;
107
+ /**
108
+ * Synchronize events in iOS Widget Extension, iOS only
109
+ * @param groupIdentifier app groupId
110
+ * @returns {groupIdentifier:string,datas:Array<object>} can be used to view data collected in Extension.
111
+ */
112
+ trackEventFromExtension(identifier: string): Promise<object>;
113
+ /**
114
+ * Shut down objects currently running in the SDK
115
+ */
116
+ shutDown(): Promise<void>;
117
+ /**
118
+ * Clear all data that has not yet been uploaded to the server.
119
+ */
120
+ clearAllData(): Promise<void>;
121
+ };
122
+ export declare const FTMobileReactNative: FTMobileReactNativeType;
123
+ export {};
@@ -0,0 +1,200 @@
1
+ /**
2
+ * Error monitoring type.
3
+ */
4
+ export declare enum ErrorMonitorType {
5
+ all = 4294967295,
6
+ battery = 2,
7
+ memory = 4,
8
+ cpu = 8
9
+ }
10
+ /**
11
+ * Page monitoring supplement type
12
+ */
13
+ export declare enum DeviceMetricsMonitorType {
14
+ all = 4294967295,
15
+ battery = 2,
16
+ memory = 4,
17
+ cpu = 8,
18
+ fps = 16
19
+ }
20
+ /**
21
+ * Device information monitoring cycle.
22
+ */
23
+ export declare enum DetectFrequency {
24
+ normal = 0,
25
+ frequent = 1,
26
+ rare = 2
27
+ }
28
+ export declare enum FTRUMCacheDiscard {
29
+ discard = 0,
30
+ discardOldest = 1
31
+ }
32
+ /**
33
+ * Set RUM tracking conditions.
34
+ * @param androidAppId appId, apply during monitoring
35
+ * @param iOSAppId appId, apply during monitoring
36
+ * @param sampleRate sampling rate
37
+ * @param sessionOnErrorSampleRate error session sampling rate. For sessions not sampled, if ERROR is hit, collect data 1 minute before the error occurs
38
+ * @param enableAutoTrackUserAction whether to automatically collect react-native control click events, can set actionName with accessibilityLabel when enabled
39
+ * @param enableTrackError whether to automatically collect react-native Error
40
+ * @param enableTrackNativeCrash whether to collect Native Error
41
+ * @param enableTrackNativeAppANR whether to collect Native ANR
42
+ * @param enableTrackNativeFreeze whether to collect Native Freeze
43
+ * @param nativeFreezeDurationMs set the threshold for collecting Native Freeze, value range [100,), unit ms. iOS default 250ms, Android default 1000ms
44
+ * @param enableNativeUserAction whether to start Native Action tracking, Button click events, recommended to disable for pure react-native apps
45
+ * @param enableNativeUserView whether to start Native View auto tracking, recommended to disable for pure react-native apps
46
+ * @param enableNativeUserResource whether to automatically collect react-native Resource
47
+ * @param enableResourceHostIP whether to collect network request Host IP (only for native http, iOS 13 and above)
48
+ * @param errorMonitorType error monitoring supplement type
49
+ * @param deviceMonitorType page monitoring supplement type
50
+ * @param detectFrequency monitoring frequency
51
+ * @param globalContext custom global parameters
52
+ * @param rumCacheLimitCount RUM max cache size, default 100_000
53
+ * @param rumDiscardStrategy RUM data discard strategy
54
+ */
55
+ export interface FTRUMConfig {
56
+ androidAppId: string;
57
+ iOSAppId: string;
58
+ sampleRate?: number;
59
+ sessionOnErrorSampleRate?: number;
60
+ enableAutoTrackUserAction?: boolean;
61
+ enableAutoTrackError?: boolean;
62
+ enableTrackNativeCrash?: boolean;
63
+ enableTrackNativeAppANR?: boolean;
64
+ enableTrackNativeFreeze?: boolean;
65
+ nativeFreezeDurationMs?: number;
66
+ enableNativeUserAction?: boolean;
67
+ enableNativeUserView?: boolean;
68
+ enableNativeUserResource?: boolean;
69
+ enableResourceHostIP?: boolean;
70
+ errorMonitorType?: ErrorMonitorType;
71
+ deviceMonitorType?: DeviceMetricsMonitorType;
72
+ detectFrequency?: DetectFrequency;
73
+ globalContext?: object;
74
+ rumCacheLimitCount?: number;
75
+ rumDiscardStrategy?: FTRUMCacheDiscard;
76
+ }
77
+ /**
78
+ * RUM Resource data.
79
+ * @param url request URL
80
+ * @param httpMethod request method
81
+ * @param requestHeader request header parameters
82
+ * @param responseHeader response header parameters
83
+ * @param responseBody response content
84
+ * @param resourceStatus response status code
85
+ */
86
+ export interface FTRUMResource {
87
+ url: string;
88
+ httpMethod: string;
89
+ requestHeader: object;
90
+ responseHeader?: object;
91
+ responseBody?: string;
92
+ resourceStatus?: number;
93
+ }
94
+ /**
95
+ * RUM Resource performance metrics.
96
+ * @param duration resource load time
97
+ * @param resource_dns resource DNS resolution time
98
+ * @param resource_tcp resource TCP connection time
99
+ * @param resource_ssl resource SSL connection time
100
+ * @param resource_ttfb resource request response time
101
+ * @param resource_trans resource content transfer time
102
+ * @param resource_first_byte resource first byte time
103
+ */
104
+ export interface FTRUMResourceMetrics {
105
+ duration?: number;
106
+ resource_dns?: number;
107
+ resource_tcp?: number;
108
+ resource_ssl?: number;
109
+ resource_ttfb?: number;
110
+ resource_trans?: number;
111
+ resource_first_byte?: number;
112
+ }
113
+ type FTReactNativeRUMType = {
114
+ /**
115
+ * Set RUM tracking conditions and enable RUM collection.
116
+ * @param config rum configuration parameters.
117
+ * @returns a Promise.
118
+ */
119
+ setConfig(config: FTRUMConfig): Promise<void>;
120
+ /**
121
+ * Start RUM Action.
122
+ * RUM will bind Resource, Error, LongTask events that may be triggered by this Action.
123
+ * Avoid adding multiple times within 0.1s, only one Action will be associated with the same View at the same time, and new Actions will be discarded if the previous one has not ended.
124
+ * Adding Action with `addAction` method does not affect each other.
125
+ * @param actionName action name
126
+ * @param actionType action type
127
+ * @param property event context (optional)
128
+ * @returns a Promise.
129
+ */
130
+ startAction(actionName: string, actionType: string, property?: object): Promise<void>;
131
+ /**
132
+ * Add Action event. This type of data cannot be associated with Error, Resource, LongTask data, and has no discard logic.
133
+ * @param actionName action name
134
+ * @param actionType action type
135
+ * @param property event context (optional)
136
+ * @returns a Promise.
137
+ */
138
+ addAction(actionName: string, actionType: string, property?: object): Promise<void>;
139
+ /**
140
+ * view load duration.
141
+ * @param viewName view name
142
+ * @param loadTime view load duration
143
+ * @returns a Promise.
144
+ */
145
+ onCreateView(viewName: string, loadTime: number): Promise<void>;
146
+ /**
147
+ * view start.
148
+ * @param viewName page name
149
+ * @param property event context (optional)
150
+ * @returns a Promise.
151
+ */
152
+ startView(viewName: string, property?: object): Promise<void>;
153
+ /**
154
+ * view end.
155
+ * @param property event context (optional)
156
+ * @returns a Promise.
157
+ */
158
+ stopView(property?: object): Promise<void>;
159
+ /**
160
+ * Exception capture and log collection.
161
+ * @param stack stack log
162
+ * @param message error message
163
+ * @param property event context (optional)
164
+ * @returns a Promise.
165
+ */
166
+ addError(stack: string, message: string, property?: object): Promise<void>;
167
+ /**
168
+ * Exception capture and log collection.
169
+ * @param type error type
170
+ * @param stack stack log
171
+ * @param message error message
172
+ * @param property event context (optional)
173
+ * @returns a Promise.
174
+ */
175
+ addErrorWithType(type: string, stack: string, message: string, property?: object): Promise<void>;
176
+ /**
177
+ * Start resource request.
178
+ * @param key unique id
179
+ * @param property event context (optional)
180
+ * @returns a Promise.
181
+ */
182
+ startResource(key: string, property?: object): Promise<void>;
183
+ /**
184
+ * End resource request.
185
+ * @param key unique id
186
+ * @param property event context (optional)
187
+ * @returns a Promise.
188
+ */
189
+ stopResource(key: string, property?: object): Promise<void>;
190
+ /**
191
+ * Send resource data metrics.
192
+ * @param key unique id
193
+ * @param resource resource data
194
+ * @param metrics resource performance data
195
+ * @returns a Promise.
196
+ */
197
+ addResource(key: string, resource: FTRUMResource, metrics?: FTRUMResourceMetrics): Promise<void>;
198
+ };
199
+ export declare const FTReactNativeRUM: FTReactNativeRUMType;
200
+ export {};
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Trace types for use.
3
+ */
4
+ export declare enum TraceType {
5
+ ddTrace = 0,
6
+ zipkinMulti = 1,
7
+ zipkinSingle = 2,
8
+ traceparent = 3,
9
+ skywalking = 4,
10
+ jaeger = 5
11
+ }
12
+ /**
13
+ * Configure trace.
14
+ * @param sampleRate sampling rate
15
+ * @param traceType trace type
16
+ * @param enableLinkRUMData whether to link with RUM data
17
+ * @param enableNativeAutoTrace whether to enable automatic tracing
18
+ */
19
+ export interface FTTraceConfig {
20
+ sampleRate?: number;
21
+ traceType?: TraceType;
22
+ enableLinkRUMData?: boolean;
23
+ enableNativeAutoTrace?: boolean;
24
+ }
25
+ type FTReactNativeTraceType = {
26
+ /**
27
+ * Configure trace to enable distributed tracing.
28
+ * @param config trace configuration parameters.
29
+ * @returns a Promise.
30
+ */
31
+ setConfig(config: FTTraceConfig): Promise<void>;
32
+ /**
33
+ * Get trace HTTP request header data.
34
+ * @param url request URL
35
+ * @returns trace request header parameters
36
+ * @deprecated use getTraceHeaderFields() replace.
37
+ */
38
+ getTraceHeader(key: String, url: String): Promise<object>;
39
+ /**
40
+ * Get trace HTTP request header data.
41
+ * @param url request URL
42
+ * @returns trace request header parameters
43
+ */
44
+ getTraceHeaderFields(url: String, key?: String): Promise<object>;
45
+ };
46
+ export declare const FTReactNativeTrace: FTReactNativeTraceType;
47
+ export {};
@@ -0,0 +1,7 @@
1
+ import { FTMobileConfig, FTMobileReactNative, EnvType, FTDBCacheDiscard } from './ft_mobile_agent';
2
+ import { FTLogConfig, FTReactNativeLog, FTLogStatus, FTLogCacheDiscard } from './ft_logger';
3
+ import { FTRUMConfig, FTRUMResource, FTReactNativeRUM, ErrorMonitorType, DeviceMetricsMonitorType, DetectFrequency, FTRUMResourceMetrics, FTRUMCacheDiscard } from './ft_rum';
4
+ import { FTTraceConfig, FTReactNativeTrace, TraceType } from './ft_tracing';
5
+ import { FTRumActionTracking } from './rum/FTRumActionTracking';
6
+ import { FTRumErrorTracking } from './rum/FTRumErrorTracking';
7
+ export { FTMobileReactNative, FTMobileConfig, EnvType, FTDBCacheDiscard, FTLogConfig, FTReactNativeLog, FTLogStatus, FTLogCacheDiscard, FTRUMConfig, FTReactNativeRUM, FTRUMResource, ErrorMonitorType, DeviceMetricsMonitorType, DetectFrequency, FTRUMResourceMetrics, FTRUMCacheDiscard, FTTraceConfig, FTReactNativeTrace, TraceType, FTRumActionTracking, FTRumErrorTracking };
@@ -0,0 +1,15 @@
1
+ export declare class FTRumActionTracking {
2
+ private static isTracking;
3
+ private static preActionTimestamp;
4
+ private static originalMemo;
5
+ private static originalJsx;
6
+ private static originalCreateElement;
7
+ private static patchCreateElementFunction;
8
+ static startTracking(): void;
9
+ static stopTracking(): void;
10
+ private static interceptOnPress;
11
+ private static handleTargetEvent;
12
+ private static resolveActionName;
13
+ private static findActionProperty;
14
+ private static findActionEnableTrack;
15
+ }
@@ -0,0 +1,11 @@
1
+ export declare class FTRumErrorTracking {
2
+ private static isTracking;
3
+ private static isInDefaultErrorHandler;
4
+ private static defaultErrorHandler;
5
+ private static defaultConsoleError;
6
+ static startTracking(): void;
7
+ static onGlobalError(error: any, isFatal?: boolean): void;
8
+ static onConsoleError(...params: unknown[]): void;
9
+ private static getErrorMessage;
10
+ private static getErrorStackTrace;
11
+ }
@@ -0,0 +1 @@
1
+ export declare const version = "0.3.15-alpha.1";
package/package.json ADDED
@@ -0,0 +1,167 @@
1
+ {
2
+ "name": "@truewatchtech/react-native-mobile",
3
+ "version": "0.3.15-alpha.1",
4
+ "description": "Base on TrueWatch Android iOS 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
+ "scripts/replace-react-require.js",
14
+ "android",
15
+ "ios",
16
+ "cpp",
17
+ "FTMobileReactNativeSDK.podspec",
18
+ "!lib/typescript/example",
19
+ "!android/build",
20
+ "!android/.gradle",
21
+ "!android/.idea",
22
+ "!ios/build",
23
+ "!**/__tests__",
24
+ "!**/__fixtures__",
25
+ "!**/__mocks__"
26
+ ],
27
+ "scripts": {
28
+ "test": "jest",
29
+ "typescript": "tsc --noEmit",
30
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
31
+ "prepare": "genversion --es6 --semi src/version.ts && bob build",
32
+ "release": "release-it",
33
+ "example": "yarn --cwd example",
34
+ "pods": "cd example && pod-install --quiet",
35
+ "bootstrap": "yarn example && yarn && yarn pods",
36
+ "postinstall": "node scripts/replace-react-require.js"
37
+ },
38
+ "keywords": [
39
+ "truewatch",
40
+ "react-native",
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.git/issues"
52
+ },
53
+ "homepage": "https://github.com/TrueWatchTech/datakit-react-native.git#readme",
54
+ "publishConfig": {
55
+ "registry": "https://registry.npmjs.org/"
56
+ },
57
+ "devDependencies": {
58
+ "@commitlint/config-conventional": "^11.0.0",
59
+ "@react-native-community/eslint-config": "^2.0.0",
60
+ "@release-it/conventional-changelog": "^2.0.0",
61
+ "@types/jest": "^26.0.0",
62
+ "@types/react": "^16.9.19",
63
+ "@types/react-native": "0.62.13",
64
+ "commitlint": "^11.0.0",
65
+ "eslint": "^7.2.0",
66
+ "eslint-config-prettier": "^7.0.0",
67
+ "eslint-plugin-prettier": "^3.1.3",
68
+ "genversion": "3.0.2",
69
+ "husky": "^4.2.5",
70
+ "jest": "^26.0.1",
71
+ "pod-install": "^0.1.0",
72
+ "prettier": "^2.0.5",
73
+ "react": "18.1.0",
74
+ "react-native": "0.70.0",
75
+ "react-native-builder-bob": "^0.17.1",
76
+ "release-it": "^14.2.2",
77
+ "typescript": "^4.1.3"
78
+ },
79
+ "peerDependencies": {
80
+ "react": ">=16.13.1",
81
+ "react-native": ">=0.63.4 <1.0"
82
+ },
83
+ "jest": {
84
+ "preset": "react-native",
85
+ "modulePathIgnorePatterns": [
86
+ "<rootDir>/example/node_modules",
87
+ "<rootDir>/lib/"
88
+ ]
89
+ },
90
+ "husky": {
91
+ "hooks": {
92
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
93
+ "pre-commit": "yarn lint && yarn typescript"
94
+ }
95
+ },
96
+ "commitlint": {
97
+ "extends": [
98
+ "@commitlint/config-conventional"
99
+ ]
100
+ },
101
+ "release-it": {
102
+ "git": {
103
+ "commitMessage": "chore: release ${version}",
104
+ "tagName": "v${version}"
105
+ },
106
+ "npm": {
107
+ "publish": true
108
+ },
109
+ "github": {
110
+ "release": true
111
+ },
112
+ "plugins": {
113
+ "@release-it/conventional-changelog": {
114
+ "preset": "angular"
115
+ }
116
+ }
117
+ },
118
+ "eslintConfig": {
119
+ "root": true,
120
+ "extends": [
121
+ "@react-native-community",
122
+ "prettier"
123
+ ],
124
+ "rules": {
125
+ "prettier/prettier": [
126
+ "error", {
127
+ "quoteProps": "consistent",
128
+ "singleQuote": true,
129
+ "tabWidth": 2,
130
+ "trailingComma": "es5",
131
+ "useTabs": false
132
+ }
133
+ ]
134
+ }
135
+ },
136
+ "eslintIgnore": [
137
+ "node_modules/",
138
+ "lib/"
139
+ ],
140
+ "prettier": {
141
+ "quoteProps": "consistent",
142
+ "singleQuote": true,
143
+ "tabWidth": 2,
144
+ "trailingComma": "es5",
145
+ "useTabs": false
146
+ },
147
+ "react-native-builder-bob": {
148
+ "source": "src",
149
+ "output": "lib",
150
+ "targets": [
151
+ "commonjs",
152
+ "module",
153
+ [
154
+ "typescript", {
155
+ "project": "tsconfig.build.json"
156
+ }
157
+ ]
158
+ ]
159
+ },
160
+ "dependencies": {
161
+ "@babel/runtime": "^7.16.5"
162
+ },
163
+ "directories": {
164
+ "example": "example",
165
+ "lib": "lib"
166
+ }
167
+ }
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+
3
+ // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
4
+ const { readFileSync, writeFileSync } = require('fs');
5
+ const GET_JSX_RUNTIME_RELATIVE_PATH =
6
+ 'rum/FTRumActionTracking';
7
+
8
+ const isJsxExportedInReactVersion = (major, minor) => {
9
+ if (Number(major) > 16) {
10
+ return true;
11
+ }
12
+ if (Number(major) === 16 && Number(minor) > 13) {
13
+ return true;
14
+ }
15
+ return false;
16
+ };
17
+ const replaceReactJsxRequire = () => {
18
+ process.stdout.write('[FTLog] replacing react/jsx-runtime by react\n');
19
+ const actionFilePath = `${__dirname}/..`;
20
+ const locations = [
21
+ { directory: `${actionFilePath}/src`, extension: 'tsx' },
22
+ { directory: `${actionFilePath}/lib/commonjs`, extension: 'js' },
23
+ { directory: `${actionFilePath}/lib/commonjs`, extension: 'js.map' },
24
+ { directory: `${actionFilePath}/lib/module`, extension: 'js' },
25
+ { directory: `${actionFilePath}/lib/module`, extension: 'js.map' }
26
+ ];
27
+
28
+ locations.forEach(location => {
29
+ const fileLocation = `${location.directory}/${GET_JSX_RUNTIME_RELATIVE_PATH}.${location.extension}`;
30
+ const file = readFileSync(fileLocation).toString();
31
+ writeFileSync(
32
+ fileLocation,
33
+ file.replace("require('react/jsx-runtime')", "require('react')")
34
+ );
35
+ });
36
+ };
37
+
38
+ try {
39
+ // Get React version
40
+ // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
41
+ const [major, minor] = require('react/package.json').version.split('.');
42
+ process.stdout.write(`[FTLog] found react version ${major}${minor}\n`);
43
+
44
+ if (!isJsxExportedInReactVersion(major, minor)) {
45
+ replaceReactJsxRequire();
46
+ }
47
+ process.stdout.write('[FTLog] postinstall replace-react-require end\n');
48
+ } catch (error) {
49
+ process.stderr.write(
50
+ `[FTLog] Error running replace-react-require: ${error}\n`
51
+ );
52
+ }