@truewatchtech/react-native-mobile 0.4.2 → 0.4.3

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 (153) hide show
  1. package/FTMobileReactNativeSDK.podspec +7 -5
  2. package/android/build.gradle +10 -3
  3. package/android/src/main/java/com/ft/sdk/reactnative/FTLogImpl.java +10 -2
  4. package/android/src/main/java/com/ft/sdk/reactnative/FTMobileImpl.java +45 -10
  5. package/android/src/main/java/com/ft/sdk/reactnative/FTRUMImpl.java +131 -6
  6. package/android/src/main/java/com/ft/sdk/reactnative/FTTraceImpl.java +10 -3
  7. package/android/src/main/java/com/ft/sdk/reactnative/JsLongTaskMonitor.java +281 -0
  8. package/android/src/main/java/com/ft/sdk/reactnative/ViewTiming.java +17 -0
  9. package/android/src/main/java/com/ft/sdk/reactnative/VisitorIdConfigMapper.java +50 -0
  10. package/android/src/main/java/com/ft/sdk/reactnative/utils/ReactNativeUtils.java +5 -12
  11. package/android/src/newarch/java/com/ft/sdk/reactnative/FTMobileModule.java +14 -5
  12. package/android/src/newarch/java/com/ft/sdk/reactnative/FTRUMModule.java +44 -1
  13. package/android/src/newarch/java/com/ft/sdk/reactnative/FTTraceModule.java +14 -0
  14. package/android/src/oldarch/java/com/ft/sdk/reactnative/FTMobileModule.java +7 -2
  15. package/android/src/oldarch/java/com/ft/sdk/reactnative/FTRUMModule.java +39 -1
  16. package/android/src/oldarch/java/com/ft/sdk/reactnative/FTTraceModule.java +12 -0
  17. package/android/src/rnpost70/java/com/ft/sdk/reactnative/ReactJsThreadExecutor.java +21 -0
  18. package/android/src/rnpre70/java/com/ft/sdk/reactnative/ReactJsThreadExecutor.java +37 -0
  19. package/android/src/test/java/com/ft/sdk/reactnative/FTMobileImplTest.java +53 -0
  20. package/android/src/test/java/com/ft/sdk/reactnative/FTRUMModuleTest.java +117 -0
  21. package/android/src/test/java/com/ft/sdk/reactnative/JsLongTaskMonitorTest.java +446 -0
  22. package/android/src/test/java/com/ft/sdk/reactnative/utils/ReactNativeUtilsTest.java +33 -0
  23. package/ios/FTJSLongTaskMonitor.h +51 -0
  24. package/ios/FTJSLongTaskMonitor.m +250 -0
  25. package/ios/FTMobileReactNative.mm +54 -18
  26. package/ios/FTReactNativeLog.mm +9 -5
  27. package/ios/FTReactNativeRUM.mm +196 -31
  28. package/ios/FTReactNativeResource.h +4 -0
  29. package/ios/FTReactNativeResource.m +64 -0
  30. package/ios/FTReactNativeTrace.mm +59 -14
  31. package/ios/FTReactNativeUtils.m +10 -15
  32. package/ios/FTReactNativeViewTiming.h +18 -0
  33. package/ios/FTReactNativeWebSocket.h +10 -0
  34. package/ios/FTReactNativeWebSocket.mm +201 -0
  35. package/ios/FTWebSocketMetadataStore.h +25 -0
  36. package/ios/FTWebSocketMetadataStore.m +622 -0
  37. package/ios/FTWebSocketResourceData.h +20 -0
  38. package/ios/FTWebSocketResourceData.m +106 -0
  39. package/lib/commonjs/ft_logger.js +3 -1
  40. package/lib/commonjs/ft_logger.js.map +1 -1
  41. package/lib/commonjs/ft_mobile_agent.js +47 -4
  42. package/lib/commonjs/ft_mobile_agent.js.map +1 -1
  43. package/lib/commonjs/ft_rum.js +65 -5
  44. package/lib/commonjs/ft_rum.js.map +1 -1
  45. package/lib/commonjs/ft_tracing.js +14 -4
  46. package/lib/commonjs/ft_tracing.js.map +1 -1
  47. package/lib/commonjs/index.js +21 -0
  48. package/lib/commonjs/index.js.map +1 -1
  49. package/lib/commonjs/rum/FTBabelInteractionTracking.js +72 -0
  50. package/lib/commonjs/rum/FTBabelInteractionTracking.js.map +1 -0
  51. package/lib/commonjs/rum/FTBabelUtils.js +87 -0
  52. package/lib/commonjs/rum/FTBabelUtils.js.map +1 -0
  53. package/lib/commonjs/rum/FTRumActionTracking.js +10 -39
  54. package/lib/commonjs/rum/FTRumActionTracking.js.map +1 -1
  55. package/lib/commonjs/rum/FTRumActionTrackingContext.js +50 -0
  56. package/lib/commonjs/rum/FTRumActionTrackingContext.js.map +1 -0
  57. package/lib/commonjs/rum/FTRumViewTracking.js +147 -0
  58. package/lib/commonjs/rum/FTRumViewTracking.js.map +1 -0
  59. package/lib/commonjs/rum/FTRumWebSocketNative.js +73 -0
  60. package/lib/commonjs/rum/FTRumWebSocketNative.js.map +1 -0
  61. package/lib/commonjs/rum/FTRumWebSocketTiming.js +73 -0
  62. package/lib/commonjs/rum/FTRumWebSocketTiming.js.map +1 -0
  63. package/lib/commonjs/rum/FTRumWebSocketTracking.js +506 -0
  64. package/lib/commonjs/rum/FTRumWebSocketTracking.js.map +1 -0
  65. package/lib/commonjs/rum/longTasksUtils.js +25 -0
  66. package/lib/commonjs/rum/longTasksUtils.js.map +1 -0
  67. package/lib/commonjs/specs/NativeFTMobileReactNative.js.map +1 -1
  68. package/lib/commonjs/specs/NativeFTReactNativeRUM.js.map +1 -1
  69. package/lib/commonjs/specs/NativeFTReactNativeTrace.js.map +1 -1
  70. package/lib/commonjs/specs/NativeFTReactNativeWebSocket.js +11 -0
  71. package/lib/commonjs/specs/NativeFTReactNativeWebSocket.js.map +1 -0
  72. package/lib/commonjs/version.js +1 -1
  73. package/lib/commonjs/version.js.map +1 -1
  74. package/lib/commonjs/visitorIdConfig.js +37 -0
  75. package/lib/commonjs/visitorIdConfig.js.map +1 -0
  76. package/lib/module/ft_logger.js +3 -1
  77. package/lib/module/ft_logger.js.map +1 -1
  78. package/lib/module/ft_mobile_agent.js +47 -4
  79. package/lib/module/ft_mobile_agent.js.map +1 -1
  80. package/lib/module/ft_rum.js +65 -5
  81. package/lib/module/ft_rum.js.map +1 -1
  82. package/lib/module/ft_tracing.js +14 -2
  83. package/lib/module/ft_tracing.js.map +1 -1
  84. package/lib/module/index.js +4 -1
  85. package/lib/module/index.js.map +1 -1
  86. package/lib/module/rum/FTBabelInteractionTracking.js +66 -0
  87. package/lib/module/rum/FTBabelInteractionTracking.js.map +1 -0
  88. package/lib/module/rum/FTBabelUtils.js +80 -0
  89. package/lib/module/rum/FTBabelUtils.js.map +1 -0
  90. package/lib/module/rum/FTRumActionTracking.js +10 -39
  91. package/lib/module/rum/FTRumActionTracking.js.map +1 -1
  92. package/lib/module/rum/FTRumActionTrackingContext.js +43 -0
  93. package/lib/module/rum/FTRumActionTrackingContext.js.map +1 -0
  94. package/lib/module/rum/FTRumViewTracking.js +140 -0
  95. package/lib/module/rum/FTRumViewTracking.js.map +1 -0
  96. package/lib/module/rum/FTRumWebSocketNative.js +62 -0
  97. package/lib/module/rum/FTRumWebSocketNative.js.map +1 -0
  98. package/lib/module/rum/FTRumWebSocketTiming.js +67 -0
  99. package/lib/module/rum/FTRumWebSocketTiming.js.map +1 -0
  100. package/lib/module/rum/FTRumWebSocketTracking.js +499 -0
  101. package/lib/module/rum/FTRumWebSocketTracking.js.map +1 -0
  102. package/lib/module/rum/longTasksUtils.js +18 -0
  103. package/lib/module/rum/longTasksUtils.js.map +1 -0
  104. package/lib/module/specs/NativeFTMobileReactNative.js.map +1 -1
  105. package/lib/module/specs/NativeFTReactNativeRUM.js.map +1 -1
  106. package/lib/module/specs/NativeFTReactNativeTrace.js.map +1 -1
  107. package/lib/module/specs/NativeFTReactNativeWebSocket.js +8 -0
  108. package/lib/module/specs/NativeFTReactNativeWebSocket.js.map +1 -0
  109. package/lib/module/version.js +1 -1
  110. package/lib/module/version.js.map +1 -1
  111. package/lib/module/visitorIdConfig.js +31 -0
  112. package/lib/module/visitorIdConfig.js.map +1 -0
  113. package/lib/typescript/ft_logger.d.ts +11 -1
  114. package/lib/typescript/ft_mobile_agent.d.ts +28 -0
  115. package/lib/typescript/ft_rum.d.ts +42 -5
  116. package/lib/typescript/ft_tracing.d.ts +9 -1
  117. package/lib/typescript/index.d.ts +5 -1
  118. package/lib/typescript/rum/FTBabelInteractionTracking.d.ts +30 -0
  119. package/lib/typescript/rum/FTBabelUtils.d.ts +1 -0
  120. package/lib/typescript/rum/FTRumActionTracking.d.ts +0 -2
  121. package/lib/typescript/rum/FTRumActionTrackingContext.d.ts +11 -0
  122. package/lib/typescript/rum/FTRumViewTracking.d.ts +32 -0
  123. package/lib/typescript/rum/FTRumWebSocketNative.d.ts +22 -0
  124. package/lib/typescript/rum/FTRumWebSocketTiming.d.ts +7 -0
  125. package/lib/typescript/rum/FTRumWebSocketTracking.d.ts +54 -0
  126. package/lib/typescript/rum/longTasksUtils.d.ts +8 -0
  127. package/lib/typescript/specs/NativeFTMobileReactNative.d.ts +15 -0
  128. package/lib/typescript/specs/NativeFTReactNativeRUM.d.ts +11 -1
  129. package/lib/typescript/specs/NativeFTReactNativeTrace.d.ts +12 -0
  130. package/lib/typescript/specs/NativeFTReactNativeWebSocket.d.ts +13 -0
  131. package/lib/typescript/version.d.ts +1 -1
  132. package/lib/typescript/visitorIdConfig.d.ts +11 -0
  133. package/package.json +6 -4
  134. package/src/ft_logger.tsx +11 -1
  135. package/src/ft_mobile_agent.tsx +79 -7
  136. package/src/ft_rum.tsx +111 -7
  137. package/src/ft_tracing.tsx +24 -2
  138. package/src/index.tsx +8 -0
  139. package/src/rum/FTBabelInteractionTracking.ts +124 -0
  140. package/src/rum/FTBabelUtils.tsx +99 -0
  141. package/src/rum/FTRumActionTracking.tsx +14 -43
  142. package/src/rum/FTRumActionTrackingContext.ts +68 -0
  143. package/src/rum/FTRumViewTracking.ts +179 -0
  144. package/src/rum/FTRumWebSocketNative.ts +107 -0
  145. package/src/rum/FTRumWebSocketTiming.ts +82 -0
  146. package/src/rum/FTRumWebSocketTracking.ts +722 -0
  147. package/src/rum/longTasksUtils.ts +17 -0
  148. package/src/specs/NativeFTMobileReactNative.ts +18 -0
  149. package/src/specs/NativeFTReactNativeRUM.ts +19 -1
  150. package/src/specs/NativeFTReactNativeTrace.ts +12 -0
  151. package/src/specs/NativeFTReactNativeWebSocket.ts +33 -0
  152. package/src/version.ts +1 -1
  153. package/src/visitorIdConfig.ts +123 -0
