@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.
Files changed (155) hide show
  1. package/FTMobileReactNativeSDK.podspec +31 -2
  2. package/android/build.gradle +7 -19
  3. package/android/src/main/java/com/ft/sdk/reactnative/FTMobileImpl.java +472 -5
  4. package/android/src/main/java/com/ft/sdk/reactnative/FTRUMImpl.java +12 -0
  5. package/android/src/newarch/java/com/ft/sdk/reactnative/FTLogModule.java +7 -14
  6. package/android/src/newarch/java/com/ft/sdk/reactnative/FTMobileModule.java +46 -12
  7. package/android/src/newarch/java/com/ft/sdk/reactnative/FTRUMModule.java +12 -13
  8. package/android/src/newarch/java/com/ft/sdk/reactnative/FTTraceModule.java +6 -8
  9. package/android/src/oldarch/java/com/ft/sdk/reactnative/FTMobileModule.java +34 -2
  10. package/android/src/oldarch/java/com/ft/sdk/reactnative/FTRUMModule.java +5 -0
  11. package/android/src/rnpost74/java/com/ft/sdk/reactnative/FTMobilePackage.java +14 -3
  12. package/android/src/rnpre74/java/com/ft/sdk/reactnative/FTMobilePackage.java +0 -3
  13. package/ios/FTMobileReactNative.h +9 -5
  14. package/ios/FTMobileReactNative.mm +625 -0
  15. package/ios/FTReactNativeLog.h +8 -3
  16. package/ios/FTReactNativeLog.mm +79 -0
  17. package/ios/FTReactNativeRUM.h +8 -3
  18. package/ios/{FTReactNativeRUM.m → FTReactNativeRUM.mm} +143 -84
  19. package/ios/FTReactNativeTrace.h +8 -2
  20. package/ios/FTReactNativeTrace.mm +74 -0
  21. package/ios/FtMobileAgent.xcodeproj/project.pbxproj +17 -1
  22. package/lib/commonjs/ft_logger.js +14 -13
  23. package/lib/commonjs/ft_logger.js.map +1 -1
  24. package/lib/commonjs/ft_mobile_agent.js +155 -6
  25. package/lib/commonjs/ft_mobile_agent.js.map +1 -1
  26. package/lib/commonjs/ft_rum.js +55 -21
  27. package/lib/commonjs/ft_rum.js.map +1 -1
  28. package/lib/commonjs/ft_tracing.js +29 -10
  29. package/lib/commonjs/ft_tracing.js.map +1 -1
  30. package/lib/commonjs/index.js +24 -13
  31. package/lib/commonjs/index.js.map +1 -1
  32. package/lib/commonjs/rum/FTRumActionTracking.js +10 -4
  33. package/lib/commonjs/rum/FTRumActionTracking.js.map +1 -1
  34. package/lib/commonjs/rum/FTRumErrorTracking.js +4 -4
  35. package/lib/commonjs/rum/FTRumErrorTracking.js.map +1 -1
  36. package/lib/commonjs/specs/NativeFTMobileReactNative.js +10 -0
  37. package/lib/commonjs/specs/NativeFTMobileReactNative.js.map +1 -0
  38. package/lib/commonjs/specs/NativeFTReactNativeLog.js +10 -0
  39. package/lib/commonjs/specs/NativeFTReactNativeLog.js.map +1 -0
  40. package/lib/commonjs/specs/NativeFTReactNativeRUM.js +10 -0
  41. package/lib/commonjs/specs/NativeFTReactNativeRUM.js.map +1 -0
  42. package/lib/commonjs/specs/NativeFTReactNativeTrace.js +10 -0
  43. package/lib/commonjs/specs/NativeFTReactNativeTrace.js.map +1 -0
  44. package/lib/commonjs/version.js +1 -1
  45. package/lib/commonjs/version.js.map +1 -1
  46. package/lib/module/ft_logger.js +14 -12
  47. package/lib/module/ft_logger.js.map +1 -1
  48. package/lib/module/ft_mobile_agent.js +161 -5
  49. package/lib/module/ft_mobile_agent.js.map +1 -1
  50. package/lib/module/ft_rum.js +54 -16
  51. package/lib/module/ft_rum.js.map +1 -1
  52. package/lib/module/ft_tracing.js +29 -9
  53. package/lib/module/ft_tracing.js.map +1 -1
  54. package/lib/module/index.js +3 -4
  55. package/lib/module/index.js.map +1 -1
  56. package/lib/module/rum/FTRumActionTracking.js +10 -4
  57. package/lib/module/rum/FTRumActionTracking.js.map +1 -1
  58. package/lib/module/rum/FTRumErrorTracking.js +4 -4
  59. package/lib/module/rum/FTRumErrorTracking.js.map +1 -1
  60. package/lib/module/specs/NativeFTMobileReactNative.js +5 -0
  61. package/lib/module/specs/NativeFTMobileReactNative.js.map +1 -0
  62. package/lib/module/specs/NativeFTReactNativeLog.js +5 -0
  63. package/lib/module/specs/NativeFTReactNativeLog.js.map +1 -0
  64. package/lib/module/specs/NativeFTReactNativeRUM.js +5 -0
  65. package/lib/module/specs/NativeFTReactNativeRUM.js.map +1 -0
  66. package/lib/module/specs/NativeFTReactNativeTrace.js +5 -0
  67. package/lib/module/specs/NativeFTReactNativeTrace.js.map +1 -0
  68. package/lib/module/version.js +1 -1
  69. package/lib/module/version.js.map +1 -1
  70. package/lib/typescript/ft_logger.d.ts +6 -6
  71. package/lib/typescript/ft_mobile_agent.d.ts +169 -14
  72. package/lib/typescript/ft_rum.d.ts +32 -8
  73. package/lib/typescript/ft_tracing.d.ts +6 -6
  74. package/lib/typescript/index.d.ts +3 -4
  75. package/lib/typescript/specs/NativeFTMobileReactNative.d.ts +75 -0
  76. package/lib/typescript/specs/NativeFTReactNativeLog.d.ts +23 -0
  77. package/lib/typescript/specs/NativeFTReactNativeRUM.d.ts +89 -0
  78. package/lib/typescript/specs/NativeFTReactNativeTrace.d.ts +24 -0
  79. package/lib/typescript/version.d.ts +1 -1
  80. package/package.json +26 -93
  81. package/scripts/replace-react-require.js +37 -38
  82. package/src/ft_logger.tsx +72 -40
  83. package/src/ft_mobile_agent.tsx +378 -91
  84. package/src/ft_rum.tsx +227 -121
  85. package/src/ft_tracing.tsx +58 -37
  86. package/src/index.tsx +58 -18
  87. package/src/rum/FTRumActionTracking.tsx +212 -204
  88. package/src/rum/FTRumErrorTracking.tsx +70 -71
  89. package/src/specs/NativeFTMobileReactNative.ts +83 -0
  90. package/src/specs/NativeFTReactNativeLog.ts +29 -0
  91. package/src/specs/NativeFTReactNativeRUM.ts +104 -0
  92. package/src/specs/NativeFTReactNativeTrace.ts +26 -0
  93. package/src/version.ts +1 -1
  94. package/LICENSE +0 -201
  95. package/android/.project +0 -17
  96. package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
  97. package/android/gradlew +0 -185
  98. package/android/local.properties +0 -8
  99. package/android/src/main/java/com/ft/sdk/InnerClassProxy.java +0 -8
  100. package/android/src/main/java/com/ft/sdk/reactnative/FTSessionReplayImpl.java +0 -60
  101. package/android/src/main/java/com/ft/sdk/reactnative/extensions/ReactDrawablesExt.java +0 -155
  102. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/NoopTextPropertiesResolver.java +0 -23
  103. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/ReactNativeSessionReplayExtensionSupport.java +0 -57
  104. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/ShadowNodeWrapper.java +0 -84
  105. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/TextPropertiesResolver.java +0 -20
  106. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/DefaultMapper.java +0 -78
  107. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/Pair.java +0 -11
  108. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactEditTextMapper.java +0 -136
  109. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactNativeImageViewMapper.java +0 -117
  110. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactTextMapper.java +0 -57
  111. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactViewGroupMapper.java +0 -22
  112. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/mappers/ReactViewModalMapper.java +0 -21
  113. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/resources/ReactDrawableCopier.java +0 -35
  114. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/DrawableUtils.java +0 -34
  115. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/ReflectionUtils.java +0 -43
  116. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/FabricTextViewUtils.java +0 -69
  117. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/LegacyTextViewUtils.java +0 -97
  118. package/android/src/main/java/com/ft/sdk/reactnative/sessionreplay/utils/text/TextViewUtils.java +0 -184
  119. package/android/src/main/java/com/ft/sdk/reactnative/utils/ColorUtils.java +0 -24
  120. package/android/src/newarch/java/com/ft/sdk/reactnative/FTSessionReplayModule.java +0 -30
  121. package/android/src/oldarch/java/com/ft/sdk/reactnative/FTSessionReplayModule.java +0 -25
  122. package/android/src/rn69/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -100
  123. package/android/src/rn75/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +0 -27
  124. package/android/src/rn75/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -116
  125. package/android/src/rn76/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +0 -38
  126. package/android/src/rn76/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -117
  127. package/android/src/rn79/java/com/ft/sdk/reactnative/sessionreplay/extensions/LengthPercentageExt.java +0 -38
  128. package/android/src/rn79/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -132
  129. package/android/src/rn80/java/com/ft/sdk/reactnative/sessionreplay/extensions/ComputedBorderRadiusExt.java +0 -58
  130. package/android/src/rn80/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -190
  131. package/android/src/rnlegacy/java/com/ft/sdk/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.java +0 -120
  132. package/ios/.idea/.name +0 -1
  133. package/ios/.idea/ios.iml +0 -2
  134. package/ios/.idea/modules.xml +0 -8
  135. package/ios/.idea/vcs.xml +0 -6
  136. package/ios/.idea/xcode.xml +0 -4
  137. package/ios/FTMobileReactNative.m +0 -184
  138. package/ios/FTRCTTextViewRecorder.h +0 -33
  139. package/ios/FTRCTTextViewRecorder.m +0 -120
  140. package/ios/FTReactNativeLog.m +0 -60
  141. package/ios/FTReactNativeSessionReplay.h +0 -6
  142. package/ios/FTReactNativeSessionReplay.mm +0 -44
  143. package/ios/FTReactNativeTrace.m +0 -56
  144. package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
  145. package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/xcuserdata/Brandon.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  146. package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/xcuserdata/Brandon.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
  147. package/ios/FtMobileAgent.xcodeproj/xcuserdata/Brandon.xcuserdatad/xcschemes/FtMobileAgent.xcscheme +0 -56
  148. package/ios/FtMobileAgent.xcodeproj/xcuserdata/Brandon.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  149. package/ios/RCTVersion.h +0 -8
  150. package/lib/commonjs/ft_session_replay.js +0 -34
  151. package/lib/commonjs/ft_session_replay.js.map +0 -1
  152. package/lib/module/ft_session_replay.js +0 -29
  153. package/lib/module/ft_session_replay.js.map +0 -1
  154. package/lib/typescript/ft_session_replay.d.ts +0 -27
  155. package/src/ft_session_replay.tsx +0 -34
