@truewatchtech/react-native-mobile 0.4.1 → 0.4.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FTMobileReactNativeSDK.podspec +7 -5
- package/README.md +34 -0
- package/android/build.gradle +9 -2
- package/android/src/main/java/com/ft/sdk/reactnative/FTMobileImpl.java +45 -14
- package/android/src/main/java/com/ft/sdk/reactnative/FTRUMImpl.java +85 -2
- package/android/src/main/java/com/ft/sdk/reactnative/FTTraceImpl.java +5 -1
- package/android/src/main/java/com/ft/sdk/reactnative/JsLongTaskMonitor.java +281 -0
- package/android/src/main/java/com/ft/sdk/reactnative/utils/ReactNativeUtils.java +5 -12
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTMobileModule.java +9 -5
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTRUMModule.java +26 -1
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTTraceModule.java +14 -0
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTMobileModule.java +2 -2
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTRUMModule.java +29 -1
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTTraceModule.java +12 -0
- package/android/src/rnpost70/java/com/ft/sdk/reactnative/ReactJsThreadExecutor.java +21 -0
- package/android/src/rnpre70/java/com/ft/sdk/reactnative/ReactJsThreadExecutor.java +37 -0
- package/android/src/test/java/com/ft/sdk/reactnative/FTRUMModuleTest.java +117 -0
- package/android/src/test/java/com/ft/sdk/reactnative/JsLongTaskMonitorTest.java +446 -0
- package/android/src/test/java/com/ft/sdk/reactnative/utils/ReactNativeUtilsTest.java +33 -0
- package/ios/FTJSLongTaskMonitor.h +51 -0
- package/ios/FTJSLongTaskMonitor.m +250 -0
- package/ios/FTMobileReactNative.mm +23 -16
- package/ios/FTReactNativeLog.mm +3 -4
- package/ios/FTReactNativeRUM.mm +103 -28
- package/ios/FTReactNativeResource.h +4 -0
- package/ios/FTReactNativeResource.m +58 -0
- package/ios/FTReactNativeTrace.mm +56 -13
- package/ios/FTReactNativeUtils.m +10 -15
- package/ios/FTReactNativeWebSocket.h +10 -0
- package/ios/FTReactNativeWebSocket.mm +201 -0
- package/ios/FTWebSocketMetadataStore.h +25 -0
- package/ios/FTWebSocketMetadataStore.m +622 -0
- package/ios/FTWebSocketResourceData.h +16 -0
- package/ios/FTWebSocketResourceData.m +75 -0
- package/lib/commonjs/ft_mobile_agent.js +36 -3
- package/lib/commonjs/ft_mobile_agent.js.map +1 -1
- package/lib/commonjs/ft_rum.js +46 -2
- package/lib/commonjs/ft_rum.js.map +1 -1
- package/lib/commonjs/ft_tracing.js +12 -3
- package/lib/commonjs/ft_tracing.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/rum/FTBabelInteractionTracking.js +72 -0
- package/lib/commonjs/rum/FTBabelInteractionTracking.js.map +1 -0
- package/lib/commonjs/rum/FTBabelUtils.js +87 -0
- package/lib/commonjs/rum/FTBabelUtils.js.map +1 -0
- package/lib/commonjs/rum/FTRumActionTracking.js +10 -39
- package/lib/commonjs/rum/FTRumActionTracking.js.map +1 -1
- package/lib/commonjs/rum/FTRumActionTrackingContext.js +50 -0
- package/lib/commonjs/rum/FTRumActionTrackingContext.js.map +1 -0
- package/lib/commonjs/rum/FTRumWebSocketNative.js +73 -0
- package/lib/commonjs/rum/FTRumWebSocketNative.js.map +1 -0
- package/lib/commonjs/rum/FTRumWebSocketTiming.js +55 -0
- package/lib/commonjs/rum/FTRumWebSocketTiming.js.map +1 -0
- package/lib/commonjs/rum/FTRumWebSocketTracking.js +510 -0
- package/lib/commonjs/rum/FTRumWebSocketTracking.js.map +1 -0
- package/lib/commonjs/rum/longTasksUtils.js +25 -0
- package/lib/commonjs/rum/longTasksUtils.js.map +1 -0
- package/lib/commonjs/specs/NativeFTMobileReactNative.js.map +1 -1
- package/lib/commonjs/specs/NativeFTReactNativeRUM.js.map +1 -1
- package/lib/commonjs/specs/NativeFTReactNativeTrace.js.map +1 -1
- package/lib/commonjs/specs/NativeFTReactNativeWebSocket.js +11 -0
- package/lib/commonjs/specs/NativeFTReactNativeWebSocket.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/ft_mobile_agent.js +36 -3
- package/lib/module/ft_mobile_agent.js.map +1 -1
- package/lib/module/ft_rum.js +46 -2
- package/lib/module/ft_rum.js.map +1 -1
- package/lib/module/ft_tracing.js +12 -1
- package/lib/module/ft_tracing.js.map +1 -1
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/rum/FTBabelInteractionTracking.js +66 -0
- package/lib/module/rum/FTBabelInteractionTracking.js.map +1 -0
- package/lib/module/rum/FTBabelUtils.js +80 -0
- package/lib/module/rum/FTBabelUtils.js.map +1 -0
- package/lib/module/rum/FTRumActionTracking.js +10 -39
- package/lib/module/rum/FTRumActionTracking.js.map +1 -1
- package/lib/module/rum/FTRumActionTrackingContext.js +43 -0
- package/lib/module/rum/FTRumActionTrackingContext.js.map +1 -0
- package/lib/module/rum/FTRumWebSocketNative.js +62 -0
- package/lib/module/rum/FTRumWebSocketNative.js.map +1 -0
- package/lib/module/rum/FTRumWebSocketTiming.js +49 -0
- package/lib/module/rum/FTRumWebSocketTiming.js.map +1 -0
- package/lib/module/rum/FTRumWebSocketTracking.js +503 -0
- package/lib/module/rum/FTRumWebSocketTracking.js.map +1 -0
- package/lib/module/rum/longTasksUtils.js +18 -0
- package/lib/module/rum/longTasksUtils.js.map +1 -0
- package/lib/module/specs/NativeFTMobileReactNative.js.map +1 -1
- package/lib/module/specs/NativeFTReactNativeRUM.js.map +1 -1
- package/lib/module/specs/NativeFTReactNativeTrace.js.map +1 -1
- package/lib/module/specs/NativeFTReactNativeWebSocket.js +8 -0
- package/lib/module/specs/NativeFTReactNativeWebSocket.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/ft_mobile_agent.d.ts +7 -0
- package/lib/typescript/ft_rum.d.ts +9 -0
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/rum/FTBabelInteractionTracking.d.ts +30 -0
- package/lib/typescript/rum/FTBabelUtils.d.ts +1 -0
- package/lib/typescript/rum/FTRumActionTracking.d.ts +0 -2
- package/lib/typescript/rum/FTRumActionTrackingContext.d.ts +11 -0
- package/lib/typescript/rum/FTRumWebSocketNative.d.ts +23 -0
- package/lib/typescript/rum/FTRumWebSocketTiming.d.ts +2 -0
- package/lib/typescript/rum/FTRumWebSocketTracking.d.ts +56 -0
- package/lib/typescript/rum/longTasksUtils.d.ts +8 -0
- package/lib/typescript/specs/NativeFTMobileReactNative.d.ts +14 -0
- package/lib/typescript/specs/NativeFTReactNativeRUM.d.ts +4 -0
- package/lib/typescript/specs/NativeFTReactNativeTrace.d.ts +12 -0
- package/lib/typescript/specs/NativeFTReactNativeWebSocket.d.ts +13 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +7 -6
- package/src/ft_mobile_agent.tsx +49 -6
- package/src/ft_rum.tsx +61 -2
- package/src/ft_tracing.tsx +15 -1
- package/src/index.tsx +4 -0
- package/src/rum/FTBabelInteractionTracking.ts +124 -0
- package/src/rum/FTBabelUtils.tsx +99 -0
- package/src/rum/FTRumActionTracking.tsx +14 -43
- package/src/rum/FTRumActionTrackingContext.ts +68 -0
- package/src/rum/FTRumWebSocketNative.ts +106 -0
- package/src/rum/FTRumWebSocketTiming.ts +50 -0
- package/src/rum/FTRumWebSocketTracking.ts +727 -0
- package/src/rum/longTasksUtils.ts +17 -0
- package/src/specs/NativeFTMobileReactNative.ts +17 -0
- package/src/specs/NativeFTReactNativeRUM.ts +4 -0
- package/src/specs/NativeFTReactNativeTrace.ts +12 -0
- package/src/specs/NativeFTReactNativeWebSocket.ts +33 -0
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sources":["NativeFTMobileReactNative.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n /**\n * SDK initialization method.\n * @param config SDK initialization configuration items.\n * @returns a Promise.\n */\n sdkConfig(config: Object): 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}\nexport default TurboModuleRegistry.get<Spec>('FTMobileReactNative');\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAFA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sources":["NativeFTMobileReactNative.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n /**\n * SDK initialization method.\n * @param config SDK initialization configuration items.\n * @returns a Promise.\n */\n sdkConfig(config: Object): 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 * Update remote configuration using the configured minimum update interval.\n */\n updateRemoteConfig(): Promise<Object>;\n /**\n * Update remote configuration using a custom minimum update interval and\n * optional override rules.\n */\n updateRemoteConfigWithMiniUpdateInterval(\n interval: number,\n rules?: Array<Object>\n ): Promise<Object>;\n /**\n * Required by NativeEventEmitter for remote configuration callbacks.\n */\n addListener(eventName: string): void;\n removeListeners(count: number): void;\n}\nexport default TurboModuleRegistry.get<Spec>('FTMobileReactNative');\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAFA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAmGeC,gCAAmB,CAACC,GAAG,CAAO,qBAAqB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sources":["NativeFTReactNativeRUM.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n /**\n * Set RUM tracking conditions and enable RUM collection.\n * @param config rum configuration parameters.\n * @returns a Promise.\n */\n setConfig(config: Object): Promise<void>;\n /**\n * Start RUM Action.\n * RUM will bind Resource, Error, LongTask events that may be triggered by this Action.\n * 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.\n * Adding Action with `addAction` method does not affect each other.\n * @param actionName action name\n * @param actionType action type\n * @param property event context (optional)\n * @returns a Promise.\n */\n startAction(\n actionName: string,\n actionType: string,\n property?: Object\n ): Promise<void>;\n /**\n * Add Action event. This type of data cannot be associated with Error, Resource, LongTask data, and has no discard logic.\n * @param actionName action name\n * @param actionType action type\n * @param property event context (optional)\n * @returns a Promise.\n */\n addAction(\n actionName: string,\n actionType: string,\n property?: Object\n ): Promise<void>;\n /**\n * view load duration.\n * @param viewName view name\n * @param loadTime view load duration\n * @returns a Promise.\n */\n onCreateView(viewName: string, loadTime: number): Promise<void>;\n /**\n * view start.\n * @param viewName page name\n * @param property event context (optional)\n * @returns a Promise.\n */\n startView(viewName: string, property?: Object): Promise<void>;\n /**\n * view end.\n * @param property event context (optional)\n * @returns a Promise.\n */\n stopView(property?: Object): Promise<void>;\n /**\n * Exception capture and log collection.\n * @param stack stack log\n * @param message error message\n * @param property event context (optional)\n * @returns a Promise.\n */\n addError(stack: string, message: string, property?: Object): Promise<void>;\n /**\n * Exception capture and log collection.\n * @param type error type\n * @param stack stack log\n * @param message error message\n * @param property event context (optional)\n * @returns a Promise.\n */\n addErrorWithType(\n type: string,\n stack: string,\n message: string,\n property?: Object\n ): Promise<void>;\n /**\n * Start resource request.\n * @param key unique id\n * @param property event context (optional)\n * @returns a Promise.\n */\n startResource(key: string, property?: Object): Promise<void>;\n /**\n * End resource request.\n * @param key unique id\n * @param property event context (optional)\n * @returns a Promise.\n */\n stopResource(key: string, property?: Object): Promise<void>;\n /**\n * Send resource data metrics.\n * @param key unique id\n * @param resource resource data\n * @param metrics resource performance data\n * @returns a Promise.\n */\n addResource(key: string, resource: Object, metrics?: Object): Promise<void>;\n}\nexport default TurboModuleRegistry.get<Spec>('FTReactNativeRUM');\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAFA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sources":["NativeFTReactNativeRUM.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n /**\n * Set RUM tracking conditions and enable RUM collection.\n * @param config rum configuration parameters.\n * @returns a Promise.\n */\n setConfig(config: Object): Promise<void>;\n /** Internal synchronous snapshot used only by native JS long task reporting. */\n setLongTaskContext(context: Object): boolean;\n /** Stops the internal JavaScript long task monitor before SDK shutdown. */\n stopLongTaskTracking(): Promise<void>;\n /**\n * Start RUM Action.\n * RUM will bind Resource, Error, LongTask events that may be triggered by this Action.\n * 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.\n * Adding Action with `addAction` method does not affect each other.\n * @param actionName action name\n * @param actionType action type\n * @param property event context (optional)\n * @returns a Promise.\n */\n startAction(\n actionName: string,\n actionType: string,\n property?: Object\n ): Promise<void>;\n /**\n * Add Action event. This type of data cannot be associated with Error, Resource, LongTask data, and has no discard logic.\n * @param actionName action name\n * @param actionType action type\n * @param property event context (optional)\n * @returns a Promise.\n */\n addAction(\n actionName: string,\n actionType: string,\n property?: Object\n ): Promise<void>;\n /**\n * view load duration.\n * @param viewName view name\n * @param loadTime view load duration\n * @returns a Promise.\n */\n onCreateView(viewName: string, loadTime: number): Promise<void>;\n /**\n * view start.\n * @param viewName page name\n * @param property event context (optional)\n * @returns a Promise.\n */\n startView(viewName: string, property?: Object): Promise<void>;\n /**\n * view end.\n * @param property event context (optional)\n * @returns a Promise.\n */\n stopView(property?: Object): Promise<void>;\n /**\n * Exception capture and log collection.\n * @param stack stack log\n * @param message error message\n * @param property event context (optional)\n * @returns a Promise.\n */\n addError(stack: string, message: string, property?: Object): Promise<void>;\n /**\n * Exception capture and log collection.\n * @param type error type\n * @param stack stack log\n * @param message error message\n * @param property event context (optional)\n * @returns a Promise.\n */\n addErrorWithType(\n type: string,\n stack: string,\n message: string,\n property?: Object\n ): Promise<void>;\n /**\n * Start resource request.\n * @param key unique id\n * @param property event context (optional)\n * @returns a Promise.\n */\n startResource(key: string, property?: Object): Promise<void>;\n /**\n * End resource request.\n * @param key unique id\n * @param property event context (optional)\n * @returns a Promise.\n */\n stopResource(key: string, property?: Object): Promise<void>;\n /**\n * Send resource data metrics.\n * @param key unique id\n * @param resource resource data\n * @param metrics resource performance data\n * @returns a Promise.\n */\n addResource(key: string, resource: Object, metrics?: Object): Promise<void>;\n}\nexport default TurboModuleRegistry.get<Spec>('FTReactNativeRUM');\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAFA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GA2GeC,gCAAmB,CAACC,GAAG,CAAO,kBAAkB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sources":["NativeFTReactNativeTrace.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n /**\n * Configure trace to enable distributed tracing.\n * @param config trace configuration parameters.\n * @returns a Promise.\n */\n setConfig(config: Object): Promise<void>;\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @returns trace request header parameters\n * @deprecated use getTraceHeaderFields() replace.\n */\n getTraceHeader(key: string, url: string): Promise<Object>;\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @returns trace request header parameters\n */\n getTraceHeaderFields(url: string, key?: string): Promise<Object>;\n}\nexport default TurboModuleRegistry.get<Spec>('FTReactNativeTrace');\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAFA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sources":["NativeFTReactNativeTrace.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n /**\n * Configure trace to enable distributed tracing.\n * @param config trace configuration parameters.\n * @returns a Promise.\n */\n setConfig(config: Object): Promise<void>;\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @returns trace request header parameters\n * @deprecated use getTraceHeaderFields() replace.\n */\n getTraceHeader(key: string, url: string): Promise<Object>;\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @returns trace request header parameters\n */\n getTraceHeaderFields(url: string, key?: string): Promise<Object>;\n /**\n * Get trace HTTP request headers synchronously for APIs whose construction\n * cannot wait for a Promise, such as React Native WebSocket.\n * @internal\n */\n getTraceHeaderFieldsSync(url: string, key: string): Object | null;\n /**\n * Discard iOS Trace correlation when WebSocket observation is abandoned\n * before Resource reporting starts. Android uses native collection.\n * @internal\n */\n cancelWebSocketTrace(key: string): Promise<void>;\n}\nexport default TurboModuleRegistry.get<Spec>('FTReactNativeTrace');\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAFA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAqCeC,gCAAmB,CAACC,GAAG,CAAO,oBAAoB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
9
|
+
/** Internal iOS handshake reporting bridge; absent on Android and older binaries. */
|
|
10
|
+
var _default = exports.default = _reactNative.TurboModuleRegistry.get('FTReactNativeWebSocket');
|
|
11
|
+
//# sourceMappingURL=NativeFTReactNativeWebSocket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sources":["NativeFTReactNativeWebSocket.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/** Internal iOS handshake reporting bridge; absent on Android and older binaries. */\nexport interface Spec extends TurboModule {\n startCapture(session: string): Promise<void>;\n stopCapture(session: string): Promise<void>;\n clear(): Promise<void>;\n startResource(\n key: string,\n socketID: number,\n url: string,\n session: string,\n sequence: number,\n property: Object\n ): Promise<void>;\n stopResource(\n key: string,\n event: string,\n session: string,\n property: Object\n ): Promise<void>;\n addResource(\n key: string,\n content: Object,\n metrics: Object,\n session: string\n ): Promise<void>;\n releaseResource(key: string, session: string): Promise<void>;\n}\n\nexport default TurboModuleRegistry.get<Spec>('FTReactNativeWebSocket');\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAFA;AAIA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GA4BeC,gCAAmB,CAACC,GAAG,CAAO,wBAAwB,CAAC","ignoreList":[]}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["version","exports"],"sources":["version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '0.4.
|
|
1
|
+
{"version":3,"names":["version","exports"],"sources":["version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '0.4.3-alpha.2';\n"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,eAAe","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
4
4
|
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); }
|
|
5
5
|
import { NativeEventEmitter, NativeModules } from 'react-native';
|
|
6
6
|
import { version as sdkVersion } from './version';
|
|
7
|
+
import { FTRumWebSocketTracking } from './rum/FTRumWebSocketTracking';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Bridge context manager for managing shared properties across RUM and Logger modules
|
|
@@ -13,6 +14,7 @@ import { version as sdkVersion } from './version';
|
|
|
13
14
|
class BridgeContextManager {
|
|
14
15
|
constructor() {
|
|
15
16
|
_defineProperty(this, "properties", new Map());
|
|
17
|
+
_defineProperty(this, "longTaskContextEnabled", false);
|
|
16
18
|
// Initialize with SDK version information
|
|
17
19
|
this.initializeSDKInfo();
|
|
18
20
|
}
|
|
@@ -53,10 +55,32 @@ class BridgeContextManager {
|
|
|
53
55
|
Object.entries(properties).forEach(([key, value]) => {
|
|
54
56
|
this.properties.set(key, value);
|
|
55
57
|
});
|
|
58
|
+
if (this.longTaskContextEnabled) {
|
|
59
|
+
this.syncLongTaskContext();
|
|
60
|
+
}
|
|
56
61
|
} catch (error) {
|
|
57
62
|
console.warn('Failed to append bridge context:', error);
|
|
58
63
|
}
|
|
59
64
|
}
|
|
65
|
+
configureLongTaskContext(enabled) {
|
|
66
|
+
this.longTaskContextEnabled = enabled;
|
|
67
|
+
if (enabled) {
|
|
68
|
+
this.syncLongTaskContext();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
syncLongTaskContext() {
|
|
72
|
+
try {
|
|
73
|
+
// Apply the snapshot before JS can block. An async native call may run after
|
|
74
|
+
// the frame that detects the long task and attach stale context to it.
|
|
75
|
+
const rum =
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
77
|
+
require('./specs/NativeFTReactNativeRUM').default;
|
|
78
|
+
rum.setLongTaskContext(this.mergeWithLocalPropertiesSync());
|
|
79
|
+
} catch (error) {
|
|
80
|
+
// Context synchronization must not make a destroyed/older bridge crash the host.
|
|
81
|
+
console.warn('Failed to sync JS long task bridge context:', error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
60
84
|
|
|
61
85
|
/**
|
|
62
86
|
* Merge bridge context properties with local properties
|
|
@@ -157,6 +181,8 @@ export let FTDBCacheDiscard = /*#__PURE__*/function (FTDBCacheDiscard) {
|
|
|
157
181
|
* @param syncSleepTime interval time between each request during data synchronization, unit milliseconds, 0 < syncSleepTime < 100
|
|
158
182
|
* @param enableDataIntegerCompatible whether to enable data integer compatibility during data synchronization, enabled by default
|
|
159
183
|
* @param compressIntakeRequests whether to compress synchronized data
|
|
184
|
+
* @param enableDataFilter whether to enable SDK-side local data filters, enabled by default
|
|
185
|
+
* @param dataFilters local blocklist filter rules. Supported categories include `logging` and `rum`. Any data that matches a rule will be discarded.
|
|
160
186
|
* @param globalContext custom global parameters
|
|
161
187
|
* @param groupIdentifiers iOS side sets the AppGroups Identifier array corresponding to the collected Widget Extension
|
|
162
188
|
* @param enableLimitWithDbSize set whether to enable using db to limit data size, after enabling, `FTLogConfig.logCacheLimitCount` and `FTRUMConfig.rumCacheLimitCount` will no longer take effect
|
|
@@ -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
|
}
|
|
@@ -218,14 +245,20 @@ class FTMobileReactNativeWrapper {
|
|
|
218
245
|
flushSyncData() {
|
|
219
246
|
return this.sdk.flushSyncData();
|
|
220
247
|
}
|
|
221
|
-
shutDown() {
|
|
222
|
-
|
|
248
|
+
async shutDown() {
|
|
249
|
+
bridgeContextManager.configureLongTaskContext(false);
|
|
250
|
+
try {
|
|
251
|
+
FTRumWebSocketTracking.shutDown();
|
|
252
|
+
await this.rum.stopLongTaskTracking();
|
|
253
|
+
} finally {
|
|
254
|
+
await this.sdk.shutDown();
|
|
255
|
+
}
|
|
223
256
|
}
|
|
224
257
|
clearAllData() {
|
|
225
258
|
return this.sdk.clearAllData();
|
|
226
259
|
}
|
|
227
260
|
appendBridgeContext(properties) {
|
|
228
|
-
//
|
|
261
|
+
// Store properties in JS and update the native long task snapshot when enabled.
|
|
229
262
|
bridgeContextManager.appendBridgeContext(properties);
|
|
230
263
|
}
|
|
231
264
|
updateRemoteConfig() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","version","sdkVersion","BridgeContextManager","constructor","_defineProperty","Map","initializeSDKInfo","sdkBridgeInfo","react_native","properties","set","JSON","stringify","getInstance","instance","appendBridgeContext","Object","entries","forEach","key","value","error","console","warn","mergeWithLocalPropertiesSync","localProperties","merged","assign","_BridgeContextManager","bridgeContextManager","EnvType","FTDBCacheDiscard","FTMobileReactNativeWrapper","require","default","getEmitter","_NativeModules$FTMobi","emitter","nativeEventModule","FTMobileReactNative","sdk","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 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 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,SAEEA,kBAAkB,EAClBC,aAAa,QACR,cAAc;AACrB,SAASC,OAAO,IAAIC,UAAU,QAAQ,WAAW;;AAEjD;AACA;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,CAAC;EAIjBC,WAAWA,CAAA,EAAG;IAAAC,eAAA,qBAFiB,IAAIC,GAAG,CAAC,CAAC;IAG9C;IACA,IAAI,CAACC,iBAAiB,CAAC,CAAC;EAC1B;;EAEA;AACF;AACA;AACA;EACUA,iBAAiBA,CAAA,EAAS;IAChC;IACA,MAAMC,aAAa,GAAG;MACpBC,YAAY,EAAEP;IAChB,CAAC;;IAED;IACA,IAAI,CAACQ,UAAU,CAACC,GAAG,CAAC,iBAAiB,EAAEC,IAAI,CAACC,SAAS,CAACL,aAAa,CAAC,CAAC;EACvE;;EAEA;AACF;AACA;AACA;EACE,OAAcM,WAAWA,CAAA,EAAyB;IAChD,IAAI,CAACX,oBAAoB,CAACY,QAAQ,EAAE;MAClCZ,oBAAoB,CAACY,QAAQ,GAAG,IAAIZ,oBAAoB,CAAC,CAAC;IAC5D;IACA,OAAOA,oBAAoB,CAACY,QAAQ;EACtC;;EAEA;AACF;AACA;AACA;EACSC,mBAAmBA,CAACN,UAA+B,EAAQ;IAChE;IACA,IAAI;MACF;MACAO,MAAM,CAACC,OAAO,CAACR,UAAU,CAAC,CAACS,OAAO,CAAC,CAAC,CAACC,GAAG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AC;EACtC;EACAC,wCAAwCA,CACtCC,QAAgB,EAChBC,KAAyC,EACV;IAC/B,OAAO,IAAI,CAAC5B,GAAG,CAAC0B,wCAAwC,CAACC,QAAQ,EAAEC,KAAK,CAAC;EAC3E;EACAC,uBAAuBA,CACrBC,QAAgD,EAC3B;IACrB,OAAO,IAAI,CAACnC,UAAU,CAAC,CAAC,CAACoC,WAAW,CAAC,2BAA2B,EAAED,QAAQ,CAAC;EAC7E;AACF;AACA,OAAO,MAAM/B,mBAA4C,GACvD,IAAIP,0BAA0B,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","version","sdkVersion","FTRumWebSocketTracking","BridgeContextManager","constructor","_defineProperty","Map","initializeSDKInfo","sdkBridgeInfo","react_native","properties","set","JSON","stringify","getInstance","instance","appendBridgeContext","Object","entries","forEach","key","value","longTaskContextEnabled","syncLongTaskContext","error","console","warn","configureLongTaskContext","enabled","rum","require","default","setLongTaskContext","mergeWithLocalPropertiesSync","localProperties","merged","assign","_BridgeContextManager","bridgeContextManager","EnvType","FTDBCacheDiscard","FTMobileReactNativeWrapper","getEmitter","_NativeModules$FTMobi","emitter","nativeEventModule","FTMobileReactNative","sdk","sdkConfig","config","serverUrl","length","datakitUrl","setDatakitURL","setDatawayURL","datawayUrl","clientToken","bindRUMUserData","userId","userName","userEmail","extra","unbindRUMUserData","appendGlobalContext","context","appendLogGlobalContext","appendRUMGlobalContext","trackEventFromExtension","identifier","flushSyncData","shutDown","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 */\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: 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 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 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,SAEEA,kBAAkB,EAClBC,aAAa,QACR,cAAc;AAGrB,SAASC,OAAO,IAAIC,UAAU,QAAQ,WAAW;AACjD,SAASC,sBAAsB,QAAQ,8BAA8B;;AAErE;AACA;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,CAAC;EAKjBC,WAAWA,CAAA,EAAG;IAAAC,eAAA,qBAHiB,IAAIC,GAAG,CAAC,CAAC;IAAAD,eAAA,iCACf,KAAK;IAGpC;IACA,IAAI,CAACE,iBAAiB,CAAC,CAAC;EAC1B;;EAEA;AACF;AACA;AACA;EACUA,iBAAiBA,CAAA,EAAS;IAChC;IACA,MAAMC,aAAa,GAAG;MACpBC,YAAY,EAAER;IAChB,CAAC;;IAED;IACA,IAAI,CAACS,UAAU,CAACC,GAAG,CAAC,iBAAiB,EAAEC,IAAI,CAACC,SAAS,CAACL,aAAa,CAAC,CAAC;EACvE;;EAEA;AACF;AACA;AACA;EACE,OAAcM,WAAWA,CAAA,EAAyB;IAChD,IAAI,CAACX,oBAAoB,CAACY,QAAQ,EAAE;MAClCZ,oBAAoB,CAACY,QAAQ,GAAG,IAAIZ,oBAAoB,CAAC,CAAC;IAC5D;IACA,OAAOA,oBAAoB,CAACY,QAAQ;EACtC;;EAEA;AACF;AACA;AACA;EACSC,mBAAmBA,CAACN,UAA+B,EAAQ;IAChE;IACA,IAAI;MACF;MACAO,MAAM,CAACC,OAAO,CAACR,UAAU,CAAC,CAACS,OAAO,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;QACnD,IAAI,CAACX,UAAU,CAACC,GAAG,CAACS,GAAG,EAAEC,KAAK,CAAC;MACjC,CAAC,CAAC;MACF,IAAI,IAAI,CAACC,sBAAsB,EAAE;QAC/B,IAAI,CAACC,mBAAmB,CAAC,CAAC;MAC5B;IACF,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdC,OAAO,CAACC,I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EACA,MAAMC,QAAQA,CAAA,EAAkB;IAC9BhC,oBAAoB,CAACX,wBAAwB,CAAC,KAAK,CAAC;IACpD,IAAI;MACFzB,sBAAsB,CAACoE,QAAQ,CAAC,CAAC;MACjC,MAAM,IAAI,CAACzC,GAAG,CAAC0C,oBAAoB,CAAC,CAAC;IACvC,CAAC,SAAS;MACR,MAAM,IAAI,CAACxB,GAAG,CAACuB,QAAQ,CAAC,CAAC;IAC3B;EACF;EACAE,YAAYA,CAAA,EAAkB;IAC5B,OAAO,IAAI,CAACzB,GAAG,CAACyB,YAAY,CAAC,CAAC;EAChC;EACAxD,mBAAmBA,CAACN,UAA+B,EAAQ;IACzD;IACA4B,oBAAoB,CAACtB,mBAAmB,CAACN,UAAU,CAAC;EACtD;EACA+D,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,CACtDC,QAAQ,EACRC,KACF,CAAC;EACH;EACAC,uBAAuBA,CACrBC,QAAgD,EAC3B;IACrB,OAAO,IAAI,CAACpC,UAAU,CAAC,CAAC,CAACqC,WAAW,CAAC,2BAA2B,EAAED,QAAQ,CAAC;EAC7E;AACF;AACA,OAAO,MAAMhC,mBAA4C,GACvD,IAAIL,0BAA0B,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/ft_rum.js
CHANGED
|
@@ -2,9 +2,13 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
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); }
|
|
4
4
|
// import { NativeModules } from 'react-native';
|
|
5
|
+
import { Platform } from 'react-native';
|
|
5
6
|
import { FTRumErrorTracking } from './rum/FTRumErrorTracking';
|
|
6
7
|
import { FTRumActionTracking } from './rum/FTRumActionTracking';
|
|
8
|
+
import { FTBabelInteractionTracking } from './rum/FTBabelInteractionTracking';
|
|
9
|
+
import { FTRumWebSocketTracking } from './rum/FTRumWebSocketTracking';
|
|
7
10
|
import { bridgeContextManager } from './ft_mobile_agent';
|
|
11
|
+
import { normalizeLongTaskThreshold } from './rum/longTasksUtils';
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* Error monitoring type.
|
|
@@ -74,9 +78,15 @@ export let IOSCrashMonitoringType = /*#__PURE__*/function (IOSCrashMonitoringTyp
|
|
|
74
78
|
* @param enableTrackNativeAppANR whether to collect Native ANR
|
|
75
79
|
* @param enableTrackNativeFreeze whether to collect Native Freeze
|
|
76
80
|
* @param nativeFreezeDurationMs set the threshold for collecting Native Freeze, value range [100,), unit ms. iOS default 250ms, Android default 1000ms
|
|
81
|
+
* @param enableLongTask whether to collect React Native JavaScript LongTasks, default false
|
|
82
|
+
* @param longTaskThresholdMs set the threshold for collecting React Native JavaScript LongTasks, unit ms. Defaults to 100 and is clamped to [100, 5000]
|
|
77
83
|
* @param enableNativeUserAction whether to start Native Action tracking, Button click events, recommended to disable for pure react-native apps
|
|
78
84
|
* @param enableNativeUserView whether to start Native View auto tracking, recommended to disable for pure react-native apps
|
|
79
85
|
* @param enableNativeUserResource whether to automatically collect react-native Resource
|
|
86
|
+
* @param enableIOSWebSocketResource whether to collect iOS WebSocket opening handshakes as RUM Resources. Defaults to false.
|
|
87
|
+
* Independent of enableNativeUserResource. Android native WebSocket collection is unaffected.
|
|
88
|
+
* iOS WebSocket Trace header injection requires both this option and enableNativeAutoTrace.
|
|
89
|
+
* When disabled, new iOS WebSocket connections are not instrumented or automatically injected with Trace headers by this SDK.
|
|
80
90
|
* @param enableResourceHostIP whether to collect network request Host IP (only for native http, iOS 13 and above)
|
|
81
91
|
* @param errorMonitorType error monitoring supplement type
|
|
82
92
|
* @param deviceMonitorType page monitoring supplement type
|
|
@@ -110,20 +120,54 @@ export let IOSCrashMonitoringType = /*#__PURE__*/function (IOSCrashMonitoringTyp
|
|
|
110
120
|
* @param resource_first_byte resource first byte time
|
|
111
121
|
*/
|
|
112
122
|
|
|
123
|
+
function isBabelPluginEnabled() {
|
|
124
|
+
if (typeof globalThis !== 'undefined') {
|
|
125
|
+
return globalThis.__FT_RN_BABEL_PLUGIN_ENABLED__ === true;
|
|
126
|
+
}
|
|
127
|
+
if (typeof global !== 'undefined') {
|
|
128
|
+
return global.__FT_RN_BABEL_PLUGIN_ENABLED__ === true;
|
|
129
|
+
}
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
113
132
|
class FTReactNativeRUMWrapper {
|
|
114
133
|
constructor() {
|
|
134
|
+
_defineProperty(this, "webSocketConfigVersion", 0);
|
|
115
135
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
116
136
|
_defineProperty(this, "rum", require('./specs/NativeFTReactNativeRUM').default);
|
|
117
137
|
}
|
|
118
138
|
setConfig(config) {
|
|
139
|
+
bridgeContextManager.configureLongTaskContext(config.enableLongTask === true);
|
|
140
|
+
const webSocketLifecycle = FTRumWebSocketTracking.getLifecycleVersion();
|
|
141
|
+
const webSocketConfigVersion = ++this.webSocketConfigVersion;
|
|
142
|
+
const trackWebSocket = config.enableIOSWebSocketResource === true;
|
|
119
143
|
console.log('FTRUMConfig');
|
|
120
144
|
if (config.enableAutoTrackError) {
|
|
121
145
|
FTRumErrorTracking.startTracking();
|
|
122
146
|
}
|
|
123
|
-
|
|
147
|
+
const babelPluginEnabled = isBabelPluginEnabled();
|
|
148
|
+
FTBabelInteractionTracking.configure({
|
|
149
|
+
trackInteractions: babelPluginEnabled && Boolean(config.enableAutoTrackUserAction),
|
|
150
|
+
actionReporter: (actionName, actionType, property) => this.startAction(actionName, actionType, property)
|
|
151
|
+
});
|
|
152
|
+
if (config.enableAutoTrackUserAction && !babelPluginEnabled) {
|
|
124
153
|
FTRumActionTracking.startTracking();
|
|
154
|
+
} else {
|
|
155
|
+
FTRumActionTracking.stopTracking();
|
|
125
156
|
}
|
|
126
|
-
return this.rum.setConfig(
|
|
157
|
+
return this.rum.setConfig({
|
|
158
|
+
...config,
|
|
159
|
+
enableLongTask: config.enableLongTask === true,
|
|
160
|
+
longTaskThresholdMs: normalizeLongTaskThreshold(config.longTaskThresholdMs)
|
|
161
|
+
}).then(() => {
|
|
162
|
+
if (webSocketLifecycle !== FTRumWebSocketTracking.getLifecycleVersion() || webSocketConfigVersion !== this.webSocketConfigVersion) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (Platform.OS === 'ios' && trackWebSocket) {
|
|
166
|
+
FTRumWebSocketTracking.startTracking(this);
|
|
167
|
+
} else {
|
|
168
|
+
FTRumWebSocketTracking.stopTracking();
|
|
169
|
+
}
|
|
170
|
+
});
|
|
127
171
|
}
|
|
128
172
|
startAction(actionName, actionType, property) {
|
|
129
173
|
// Automatically merge bridge context properties with local properties
|
package/lib/module/ft_rum.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FTRumErrorTracking","FTRumActionTracking","bridgeContextManager","ErrorMonitorType","DeviceMetricsMonitorType","DetectFrequency","FTRUMCacheDiscard","IOSCrashMonitoringType","FTReactNativeRUMWrapper","constructor","_defineProperty","require","default","setConfig","config","console","log","enableAutoTrackError","startTracking","enableAutoTrackUserAction","rum","startAction","actionName","actionType","property","mergedProperties","mergeWithLocalPropertiesSync","addAction","onCreateView","viewName","loadTime","startView","stopView","addError","stack","message","addErrorWithType","type","startResource","key","stopResource","addResource","resource","metrics","FTReactNativeRUM"],"sources":["ft_rum.tsx"],"sourcesContent":["// import { NativeModules } from 'react-native';\nimport { FTRumErrorTracking } from './rum/FTRumErrorTracking';\nimport { FTRumActionTracking } from './rum/FTRumActionTracking';\nimport { bridgeContextManager } from './ft_mobile_agent';\n\n/**\n * Error monitoring type.\n */\n/* eslint-disable no-bitwise */\nexport enum ErrorMonitorType {\n all = 0xffffffff,\n battery = 1 << 1,\n memory = 1 << 2,\n cpu = 1 << 3,\n}\n/**\n * Page monitoring supplement type\n */\nexport enum DeviceMetricsMonitorType {\n all = 0xffffffff,\n battery = 1 << 1,\n memory = 1 << 2,\n cpu = 1 << 3,\n fps = 1 << 4,\n}\n/**\n * Device information monitoring cycle.\n */\nexport enum DetectFrequency {\n normal,\n frequent,\n rare,\n}\n\nexport enum FTRUMCacheDiscard {\n discard,\n discardOldest,\n}\n\nexport enum IOSCrashMonitoringType {\n /** Monitor Mach kernel exceptions. */\n machException = 0x01,\n\n /** Monitor fatal signals. */\n signal = 0x02,\n\n /** Monitor uncaught C++ exceptions. */\n cppException = 0x04,\n\n /** Monitor uncaught Objective-C NSExceptions. */\n nsException = 0x08,\n\n /** Track and inject system information. */\n system = 0x40,\n\n /** Track and inject application state information. */\n applicationState = 0x80,\n\n /** All crash monitor types. */\n all = machException |\n signal |\n cppException |\n nsException |\n applicationState |\n system,\n\n /** High compatibility crash monitor types (excludes Mach exceptions). */\n highCompatibility = all & ~machException,\n}\n/* eslint-enable no-bitwise */\n/**\n * Set RUM tracking conditions.\n * @param androidAppId appId, apply during monitoring\n * @param iOSAppId appId, apply during monitoring\n * @param sampleRate sampling rate\n * @param sessionOnErrorSampleRate error session sampling rate. For sessions not sampled, if ERROR is hit, collect data 1 minute before the error occurs\n * @param enableAutoTrackUserAction whether to automatically collect react-native control click events, can set actionName with accessibilityLabel when enabled\n * @param enableTrackError whether to automatically collect react-native Error\n * @param enableTrackNativeCrash whether to collect Native Error\n * @param enableTrackNativeAppANR whether to collect Native ANR\n * @param enableTrackNativeFreeze whether to collect Native Freeze\n * @param nativeFreezeDurationMs set the threshold for collecting Native Freeze, value range [100,), unit ms. iOS default 250ms, Android default 1000ms\n * @param enableNativeUserAction whether to start Native Action tracking, Button click events, recommended to disable for pure react-native apps\n * @param enableNativeUserView whether to start Native View auto tracking, recommended to disable for pure react-native apps\n * @param enableNativeUserResource whether to automatically collect react-native Resource\n * @param enableResourceHostIP whether to collect network request Host IP (only for native http, iOS 13 and above)\n * @param errorMonitorType error monitoring supplement type\n * @param deviceMonitorType page monitoring supplement type\n * @param detectFrequency monitoring frequency\n * @param globalContext custom global parameters\n * @param rumCacheLimitCount RUM max cache size, default 100_000\n * @param rumDiscardStrategy RUM data discard strategy\n * @param enableTraceWebView Set whether to enable WebView data collection, default true\n * @param allowWebViewHost Set specific hosts or domains allowed to collect WebView data, nil means collect all\n * @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.\n */\nexport interface FTRUMConfig {\n androidAppId: string;\n iOSAppId: string;\n sampleRate?: number;\n sessionOnErrorSampleRate?: number;\n enableAutoTrackUserAction?: boolean;\n enableAutoTrackError?: boolean;\n enableTrackNativeCrash?: boolean;\n enableTrackNativeAppANR?: boolean;\n enableTrackNativeFreeze?: boolean;\n nativeFreezeDurationMs?: number;\n enableNativeUserAction?: boolean;\n enableNativeUserView?: boolean;\n enableNativeUserResource?: boolean;\n enableResourceHostIP?: boolean;\n errorMonitorType?: ErrorMonitorType;\n deviceMonitorType?: DeviceMetricsMonitorType;\n detectFrequency?: DetectFrequency;\n globalContext?: object;\n rumCacheLimitCount?: number;\n rumDiscardStrategy?: FTRUMCacheDiscard;\n enableTraceWebView?: boolean;\n allowWebViewHost?: Array<string>;\n iosCrashMonitoringType?: IOSCrashMonitoringType;\n}\n/**\n * RUM Resource data.\n * @param url request URL\n * @param httpMethod request method\n * @param requestHeader request header parameters\n * @param responseHeader response header parameters\n * @param responseBody response content\n * @param resourceStatus response status code\n */\nexport interface FTRUMResource {\n url: string;\n httpMethod: string;\n requestHeader: object;\n responseHeader?: object;\n responseBody?: string;\n resourceStatus?: number;\n}\n/**\n * RUM Resource performance metrics.\n * @param duration resource load time\n * @param resource_dns resource DNS resolution time\n * @param resource_tcp resource TCP connection time\n * @param resource_ssl resource SSL connection time\n * @param resource_ttfb resource request response time\n * @param resource_trans resource content transfer time\n * @param resource_first_byte resource first byte time\n */\nexport interface FTRUMResourceMetrics {\n duration?: number;\n resource_dns?: number;\n resource_tcp?: number;\n resource_ssl?: number;\n resource_ttfb?: number;\n resource_trans?: number;\n resource_first_byte?: number;\n}\ntype FTReactNativeRUMType = {\n /**\n * Set RUM tracking conditions and enable RUM collection.\n * @param config rum configuration parameters.\n * @returns a Promise.\n */\n setConfig(config: FTRUMConfig): Promise<void>;\n /**\n * Start RUM Action.\n * RUM will bind Resource, Error, LongTask events that may be triggered by this Action.\n * 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.\n * Adding Action with `addAction` method does not affect each other.\n * @param actionName action name\n * @param actionType action type\n * @param property event context (optional)\n * @returns a Promise.\n */\n startAction(\n actionName: string,\n actionType: string,\n property?: object\n ): Promise<void>;\n /**\n * Add Action event. This type of data cannot be associated with Error, Resource, LongTask data, and has no discard logic.\n * @param actionName action name\n * @param actionType action type\n * @param property event context (optional)\n * @returns a Promise.\n */\n addAction(\n actionName: string,\n actionType: string,\n property?: object\n ): Promise<void>;\n /**\n * view load duration.\n * @param viewName view name\n * @param loadTime view load duration\n * @returns a Promise.\n */\n onCreateView(viewName: string, loadTime: number): Promise<void>;\n /**\n * view start.\n * @param viewName page name\n * @param property event context (optional)\n * @returns a Promise.\n */\n startView(viewName: string, property?: object): Promise<void>;\n /**\n * view end.\n * @param property event context (optional)\n * @returns a Promise.\n */\n stopView(property?: object): Promise<void>;\n /**\n * Exception capture and log collection.\n * @param stack stack log\n * @param message error message\n * @param property event context (optional)\n * @returns a Promise.\n */\n addError(stack: string, message: string, property?: object): Promise<void>;\n /**\n * Exception capture and log collection.\n * @param type error type\n * @param stack stack log\n * @param message error message\n * @param property event context (optional)\n * @returns a Promise.\n */\n addErrorWithType(\n type: string,\n stack: string,\n message: string,\n property?: object\n ): Promise<void>;\n /**\n * Start resource request.\n * @param key unique id\n * @param property event context (optional)\n * @returns a Promise.\n */\n startResource(key: string, property?: object): Promise<void>;\n /**\n * End resource request.\n * @param key unique id\n * @param property event context (optional)\n * @returns a Promise.\n */\n stopResource(key: string, property?: object): Promise<void>;\n /**\n * Send resource data metrics.\n * @param key unique id\n * @param resource resource data\n * @param metrics resource performance data\n * @returns a Promise.\n */\n addResource(\n key: string,\n resource: FTRUMResource,\n metrics?: FTRUMResourceMetrics\n ): Promise<void>;\n};\n\nclass FTReactNativeRUMWrapper implements FTReactNativeRUMType {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n private rum: FTReactNativeRUMType = require('./specs/NativeFTReactNativeRUM')\n .default;\n\n setConfig(config: FTRUMConfig): Promise<void> {\n console.log('FTRUMConfig');\n if (config.enableAutoTrackError) {\n FTRumErrorTracking.startTracking();\n }\n if (config.enableAutoTrackUserAction) {\n FTRumActionTracking.startTracking();\n }\n return this.rum.setConfig(config);\n }\n startAction(\n actionName: string,\n actionType: string,\n property?: object\n ): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.startAction(actionName, actionType, mergedProperties);\n }\n addAction(\n actionName: string,\n actionType: string,\n property?: object\n ): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.addAction(actionName, actionType, mergedProperties);\n }\n onCreateView(viewName: string, loadTime: number): Promise<void> {\n return this.rum.onCreateView(viewName, loadTime);\n }\n startView(viewName: string, property?: object): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.startView(viewName, mergedProperties);\n }\n stopView(property?: object): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.stopView(mergedProperties);\n }\n addError(stack: string, message: string, property?: object): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.addError(stack, message, mergedProperties);\n }\n addErrorWithType(\n type: string,\n stack: string,\n message: string,\n property?: object\n ): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.addErrorWithType(type, stack, message, mergedProperties);\n }\n startResource(key: string, property?: object): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.startResource(key, mergedProperties);\n }\n stopResource(key: string, property?: object): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.stopResource(key, mergedProperties);\n }\n addResource(\n key: string,\n resource: FTRUMResource,\n metrics: FTRUMResourceMetrics = {}\n ): Promise<void> {\n return this.rum.addResource(key, resource, metrics);\n }\n}\n\nexport const FTReactNativeRUM: FTReactNativeRUMType =\n new FTReactNativeRUMWrapper();\n"],"mappings":";;;AAAA;AACA,SAASA,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,oBAAoB,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA;AACA,WAAYC,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAM5B;AACA;AACA;AACA,WAAYC,wBAAwB,0BAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA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FTRumErrorTracking","FTRumActionTracking","FTBabelInteractionTracking","FTRumWebSocketTracking","bridgeContextManager","normalizeLongTaskThreshold","ErrorMonitorType","DeviceMetricsMonitorType","DetectFrequency","FTRUMCacheDiscard","IOSCrashMonitoringType","isBabelPluginEnabled","globalThis","__FT_RN_BABEL_PLUGIN_ENABLED__","global","FTReactNativeRUMWrapper","constructor","_defineProperty","require","default","setConfig","config","configureLongTaskContext","enableLongTask","webSocketLifecycle","getLifecycleVersion","webSocketConfigVersion","trackWebSocket","enableIOSWebSocketResource","console","log","enableAutoTrackError","startTracking","babelPluginEnabled","configure","trackInteractions","Boolean","enableAutoTrackUserAction","actionReporter","actionName","actionType","property","startAction","stopTracking","rum","longTaskThresholdMs","then","OS","mergedProperties","mergeWithLocalPropertiesSync","addAction","onCreateView","viewName","loadTime","startView","stopView","addError","stack","message","addErrorWithType","type","startResource","key","stopResource","addResource","resource","metrics","FTReactNativeRUM"],"sources":["ft_rum.tsx"],"sourcesContent":["// import { NativeModules } from 'react-native';\nimport { Platform } from 'react-native';\nimport { FTRumErrorTracking } from './rum/FTRumErrorTracking';\nimport { FTRumActionTracking } from './rum/FTRumActionTracking';\nimport { FTBabelInteractionTracking } from './rum/FTBabelInteractionTracking';\nimport { FTRumWebSocketTracking } from './rum/FTRumWebSocketTracking';\nimport { bridgeContextManager } from './ft_mobile_agent';\nimport { normalizeLongTaskThreshold } from './rum/longTasksUtils';\n\n/**\n * Error monitoring type.\n */\n/* eslint-disable no-bitwise */\nexport enum ErrorMonitorType {\n all = 0xffffffff,\n battery = 1 << 1,\n memory = 1 << 2,\n cpu = 1 << 3,\n}\n/**\n * Page monitoring supplement type\n */\nexport enum DeviceMetricsMonitorType {\n all = 0xffffffff,\n battery = 1 << 1,\n memory = 1 << 2,\n cpu = 1 << 3,\n fps = 1 << 4,\n}\n/**\n * Device information monitoring cycle.\n */\nexport enum DetectFrequency {\n normal,\n frequent,\n rare,\n}\n\nexport enum FTRUMCacheDiscard {\n discard,\n discardOldest,\n}\n\nexport enum IOSCrashMonitoringType {\n /** Monitor Mach kernel exceptions. */\n machException = 0x01,\n\n /** Monitor fatal signals. */\n signal = 0x02,\n\n /** Monitor uncaught C++ exceptions. */\n cppException = 0x04,\n\n /** Monitor uncaught Objective-C NSExceptions. */\n nsException = 0x08,\n\n /** Track and inject system information. */\n system = 0x40,\n\n /** Track and inject application state information. */\n applicationState = 0x80,\n\n /** All crash monitor types. */\n all = machException |\n signal |\n cppException |\n nsException |\n applicationState |\n system,\n\n /** High compatibility crash monitor types (excludes Mach exceptions). */\n highCompatibility = all & ~machException,\n}\n/* eslint-enable no-bitwise */\n/**\n * Set RUM tracking conditions.\n * @param androidAppId appId, apply during monitoring\n * @param iOSAppId appId, apply during monitoring\n * @param sampleRate sampling rate\n * @param sessionOnErrorSampleRate error session sampling rate. For sessions not sampled, if ERROR is hit, collect data 1 minute before the error occurs\n * @param enableAutoTrackUserAction whether to automatically collect react-native control click events, can set actionName with accessibilityLabel when enabled\n * @param enableTrackError whether to automatically collect react-native Error\n * @param enableTrackNativeCrash whether to collect Native Error\n * @param enableTrackNativeAppANR whether to collect Native ANR\n * @param enableTrackNativeFreeze whether to collect Native Freeze\n * @param nativeFreezeDurationMs set the threshold for collecting Native Freeze, value range [100,), unit ms. iOS default 250ms, Android default 1000ms\n * @param enableLongTask whether to collect React Native JavaScript LongTasks, default false\n * @param longTaskThresholdMs set the threshold for collecting React Native JavaScript LongTasks, unit ms. Defaults to 100 and is clamped to [100, 5000]\n * @param enableNativeUserAction whether to start Native Action tracking, Button click events, recommended to disable for pure react-native apps\n * @param enableNativeUserView whether to start Native View auto tracking, recommended to disable for pure react-native apps\n * @param enableNativeUserResource whether to automatically collect react-native Resource\n * @param enableIOSWebSocketResource whether to collect iOS WebSocket opening handshakes as RUM Resources. Defaults to false.\n * Independent of enableNativeUserResource. Android native WebSocket collection is unaffected.\n * iOS WebSocket Trace header injection requires both this option and enableNativeAutoTrace.\n * When disabled, new iOS WebSocket connections are not instrumented or automatically injected with Trace headers by this SDK.\n * @param enableResourceHostIP whether to collect network request Host IP (only for native http, iOS 13 and above)\n * @param errorMonitorType error monitoring supplement type\n * @param deviceMonitorType page monitoring supplement type\n * @param detectFrequency monitoring frequency\n * @param globalContext custom global parameters\n * @param rumCacheLimitCount RUM max cache size, default 100_000\n * @param rumDiscardStrategy RUM data discard strategy\n * @param enableTraceWebView Set whether to enable WebView data collection, default true\n * @param allowWebViewHost Set specific hosts or domains allowed to collect WebView data, nil means collect all\n * @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.\n */\nexport interface FTRUMConfig {\n androidAppId: string;\n iOSAppId: string;\n sampleRate?: number;\n sessionOnErrorSampleRate?: number;\n enableAutoTrackUserAction?: boolean;\n enableAutoTrackError?: boolean;\n enableTrackNativeCrash?: boolean;\n enableTrackNativeAppANR?: boolean;\n enableTrackNativeFreeze?: boolean;\n nativeFreezeDurationMs?: number;\n enableLongTask?: boolean;\n longTaskThresholdMs?: number;\n enableNativeUserAction?: boolean;\n enableNativeUserView?: boolean;\n enableNativeUserResource?: boolean;\n enableIOSWebSocketResource?: boolean;\n enableResourceHostIP?: boolean;\n errorMonitorType?: ErrorMonitorType;\n deviceMonitorType?: DeviceMetricsMonitorType;\n detectFrequency?: DetectFrequency;\n globalContext?: object;\n rumCacheLimitCount?: number;\n rumDiscardStrategy?: FTRUMCacheDiscard;\n enableTraceWebView?: boolean;\n allowWebViewHost?: Array<string>;\n iosCrashMonitoringType?: IOSCrashMonitoringType;\n}\n/**\n * RUM Resource data.\n * @param url request URL\n * @param httpMethod request method\n * @param requestHeader request header parameters\n * @param responseHeader response header parameters\n * @param responseBody response content\n * @param resourceStatus response status code\n */\nexport interface FTRUMResource {\n url: string;\n httpMethod: string;\n requestHeader: object;\n responseHeader?: object;\n responseBody?: string;\n resourceStatus?: number;\n}\n/**\n * RUM Resource performance metrics.\n * @param duration resource load time\n * @param resource_dns resource DNS resolution time\n * @param resource_tcp resource TCP connection time\n * @param resource_ssl resource SSL connection time\n * @param resource_ttfb resource request response time\n * @param resource_trans resource content transfer time\n * @param resource_first_byte resource first byte time\n */\nexport interface FTRUMResourceMetrics {\n duration?: number;\n resource_dns?: number;\n resource_tcp?: number;\n resource_ssl?: number;\n resource_ttfb?: number;\n resource_trans?: number;\n resource_first_byte?: number;\n}\ntype FTReactNativeRUMType = {\n /**\n * Set RUM tracking conditions and enable RUM collection.\n * @param config rum configuration parameters.\n * @returns a Promise.\n */\n setConfig(config: FTRUMConfig): Promise<void>;\n /**\n * Start RUM Action.\n * RUM will bind Resource, Error, LongTask events that may be triggered by this Action.\n * 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.\n * Adding Action with `addAction` method does not affect each other.\n * @param actionName action name\n * @param actionType action type\n * @param property event context (optional)\n * @returns a Promise.\n */\n startAction(\n actionName: string,\n actionType: string,\n property?: object\n ): Promise<void>;\n /**\n * Add Action event. This type of data cannot be associated with Error, Resource, LongTask data, and has no discard logic.\n * @param actionName action name\n * @param actionType action type\n * @param property event context (optional)\n * @returns a Promise.\n */\n addAction(\n actionName: string,\n actionType: string,\n property?: object\n ): Promise<void>;\n /**\n * view load duration.\n * @param viewName view name\n * @param loadTime view load duration\n * @returns a Promise.\n */\n onCreateView(viewName: string, loadTime: number): Promise<void>;\n /**\n * view start.\n * @param viewName page name\n * @param property event context (optional)\n * @returns a Promise.\n */\n startView(viewName: string, property?: object): Promise<void>;\n /**\n * view end.\n * @param property event context (optional)\n * @returns a Promise.\n */\n stopView(property?: object): Promise<void>;\n /**\n * Exception capture and log collection.\n * @param stack stack log\n * @param message error message\n * @param property event context (optional)\n * @returns a Promise.\n */\n addError(stack: string, message: string, property?: object): Promise<void>;\n /**\n * Exception capture and log collection.\n * @param type error type\n * @param stack stack log\n * @param message error message\n * @param property event context (optional)\n * @returns a Promise.\n */\n addErrorWithType(\n type: string,\n stack: string,\n message: string,\n property?: object\n ): Promise<void>;\n /**\n * Start resource request.\n * @param key unique id\n * @param property event context (optional)\n * @returns a Promise.\n */\n startResource(key: string, property?: object): Promise<void>;\n /**\n * End resource request.\n * @param key unique id\n * @param property event context (optional)\n * @returns a Promise.\n */\n stopResource(key: string, property?: object): Promise<void>;\n /**\n * Send resource data metrics.\n * @param key unique id\n * @param resource resource data\n * @param metrics resource performance data\n * @returns a Promise.\n */\n addResource(\n key: string,\n resource: FTRUMResource,\n metrics?: FTRUMResourceMetrics\n ): Promise<void>;\n};\n\nfunction isBabelPluginEnabled(): boolean {\n if (typeof globalThis !== 'undefined') {\n return globalThis.__FT_RN_BABEL_PLUGIN_ENABLED__ === true;\n }\n if (typeof global !== 'undefined') {\n return global.__FT_RN_BABEL_PLUGIN_ENABLED__ === true;\n }\n return false;\n}\n\nclass FTReactNativeRUMWrapper implements FTReactNativeRUMType {\n private webSocketConfigVersion = 0;\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n private rum: FTReactNativeRUMType = require('./specs/NativeFTReactNativeRUM')\n .default;\n\n setConfig(config: FTRUMConfig): Promise<void> {\n bridgeContextManager.configureLongTaskContext(\n config.enableLongTask === true\n );\n const webSocketLifecycle = FTRumWebSocketTracking.getLifecycleVersion();\n const webSocketConfigVersion = ++this.webSocketConfigVersion;\n const trackWebSocket = config.enableIOSWebSocketResource === true;\n console.log('FTRUMConfig');\n if (config.enableAutoTrackError) {\n FTRumErrorTracking.startTracking();\n }\n const babelPluginEnabled = isBabelPluginEnabled();\n FTBabelInteractionTracking.configure({\n trackInteractions:\n babelPluginEnabled && Boolean(config.enableAutoTrackUserAction),\n actionReporter: (actionName, actionType, property) =>\n this.startAction(actionName, actionType, property),\n });\n if (config.enableAutoTrackUserAction && !babelPluginEnabled) {\n FTRumActionTracking.startTracking();\n } else {\n FTRumActionTracking.stopTracking();\n }\n return this.rum\n .setConfig({\n ...config,\n enableLongTask: config.enableLongTask === true,\n longTaskThresholdMs: normalizeLongTaskThreshold(\n config.longTaskThresholdMs\n ),\n })\n .then(() => {\n if (\n webSocketLifecycle !== FTRumWebSocketTracking.getLifecycleVersion() ||\n webSocketConfigVersion !== this.webSocketConfigVersion\n ) {\n return;\n }\n if (Platform.OS === 'ios' && trackWebSocket) {\n FTRumWebSocketTracking.startTracking(this);\n } else {\n FTRumWebSocketTracking.stopTracking();\n }\n });\n }\n startAction(\n actionName: string,\n actionType: string,\n property?: object\n ): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.startAction(actionName, actionType, mergedProperties);\n }\n addAction(\n actionName: string,\n actionType: string,\n property?: object\n ): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.addAction(actionName, actionType, mergedProperties);\n }\n onCreateView(viewName: string, loadTime: number): Promise<void> {\n return this.rum.onCreateView(viewName, loadTime);\n }\n startView(viewName: string, property?: object): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.startView(viewName, mergedProperties);\n }\n stopView(property?: object): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.stopView(mergedProperties);\n }\n addError(stack: string, message: string, property?: object): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.addError(stack, message, mergedProperties);\n }\n addErrorWithType(\n type: string,\n stack: string,\n message: string,\n property?: object\n ): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.addErrorWithType(type, stack, message, mergedProperties);\n }\n startResource(key: string, property?: object): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.startResource(key, mergedProperties);\n }\n stopResource(key: string, property?: object): Promise<void> {\n // Automatically merge bridge context properties with local properties\n const mergedProperties =\n bridgeContextManager.mergeWithLocalPropertiesSync(property);\n return this.rum.stopResource(key, mergedProperties);\n }\n addResource(\n key: string,\n resource: FTRUMResource,\n metrics: FTRUMResourceMetrics = {}\n ): Promise<void> {\n return this.rum.addResource(key, resource, metrics);\n }\n}\n\nexport const FTReactNativeRUM: FTReactNativeRUMType =\n new FTReactNativeRUMWrapper();\n"],"mappings":";;;AAAA;AACA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,0BAA0B,QAAQ,kCAAkC;AAC7E,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,oBAAoB,QAAQ,mBAAmB;AACxD,SAASC,0BAA0B,QAAQ,sBAAsB;;AAEjE;AACA;AACA;AACA;AACA,WAAYC,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAM5B;AACA;AACA;AACA,WAAYC,wBAAwB,0BAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAxBA,wBAAwB,CAAxBA,wBAAwB;EAAA,OAAxBA,wBAAwB;AAAA;AAOpC;AACA;AACA;AACA,WAAYC,eAAe,0BAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAA,OAAfA,eAAe;AAA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;IACA,MAAMO,gBAAgB,GACpB5C,oBAAoB,CAAC6C,4BAA4B,CAACR,QAAQ,CAAC;IAC7D,OAAO,IAAI,CAACG,GAAG,CAACY,QAAQ,CAACC,KAAK,EAAEC,OAAO,EAAEV,gBAAgB,CAAC;EAC5D;EACAW,gBAAgBA,CACdC,IAAY,EACZH,KAAa,EACbC,OAAe,EACfjB,QAAiB,EACF;IACf;IACA,MAAMO,gBAAgB,GACpB5C,oBAAoB,CAAC6C,4BAA4B,CAACR,QAAQ,CAAC;IAC7D,OAAO,IAAI,CAACG,GAAG,CAACe,gBAAgB,CAACC,IAAI,EAAEH,KAAK,EAAEC,OAAO,EAAEV,gBAAgB,CAAC;EAC1E;EACAa,aAAaA,CAACC,GAAW,EAAErB,QAAiB,EAAiB;IAC3D;IACA,MAAMO,gBAAgB,GACpB5C,oBAAoB,CAAC6C,4BAA4B,CAACR,QAAQ,CAAC;IAC7D,OAAO,IAAI,CAACG,GAAG,CAACiB,aAAa,CAACC,GAAG,EAAEd,gBAAgB,CAAC;EACtD;EACAe,YAAYA,CAACD,GAAW,EAAErB,QAAiB,EAAiB;IAC1D;IACA,MAAMO,gBAAgB,GACpB5C,oBAAoB,CAAC6C,4BAA4B,CAACR,QAAQ,CAAC;IAC7D,OAAO,IAAI,CAACG,GAAG,CAACmB,YAAY,CAACD,GAAG,EAAEd,gBAAgB,CAAC;EACrD;EACAgB,WAAWA,CACTF,GAAW,EACXG,QAAuB,EACvBC,OAA6B,GAAG,CAAC,CAAC,EACnB;IACf,OAAO,IAAI,CAACtB,GAAG,CAACoB,WAAW,CAACF,GAAG,EAAEG,QAAQ,EAAEC,OAAO,CAAC;EACrD;AACF;AAEA,OAAO,MAAMC,gBAAsC,GACjD,IAAIpD,uBAAuB,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/ft_tracing.js
CHANGED
|
@@ -4,6 +4,8 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
4
4
|
// import { NativeModules } from 'react-native';
|
|
5
5
|
//FTReactNativeTrace
|
|
6
6
|
|
|
7
|
+
import { FTRumWebSocketTracking } from './rum/FTRumWebSocketTracking';
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* Trace types for use.
|
|
9
11
|
*/
|
|
@@ -45,13 +47,22 @@ export let TraceType = /*#__PURE__*/function (TraceType) {
|
|
|
45
47
|
|
|
46
48
|
class FTReactNativeTraceWrapper {
|
|
47
49
|
constructor() {
|
|
50
|
+
_defineProperty(this, "webSocketConfigVersion", 0);
|
|
48
51
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
49
52
|
_defineProperty(this, "trace", require('./specs/NativeFTReactNativeTrace').default);
|
|
50
53
|
}
|
|
51
54
|
/* eslint-enable @typescript-eslint/no-var-requires */
|
|
52
55
|
|
|
53
56
|
setConfig(config) {
|
|
54
|
-
|
|
57
|
+
const webSocketLifecycle = FTRumWebSocketTracking.getLifecycleVersion();
|
|
58
|
+
const webSocketConfigVersion = ++this.webSocketConfigVersion;
|
|
59
|
+
const traceWebSocket = config.enableNativeAutoTrace === true;
|
|
60
|
+
return this.trace.setConfig(config).then(() => {
|
|
61
|
+
if (webSocketLifecycle !== FTRumWebSocketTracking.getLifecycleVersion() || webSocketConfigVersion !== this.webSocketConfigVersion) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
FTRumWebSocketTracking.setNativeAutoTraceEnabled(traceWebSocket);
|
|
65
|
+
});
|
|
55
66
|
}
|
|
56
67
|
/**
|
|
57
68
|
* Get trace HTTP request header data.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TraceType","FTReactNativeTraceWrapper","constructor","_defineProperty","require","default","setConfig","config","trace","getTraceHeader","key","url","getTraceHeaderFields","FTReactNativeTrace"],"sources":["ft_tracing.tsx"],"sourcesContent":["// import { NativeModules } from 'react-native';\n//FTReactNativeTrace\n\n/**\n * Trace types for use.\n */\nexport enum TraceType {\n //\n // datadog trace\n //\n // x-datadog-trace-id\n // x-datadog-parent-id\n // x-datadog-sampling-priority\n // x-datadog-origin\n //\n ddTrace,\n //\n // zipkin multi header\n //\n // X-B3-TraceId\n // X-B3-SpanId\n // X-B3-Sampled\n //\n zipkinMulti,\n /// zipkin single header,b3\n zipkinSingle,\n // w3c, traceparent\n traceparent,\n // skywalking 8.0+, sw-8\n skywalking,\n // jaeger, header uber-trace-id\n jaeger,\n}\n/**\n * Configure trace.\n * @param sampleRate sampling rate\n * @param traceType trace type\n * @param enableLinkRUMData whether to link with RUM data\n * @param enableNativeAutoTrace whether to enable automatic tracing\n */\nexport interface FTTraceConfig {\n sampleRate?: number;\n traceType?: TraceType;\n enableLinkRUMData?: boolean;\n enableNativeAutoTrace?: boolean;\n}\n\ntype FTReactNativeTraceType = {\n /**\n * Configure trace to enable distributed tracing.\n * @param config trace configuration parameters.\n * @returns a Promise.\n */\n setConfig(config: FTTraceConfig): Promise<void>;\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @returns trace request header parameters\n * @deprecated use getTraceHeaderFields() replace.\n */\n getTraceHeader(key: string, url: string): Promise<object>;\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @returns trace request header parameters\n */\n getTraceHeaderFields(url: string, key?: string): Promise<object>;\n};\n\nclass FTReactNativeTraceWrapper implements FTReactNativeTraceType {\n /* eslint-disable @typescript-eslint/no-var-requires */\n private trace: FTReactNativeTraceType =\n require('./specs/NativeFTReactNativeTrace').default;\n /* eslint-enable @typescript-eslint/no-var-requires */\n\n setConfig(config: FTTraceConfig): Promise<void> {\n return this.trace.setConfig(config);\n }\n /**\n * Get trace HTTP request header data.\n * @param key unique id\n * @param url request URL\n * @returns a Promise.\n */\n getTraceHeader(key: string, url: string): Promise<object> {\n return this.trace.getTraceHeaderFields(url, key);\n }\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @param key unique id\n * @returns a Promise.\n */\n getTraceHeaderFields(url: string, key?: string): Promise<object> {\n return this.trace.getTraceHeaderFields(url, key);\n }\n}\nexport const FTReactNativeTrace: FTReactNativeTraceType =\n new FTReactNativeTraceWrapper();\n"],"mappings":";;;AAAA;AACA;;AAEA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"names":["FTRumWebSocketTracking","TraceType","FTReactNativeTraceWrapper","constructor","_defineProperty","require","default","setConfig","config","webSocketLifecycle","getLifecycleVersion","webSocketConfigVersion","traceWebSocket","enableNativeAutoTrace","trace","then","setNativeAutoTraceEnabled","getTraceHeader","key","url","getTraceHeaderFields","FTReactNativeTrace"],"sources":["ft_tracing.tsx"],"sourcesContent":["// import { NativeModules } from 'react-native';\n//FTReactNativeTrace\n\nimport { FTRumWebSocketTracking } from './rum/FTRumWebSocketTracking';\n\n/**\n * Trace types for use.\n */\nexport enum TraceType {\n //\n // datadog trace\n //\n // x-datadog-trace-id\n // x-datadog-parent-id\n // x-datadog-sampling-priority\n // x-datadog-origin\n //\n ddTrace,\n //\n // zipkin multi header\n //\n // X-B3-TraceId\n // X-B3-SpanId\n // X-B3-Sampled\n //\n zipkinMulti,\n /// zipkin single header,b3\n zipkinSingle,\n // w3c, traceparent\n traceparent,\n // skywalking 8.0+, sw-8\n skywalking,\n // jaeger, header uber-trace-id\n jaeger,\n}\n/**\n * Configure trace.\n * @param sampleRate sampling rate\n * @param traceType trace type\n * @param enableLinkRUMData whether to link with RUM data\n * @param enableNativeAutoTrace whether to enable automatic tracing\n */\nexport interface FTTraceConfig {\n sampleRate?: number;\n traceType?: TraceType;\n enableLinkRUMData?: boolean;\n enableNativeAutoTrace?: boolean;\n}\n\ntype FTReactNativeTraceType = {\n /**\n * Configure trace to enable distributed tracing.\n * @param config trace configuration parameters.\n * @returns a Promise.\n */\n setConfig(config: FTTraceConfig): Promise<void>;\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @returns trace request header parameters\n * @deprecated use getTraceHeaderFields() replace.\n */\n getTraceHeader(key: string, url: string): Promise<object>;\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @returns trace request header parameters\n */\n getTraceHeaderFields(url: string, key?: string): Promise<object>;\n};\n\nclass FTReactNativeTraceWrapper implements FTReactNativeTraceType {\n private webSocketConfigVersion = 0;\n /* eslint-disable @typescript-eslint/no-var-requires */\n private trace: FTReactNativeTraceType =\n require('./specs/NativeFTReactNativeTrace').default;\n /* eslint-enable @typescript-eslint/no-var-requires */\n\n setConfig(config: FTTraceConfig): Promise<void> {\n const webSocketLifecycle = FTRumWebSocketTracking.getLifecycleVersion();\n const webSocketConfigVersion = ++this.webSocketConfigVersion;\n const traceWebSocket = config.enableNativeAutoTrace === true;\n return this.trace.setConfig(config).then(() => {\n if (\n webSocketLifecycle !== FTRumWebSocketTracking.getLifecycleVersion() ||\n webSocketConfigVersion !== this.webSocketConfigVersion\n ) {\n return;\n }\n FTRumWebSocketTracking.setNativeAutoTraceEnabled(traceWebSocket);\n });\n }\n /**\n * Get trace HTTP request header data.\n * @param key unique id\n * @param url request URL\n * @returns a Promise.\n */\n getTraceHeader(key: string, url: string): Promise<object> {\n return this.trace.getTraceHeaderFields(url, key);\n }\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @param key unique id\n * @returns a Promise.\n */\n getTraceHeaderFields(url: string, key?: string): Promise<object> {\n return this.trace.getTraceHeaderFields(url, key);\n }\n}\nexport const FTReactNativeTrace: FTReactNativeTraceType =\n new FTReactNativeTraceWrapper();\n"],"mappings":";;;AAAA;AACA;;AAEA,SAASA,sBAAsB,QAAQ,8BAA8B;;AAErE;AACA;AACA;AACA,WAAYC,SAAS,0BAATA,SAAS;EACnB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EARUA,SAAS,CAATA,SAAS;EAUnB;EACA;EACA;EACA;EACA;EACA;EACA;EAhBUA,SAAS,CAATA,SAAS;EAkBnB;EAlBUA,SAAS,CAATA,SAAS;EAoBnB;EApBUA,SAAS,CAATA,SAAS;EAsBnB;EAtBUA,SAAS,CAATA,SAAS;EAwBnB;EAxBUA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AA2BrB;AACA;AACA;AACA;AACA;AACA;AACA;;AA8BA,MAAMC,yBAAyB,CAAmC;EAAAC,YAAA;IAAAC,eAAA,iCAC/B,CAAC;IAClC;IAAAA,eAAA,gBAEEC,OAAO,CAAC,kCAAkC,CAAC,CAACC,OAAO;EAAA;EACrD;;EAEAC,SAASA,CAACC,MAAqB,EAAiB;IAC9C,MAAMC,kBAAkB,GAAGT,sBAAsB,CAACU,mBAAmB,CAAC,CAAC;IACvE,MAAMC,sBAAsB,GAAG,EAAE,IAAI,CAACA,sBAAsB;IAC5D,MAAMC,cAAc,GAAGJ,MAAM,CAACK,qBAAqB,KAAK,IAAI;IAC5D,OAAO,IAAI,CAACC,KAAK,CAACP,SAAS,CAACC,MAAM,CAAC,CAACO,IAAI,CAAC,MAAM;MAC7C,IACEN,kBAAkB,KAAKT,sBAAsB,CAACU,mBAAmB,CAAC,CAAC,IACnEC,sBAAsB,KAAK,IAAI,CAACA,sBAAsB,EACtD;QACA;MACF;MACAX,sBAAsB,CAACgB,yBAAyB,CAACJ,cAAc,CAAC;IAClE,CAAC,CAAC;EACJ;EACA;AACF;AACA;AACA;AACA;AACA;EACEK,cAAcA,CAACC,GAAW,EAAEC,GAAW,EAAmB;IACxD,OAAO,IAAI,CAACL,KAAK,CAACM,oBAAoB,CAACD,GAAG,EAAED,GAAG,CAAC;EAClD;EACA;AACF;AACA;AACA;AACA;AACA;EACEE,oBAAoBA,CAACD,GAAW,EAAED,GAAY,EAAmB;IAC/D,OAAO,IAAI,CAACJ,KAAK,CAACM,oBAAoB,CAACD,GAAG,EAAED,GAAG,CAAC;EAClD;AACF;AACA,OAAO,MAAMG,kBAA0C,GACrD,IAAInB,yBAAyB,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -4,5 +4,7 @@ import { FTRUMConfig, FTRUMResource, FTReactNativeRUM, ErrorMonitorType, DeviceM
|
|
|
4
4
|
import { FTTraceConfig, FTReactNativeTrace, TraceType } from './ft_tracing';
|
|
5
5
|
import { FTRumActionTracking } from './rum/FTRumActionTracking';
|
|
6
6
|
import { FTRumErrorTracking } from './rum/FTRumErrorTracking';
|
|
7
|
-
|
|
7
|
+
import { FTBabelInteractionTracking } from './rum/FTBabelInteractionTracking';
|
|
8
|
+
import { __ftExtractText } from './rum/FTBabelUtils';
|
|
9
|
+
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, FTBabelInteractionTracking, __ftExtractText };
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FTMobileConfig","FTMobileReactNative","EnvType","FTDBCacheDiscard","FTRemoteConfigResult","FTRemoteConfigOverrideRule","FTRemoteConfigOverrideMatch","FTRemoteConfigOverrideValues","FTLogConfig","FTReactNativeLog","FTLogStatus","FTLogCacheDiscard","FTRUMConfig","FTRUMResource","FTReactNativeRUM","ErrorMonitorType","DeviceMetricsMonitorType","DetectFrequency","FTRUMResourceMetrics","FTRUMCacheDiscard","IOSCrashMonitoringType","FTTraceConfig","FTReactNativeTrace","TraceType","FTRumActionTracking","FTRumErrorTracking"],"sources":["index.tsx"],"sourcesContent":["import {\n FTMobileConfig,\n FTMobileReactNative,\n EnvType,\n FTDBCacheDiscard,\n FTRemoteConfigResult,\n FTRemoteConfigOverrideRule,\n FTRemoteConfigOverrideMatch,\n FTRemoteConfigOverrideValues,\n} from './ft_mobile_agent';\nimport {\n FTLogConfig,\n FTReactNativeLog,\n FTLogStatus,\n FTLogCacheDiscard,\n} from './ft_logger';\nimport {\n FTRUMConfig,\n FTRUMResource,\n FTReactNativeRUM,\n ErrorMonitorType,\n DeviceMetricsMonitorType,\n DetectFrequency,\n FTRUMResourceMetrics,\n FTRUMCacheDiscard,\n IOSCrashMonitoringType,\n} from './ft_rum';\nimport { FTTraceConfig, FTReactNativeTrace, TraceType } from './ft_tracing';\nimport { FTRumActionTracking } from './rum/FTRumActionTracking';\nimport { FTRumErrorTracking } from './rum/FTRumErrorTracking';\n\nexport {\n FTMobileReactNative,\n FTMobileConfig,\n EnvType,\n FTDBCacheDiscard,\n FTRemoteConfigResult,\n FTRemoteConfigOverrideRule,\n FTRemoteConfigOverrideMatch,\n FTRemoteConfigOverrideValues,\n FTLogConfig,\n FTReactNativeLog,\n FTLogStatus,\n FTLogCacheDiscard,\n FTRUMConfig,\n FTReactNativeRUM,\n FTRUMResource,\n ErrorMonitorType,\n DeviceMetricsMonitorType,\n DetectFrequency,\n FTRUMResourceMetrics,\n FTRUMCacheDiscard,\n IOSCrashMonitoringType,\n FTTraceConfig,\n FTReactNativeTrace,\n TraceType,\n FTRumActionTracking,\n FTRumErrorTracking,\n};\n"],"mappings":"AAAA,SACEA,cAAc,EACdC,mBAAmB,EACnBC,OAAO,EACPC,gBAAgB,EAChBC,oBAAoB,EACpBC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,4BAA4B,QACvB,mBAAmB;AAC1B,SACEC,WAAW,EACXC,gBAAgB,EAChBC,WAAW,EACXC,iBAAiB,QACZ,aAAa;AACpB,SACEC,WAAW,EACXC,aAAa,EACbC,gBAAgB,EAChBC,gBAAgB,EAChBC,wBAAwB,EACxBC,eAAe,EACfC,oBAAoB,EACpBC,iBAAiB,EACjBC,sBAAsB,QACjB,UAAU;AACjB,SAASC,aAAa,EAAEC,kBAAkB,EAAEC,SAAS,QAAQ,cAAc;AAC3E,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,kBAAkB,QAAQ,0BAA0B;
|
|
1
|
+
{"version":3,"names":["FTMobileConfig","FTMobileReactNative","EnvType","FTDBCacheDiscard","FTRemoteConfigResult","FTRemoteConfigOverrideRule","FTRemoteConfigOverrideMatch","FTRemoteConfigOverrideValues","FTLogConfig","FTReactNativeLog","FTLogStatus","FTLogCacheDiscard","FTRUMConfig","FTRUMResource","FTReactNativeRUM","ErrorMonitorType","DeviceMetricsMonitorType","DetectFrequency","FTRUMResourceMetrics","FTRUMCacheDiscard","IOSCrashMonitoringType","FTTraceConfig","FTReactNativeTrace","TraceType","FTRumActionTracking","FTRumErrorTracking","FTBabelInteractionTracking","__ftExtractText"],"sources":["index.tsx"],"sourcesContent":["import {\n FTMobileConfig,\n FTMobileReactNative,\n EnvType,\n FTDBCacheDiscard,\n FTRemoteConfigResult,\n FTRemoteConfigOverrideRule,\n FTRemoteConfigOverrideMatch,\n FTRemoteConfigOverrideValues,\n} from './ft_mobile_agent';\nimport {\n FTLogConfig,\n FTReactNativeLog,\n FTLogStatus,\n FTLogCacheDiscard,\n} from './ft_logger';\nimport {\n FTRUMConfig,\n FTRUMResource,\n FTReactNativeRUM,\n ErrorMonitorType,\n DeviceMetricsMonitorType,\n DetectFrequency,\n FTRUMResourceMetrics,\n FTRUMCacheDiscard,\n IOSCrashMonitoringType,\n} from './ft_rum';\nimport { FTTraceConfig, FTReactNativeTrace, TraceType } from './ft_tracing';\nimport { FTRumActionTracking } from './rum/FTRumActionTracking';\nimport { FTRumErrorTracking } from './rum/FTRumErrorTracking';\nimport { FTBabelInteractionTracking } from './rum/FTBabelInteractionTracking';\nimport { __ftExtractText } from './rum/FTBabelUtils';\n\nexport {\n FTMobileReactNative,\n FTMobileConfig,\n EnvType,\n FTDBCacheDiscard,\n FTRemoteConfigResult,\n FTRemoteConfigOverrideRule,\n FTRemoteConfigOverrideMatch,\n FTRemoteConfigOverrideValues,\n FTLogConfig,\n FTReactNativeLog,\n FTLogStatus,\n FTLogCacheDiscard,\n FTRUMConfig,\n FTReactNativeRUM,\n FTRUMResource,\n ErrorMonitorType,\n DeviceMetricsMonitorType,\n DetectFrequency,\n FTRUMResourceMetrics,\n FTRUMCacheDiscard,\n IOSCrashMonitoringType,\n FTTraceConfig,\n FTReactNativeTrace,\n TraceType,\n FTRumActionTracking,\n FTRumErrorTracking,\n FTBabelInteractionTracking,\n __ftExtractText,\n};\n"],"mappings":"AAAA,SACEA,cAAc,EACdC,mBAAmB,EACnBC,OAAO,EACPC,gBAAgB,EAChBC,oBAAoB,EACpBC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,4BAA4B,QACvB,mBAAmB;AAC1B,SACEC,WAAW,EACXC,gBAAgB,EAChBC,WAAW,EACXC,iBAAiB,QACZ,aAAa;AACpB,SACEC,WAAW,EACXC,aAAa,EACbC,gBAAgB,EAChBC,gBAAgB,EAChBC,wBAAwB,EACxBC,eAAe,EACfC,oBAAoB,EACpBC,iBAAiB,EACjBC,sBAAsB,QACjB,UAAU;AACjB,SAASC,aAAa,EAAEC,kBAAkB,EAAEC,SAAS,QAAQ,cAAc;AAC3E,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,0BAA0B,QAAQ,kCAAkC;AAC7E,SAASC,eAAe,QAAQ,oBAAoB;AAEpD,SACE1B,mBAAmB,EACnBD,cAAc,EACdE,OAAO,EACPC,gBAAgB,EAChBC,oBAAoB,EACpBC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,WAAW,EACXC,gBAAgB,EAChBC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXE,gBAAgB,EAChBD,aAAa,EACbE,gBAAgB,EAChBC,wBAAwB,EACxBC,eAAe,EACfC,oBAAoB,EACpBC,iBAAiB,EACjBC,sBAAsB,EACtBC,aAAa,EACbC,kBAAkB,EAClBC,SAAS,EACTC,mBAAmB,EACnBC,kBAAkB,EAClBC,0BAA0B,EAC1BC,eAAe","ignoreList":[]}
|