@@ -0,0 +1,106 @@
1
+ #import "FTWebSocketResourceData.h"
2
+ #import <objc/message.h>
3
+ #include <math.h>
4
+ #include <string.h>
5
+ #include <stdint.h>
6
+
7
+ static BOOL FTWebSocketEpochNanoseconds(id value, int64_t *result) {
8
+ if (![value isKindOfClass:NSString.class]) return NO;
9
+ NSString *text = value;
10
+ if (text.length == 0 || text.length > 19 || [text characterAtIndex:0] == '0') return NO;
11
+ int64_t number = 0;
12
+ for (NSUInteger index = 0; index < text.length; index++) {
13
+ unichar character = [text characterAtIndex:index];
14
+ if (character < '0' || character > '9') return NO;
15
+ int digit = character - '0';
16
+ if (number > (INT64_MAX - digit) / 10) return NO;
17
+ number = number * 10 + digit;
18
+ }
19
+ *result = number;
20
+ return YES;
21
+ }
22
+
23
+ BOOL FTWebSocketResourceInterval(NSDictionary *metrics, int64_t *start, int64_t *end) {
24
+ int64_t startNs, endNs;
25
+ if (!FTWebSocketEpochNanoseconds(metrics[@"fetchStartNsTimeInterval"], &startNs) ||
26
+ !FTWebSocketEpochNanoseconds(metrics[@"fetchEndNsTimeInterval"], &endNs) || endNs < startNs) return NO;
27
+ *start = startNs;
28
+ *end = endNs;
29
+ return YES;
30
+ }
31
+
32
+ BOOL FTWebSocketDiscardTraceResource(id interceptor, NSString *key) {
33
+ if (!interceptor || !key.length) return NO;
34
+ // The SDK's current cancellation primitive is not in its public header.
35
+ // Validate the ABI before calling it; no swizzle, KVC, or unknown ivar reads.
36
+ // Compatibility with a different native SDK must include this capability.
37
+ SEL selector = NSSelectorFromString(@"removeTraceHandlerWithKey:");
38
+ @try {
39
+ if (![interceptor respondsToSelector:selector]) return NO;
40
+ NSMethodSignature *signature = [interceptor methodSignatureForSelector:selector];
41
+ if (!signature || signature.numberOfArguments != 3 ||
42
+ strcmp(signature.methodReturnType, @encode(void)) != 0 ||
43
+ strcmp([signature getArgumentTypeAtIndex:2], @encode(id)) != 0) return NO;
44
+ ((void (*)(id, SEL, id))objc_msgSend)(interceptor, selector, key);
45
+ return YES;
46
+ } @catch (__unused NSException *exception) { return NO; }
47
+ }
48
+
49
+ BOOL FTWebSocketShouldCollectResource(NSURL *url, BOOL (^resourceUrlHandler)(NSURL *),
50
+ BOOL (^intakeUrlHandler)(NSURL *)) {
51
+ if (resourceUrlHandler || intakeUrlHandler) {
52
+ if (!url) return NO;
53
+ if (resourceUrlHandler) return !resourceUrlHandler(url);
54
+ return intakeUrlHandler(url);
55
+ }
56
+ return YES;
57
+ }
58
+
59
+ static NSNumber *FTHTTPStatus(NSDictionary *metadata, NSString *message) {
60
+ id status = metadata[@"httpStatus"];
61
+ if ([status isKindOfClass:NSNumber.class]) {
62
+ double value = [status doubleValue];
63
+ if (isfinite(value) && value == floor(value)) return status;
64
+ }
65
+ if (![message isKindOfClass:NSString.class] || message.length > 512) return nil;
66
+ static NSRegularExpression *pattern;
67
+ static dispatch_once_t once;
68
+ dispatch_once(&once, ^{
69
+ pattern = [NSRegularExpression regularExpressionWithPattern:
70
+ @"\\AReceived\\s+bad\\s+response\\s+code\\s+from\\s+server\\s*:\\s*([1-9][0-9]{2})\\s*\\.?\\z"
71
+ options:NSRegularExpressionCaseInsensitive error:nil];
72
+ });
73
+ NSString *text = [message stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
74
+ NSTextCheckingResult *match = [pattern firstMatchInString:text options:0 range:NSMakeRange(0, text.length)];
75
+ return match ? @([[text substringWithRange:[match rangeAtIndex:1]] integerValue]) : nil;
76
+ }
77
+
78
+ NSDictionary *FTWebSocketResourceData(NSDictionary *content, NSDictionary *metrics,
79
+ NSDictionary *metadata, NSString *event) {
80
+ BOOL success = [event isEqualToString:@"open"];
81
+ NSString *message = [content[@"errorMessage"] isKindOfClass:NSString.class] ? content[@"errorMessage"] : nil;
82
+ // Keep absence separate from the exported unknown value 0. A native HTTP
83
+ // response takes precedence over text, without restricting its status class.
84
+ NSNumber *status = FTHTTPStatus(metadata, success ? nil : message);
85
+ NSMutableDictionary *resource = [NSMutableDictionary new];
86
+ for (NSString *key in @[@"url", @"httpMethod", @"requestHeader"]) {
87
+ if (content[key]) resource[key] = content[key];
88
+ }
89
+ resource[@"resourceType"] = @"websocket";
90
+ resource[@"webSocketHandshake"] = @YES;
91
+ resource[@"resourceStatus"] = status ?: @0;
92
+ resource[@"webSocketHandshakeState"] = success ? @"success" : (status && ![status isEqualToNumber:@101] ? @"rejected" : @"failed");
93
+ if (!success && message.length) resource[@"errorMessage"] = message;
94
+ if ([metadata[@"responseHeader"] isKindOfClass:NSDictionary.class]) resource[@"responseHeader"] = metadata[@"responseHeader"];
95
+ NSMutableDictionary *resultMetrics = [NSMutableDictionary new];
96
+ id duration = metrics[@"duration"];
97
+ if ([duration isKindOfClass:NSNumber.class] && isfinite([duration doubleValue]) && [duration doubleValue] >= 0)
98
+ resultMetrics[@"duration"] = duration; // JS event-boundary duration, already in nanoseconds.
99
+ int64_t startNs, endNs;
100
+ if (FTWebSocketResourceInterval(metrics, &startNs, &endNs)) {
101
+ resultMetrics[@"fetchStartNsTimeInterval"] = metrics[@"fetchStartNsTimeInterval"];
102
+ resultMetrics[@"fetchEndNsTimeInterval"] = metrics[@"fetchEndNsTimeInterval"];
103
+ }
104
+ if ([metadata[@"httpProtocol"] isKindOfClass:NSString.class]) resultMetrics[@"resource_http_protocol"] = metadata[@"httpProtocol"];
105
+ return @{@"content": resource, @"metrics": resultMetrics};
106
+ }
@@ -29,8 +29,10 @@ let FTLogCacheDiscard = exports.FTLogCacheDiscard = /*#__PURE__*/function (FTLog
29
29
  }({});
30
30
  /**
31
31
  * Configure log output configuration.
32
- * @param sampleRate sampling rate
32
+ * @param logSamplingRate Log sampling percentage in [0, 100], default 100. Supports fractional percentages and takes precedence over sampleRate.
33
+ * @param sampleRate Deprecated log sampling probability in [0, 1], default 1. Used only when logSamplingRate is omitted; multiplied by 100 before passing to Native.
33
34
  * @param enableLinkRumData whether to link with RUM
35
+ * @param enableWebViewLog Collect Browser Logs SDK events from WebViews, default false
34
36
  * @param enableCustomLog whether to enable custom logs
35
37
  * @param discardStrategy log discard strategy
36
38
  * @param logLevelFilters log level filter
@@ -1 +1 @@
1
- {"version":3,"names":["_ft_mobile_agent","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","FTLogStatus","exports","FTLogCacheDiscard","FTReactNativeLogWrapper","constructor","default","logConfig","config","logger","logging","content","logStatus","property","mergedProperties","bridgeContextManager","mergeWithLocalPropertiesSync","logWithStatusString","toString","enumLogStatus","FTReactNativeLog"],"sources":["ft_logger.tsx"],"sourcesContent":["import { bridgeContextManager } from './ft_mobile_agent';\n/**\n * Set log level.\n */\nexport enum FTLogStatus {\n info,\n warning,\n error,\n critical,\n ok,\n}\n/**\n * Log discard method.\n */\nexport enum FTLogCacheDiscard {\n discard,\n discardOldest,\n}\n/**\n * Configure log output configuration.\n * @param sampleRate sampling rate\n * @param enableLinkRumData whether to link with RUM\n * @param enableCustomLog whether to enable custom logs\n * @param discardStrategy log discard strategy\n * @param logLevelFilters log level filter\n * @param globalContext custom global parameters\n * @param logCacheLimitCount get maximum log entry count limit [1000,), default 5000\n */\nexport interface FTLogConfig {\n sampleRate?: number;\n enableLinkRumData?: boolean;\n enableCustomLog?: boolean;\n discardStrategy?: FTLogCacheDiscard;\n logLevelFilters?: Array<FTLogStatus>;\n globalContext?: object;\n logCacheLimitCount?: number;\n}\n\ntype FTReactNativeLogType = {\n /**\n *Configure log output configuration to enable log collection.\n */\n logConfig(config: FTLogConfig): Promise<void>;\n /**\n * Output log.\n * @param content log content\n * @param status log status\n * @param property log context (optional)\n */\n logging(\n content: string,\n logStatus: FTLogStatus,\n property?: object\n ): Promise<void>;\n /**\n * Output log.\n * @param content log content\n * @param status log status\n * @param property log context (optional)\n */\n logWithStatusString(\n content: string,\n logStatus: string,\n property?: object\n ): Promise<void>;\n};\n\nclass FTReactNativeLogWrapper {\n /* eslint-disable @typescript-eslint/no-var-requires */\n private logger: FTReactNativeLogType =\n require('./specs/NativeFTReactNativeLog').default;\n /* eslint-enable @typescript-eslint/no-var-requires */\n\n /**\n *Configure log output configuration to enable log collection.\n */\n logConfig(config: FTLogConfig): Promise<void> {\n return this.logger.logConfig(config);\n }\n\n /**\n * Output log.\n * @param content log content\n * @param status log status\n * @param property log context (optional)\n */\n logging(\n content: string,\n logStatus: FTLogStatus | string,\n property?: object\n ): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n\n if (typeof logStatus === 'string') {\n return this.logger.logWithStatusString(\n content,\n logStatus.toString(),\n mergedProperties\n );\n }\n let enumLogStatus: FTLogStatus = logStatus as FTLogStatus;\n return this.logger.logging(content, enumLogStatus, mergedProperties);\n }\n}\nexport const FTReactNativeLog: FTReactNativeLogWrapper =\n new FTReactNativeLogWrapper();\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAAyD,SAAAC,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AACzD;AACA;AACA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AAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_ft_mobile_agent","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","FTLogStatus","exports","FTLogCacheDiscard","FTReactNativeLogWrapper","constructor","default","logConfig","config","logger","logging","content","logStatus","property","mergedProperties","bridgeContextManager","mergeWithLocalPropertiesSync","logWithStatusString","toString","enumLogStatus","FTReactNativeLog"],"sources":["ft_logger.tsx"],"sourcesContent":["import { bridgeContextManager } from './ft_mobile_agent';\n/**\n * Set log level.\n */\nexport enum FTLogStatus {\n info,\n warning,\n error,\n critical,\n ok,\n}\n/**\n * Log discard method.\n */\nexport enum FTLogCacheDiscard {\n discard,\n discardOldest,\n}\n/**\n * Configure log output configuration.\n * @param logSamplingRate Log sampling percentage in [0, 100], default 100. Supports fractional percentages and takes precedence over sampleRate.\n * @param sampleRate Deprecated log sampling probability in [0, 1], default 1. Used only when logSamplingRate is omitted; multiplied by 100 before passing to Native.\n * @param enableLinkRumData whether to link with RUM\n * @param enableWebViewLog Collect Browser Logs SDK events from WebViews, default false\n * @param enableCustomLog whether to enable custom logs\n * @param discardStrategy log discard strategy\n * @param logLevelFilters log level filter\n * @param globalContext custom global parameters\n * @param logCacheLimitCount get maximum log entry count limit [1000,), default 5000\n */\nexport interface FTLogConfig {\n /**\n * Log sampling percentage in [0, 100], default 100.\n * Supports fractional percentages: 12.5 means 12.5%, not 0.125.\n * Takes precedence over sampleRate when both are supplied, including 0.\n */\n logSamplingRate?: number;\n /** @deprecated Use logSamplingRate. Probability in [0, 1], default 1; 0.125 maps to 12.5%. Ignored when logSamplingRate is supplied. */\n sampleRate?: number;\n enableLinkRumData?: boolean;\n enableCustomLog?: boolean;\n enableWebViewLog?: boolean;\n discardStrategy?: FTLogCacheDiscard;\n logLevelFilters?: Array<FTLogStatus>;\n globalContext?: object;\n logCacheLimitCount?: number;\n}\n\ntype FTReactNativeLogType = {\n /**\n *Configure log output configuration to enable log collection.\n */\n logConfig(config: FTLogConfig): Promise<void>;\n /**\n * Output log.\n * @param content log content\n * @param status log status\n * @param property log context (optional)\n */\n logging(\n content: string,\n logStatus: FTLogStatus,\n property?: object\n ): Promise<void>;\n /**\n * Output log.\n * @param content log content\n * @param status log status\n * @param property log context (optional)\n */\n logWithStatusString(\n content: string,\n logStatus: string,\n property?: object\n ): Promise<void>;\n};\n\nclass FTReactNativeLogWrapper {\n /* eslint-disable @typescript-eslint/no-var-requires */\n private logger: FTReactNativeLogType =\n require('./specs/NativeFTReactNativeLog').default;\n /* eslint-enable @typescript-eslint/no-var-requires */\n\n /**\n *Configure log output configuration to enable log collection.\n */\n logConfig(config: FTLogConfig): Promise<void> {\n return this.logger.logConfig(config);\n }\n\n /**\n * Output log.\n * @param content log content\n * @param status log status\n * @param property log context (optional)\n */\n logging(\n content: string,\n logStatus: FTLogStatus | string,\n property?: object\n ): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n\n if (typeof logStatus === 'string') {\n return this.logger.logWithStatusString(\n content,\n logStatus.toString(),\n mergedProperties\n );\n }\n let enumLogStatus: FTLogStatus = logStatus as FTLogStatus;\n return this.logger.logging(content, enumLogStatus, mergedProperties);\n }\n}\nexport const FTReactNativeLog: FTReactNativeLogWrapper =\n new FTReactNativeLogWrapper();\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAAyD,SAAAC,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,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CAAoB,CAACC,4BAA4B,CAACH,QAAQ,CAAC;IAE7D,IAAI,OAAOD,SAAS,KAAK,QAAQ,EAAE;MACjC,OAAO,IAAI,CAACH,MAAM,CAACQ,mBAAmB,CACpCN,OAAO,EACPC,SAAS,CAACM,QAAQ,CAAC,CAAC,EACpBJ,gBACF,CAAC;IACH;IACA,IAAIK,aAA0B,GAAGP,SAAwB;IACzD,OAAO,IAAI,CAACH,MAAM,CAACC,OAAO,CAACC,OAAO,EAAEQ,aAAa,EAAEL,gBAAgB,CAAC;EACtE;AACF;AACO,MAAMM,gBAAyC,GAAAlB,OAAA,CAAAkB,gBAAA,GACpD,IAAIhB,uBAAuB,CAAC,CAAC","ignoreList":[]}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.bridgeContextManager = exports.FTMobileReactNative = exports.FTDBCacheDiscard = exports.EnvType = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  var _version = require("./version");
9
+ var _FTRumWebSocketTracking = require("./rum/FTRumWebSocketTracking");
9
10
  var _BridgeContextManager;