@@ -8,8 +8,8 @@ export declare enum ErrorMonitorType {
8
8
  cpu = 8
9
9
  }
10
10
  /**
11
- * Page monitoring supplement type
12
- */
11
+ * Page monitoring supplement type
12
+ */
13
13
  export declare enum DeviceMetricsMonitorType {
14
14
  all = 4294967295,
15
15
  battery = 2,
@@ -29,6 +29,24 @@ export declare enum FTRUMCacheDiscard {
29
29
  discard = 0,
30
30
  discardOldest = 1
31
31
  }
32
+ export declare enum IOSCrashMonitoringType {
33
+ /** Monitor Mach kernel exceptions. */
34
+ machException = 1,
35
+ /** Monitor fatal signals. */
36
+ signal = 2,
37
+ /** Monitor uncaught C++ exceptions. */
38
+ cppException = 4,
39
+ /** Monitor uncaught Objective-C NSExceptions. */
40
+ nsException = 8,
41
+ /** Track and inject system information. */
42
+ system = 64,
43
+ /** Track and inject application state information. */
44
+ applicationState = 128,
45
+ /** All crash monitor types. */
46
+ all = 207,
47
+ /** High compatibility crash monitor types (excludes Mach exceptions). */
48
+ highCompatibility = 206
49
+ }
32
50
  /**
33
51
  * Set RUM tracking conditions.
34
52
  * @param androidAppId appId, apply during monitoring
@@ -51,6 +69,9 @@ export declare enum FTRUMCacheDiscard {
51
69
  * @param globalContext custom global parameters
52
70
  * @param rumCacheLimitCount RUM max cache size, default 100_000
53
71
  * @param rumDiscardStrategy RUM data discard strategy
72
+ * @param enableTraceWebView Set whether to enable WebView data collection, default true
73
+ * @param allowWebViewHost Set specific hosts or domains allowed to collect WebView data, nil means collect all
74
+ * @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.
54
75
  */
55
76
  export interface FTRUMConfig {
56
77
  androidAppId: string;
@@ -73,6 +94,9 @@ export interface FTRUMConfig {
73
94
  globalContext?: object;
74
95
  rumCacheLimitCount?: number;
75
96
  rumDiscardStrategy?: FTRUMCacheDiscard;
97
+ enableTraceWebView?: boolean;
98
+ allowWebViewHost?: Array<string>;
99
+ iosCrashMonitoringType?: IOSCrashMonitoringType;
76
100
  }
77
101
  /**
78
102
  * RUM Resource data.
@@ -129,12 +153,12 @@ type FTReactNativeRUMType = {
129
153
  */
130
154
  startAction(actionName: string, actionType: string, property?: object): Promise<void>;
131
155
  /**
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
- */
156
+ * Add Action event. This type of data cannot be associated with Error, Resource, LongTask data, and has no discard logic.
157
+ * @param actionName action name
158
+ * @param actionType action type
159
+ * @param property event context (optional)
160
+ * @returns a Promise.
161
+ */
138
162
  addAction(actionName: string, actionType: string, property?: object): Promise<void>;
139
163
  /**
140
164
  * view load duration.
@@ -35,13 +35,13 @@ type FTReactNativeTraceType = {
35
35
  * @returns trace request header parameters
36
36
  * @deprecated use getTraceHeaderFields() replace.
37
37
  */
38
- getTraceHeader(key: String, url: String): Promise<object>;
38
+ getTraceHeader(key: string, url: string): Promise<object>;
39
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>;
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
45
  };
46
46
  export declare const FTReactNativeTrace: FTReactNativeTraceType;
47
47
  export {};
@@ -1,8 +1,7 @@
1
- import { FTMobileConfig, FTMobileReactNative, EnvType, FTDBCacheDiscard } from './ft_mobile_agent';
1
+ import { FTMobileConfig, FTMobileReactNative, EnvType, FTDBCacheDiscard, FTRemoteConfigResult, FTRemoteConfigOverrideRule, FTRemoteConfigOverrideMatch, FTRemoteConfigOverrideValues } from './ft_mobile_agent';
2
2
  import { FTLogConfig, FTReactNativeLog, FTLogStatus, FTLogCacheDiscard } from './ft_logger';
3
- import { FTRUMConfig, FTRUMResource, FTReactNativeRUM, ErrorMonitorType, DeviceMetricsMonitorType, DetectFrequency, FTRUMResourceMetrics, FTRUMCacheDiscard } from './ft_rum';
3
+ import { FTRUMConfig, FTRUMResource, FTReactNativeRUM, ErrorMonitorType, DeviceMetricsMonitorType, DetectFrequency, FTRUMResourceMetrics, FTRUMCacheDiscard, IOSCrashMonitoringType } from './ft_rum';
4
4
  import { FTTraceConfig, FTReactNativeTrace, TraceType } from './ft_tracing';
5
- import { FTSessionReplayConfig, SessionReplayPrivacy, FTReactNativeSessionReplay } from './ft_session_replay';
6
5
  import { FTRumActionTracking } from './rum/FTRumActionTracking';
7
6
  import { FTRumErrorTracking } from './rum/FTRumErrorTracking';
8
- export { FTMobileReactNative, FTMobileConfig, EnvType, FTDBCacheDiscard, FTLogConfig, FTReactNativeLog, FTLogStatus, FTLogCacheDiscard, FTRUMConfig, FTReactNativeRUM, FTRUMResource, ErrorMonitorType, DeviceMetricsMonitorType, DetectFrequency, FTRUMResourceMetrics, FTRUMCacheDiscard, FTTraceConfig, FTReactNativeTrace, TraceType, FTSessionReplayConfig, SessionReplayPrivacy, FTReactNativeSessionReplay, FTRumActionTracking, FTRumErrorTracking };
7
+ export { FTMobileReactNative, FTMobileConfig, EnvType, FTDBCacheDiscard, FTRemoteConfigResult, FTRemoteConfigOverrideRule, FTRemoteConfigOverrideMatch, FTRemoteConfigOverrideValues, FTLogConfig, FTReactNativeLog, FTLogStatus, FTLogCacheDiscard, FTRUMConfig, FTReactNativeRUM, FTRUMResource, ErrorMonitorType, DeviceMetricsMonitorType, DetectFrequency, FTRUMResourceMetrics, FTRUMCacheDiscard, IOSCrashMonitoringType, FTTraceConfig, FTReactNativeTrace, TraceType, FTRumActionTracking, FTRumErrorTracking, };
@@ -0,0 +1,75 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ /**
4
+ * SDK initialization method.
5
+ * @param config SDK initialization configuration items.
6
+ * @returns a Promise.
7
+ */
8
+ sdkConfig(config: Object): Promise<void>;
9
+ /**
10
+ * Dynamically set the Datakit upload URL after SDK initialization.
11
+ * @param datakitUrl Datakit upload URL.
12
+ * @returns a Promise.
13
+ */
14
+ setDatakitURL(datakitUrl: string): Promise<void>;
15
+ /**
16
+ * Dynamically set the Dataway upload URL and client token after SDK initialization.
17
+ * @param datawayUrl Dataway upload URL.
18
+ * @param clientToken Dataway authentication token.
19
+ * @returns a Promise.
20
+ */
21
+ setDatawayURL(datawayUrl: string, clientToken: string): Promise<void>;
22
+ /**
23
+ * Bind user.
24
+ * @param userId user ID.
25
+ * @param userName user name.
26
+ * @param userEmail user email
27
+ * @param extra additional user information
28
+ * @returns a Promise.
29
+ */
30
+ bindRUMUserData(userId: string, userName?: string, userEmail?: string, extra?: Object): Promise<void>;
31
+ /**
32
+ * Unbind user.
33
+ * @returns a Promise.
34
+ */
35
+ unbindRUMUserData(): Promise<void>;
36
+ /**
37
+ * Add custom global parameters. Applies to RUM and Log data
38
+ * @param context custom global parameters.
39
+ * @returns a Promise.
40
+ */
41
+ appendGlobalContext(context: Object): Promise<void>;
42
+ /**
43
+ * Add custom RUM global parameters. Applies to RUM data
44
+ * @param context custom RUM global parameters.
45
+ * @returns a Promise.
46
+ */
47
+ appendRUMGlobalContext(context: Object): Promise<void>;
48
+ /**
49
+ * Add custom RUM and Log global parameters. Applies to Log data
50
+ * @param context custom Log global parameters.
51
+ * @returns a Promise.
52
+ */
53
+ appendLogGlobalContext(context: Object): Promise<void>;
54
+ /**
55
+ * Actively synchronize data. When `FTMobileConfig.autoSync=false` is configured, you need to actively trigger this method to synchronize data.
56
+ * @returns a Promise.
57
+ */
58
+ flushSyncData(): Promise<void>;
59
+ /**
60
+ * Synchronize events in iOS Widget Extension, iOS only
61
+ * @param groupIdentifier app groupId
62
+ * @returns {groupIdentifier:string,datas:Array<Object>} can be used to view data collected in Extension.
63
+ */
64
+ trackEventFromExtension(identifier: string): Promise<Object>;
65
+ /**
66
+ * Shut down objects currently running in the SDK
67
+ */
68
+ shutDown(): Promise<void>;
69
+ /**
70
+ * Clear all data that has not yet been uploaded to the server.
71
+ */
72
+ clearAllData(): Promise<void>;
73
+ }
74
+ declare const _default: Spec | null;
75
+ export default _default;
@@ -0,0 +1,23 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ /**
4
+ *Configure log output configuration to enable log collection.
5
+ */
6
+ logConfig(config: Object): Promise<void>;
7
+ /**
8
+ * Output log.
9
+ * @param content log content
10
+ * @param status log status
11
+ * @param property log context (optional)
12
+ */
13
+ logging(content: string, logStatus: number, property?: Object): Promise<void>;
14
+ /**
15
+ * Output log.
16
+ * @param content log content
17
+ * @param status log status
18
+ * @param property log context (optional)
19
+ */
20
+ logWithStatusString(content: string, logStatus: string, property?: Object): Promise<void>;
21
+ }
22
+ declare const _default: Spec | null;
23
+ export default _default;
@@ -0,0 +1,89 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ /**
4
+ * Set RUM tracking conditions and enable RUM collection.
5
+ * @param config rum configuration parameters.
6
+ * @returns a Promise.
7
+ */
8
+ setConfig(config: Object): Promise<void>;
9
+ /**
10
+ * Start RUM Action.
11
+ * RUM will bind Resource, Error, LongTask events that may be triggered by this Action.
12
+ * 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.
13
+ * Adding Action with `addAction` method does not affect each other.
14
+ * @param actionName action name
15
+ * @param actionType action type
16
+ * @param property event context (optional)
17
+ * @returns a Promise.
18
+ */
19
+ startAction(actionName: string, actionType: string, property?: Object): Promise<void>;
20
+ /**
21
+ * Add Action event. This type of data cannot be associated with Error, Resource, LongTask data, and has no discard logic.
22
+ * @param actionName action name
23
+ * @param actionType action type
24
+ * @param property event context (optional)
25
+ * @returns a Promise.
26
+ */
27
+ addAction(actionName: string, actionType: string, property?: Object): Promise<void>;
28
+ /**
29
+ * view load duration.
30
+ * @param viewName view name
31
+ * @param loadTime view load duration
32
+ * @returns a Promise.
33
+ */
34
+ onCreateView(viewName: string, loadTime: number): Promise<void>;
35
+ /**
36
+ * view start.
37
+ * @param viewName page name
38
+ * @param property event context (optional)
39
+ * @returns a Promise.
40
+ */
41
+ startView(viewName: string, property?: Object): Promise<void>;
42
+ /**
43
+ * view end.
44
+ * @param property event context (optional)
45
+ * @returns a Promise.
46
+ */
47
+ stopView(property?: Object): Promise<void>;
48
+ /**
49
+ * Exception capture and log collection.
50
+ * @param stack stack log
51
+ * @param message error message
52
+ * @param property event context (optional)
53
+ * @returns a Promise.
54
+ */
55
+ addError(stack: string, message: string, property?: Object): Promise<void>;
56
+ /**
57
+ * Exception capture and log collection.
58
+ * @param type error type
59
+ * @param stack stack log
60
+ * @param message error message
61
+ * @param property event context (optional)
62
+ * @returns a Promise.
63
+ */
64
+ addErrorWithType(type: string, stack: string, message: string, property?: Object): Promise<void>;
65
+ /**
66
+ * Start resource request.
67
+ * @param key unique id
68
+ * @param property event context (optional)
69
+ * @returns a Promise.
70
+ */
71
+ startResource(key: string, property?: Object): Promise<void>;
72
+ /**
73
+ * End resource request.
74
+ * @param key unique id
75
+ * @param property event context (optional)
76
+ * @returns a Promise.
77
+ */
78
+ stopResource(key: string, property?: Object): Promise<void>;
79
+ /**
80
+ * Send resource data metrics.
81
+ * @param key unique id
82
+ * @param resource resource data
83
+ * @param metrics resource performance data
84
+ * @returns a Promise.
85
+ */
86
+ addResource(key: string, resource: Object, metrics?: Object): Promise<void>;
87
+ }
88
+ declare const _default: Spec | null;
89
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ /**
4
+ * Configure trace to enable distributed tracing.
5
+ * @param config trace configuration parameters.
6
+ * @returns a Promise.
7
+ */
8
+ setConfig(config: Object): Promise<void>;
9
+ /**
10
+ * Get trace HTTP request header data.
11
+ * @param url request URL
12
+ * @returns trace request header parameters
13
+ * @deprecated use getTraceHeaderFields() replace.
14
+ */
15
+ getTraceHeader(key: string, url: string): Promise<Object>;
16
+ /**
17
+ * Get trace HTTP request header data.
18
+ * @param url request URL
19
+ * @returns trace request header parameters
20
+ */
21
+ getTraceHeaderFields(url: string, key?: string): Promise<Object>;
22
+ }
23
+ declare const _default: Spec | null;
24
+ export default _default;
@@ -1 +1 @@
1
- export declare const version = "0.4.0-alpha.4";
1
+ export declare const version = "0.4.2";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@truewatchtech/react-native-mobile",
3
- "version": "0.4.0-alpha.4",
4
- "description": "Base on TrueWatch Android iOS React Native SDK",
3
+ "version": "0.4.2",
4
+ "description": "Base on TrueWatchTech Android iOS React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
7
7
  "types": "lib/typescript/index.d.ts",