10
11
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
11
12
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
@@ -18,6 +19,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
18
19
  class BridgeContextManager {
19
20
  constructor() {
20
21
  _defineProperty(this, "properties", new Map());
22
+ _defineProperty(this, "longTaskContextEnabled", false);
21
23
  // Initialize with SDK version information
22
24
  this.initializeSDKInfo();
23
25
  }
@@ -58,10 +60,32 @@ class BridgeContextManager {
58
60
  Object.entries(properties).forEach(([key, value]) => {
59
61
  this.properties.set(key, value);
60
62
  });
63
+ if (this.longTaskContextEnabled) {
64
+ this.syncLongTaskContext();
65
+ }
61
66
  } catch (error) {
62
67
  console.warn('Failed to append bridge context:', error);
63
68
  }
64
69
  }
70
+ configureLongTaskContext(enabled) {
71
+ this.longTaskContextEnabled = enabled;
72
+ if (enabled) {
73
+ this.syncLongTaskContext();
74
+ }
75
+ }
76
+ syncLongTaskContext() {
77
+ try {
78
+ // Apply the snapshot before JS can block. An async native call may run after
79
+ // the frame that detects the long task and attach stale context to it.
80
+ const rum =
81
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
82
+ require('./specs/NativeFTReactNativeRUM').default;
83
+ rum.setLongTaskContext(this.mergeWithLocalPropertiesSync());
84
+ } catch (error) {
85
+ // Context synchronization must not make a destroyed/older bridge crash the host.
86
+ console.warn('Failed to sync JS long task bridge context:', error);
87
+ }
88
+ }
65
89
 
66
90
  /**
67
91
  * Merge bridge context properties with local properties
@@ -126,6 +150,8 @@ let FTDBCacheDiscard = exports.FTDBCacheDiscard = /*#__PURE__*/function (FTDBCac
126
150
  /**
127
151
  * Values that can be modified by remote config override rules.
128
152
  * These values will adjust the fetched remote configuration before it is applied.
153
+ * Omitted fields are not changed by this rule. Sampling percentages use [0, 100]
154
+ * and support fractions (12.5 means 12.5%); legacy probabilities use [0, 1].
129
155
  */
130
156
  /**
131
157
  * Remote config override rules .
@@ -173,6 +199,7 @@ class FTMobileReactNativeWrapper {
173
199
  constructor() {
174
200
  /* eslint-disable @typescript-eslint/no-var-requires */
175
201
  _defineProperty(this, "sdk", require('./specs/NativeFTMobileReactNative').default);
202
+ _defineProperty(this, "rum", require('./specs/NativeFTReactNativeRUM').default);
176
203
  /* eslint-enable @typescript-eslint/no-var-requires */
177
204
  _defineProperty(this, "emitter", null);
178
205
  }
@@ -189,7 +216,14 @@ class FTMobileReactNativeWrapper {
189
216
  if (config.serverUrl != null && config.serverUrl.length > 0 && config.datakitUrl == null) {
190
217
  config.datakitUrl = config.serverUrl;
191
218
  }
192
- return this.sdk.sdkConfig(config);
219
+ const nativeConfig = {
220
+ ...config
221
+ };
222
+ // Keep undefined equivalent to omission; explicit null overrides legacy hosts.
223
+ if (nativeConfig.allowWebViewHost === undefined) {
224
+ delete nativeConfig.allowWebViewHost;
225
+ }
226
+ return this.sdk.sdkConfig(nativeConfig);
193
227
  }