@@ -16,23 +16,25 @@
16
16
  "cpp",
17
17
  "FTMobileReactNativeSDK.podspec",
18
18
  "!lib/typescript/example",
19
+ "!android/.project",
19
20
  "!android/build",
20
21
  "!android/.gradle",
21
22
  "!android/.idea",
23
+ "!android/.settings",
22
24
  "!ios/build",
25
+ "!ios/**/xcuserdata",
26
+ "!ios/**/*.xcuserstate",
23
27
  "!**/__tests__",
24
28
  "!**/__fixtures__",
25
29
  "!**/__mocks__"
26
30
  ],
27
31
  "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",
32
+ "test": "yarn run -T jest",
33
+ "typescript": "yarn run -T tsc --noEmit",
34
+ "lint": "yarn run -T eslint \"**/*.{js,ts,tsx}\"",
35
+ "prepare": "yarn run -T genversion --es6 --semi src/version.ts && yarn run -T bob build",
36
+ "prepack": "yarn run -T check-version && yarn prepare",
37
+ "release": "yarn run -T release-it",
36
38
  "postinstall": "node scripts/replace-react-require.js"
37
39
  },
38
40
  "keywords": [
@@ -54,27 +56,8 @@
54
56
  "publishConfig": {
55
57
  "registry": "https://registry.npmjs.org/"
56
58
  },
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"
59
+ "engines": {
60
+ "node": ">=18"
78
61
  },
79
62
  "peerDependencies": {
80
63
  "react": ">=16.13.1",
@@ -83,67 +66,9 @@
83
66
  "jest": {
84
67
  "preset": "react-native",
85
68
  "modulePathIgnorePatterns": [
86
- "<rootDir>/example/node_modules",
87
69
  "<rootDir>/lib/"
88
70
  ]
89
71
  },
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
72
  "react-native-builder-bob": {
148
73
  "source": "src",
149
74
  "output": "lib",
@@ -151,17 +76,25 @@
151
76
  "commonjs",
152
77
  "module",
153
78
  [
154
- "typescript", {
155
- "project": "tsconfig.build.json"
79
+ "typescript",
80
+ {
81
+ "tsc": "../../node_modules/.bin/tsc"
156
82
  }
157
83
  ]
158
84
  ]
159
85
  },
86
+ "codegenConfig": {
87
+ "name": "FTSdkReactNative",
88
+ "type": "all",
89
+ "jsSrcsDir": "./src/specs",
90
+ "android": {
91
+ "javaPackageName": "com.ft.sdk.reactnative"
92
+ }
93
+ },
160
94
  "dependencies": {
161
95
  "@babel/runtime": "^7.16.5"
162
96
  },
163
97
  "directories": {
164
- "example": "example",
165
98
  "lib": "lib"
166
99
  }
167
- }
100
+ }
@@ -2,51 +2,50 @@
2
2
 