194
228
  setDatakitURL(datakitUrl) {
195
229
  return this.sdk.setDatakitURL(datakitUrl);
@@ -200,6 +234,9 @@ class FTMobileReactNativeWrapper {
200
234
  bindRUMUserData(userId, userName, userEmail, extra) {
201
235
  return this.sdk.bindRUMUserData(userId, userName, userEmail, extra);
202
236
  }
237
+ resetVisitorId() {
238
+ return this.sdk.resetVisitorId();
239
+ }
203
240
  unbindRUMUserData() {
204
241
  return this.sdk.unbindRUMUserData();
205
242
  }
@@ -218,14 +255,20 @@ class FTMobileReactNativeWrapper {
218
255
  flushSyncData() {
219
256
  return this.sdk.flushSyncData();
220
257
  }
221
- shutDown() {
222
- return this.sdk.shutDown();
258
+ async shutDown() {
259
+ bridgeContextManager.configureLongTaskContext(false);
260
+ try {
261
+ _FTRumWebSocketTracking.FTRumWebSocketTracking.shutDown();
262
+ await this.rum.stopLongTaskTracking();
263
+ } finally {
264
+ await this.sdk.shutDown();
265
+ }
223
266
  }
224
267
  clearAllData() {
225
268
  return this.sdk.clearAllData();
226
269
  }
227
270
  appendBridgeContext(properties) {
228
- // Use bridgeContextManager to store properties in JavaScript and send to native SDK
271
+ // Store properties in JS and update the native long task snapshot when enabled.
229
272
  bridgeContextManager.appendBridgeContext(properties);
230
273
  }
231
274
  updateRemoteConfig() {
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_version","_BridgeContextManager","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","BridgeContextManager","constructor","Map","initializeSDKInfo","sdkBridgeInfo","react_native","sdkVersion","properties","set","JSON","stringify","getInstance","instance","appendBridgeContext","entries","forEach","key","error","console","warn","mergeWithLocalPropertiesSync","localProperties","merged","assign","bridgeContextManager","exports","EnvType","FTDBCacheDiscard","FTMobileReactNativeWrapper","default","getEmitter","_NativeModules$FTMobi","emitter","nativeEventModule","NativeModules","FTMobileReactNative","sdk","NativeEventEmitter","sdkConfig","config","serverUrl","length","datakitUrl","setDatakitURL","setDatawayURL","datawayUrl","clientToken","bindRUMUserData","userId","userName","userEmail","extra","unbindRUMUserData","appendGlobalContext","context","appendLogGlobalContext","appendRUMGlobalContext","trackEventFromExtension","identifier","flushSyncData","shutDown","clearAllData","updateRemoteConfig","updateRemoteConfigWithMiniUpdateInterval","interval","rules","addRemoteConfigListener","listener","addListener"],"sources":["ft_mobile_agent.tsx"],"sourcesContent":["import {\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n} from 'react-native';\nimport { version as sdkVersion } from './version';\n\n/**\n * Bridge context manager for managing shared properties across RUM and Logger modules\n * This class provides a centralized way to store and retrieve global properties that will be\n * automatically merged with local properties when making calls to RUM and Logger functions\n */\nclass BridgeContextManager {\n private static instance: BridgeContextManager;\n private properties: Map<string, any> = new Map();\n\n private constructor() {\n // Initialize with SDK version information\n this.initializeSDKInfo();\n }\n\n /**\n * Initialize SDK information properties\n * @private\n */\n private initializeSDKInfo(): void {\n // Create sdk_bridge_info with version information\n const sdkBridgeInfo = {\n react_native: sdkVersion,\n };\n\n // Set the sdk_bridge_info property\n this.properties.set('sdk_bridge_info', JSON.stringify(sdkBridgeInfo));\n }\n\n /**\n * Get singleton instance of BridgeContextManager\n * @returns BridgeContextManager instance\n */\n public static getInstance(): BridgeContextManager {\n if (!BridgeContextManager.instance) {\n BridgeContextManager.instance = new BridgeContextManager();\n }\n return BridgeContextManager.instance;\n }\n\n /**\n * Add bridge context properties that will be automatically merged with local properties\n * @param properties Object containing key-value pairs\n */\n public appendBridgeContext(properties: Record<string, any>): void {\n // Store properties locally in JavaScript\n try {\n // Store properties locally in JavaScript\n Object.entries(properties).forEach(([key, value]) => {\n this.properties.set(key, value);\n });\n } catch (error) {\n console.warn('Failed to append bridge context:', error);\n }\n }\n\n /**\n * Merge bridge context properties with local properties\n * Bridge context properties take precedence over local properties\n * @param localProperties Local properties to merge with bridge context properties\n * @returns Merged properties object\n */\n public mergeWithLocalPropertiesSync(\n localProperties?: object\n ): Record<string, any> {\n try {\n const merged: Record<string, any> = {};\n\n // First add local properties (if any)\n if (localProperties) {\n Object.assign(merged, localProperties);\n }\n\n // Then add bridge context properties (these will override local properties with same keys)\n this.properties.forEach((value, key) => {\n merged[key] = value;\n });\n\n return merged;\n } catch (error) {\n console.warn(\n 'Failed to merge bridge context with local properties:',\n error\n );\n // Return empty object or only local properties on error\n return localProperties ? { ...localProperties } : {};\n }\n }\n}\n\n// Internal bridge context manager - not exported\nexport const bridgeContextManager = BridgeContextManager.getInstance();\n\n/**\n * Environment.\n */\nexport enum EnvType {\n prod,\n gray,\n pre,\n common,\n local,\n}\nexport enum FTDBCacheDiscard {\n discard,\n discardOldest,\n}\n\n/**\n * Remote config override rule matching condition for custom keys. Supports exact match and contains match.\n * For exact match, set the value directly, for example: \"userid\": \"test_user\", which means the rule will be applied when the custom key \"userid\" is exactly \"test_user\".\n * For contains match, set the value as an object with a \"contains\" field, for example: \"userid\": { \"contains\": \"test_user\" }, which means the rule will be applied when the custom key \"userid\" contains the object \"test_user\".\n */\nexport type FTRemoteConfigCustomKeyContainsMatch = {\n contains: string | number | boolean;\n};\n\n/**\n * Matching rules for remote config override\n * Defines matching conditions using customKeys\n */\nexport type FTRemoteConfigOverrideMatch = {\n customKeys?: Record<\n string,\n string | number | boolean | FTRemoteConfigCustomKeyContainsMatch\n >;\n};\n\n/**\n * Values that can be modified by remote config override rules.\n * These values will adjust the fetched remote configuration before it is applied.\n */\nexport type FTRemoteConfigOverrideValues = {\n env?: string;\n serviceName?: string;\n autoSync?: boolean;\n compressIntakeRequests?: boolean;\n syncPageSize?: number;\n syncSleepTime?: number;\n rumSampleRate?: number;\n rumSessionOnErrorSampleRate?: number;\n rumEnableTraceUserAction?: boolean;\n rumEnableTraceUserView?: boolean;\n rumEnableTraceUserResource?: boolean;\n rumEnableResourceHostIP?: boolean;\n rumEnableTrackAppUIBlock?: boolean;\n rumBlockDurationMs?: number;\n rumEnableTrackAppCrash?: boolean;\n rumEnableTrackAppANR?: boolean;\n rumEnableTraceWebView?: boolean;\n rumAllowWebViewHost?: Array<string>;\n traceSampleRate?: number;\n traceEnableAutoTrace?: boolean;\n traceType?: string;\n logSampleRate?: number;\n logLevelFilters?: Array<string>;\n logEnableCustomLog?: boolean;\n logEnableConsoleLog?: boolean;\n};\n\n/**\n * Remote config override rules .\n * Adjust the fetched remote configuration before application.\n */\nexport type FTRemoteConfigOverrideRule = {\n id?: string;\n enabled?: boolean;\n match: FTRemoteConfigOverrideMatch;\n override: FTRemoteConfigOverrideValues;\n};\n/**\n * Final result of the remote config update\n * @param triggerType the type of remote config update trigger, auto or manual\n * @param success whether the remote config update was successful\n * @param platform the platform of the device, ios or android\n * @param timestamp the timestamp when the remote config update was triggered\n * @param rawJson the final remote config update result, in JSON string format\n * @param errorCode the error code if the remote config update failed, may be null if the update was successful\n * @param errorMessage the error message if the remote config update failed, may be null if the update was successful\n * @param appliedOverrideRuleIds the list of override rule IDs applied in this remote config update, may be null if no rules were applied\n */\nexport type FTRemoteConfigResult = {\n triggerType: 'auto' | 'manual';\n success: boolean;\n platform: 'ios' | 'android';\n timestamp: number;\n rawJson?: string;\n errorCode?: string | number;\n errorMessage?: string;\n appliedOverrideRuleIds?: string[];\n};\n/**\n * Configure SDK startup parameters.\n * @param serverUrl data reporting address, deprecated, use [datakitUrl] instead\n * @param datakitUrl datakit access URL address, example: http://10.0.0.1:9529, default port 9529. Choose one between datakit and dataway configuration\n * @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\n * @param clientToken dataway authentication token, needs to be configured together with [datawayUrl]\n * @param debug set whether to allow log printing, default false\n * @param env environment, default prod\n * @param service set the name of the business or service it belongs to, default: `df_rum_ios`, `df_rum_android`\n * @param autoSync whether data is automatically synchronized and uploaded, default: true\n * @param syncPageSize number of synchronized items per request during data synchronization, minimum value 5, default: 10\n * @param syncSleepTime interval time between each request during data synchronization, unit milliseconds, 0 < syncSleepTime < 100\n * @param enableDataIntegerCompatible whether to enable data integer compatibility during data synchronization, enabled by default\n * @param compressIntakeRequests whether to compress synchronized data\n * @param enableDataFilter whether to enable SDK-side local data filters, enabled by default\n * @param dataFilters local blocklist filter rules. Supported categories include `logging` and `rum`. Any data that matches a rule will be discarded.\n * @param globalContext custom global parameters\n * @param groupIdentifiers iOS side sets the AppGroups Identifier array corresponding to the collected Widget Extension\n * @param enableLimitWithDbSize set whether to enable using db to limit data size, after enabling, `FTLogConfig.logCacheLimitCount` and `FTRUMConfig.rumCacheLimitCount` will no longer take effect\n * @param dbCacheLimit db cache limit size, minimum value 30MB, default 100MB, unit byte\n * @param dbDiscardStrategy db data discard strategy\n * @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\n * @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\n * @param remoteConfiguration Set whether to enable remote dynamic configuration\n * @param remoteConfigMiniUpdateInterval Set remote dynamic configuration minimum update interval, unit seconds, default 12*60*60\n * @param remoteConfigOverrideRules Remote config override rules .Adjust the fetched remote configuration before application.\n */\nexport interface FTMobileConfig {\n /**\n * @deprecated \"serverUrl\" parameter renamed to \"datakitUrl\"\n */\n serverUrl?: string;\n datakitUrl?: string;\n datawayUrl?: string;\n clientToken?: string;\n debug?: boolean;\n envType?: EnvType;\n env?: string;\n service?: string;\n autoSync?: boolean;\n syncPageSize?: number;\n syncSleepTime?: number;\n enableDataIntegerCompatible?: boolean;\n compressIntakeRequests?: boolean;\n enableDataFilter?: boolean;\n dataFilters?: Record<string, Array<string>>;\n globalContext?: object;\n groupIdentifiers?: Array<string>;\n enableLimitWithDbSize?: boolean;\n dbCacheLimit?: number;\n dbDiscardStrategy?: FTDBCacheDiscard;\n dataModifier?: object;\n lineDataModifier?: object;\n remoteConfiguration?: boolean;\n remoteConfigMiniUpdateInterval?: number;\n remoteConfigOverrideRules?: Array<FTRemoteConfigOverrideRule>;\n}\n\ntype FTMobileReactNativeType = {\n /**\n * SDK initialization method.\n * @param config SDK initialization configuration items.\n * @returns a Promise.\n */\n sdkConfig(config: FTMobileConfig): Promise<void>;\n /**\n * Dynamically set the Datakit upload URL after SDK initialization.\n * @param datakitUrl Datakit upload URL.\n * @returns a Promise.\n */\n setDatakitURL(datakitUrl: string): Promise<void>;\n /**\n * Dynamically set the Dataway upload URL and client token after SDK initialization.\n * @param datawayUrl Dataway upload URL.\n * @param clientToken Dataway authentication token.\n * @returns a Promise.\n */\n setDatawayURL(datawayUrl: string, clientToken: string): Promise<void>;\n /**\n * Bind user.\n * @param userId user ID.\n * @param userName user name.\n * @param userEmail user email\n * @param extra additional user information\n * @returns a Promise.\n */\n bindRUMUserData(\n userId: string,\n userName?: string,\n userEmail?: string,\n extra?: object\n ): Promise<void>;\n /**\n * Unbind user.\n * @returns a Promise.\n */\n unbindRUMUserData(): Promise<void>;\n /**\n * Add custom global parameters. Applies to RUM and Log data\n * @param context custom global parameters.\n * @returns a Promise.\n */\n appendGlobalContext(context: object): Promise<void>;\n /**\n * Add custom RUM global parameters. Applies to RUM data\n * @param context custom RUM global parameters.\n * @returns a Promise.\n */\n appendRUMGlobalContext(context: object): Promise<void>;\n /**\n * Add custom RUM and Log global parameters. Applies to Log data\n * @param context custom Log global parameters.\n * @returns a Promise.\n */\n appendLogGlobalContext(context: object): Promise<void>;\n /**\n * Actively synchronize data. When `FTMobileConfig.autoSync=false` is configured, you need to actively trigger this method to synchronize data.\n * @returns a Promise.\n */\n flushSyncData(): Promise<void>;\n\n /**\n * Synchronize events in iOS Widget Extension, iOS only\n * @param groupIdentifier app groupId\n * @returns {groupIdentifier:string,datas:Array<object>} can be used to view data collected in Extension.\n */\n trackEventFromExtension(identifier: string): Promise<object>;\n /**\n * Shut down objects currently running in the SDK\n */\n shutDown(): Promise<void>;\n /**\n * Clear all data that has not yet been uploaded to the server.\n */\n clearAllData(): Promise<void>;\n /**\n * Add bridge context properties that will be automatically merged with local properties\n * @param properties Object containing key-value pairs\n */\n appendBridgeContext(properties: Record<string, any>): void;\n /**\n * Update remote configuration, after enabling remote configuration, you can call this method to update the configuration in real time.\n */\n updateRemoteConfig(): Promise<FTRemoteConfigResult>;\n /**\n * Update remote configuration with minimum update interval, after enabling remote configuration, you can call this method to update the configuration in real time.\n * This method is used to set the minimum update interval for remote configuration updates. If the time since the last update is less than the specified interval, the update will not be performed.\n * @param interval minimum update interval, unit seconds\n * @param rules Remote config override rules .Adjust the fetched remote configuration before application.\n * @returns the result of the remote config update\n */\n updateRemoteConfigWithMiniUpdateInterval(\n interval: number,\n rules?: Array<FTRemoteConfigOverrideRule>\n ): Promise<FTRemoteConfigResult>;\n /**\n * Listen for auto remote configuration updates triggered by the native SDK.\n * Manual updates are returned through the update Promise instead of this event.\n */\n addRemoteConfigListener(\n listener: (result: FTRemoteConfigResult) => void\n ): EmitterSubscription;\n};\n\nclass FTMobileReactNativeWrapper implements FTMobileReactNativeType {\n /* eslint-disable @typescript-eslint/no-var-requires */\n private sdk: FTMobileReactNativeType =\n require('./specs/NativeFTMobileReactNative').default;\n /* eslint-enable @typescript-eslint/no-var-requires */\n\n private emitter: NativeEventEmitter | null = null;\n\n private getEmitter(): NativeEventEmitter {\n if (this.emitter) {\n return this.emitter;\n }\n\n const nativeEventModule = NativeModules.FTMobileReactNative ?? this.sdk;\n this.emitter = new NativeEventEmitter(nativeEventModule as never);\n return this.emitter;\n }\n\n sdkConfig(config: FTMobileConfig): Promise<void> {\n if (\n config.serverUrl != null &&\n config.serverUrl.length > 0 &&\n config.datakitUrl == null\n ) {\n config.datakitUrl = config.serverUrl;\n }\n return this.sdk.sdkConfig(config);\n }\n setDatakitURL(datakitUrl: string): Promise<void> {\n return this.sdk.setDatakitURL(datakitUrl);\n }\n setDatawayURL(datawayUrl: string, clientToken: string): Promise<void> {\n return this.sdk.setDatawayURL(datawayUrl, clientToken);\n }\n bindRUMUserData(\n userId: string,\n userName?: string,\n userEmail?: string,\n extra?: object\n ): Promise<void> {\n return this.sdk.bindRUMUserData(userId, userName, userEmail, extra);\n }\n unbindRUMUserData(): Promise<void> {\n return this.sdk.unbindRUMUserData();\n }\n appendGlobalContext(context: object): Promise<void> {\n return this.sdk.appendGlobalContext(context);\n }\n appendLogGlobalContext(context: object): Promise<void> {\n return this.sdk.appendLogGlobalContext(context);\n }\n appendRUMGlobalContext(context: object): Promise<void> {\n return this.sdk.appendRUMGlobalContext(context);\n }\n trackEventFromExtension(identifier: string): Promise<object> {\n return this.sdk.trackEventFromExtension(identifier);\n }\n flushSyncData(): Promise<void> {\n return this.sdk.flushSyncData();\n }\n shutDown(): Promise<void> {\n return this.sdk.shutDown();\n }\n clearAllData(): Promise<void> {\n return this.sdk.clearAllData();\n }\n appendBridgeContext(properties: Record<string, any>): void {\n // Use bridgeContextManager to store properties in JavaScript and send to native SDK\n bridgeContextManager.appendBridgeContext(properties);\n }\n updateRemoteConfig(): Promise<FTRemoteConfigResult> {\n return this.sdk.updateRemoteConfig();\n }\n updateRemoteConfigWithMiniUpdateInterval(\n interval: number,\n rules?: Array<FTRemoteConfigOverrideRule>\n ): Promise<FTRemoteConfigResult> {\n return this.sdk.updateRemoteConfigWithMiniUpdateInterval(interval, rules);\n }\n addRemoteConfigListener(\n listener: (result: FTRemoteConfigResult) => void\n ): EmitterSubscription {\n return this.getEmitter().addListener('ft_remote_config_callback', listener);\n }\n}\nexport const FTMobileReactNative: FTMobileReactNativeType =\n new FTMobileReactNativeWrapper();\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAAkD,IAAAE,qBAAA;AAAA,SAAAC,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD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5B,OAAO,IAAI,CAACzB,GAAG,CAACyB,YAAY,CAAC,CAAC;EAChC;EACAhD,mBAAmBA,CAACN,UAA+B,EAAQ;IACzD;IACAiB,oBAAoB,CAACX,mBAAmB,CAACN,UAAU,CAAC;EACtD;EACAuD,kBAAkBA,CAAA,EAAkC;IAClD,OAAO,IAAI,CAAC1B,GAAG,CAAC0B,kBAAkB,CAAC,CAAC;EACtC;EACAC,wCAAwCA,CACtCC,QAAgB,EAChBC,KAAyC,EACV;IAC/B,OAAO,IAAI,CAAC7B,GAAG,CAAC2B,wCAAwC,CAACC,QAAQ,EAAEC,KAAK,CAAC;EAC3E;EACAC,uBAAuBA,CACrBC,QAAgD,EAC3B;IACrB,OAAO,IAAI,CAACrC,UAAU,CAAC,CAAC,CAACsC,WAAW,CAAC,2BAA2B,EAAED,QAAQ,CAAC;EAC7E;AACF;AACO,MAAMhC,mBAA4C,GAAAV,OAAA,CAAAU,mBAAA,GACvD,IAAIP,0BAA0B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_version","_FTRumWebSocketTracking","_BridgeContextManager","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","BridgeContextManager","constructor","Map","initializeSDKInfo","sdkBridgeInfo","react_native","sdkVersion","properties","set","JSON","stringify","getInstance","instance","appendBridgeContext","entries","forEach","key","longTaskContextEnabled","syncLongTaskContext","error","console","warn","configureLongTaskContext","enabled","rum","default","setLongTaskContext","mergeWithLocalPropertiesSync","localProperties","merged","assign","bridgeContextManager","exports","EnvType","FTDBCacheDiscard","FTMobileReactNativeWrapper","getEmitter","_NativeModules$FTMobi","emitter","nativeEventModule","NativeModules","FTMobileReactNative","sdk","NativeEventEmitter","sdkConfig","config","serverUrl","length","datakitUrl","nativeConfig","allowWebViewHost","undefined","setDatakitURL","setDatawayURL","datawayUrl","clientToken","bindRUMUserData","userId","userName","userEmail","extra","resetVisitorId","unbindRUMUserData","appendGlobalContext","context","appendLogGlobalContext","appendRUMGlobalContext","trackEventFromExtension","identifier","flushSyncData","shutDown","FTRumWebSocketTracking","stopLongTaskTracking","clearAllData","updateRemoteConfig","updateRemoteConfigWithMiniUpdateInterval","interval","rules","addRemoteConfigListener","listener","addListener"],"sources":["ft_mobile_agent.tsx"],"sourcesContent":["import {\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n} from 'react-native';\nimport type { Spec as NativeFTMobileReactNativeSpec } from './specs/NativeFTMobileReactNative';\nimport type { Spec as NativeFTReactNativeRUMSpec } from './specs/NativeFTReactNativeRUM';\nimport { version as sdkVersion } from './version';\nimport { FTRumWebSocketTracking } from './rum/FTRumWebSocketTracking';\n\n/**\n * Bridge context manager for managing shared properties across RUM and Logger modules\n * This class provides a centralized way to store and retrieve global properties that will be\n * automatically merged with local properties when making calls to RUM and Logger functions\n */\nclass BridgeContextManager {\n private static instance: BridgeContextManager;\n private properties: Map<string, any> = new Map();\n private longTaskContextEnabled = false;\n\n private constructor() {\n // Initialize with SDK version information\n this.initializeSDKInfo();\n }\n\n /**\n * Initialize SDK information properties\n * @private\n */\n private initializeSDKInfo(): void {\n // Create sdk_bridge_info with version information\n const sdkBridgeInfo = {\n react_native: sdkVersion,\n };\n\n // Set the sdk_bridge_info property\n this.properties.set('sdk_bridge_info', JSON.stringify(sdkBridgeInfo));\n }\n\n /**\n * Get singleton instance of BridgeContextManager\n * @returns BridgeContextManager instance\n */\n public static getInstance(): BridgeContextManager {\n if (!BridgeContextManager.instance) {\n BridgeContextManager.instance = new BridgeContextManager();\n }\n return BridgeContextManager.instance;\n }\n\n /**\n * Add bridge context properties that will be automatically merged with local properties\n * @param properties Object containing key-value pairs\n */\n public appendBridgeContext(properties: Record<string, any>): void {\n // Store properties locally in JavaScript\n try {\n // Store properties locally in JavaScript\n Object.entries(properties).forEach(([key, value]) => {\n this.properties.set(key, value);\n });\n if (this.longTaskContextEnabled) {\n this.syncLongTaskContext();\n }\n } catch (error) {\n console.warn('Failed to append bridge context:', error);\n }\n }\n\n public configureLongTaskContext(enabled: boolean): void {\n this.longTaskContextEnabled = enabled;\n if (enabled) {\n this.syncLongTaskContext();\n }\n }\n\n private syncLongTaskContext(): void {\n try {\n // Apply the snapshot before JS can block. An async native call may run after\n // the frame that detects the long task and attach stale context to it.\n const rum: NativeFTReactNativeRUMSpec =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('./specs/NativeFTReactNativeRUM').default;\n rum.setLongTaskContext(this.mergeWithLocalPropertiesSync());\n } catch (error) {\n // Context synchronization must not make a destroyed/older bridge crash the host.\n console.warn('Failed to sync JS long task bridge context:', error);\n }\n }\n\n /**\n * Merge bridge context properties with local properties\n * Bridge context properties take precedence over local properties\n * @param localProperties Local properties to merge with bridge context properties\n * @returns Merged properties object\n */\n public mergeWithLocalPropertiesSync(\n localProperties?: object\n ): Record<string, any> {\n try {\n const merged: Record<string, any> = {};\n\n // First add local properties (if any)\n if (localProperties) {\n Object.assign(merged, localProperties);\n }\n\n // Then add bridge context properties (these will override local properties with same keys)\n this.properties.forEach((value, key) => {\n merged[key] = value;\n });\n\n return merged;\n } catch (error) {\n console.warn(\n 'Failed to merge bridge context with local properties:',\n error\n );\n // Return empty object or only local properties on error\n return localProperties ? { ...localProperties } : {};\n }\n }\n}\n\n// Internal bridge context manager - not exported\nexport const bridgeContextManager = BridgeContextManager.getInstance();\n\n/**\n * Environment.\n */\nexport enum EnvType {\n prod,\n gray,\n pre,\n common,\n local,\n}\nexport enum FTDBCacheDiscard {\n discard,\n discardOldest,\n}\n\n/**\n * Remote config override rule matching condition for custom keys. Supports exact match and contains match.\n * For exact match, set the value directly, for example: \"userid\": \"test_user\", which means the rule will be applied when the custom key \"userid\" is exactly \"test_user\".\n * For contains match, set the value as an object with a \"contains\" field, for example: \"userid\": { \"contains\": \"test_user\" }, which means the rule will be applied when the custom key \"userid\" contains the object \"test_user\".\n */\nexport type FTRemoteConfigCustomKeyContainsMatch = {\n contains: string | number | boolean;\n};\n\n/**\n * Matching rules for remote config override\n * Defines matching conditions using customKeys\n */\nexport type FTRemoteConfigOverrideMatch = {\n customKeys?: Record<\n string,\n string | number | boolean | FTRemoteConfigCustomKeyContainsMatch\n >;\n};\n\n/**\n * Values that can be modified by remote config override rules.\n * These values will adjust the fetched remote configuration before it is applied.\n * Omitted fields are not changed by this rule. Sampling percentages use [0, 100]\n * and support fractions (12.5 means 12.5%); legacy probabilities use [0, 1].\n */\nexport type FTRemoteConfigOverrideValues = {\n env?: string;\n serviceName?: string;\n autoSync?: boolean;\n compressIntakeRequests?: boolean;\n syncPageSize?: number;\n syncSleepTime?: number;\n /** RUM session sampling percentage override in [0, 100]; takes precedence over rumSampleRate, including 0. */\n sessionSamplingRate?: number;\n /** Error session sampling percentage override in [0, 100]; takes precedence over rumSessionOnErrorSampleRate, including 0. */\n sessionOnErrorSamplingRate?: number;\n /** Trace sampling percentage override in [0, 100]; takes precedence over traceSampleRate, including 0. */\n traceSamplingRate?: number;\n /** Log sampling percentage override in [0, 100]; takes precedence over logSampleRate, including 0. */\n logSamplingRate?: number;\n /** Session Replay sampling percentage override in [0, 100]; fractional percentages are supported. */\n sessionReplaySamplingRate?: number;\n /** Error replay sampling percentage override in [0, 100]; fractional percentages are supported. */\n sessionReplayOnErrorSamplingRate?: number;\n /** @deprecated Use sessionSamplingRate. Legacy RUM probability override in [0, 1]; 0.125 maps to 12.5%. */\n rumSampleRate?: number;\n /** @deprecated Use sessionOnErrorSamplingRate. Legacy error session probability override in [0, 1]. */\n rumSessionOnErrorSampleRate?: number;\n rumEnableTraceUserAction?: boolean;\n rumEnableTraceUserView?: boolean;\n rumEnableTraceUserResource?: boolean;\n rumEnableResourceHostIP?: boolean;\n rumEnableTrackAppUIBlock?: boolean;\n rumBlockDurationMs?: number;\n rumEnableTrackAppCrash?: boolean;\n rumEnableTrackAppANR?: boolean;\n rumEnableTraceWebView?: boolean;\n rumAllowWebViewHost?: Array<string>;\n /** @deprecated Use traceSamplingRate. Legacy Trace probability override in [0, 1]. */\n traceSampleRate?: number;\n traceEnableAutoTrace?: boolean;\n traceType?: string;\n /** @deprecated Use logSamplingRate. Legacy log probability override in [0, 1]. */\n logSampleRate?: number;\n logLevelFilters?: Array<string>;\n logEnableCustomLog?: boolean;\n logEnableWebViewLog?: boolean;\n logEnableConsoleLog?: boolean;\n};\n\n/**\n * Remote config override rules .\n * Adjust the fetched remote configuration before application.\n */\nexport type FTRemoteConfigOverrideRule = {\n id?: string;\n enabled?: boolean;\n match: FTRemoteConfigOverrideMatch;\n override: FTRemoteConfigOverrideValues;\n};\n/**\n * Final result of the remote config update\n * @param triggerType the type of remote config update trigger, auto or manual\n * @param success whether the remote config update was successful\n * @param platform the platform of the device, ios or android\n * @param timestamp the timestamp when the remote config update was triggered\n * @param rawJson the final remote config update result, in JSON string format\n * @param errorCode the error code if the remote config update failed, may be null if the update was successful\n * @param errorMessage the error message if the remote config update failed, may be null if the update was successful\n * @param appliedOverrideRuleIds the list of override rule IDs applied in this remote config update, may be null if no rules were applied\n */\nexport type FTRemoteConfigResult = {\n triggerType: 'auto' | 'manual';\n success: boolean;\n platform: 'ios' | 'android';\n timestamp: number;\n rawJson?: string;\n errorCode?: string | number;\n errorMessage?: string;\n appliedOverrideRuleIds?: string[];\n};\n/**\n * Configure SDK startup parameters.\n * @param serverUrl data reporting address, deprecated, use [datakitUrl] instead\n * @param datakitUrl datakit access URL address, example: http://10.0.0.1:9529, default port 9529. Choose one between datakit and dataway configuration\n * @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\n * @param clientToken dataway authentication token, needs to be configured together with [datawayUrl]\n * @param debug set whether to allow log printing, default false\n * @param env environment, default prod\n * @param service set the name of the business or service it belongs to, default: `df_rum_ios`, `df_rum_android`\n * @param autoSync whether data is automatically synchronized and uploaded, default: true\n * @param syncPageSize number of synchronized items per request during data synchronization, minimum value 5, default: 10\n * @param syncSleepTime interval time between each request during data synchronization, unit milliseconds, 0 < syncSleepTime < 100\n * @param enableDataIntegerCompatible whether to enable data integer compatibility during data synchronization, enabled by default\n * @param compressIntakeRequests whether to compress synchronized data\n * @param enableDataFilter whether to enable SDK-side local data filters, enabled by default\n * @param dataFilters local blocklist filter rules. Supported categories include `logging` and `rum`. Any data that matches a rule will be discarded.\n * @param globalContext custom global parameters\n * @param groupIdentifiers iOS side sets the AppGroups Identifier array corresponding to the collected Widget Extension\n * @param enableLimitWithDbSize set whether to enable using db to limit data size, after enabling, `FTLogConfig.logCacheLimitCount` and `FTRUMConfig.rumCacheLimitCount` will no longer take effect\n * @param dbCacheLimit db cache limit size, minimum value 30MB, default 100MB, unit byte\n * @param dbDiscardStrategy db data discard strategy\n * @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\n * @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\n * @param remoteConfiguration Set whether to enable remote dynamic configuration\n * @param remoteConfigMiniUpdateInterval Set remote dynamic configuration minimum update interval, unit seconds, default 12*60*60\n * @param remoteConfigOverrideRules Remote config override rules .Adjust the fetched remote configuration before application.\n */\nexport interface FTMobileConfig {\n /**\n * @deprecated \"serverUrl\" parameter renamed to \"datakitUrl\"\n */\n serverUrl?: string;\n datakitUrl?: string;\n datawayUrl?: string;\n clientToken?: string;\n debug?: boolean;\n envType?: EnvType;\n env?: string;\n service?: string;\n autoSync?: boolean;\n syncPageSize?: number;\n syncSleepTime?: number;\n enableDataIntegerCompatible?: boolean;\n compressIntakeRequests?: boolean;\n enableDataFilter?: boolean;\n dataFilters?: Record<string, Array<string>>;\n /** Shared WebView host allowlist for RUM and Log. Omitted uses the legacy RUM\n * config; null allows every host; [] disables bridge access. Remote config wins.\n */\n allowWebViewHost?: Array<string> | null;\n globalContext?: object;\n groupIdentifiers?: Array<string>;\n enableLimitWithDbSize?: boolean;\n dbCacheLimit?: number;\n dbDiscardStrategy?: FTDBCacheDiscard;\n dataModifier?: object;\n lineDataModifier?: object;\n remoteConfiguration?: boolean;\n remoteConfigMiniUpdateInterval?: number;\n remoteConfigOverrideRules?: Array<FTRemoteConfigOverrideRule>;\n}\n\ntype FTMobileReactNativeType = {\n /**\n * SDK initialization method.\n * @param config SDK initialization configuration items.\n * @returns a Promise.\n */\n sdkConfig(config: FTMobileConfig): Promise<void>;\n /**\n * Dynamically set the Datakit upload URL after SDK initialization.\n * @param datakitUrl Datakit upload URL.\n * @returns a Promise.\n */\n setDatakitURL(datakitUrl: string): Promise<void>;\n /**\n * Dynamically set the Dataway upload URL and client token after SDK initialization.\n * @param datawayUrl Dataway upload URL.\n * @param clientToken Dataway authentication token.\n * @returns a Promise.\n */\n setDatawayURL(datawayUrl: string, clientToken: string): Promise<void>;\n /**\n * Bind user.\n * @param userId user ID.\n * @param userName user name.\n * @param userEmail user email\n * @param extra additional user information\n * @returns a Promise.\n */\n bindRUMUserData(\n userId: string,\n userName?: string,\n userEmail?: string,\n extra?: object\n ): Promise<void>;\n /**\n * Unbind user.\n * @returns a Promise.\n */\n unbindRUMUserData(): Promise<void>;\n /** Rotate the native anonymous Visitor ID for subsequent requests. */\n resetVisitorId(): Promise<void>;\n /**\n * Add custom global parameters. Applies to RUM and Log data\n * @param context custom global parameters.\n * @returns a Promise.\n */\n appendGlobalContext(context: object): Promise<void>;\n /**\n * Add custom RUM global parameters. Applies to RUM data\n * @param context custom RUM global parameters.\n * @returns a Promise.\n */\n appendRUMGlobalContext(context: object): Promise<void>;\n /**\n * Add custom RUM and Log global parameters. Applies to Log data\n * @param context custom Log global parameters.\n * @returns a Promise.\n */\n appendLogGlobalContext(context: object): Promise<void>;\n /**\n * Actively synchronize data. When `FTMobileConfig.autoSync=false` is configured, you need to actively trigger this method to synchronize data.\n * @returns a Promise.\n */\n flushSyncData(): Promise<void>;\n\n /**\n * Synchronize events in iOS Widget Extension, iOS only\n * @param groupIdentifier app groupId\n * @returns {groupIdentifier:string,datas:Array<object>} can be used to view data collected in Extension.\n */\n trackEventFromExtension(identifier: string): Promise<object>;\n /**\n * Shut down objects currently running in the SDK\n */\n shutDown(): Promise<void>;\n /**\n * Clear all data that has not yet been uploaded to the server.\n */\n clearAllData(): Promise<void>;\n /**\n * Add bridge context properties that will be automatically merged with local properties\n * @param properties Object containing key-value pairs\n */\n appendBridgeContext(properties: Record<string, any>): void;\n /**\n * Update remote configuration, after enabling remote configuration, you can call this method to update the configuration in real time.\n */\n updateRemoteConfig(): Promise<FTRemoteConfigResult>;\n /**\n * Update remote configuration with minimum update interval, after enabling remote configuration, you can call this method to update the configuration in real time.\n * This method is used to set the minimum update interval for remote configuration updates. If the time since the last update is less than the specified interval, the update will not be performed.\n * @param interval minimum update interval, unit seconds\n * @param rules Remote config override rules .Adjust the fetched remote configuration before application.\n * @returns the result of the remote config update\n */\n updateRemoteConfigWithMiniUpdateInterval(\n interval: number,\n rules?: Array<FTRemoteConfigOverrideRule>\n ): Promise<FTRemoteConfigResult>;\n /**\n * Listen for auto remote configuration updates triggered by the native SDK.\n * Manual updates are returned through the update Promise instead of this event.\n */\n addRemoteConfigListener(\n listener: (result: FTRemoteConfigResult) => void\n ): EmitterSubscription;\n};\n\nclass FTMobileReactNativeWrapper implements FTMobileReactNativeType {\n /* eslint-disable @typescript-eslint/no-var-requires */\n private sdk: NativeFTMobileReactNativeSpec =\n require('./specs/NativeFTMobileReactNative').default;\n private rum: NativeFTReactNativeRUMSpec =\n require('./specs/NativeFTReactNativeRUM').default;\n /* eslint-enable @typescript-eslint/no-var-requires */\n\n private emitter: NativeEventEmitter | null = null;\n\n private getEmitter(): NativeEventEmitter {\n if (this.emitter) {\n return this.emitter;\n }\n\n const nativeEventModule = NativeModules.FTMobileReactNative ?? this.sdk;\n this.emitter = new NativeEventEmitter(nativeEventModule as never);\n return this.emitter;\n }\n\n sdkConfig(config: FTMobileConfig): Promise<void> {\n if (\n config.serverUrl != null &&\n config.serverUrl.length > 0 &&\n config.datakitUrl == null\n ) {\n config.datakitUrl = config.serverUrl;\n }\n const nativeConfig = { ...config };\n // Keep undefined equivalent to omission; explicit null overrides legacy hosts.\n if (nativeConfig.allowWebViewHost === undefined) {\n delete nativeConfig.allowWebViewHost;\n }\n return this.sdk.sdkConfig(nativeConfig);\n }\n setDatakitURL(datakitUrl: string): Promise<void> {\n return this.sdk.setDatakitURL(datakitUrl);\n }\n setDatawayURL(datawayUrl: string, clientToken: string): Promise<void> {\n return this.sdk.setDatawayURL(datawayUrl, clientToken);\n }\n bindRUMUserData(\n userId: string,\n userName?: string,\n userEmail?: string,\n extra?: object\n ): Promise<void> {\n return this.sdk.bindRUMUserData(userId, userName, userEmail, extra);\n }\n resetVisitorId(): Promise<void> {\n return this.sdk.resetVisitorId();\n }\n unbindRUMUserData(): Promise<void> {\n return this.sdk.unbindRUMUserData();\n }\n appendGlobalContext(context: object): Promise<void> {\n return this.sdk.appendGlobalContext(context);\n }\n appendLogGlobalContext(context: object): Promise<void> {\n return this.sdk.appendLogGlobalContext(context);\n }\n appendRUMGlobalContext(context: object): Promise<void> {\n return this.sdk.appendRUMGlobalContext(context);\n }\n trackEventFromExtension(identifier: string): Promise<object> {\n return this.sdk.trackEventFromExtension(identifier);\n }\n flushSyncData(): Promise<void> {\n return this.sdk.flushSyncData();\n }\n async shutDown(): Promise<void> {\n bridgeContextManager.configureLongTaskContext(false);\n try {\n FTRumWebSocketTracking.shutDown();\n await this.rum.stopLongTaskTracking();\n } finally {\n await this.sdk.shutDown();\n }\n }\n clearAllData(): Promise<void> {\n return this.sdk.clearAllData();\n }\n appendBridgeContext(properties: Record<string, any>): void {\n // Store properties in JS and update the native long task snapshot when enabled.\n bridgeContextManager.appendBridgeContext(properties);\n }\n updateRemoteConfig(): Promise<FTRemoteConfigResult> {\n return this.sdk.updateRemoteConfig() as Promise<FTRemoteConfigResult>;\n }\n updateRemoteConfigWithMiniUpdateInterval(\n interval: number,\n rules?: Array<FTRemoteConfigOverrideRule>\n ): Promise<FTRemoteConfigResult> {\n return this.sdk.updateRemoteConfigWithMiniUpdateInterval(\n interval,\n rules\n ) as Promise<FTRemoteConfigResult>;\n }\n addRemoteConfigListener(\n listener: (result: FTRemoteConfigResult) => void\n ): EmitterSubscription {\n return this.getEmitter().addListener('ft_remote_config_callback', listener);\n }\n}\nexport const FTMobileReactNative: FTMobileReactNativeType =\n new FTMobileReactNativeWrapper();\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,uBAAA,GAAAF,OAAA;AAAsE,IAAAG,qBAAA;AAAA,SAAAC,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAEtE;AACA;AACA;AACA;AACA;AACA,MAAMgB,oBAAoB,CAAC;EAKjBC,WAAWA,CAAA,EAAG;IAAApB,eAAA,qBAHiB,IAAIqB,GAAG,CAAC,CAAC;IAA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GAAG,CAAC2B,aAAa,CAAC,CAAC;EACjC;EACA,MAAMC,QAAQA,CAAA,EAAkB;IAC9BvC,oBAAoB,CAACT,wBAAwB,CAAC,KAAK,CAAC;IACpD,IAAI;MACFiD,8CAAsB,CAACD,QAAQ,CAAC,CAAC;MACjC,MAAM,IAAI,CAAC9C,GAAG,CAACgD,oBAAoB,CAAC,CAAC;IACvC,CAAC,SAAS;MACR,MAAM,IAAI,CAAC9B,GAAG,CAAC4B,QAAQ,CAAC,CAAC;IAC3B;EACF;EACAG,YAAYA,CAAA,EAAkB;IAC5B,OAAO,IAAI,CAAC/B,GAAG,CAAC+B,YAAY,CAAC,CAAC;EAChC;EACA5D,mBAAmBA,CAACN,UAA+B,EAAQ;IACzD;IACAwB,oBAAoB,CAAClB,mBAAmB,CAACN,UAAU,CAAC;EACtD;EACAmE,kBAAkBA,CAAA,EAAkC;IAClD,OAAO,IAAI,CAAChC,GAAG,CAACgC,kBAAkB,CAAC,CAAC;EACtC;EACAC,wCAAwCA,CACtCC,QAAgB,EAChBC,KAAyC,EACV;IAC/B,OAAO,IAAI,CAACnC,GAAG,CAACiC,wCAAwC,CACtDC,QAAQ,EACRC,KACF,CAAC;EACH;EACAC,uBAAuBA,CACrBC,QAAgD,EAC3B;IACrB,OAAO,IAAI,CAAC3C,UAAU,CAAC,CAAC,CAAC4C,WAAW,CAAC,2BAA2B,EAAED,QAAQ,CAAC;EAC7E;AACF;AACO,MAAMtC,mBAA4C,GAAAT,OAAA,CAAAS,mBAAA,GACvD,IAAIN,0BAA0B,CAAC,CAAC","ignoreList":[]}
@@ -4,9 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.IOSCrashMonitoringType = exports.FTReactNativeRUM = exports.FTRUMCacheDiscard = exports.ErrorMonitorType = exports.DeviceMetricsMonitorType = exports.DetectFrequency = void 0;
7
+ var _visitorIdConfig = require("./visitorIdConfig");
8
+ var _reactNative = require("react-native");
7
9
  var _FTRumErrorTracking = require("./rum/FTRumErrorTracking");
8
10
  var _FTRumActionTracking = require("./rum/FTRumActionTracking");
11
+ var _FTBabelInteractionTracking = require("./rum/FTBabelInteractionTracking");
12
+ var _FTRumWebSocketTracking = require("./rum/FTRumWebSocketTracking");
9
13
  var _ft_mobile_agent = require("./ft_mobile_agent");
14
+ var _longTasksUtils = require("./rum/longTasksUtils");
10
15
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
11
16
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
12
17
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // import { NativeModules } from 'react-native';
@@ -70,17 +75,25 @@ let IOSCrashMonitoringType = exports.IOSCrashMonitoringType = /*#__PURE__*/funct
70
75
  * Set RUM tracking conditions.
71
76
  * @param androidAppId appId, apply during monitoring
72
77
  * @param iOSAppId appId, apply during monitoring
73
- * @param sampleRate sampling rate
74
- * @param sessionOnErrorSampleRate error session sampling rate. For sessions not sampled, if ERROR is hit, collect data 1 minute before the error occurs
78
+ * @param sessionSamplingRate RUM session sampling percentage in [0, 100], default 100. Supports fractional percentages and takes precedence over sampleRate.
79
+ * @param sessionOnErrorSamplingRate Sampling percentage in [0, 100] for otherwise unsampled sessions when an error occurs, default 0. Supports fractional percentages and takes precedence over sessionOnErrorSampleRate.
80
+ * @param sampleRate Deprecated RUM session sampling probability in [0, 1], default 1. Used only when sessionSamplingRate is omitted; multiplied by 100 before passing to Native.
81
+ * @param sessionOnErrorSampleRate Deprecated error session sampling probability in [0, 1], default 0. Used only when sessionOnErrorSamplingRate is omitted; multiplied by 100 before passing to Native.
75
82
  * @param enableAutoTrackUserAction whether to automatically collect react-native control click events, can set actionName with accessibilityLabel when enabled
76
83
  * @param enableTrackError whether to automatically collect react-native Error
77
84
  * @param enableTrackNativeCrash whether to collect Native Error
78
85
  * @param enableTrackNativeAppANR whether to collect Native ANR
79
86
  * @param enableTrackNativeFreeze whether to collect Native Freeze
80
87
  * @param nativeFreezeDurationMs set the threshold for collecting Native Freeze, value range [100,), unit ms. iOS default 250ms, Android default 1000ms
88
+ * @param enableLongTask whether to collect React Native JavaScript LongTasks, default false
89
+ * @param longTaskThresholdMs set the threshold for collecting React Native JavaScript LongTasks, unit ms. Defaults to 100 and is clamped to [100, 5000]
81
90
  * @param enableNativeUserAction whether to start Native Action tracking, Button click events, recommended to disable for pure react-native apps
82
91
  * @param enableNativeUserView whether to start Native View auto tracking, recommended to disable for pure react-native apps
83
92
  * @param enableNativeUserResource whether to automatically collect react-native Resource
93
+ * @param enableIOSWebSocketResource whether to collect iOS WebSocket opening handshakes as RUM Resources. Defaults to false.
94
+ * Independent of enableNativeUserResource. Android native WebSocket collection is unaffected.
95
+ * iOS WebSocket Trace header injection requires both this option and enableNativeAutoTrace.
96
+ * When disabled, new iOS WebSocket connections are not instrumented or automatically injected with Trace headers by this SDK.
84
97
  * @param enableResourceHostIP whether to collect network request Host IP (only for native http, iOS 13 and above)
85
98
  * @param errorMonitorType error monitoring supplement type
86
99
  * @param deviceMonitorType page monitoring supplement type
@@ -89,7 +102,7 @@ let IOSCrashMonitoringType = exports.IOSCrashMonitoringType = /*#__PURE__*/funct
89
102
  * @param rumCacheLimitCount RUM max cache size, default 100_000
90
103
  * @param rumDiscardStrategy RUM data discard strategy
91
104
  * @param enableTraceWebView Set whether to enable WebView data collection, default true
92
- * @param allowWebViewHost Set specific hosts or domains allowed to collect WebView data, nil means collect all
105
+ * @param allowWebViewHost Deprecated; use FTMobileConfig.allowWebViewHost for shared WebView host filtering.
93
106
  * @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.
94
107
  */
95
108
  /**
@@ -111,20 +124,61 @@ let IOSCrashMonitoringType = exports.IOSCrashMonitoringType = /*#__PURE__*/funct
111
124
  * @param resource_trans resource content transfer time
112
125
  * @param resource_first_byte resource first byte time
113
126
  */
127
+ function isBabelPluginEnabled() {
128
+ if (typeof globalThis !== 'undefined') {
129
+ return globalThis.__FT_RN_BABEL_PLUGIN_ENABLED__ === true;
130
+ }
131
+ if (typeof global !== 'undefined') {
132
+ return global.__FT_RN_BABEL_PLUGIN_ENABLED__ === true;
133
+ }
134
+ return false;
135
+ }
114
136
  class FTReactNativeRUMWrapper {
115
137
  constructor() {
138
+ _defineProperty(this, "webSocketConfigVersion", 0);
116
139
  // eslint-disable-next-line @typescript-eslint/no-var-requires
117
140
  _defineProperty(this, "rum", require('./specs/NativeFTReactNativeRUM').default);
118
141
  }
119
142
  setConfig(config) {
143
+ if (config.visitorIdConfig != null) {
144
+ try {
145
+ (0, _visitorIdConfig.validateVisitorIdConfig)(config.visitorIdConfig);
146
+ } catch (error) {
147
+ return Promise.reject(error);
148
+ }
149
+ }
150
+ _ft_mobile_agent.bridgeContextManager.configureLongTaskContext(config.enableLongTask === true);
151
+ const webSocketLifecycle = _FTRumWebSocketTracking.FTRumWebSocketTracking.getLifecycleVersion();
152
+ const webSocketConfigVersion = ++this.webSocketConfigVersion;
153
+ const trackWebSocket = config.enableIOSWebSocketResource === true;
120
154
  console.log('FTRUMConfig');
121
155
  if (config.enableAutoTrackError) {
122
156
  _FTRumErrorTracking.FTRumErrorTracking.startTracking();
123
157
  }
124
- if (config.enableAutoTrackUserAction) {
158
+ const babelPluginEnabled = isBabelPluginEnabled();
159
+ _FTBabelInteractionTracking.FTBabelInteractionTracking.configure({
160
+ trackInteractions: babelPluginEnabled && Boolean(config.enableAutoTrackUserAction),
161
+ actionReporter: (actionName, actionType, property) => this.startAction(actionName, actionType, property)
162
+ });
163
+ if (config.enableAutoTrackUserAction && !babelPluginEnabled) {
125
164
  _FTRumActionTracking.FTRumActionTracking.startTracking();
165
+ } else {
166
+ _FTRumActionTracking.FTRumActionTracking.stopTracking();
126
167
  }
127
- return this.rum.setConfig(config);
168
+ return this.rum.setConfig({
169
+ ...config,
170
+ enableLongTask: config.enableLongTask === true,
171
+ longTaskThresholdMs: (0, _longTasksUtils.normalizeLongTaskThreshold)(config.longTaskThresholdMs)
172
+ }).then(() => {
173
+ if (webSocketLifecycle !== _FTRumWebSocketTracking.FTRumWebSocketTracking.getLifecycleVersion() || webSocketConfigVersion !== this.webSocketConfigVersion) {
174
+ return;
175
+ }
176
+ if (_reactNative.Platform.OS === 'ios' && trackWebSocket) {
177
+ _FTRumWebSocketTracking.FTRumWebSocketTracking.startTracking(this);
178
+ } else {
179
+ _FTRumWebSocketTracking.FTRumWebSocketTracking.stopTracking();
180
+ }
181
+ });
128
182
  }
129
183
  startAction(actionName, actionType, property) {
130
184
  // Automatically merge bridge context properties with local properties
@@ -139,6 +193,12 @@ class FTReactNativeRUMWrapper {
139
193
  onCreateView(viewName, loadTime) {
140
194
  return this.rum.onCreateView(viewName, loadTime);
141
195
  }
196
+ updateViewLoadingTime(duration) {
197
+ if (!Number.isSafeInteger(duration) || duration < 0) {
198
+ return Promise.reject(new RangeError('duration must be a non-negative safe integer in nanoseconds'));
199
+ }
200
+ return this.rum.updateViewLoadingTime(duration);
201
+ }
142
202
  startView(viewName, property) {
143
203
  // Automatically merge bridge context properties with local properties
144
204
  const mergedProperties = _ft_mobile_agent.bridgeContextManager.mergeWithLocalPropertiesSync(property);