3
3
  // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
4
4
  const { readFileSync, writeFileSync } = require('fs');
5
- const GET_JSX_RUNTIME_RELATIVE_PATH =
6
- 'rum/FTRumActionTracking';
5
+ const GET_JSX_RUNTIME_RELATIVE_PATH = 'rum/FTRumActionTracking';
7
6
 
8
7
  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;
8
+ if (Number(major) > 16) {
9
+ return true;
10
+ }
11
+ if (Number(major) === 16 && Number(minor) > 13) {
12
+ return true;
13
+ }
14
+ return false;
16
15
  };
17
16
  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
- ];
17
+ process.stdout.write('[FTLog] replacing react/jsx-runtime by react\n');
18
+ const actionFilePath = `${__dirname}/..`;
19
+ const locations = [
20
+ { directory: `${actionFilePath}/src`, extension: 'tsx' },
21
+ { directory: `${actionFilePath}/lib/commonjs`, extension: 'js' },
22
+ { directory: `${actionFilePath}/lib/commonjs`, extension: 'js.map' },
23
+ { directory: `${actionFilePath}/lib/module`, extension: 'js' },
24
+ { directory: `${actionFilePath}/lib/module`, extension: 'js.map' },
25
+ ];
27
26
 
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
- });
27
+ locations.forEach((location) => {
28
+ const fileLocation = `${location.directory}/${GET_JSX_RUNTIME_RELATIVE_PATH}.${location.extension}`;
29
+ const file = readFileSync(fileLocation).toString();
30
+ writeFileSync(
31
+ fileLocation,
32
+ file.replace("require('react/jsx-runtime')", "require('react')")
33
+ );
34
+ });
36
35
  };
37
36
 
38
37
  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`);
38
+ // Get React version
39
+ // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
40
+ const [major, minor] = require('react/package.json').version.split('.');
41
+ process.stdout.write(`[FTLog] found react version ${major}${minor}\n`);
43
42
 
44
- if (!isJsxExportedInReactVersion(major, minor)) {
45
- replaceReactJsxRequire();
46
- }
47
- process.stdout.write('[FTLog] postinstall replace-react-require end\n');
43
+ if (!isJsxExportedInReactVersion(major, minor)) {
44
+ replaceReactJsxRequire();
45
+ }
46
+ process.stdout.write('[FTLog] postinstall replace-react-require end\n');
48
47
  } catch (error) {
49
- process.stderr.write(
50
- `[FTLog] Error running replace-react-require: ${error}\n`
51
- );
52
- }
48
+ process.stderr.write(
49
+ `[FTLog] Error running replace-react-require: ${error}\n`
50
+ );
51
+ }