@grafana/faro-react-native 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/android/build.gradle +118 -36
  2. package/android/consumer-proguard-rules.pro +2 -0
  3. package/android/src/main/java/com/grafana/faro/reactnative/ANRTracker.kt +61 -9
  4. package/android/src/main/java/com/grafana/faro/reactnative/AnrThreadDumpParser.kt +70 -0
  5. package/android/src/main/java/com/grafana/faro/reactnative/ApplicationExitTraceReader.kt +142 -0
  6. package/android/src/main/java/com/grafana/faro/reactnative/FaroAnrCache.kt +163 -0
  7. package/android/src/main/java/com/grafana/faro/reactnative/FaroAnrReporter.kt +163 -0
  8. package/android/src/main/java/com/grafana/faro/reactnative/FaroCrashReporter.kt +243 -50
  9. package/android/src/main/java/com/grafana/faro/reactnative/FaroCrashTraceCache.kt +75 -0
  10. package/android/src/main/java/com/grafana/faro/reactnative/FaroNativeCrashTrace.kt +39 -0
  11. package/android/src/main/java/com/grafana/faro/reactnative/FaroReactNativeModule.kt +99 -8
  12. package/android/src/main/java/com/grafana/faro/reactnative/FaroReactNativePackage.kt +1 -0
  13. package/android/src/main/java/com/grafana/faro/reactnative/FaroUncaughtExceptionHandler.kt +62 -0
  14. package/android/src/main/java/com/grafana/faro/reactnative/TombstoneBacktraceFormatter.kt +117 -0
  15. package/android/src/main/java/com/grafana/faro/reactnative/TombstoneModels.kt +35 -0
  16. package/android/src/main/java/com/grafana/faro/reactnative/TombstoneWireParser.kt +235 -0
  17. package/android/src/main/proto/tombstone.proto +62 -0
  18. package/android/src/test/java/com/grafana/faro/reactnative/AnrStackFiltersTest.kt +28 -0
  19. package/android/src/test/java/com/grafana/faro/reactnative/AnrThreadDumpParserTest.kt +38 -0
  20. package/android/src/test/java/com/grafana/faro/reactnative/FaroAnrCacheTest.kt +81 -0
  21. package/android/src/test/java/com/grafana/faro/reactnative/TombstoneWireParserTest.kt +51 -0
  22. package/dist/cjs/config/getRNInstrumentations.js +3 -1
  23. package/dist/cjs/config/getRNInstrumentations.js.map +1 -1
  24. package/dist/cjs/config/makeRNConfig.js +48 -9
  25. package/dist/cjs/config/makeRNConfig.js.map +1 -1
  26. package/dist/cjs/config/types.js.map +1 -1
  27. package/dist/cjs/generated/faroRNPackageMeta.js +1 -1
  28. package/dist/cjs/generated/faroRNPackageMeta.js.map +1 -1
  29. package/dist/cjs/index.js +3 -2
  30. package/dist/cjs/index.js.map +1 -1
  31. package/dist/cjs/initialize.js +14 -8
  32. package/dist/cjs/initialize.js.map +1 -1
  33. package/dist/cjs/instrumentations/anr/anrStack.js +19 -0
  34. package/dist/cjs/instrumentations/anr/anrStack.js.map +1 -0
  35. package/dist/cjs/instrumentations/anr/instrumentation.js +374 -72
  36. package/dist/cjs/instrumentations/anr/instrumentation.js.map +1 -1
  37. package/dist/cjs/instrumentations/anr/types.js.map +1 -1
  38. package/dist/cjs/instrumentations/console/index.js +5 -1
  39. package/dist/cjs/instrumentations/console/index.js.map +1 -1
  40. package/dist/cjs/instrumentations/crashReporting/{instrumentation.js → BaseCrashReportingInstrumentation.js} +110 -103
  41. package/dist/cjs/instrumentations/crashReporting/BaseCrashReportingInstrumentation.js.map +1 -0
  42. package/dist/cjs/instrumentations/crashReporting/NoOpCrashReportingInstrumentation.js +41 -0
  43. package/dist/cjs/instrumentations/crashReporting/NoOpCrashReportingInstrumentation.js.map +1 -0
  44. package/dist/cjs/instrumentations/crashReporting/android/AndroidCrashReportingInstrumentation.js +87 -0
  45. package/dist/cjs/instrumentations/crashReporting/android/AndroidCrashReportingInstrumentation.js.map +1 -0
  46. package/dist/cjs/instrumentations/crashReporting/android/crashErrorMessage.js +123 -0
  47. package/dist/cjs/instrumentations/crashReporting/android/crashErrorMessage.js.map +1 -0
  48. package/dist/cjs/instrumentations/crashReporting/android/index.js +12 -0
  49. package/dist/cjs/instrumentations/crashReporting/android/index.js.map +1 -0
  50. package/dist/cjs/instrumentations/crashReporting/android/nativeTombstoneTrace.js +11 -0
  51. package/dist/cjs/instrumentations/crashReporting/android/nativeTombstoneTrace.js.map +1 -0
  52. package/dist/cjs/instrumentations/crashReporting/android/parseAndroidCrashTrace.js +181 -0
  53. package/dist/cjs/instrumentations/crashReporting/android/parseAndroidCrashTrace.js.map +1 -0
  54. package/dist/cjs/instrumentations/crashReporting/index.js +35 -2
  55. package/dist/cjs/instrumentations/crashReporting/index.js.map +1 -1
  56. package/dist/cjs/instrumentations/crashReporting/ios/IosCrashReportingInstrumentation.js +78 -0
  57. package/dist/cjs/instrumentations/crashReporting/ios/IosCrashReportingInstrumentation.js.map +1 -0
  58. package/dist/cjs/instrumentations/crashReporting/ios/crashErrorMessage.js +103 -0
  59. package/dist/cjs/instrumentations/crashReporting/ios/crashErrorMessage.js.map +1 -0
  60. package/dist/cjs/instrumentations/crashReporting/ios/index.js +11 -0
  61. package/dist/cjs/instrumentations/crashReporting/ios/index.js.map +1 -0
  62. package/dist/cjs/instrumentations/crashReporting/ios/parseIosCrashTrace.js +48 -0
  63. package/dist/cjs/instrumentations/crashReporting/ios/parseIosCrashTrace.js.map +1 -0
  64. package/dist/cjs/instrumentations/crashReporting/types.js.map +1 -1
  65. package/dist/cjs/instrumentations/errors/index.js +2 -1
  66. package/dist/cjs/instrumentations/errors/index.js.map +1 -1
  67. package/dist/cjs/instrumentations/session/installationId.js +91 -0
  68. package/dist/cjs/instrumentations/session/installationId.js.map +1 -0
  69. package/dist/cjs/instrumentations/session/sessionAttributes.js +152 -89
  70. package/dist/cjs/instrumentations/session/sessionAttributes.js.map +1 -1
  71. package/dist/cjs/metas/appBuildIdentity.js +95 -0
  72. package/dist/cjs/metas/appBuildIdentity.js.map +1 -0
  73. package/dist/cjs/testUtils/mockDeviceInfo.js +5 -0
  74. package/dist/cjs/testUtils/mockDeviceInfo.js.map +1 -1
  75. package/dist/cjs/testUtils/setupTests.js +7 -0
  76. package/dist/cjs/testUtils/setupTests.js.map +1 -1
  77. package/dist/esm/config/getRNInstrumentations.js +3 -1
  78. package/dist/esm/config/getRNInstrumentations.js.map +1 -1
  79. package/dist/esm/config/makeRNConfig.js +49 -10
  80. package/dist/esm/config/makeRNConfig.js.map +1 -1
  81. package/dist/esm/config/types.js.map +1 -1
  82. package/dist/esm/generated/faroRNPackageMeta.js +1 -1
  83. package/dist/esm/generated/faroRNPackageMeta.js.map +1 -1
  84. package/dist/esm/index.js +1 -1
  85. package/dist/esm/index.js.map +1 -1
  86. package/dist/esm/initialize.js +11 -5
  87. package/dist/esm/initialize.js.map +1 -1
  88. package/dist/esm/instrumentations/anr/anrStack.js +16 -0
  89. package/dist/esm/instrumentations/anr/anrStack.js.map +1 -0
  90. package/dist/esm/instrumentations/anr/instrumentation.js +260 -67
  91. package/dist/esm/instrumentations/anr/instrumentation.js.map +1 -1
  92. package/dist/esm/instrumentations/anr/types.js.map +1 -1
  93. package/dist/esm/instrumentations/console/index.js +5 -1
  94. package/dist/esm/instrumentations/console/index.js.map +1 -1
  95. package/dist/esm/instrumentations/crashReporting/{instrumentation.js → BaseCrashReportingInstrumentation.js} +76 -94
  96. package/dist/esm/instrumentations/crashReporting/BaseCrashReportingInstrumentation.js.map +1 -0
  97. package/dist/esm/instrumentations/crashReporting/NoOpCrashReportingInstrumentation.js +18 -0
  98. package/dist/esm/instrumentations/crashReporting/NoOpCrashReportingInstrumentation.js.map +1 -0
  99. package/dist/esm/instrumentations/crashReporting/android/AndroidCrashReportingInstrumentation.js +56 -0
  100. package/dist/esm/instrumentations/crashReporting/android/AndroidCrashReportingInstrumentation.js.map +1 -0
  101. package/dist/esm/instrumentations/crashReporting/android/crashErrorMessage.js +116 -0
  102. package/dist/esm/instrumentations/crashReporting/android/crashErrorMessage.js.map +1 -0
  103. package/dist/esm/instrumentations/crashReporting/android/index.js +4 -0
  104. package/dist/esm/instrumentations/crashReporting/android/index.js.map +1 -0
  105. package/dist/esm/instrumentations/crashReporting/android/nativeTombstoneTrace.js +8 -0
  106. package/dist/esm/instrumentations/crashReporting/android/nativeTombstoneTrace.js.map +1 -0
  107. package/dist/esm/instrumentations/crashReporting/android/parseAndroidCrashTrace.js +174 -0
  108. package/dist/esm/instrumentations/crashReporting/android/parseAndroidCrashTrace.js.map +1 -0
  109. package/dist/esm/instrumentations/crashReporting/index.js +35 -1
  110. package/dist/esm/instrumentations/crashReporting/index.js.map +1 -1
  111. package/dist/esm/instrumentations/crashReporting/ios/IosCrashReportingInstrumentation.js +56 -0
  112. package/dist/esm/instrumentations/crashReporting/ios/IosCrashReportingInstrumentation.js.map +1 -0
  113. package/dist/esm/instrumentations/crashReporting/ios/crashErrorMessage.js +98 -0
  114. package/dist/esm/instrumentations/crashReporting/ios/crashErrorMessage.js.map +1 -0
  115. package/dist/esm/instrumentations/crashReporting/ios/index.js +4 -0
  116. package/dist/esm/instrumentations/crashReporting/ios/index.js.map +1 -0
  117. package/dist/esm/instrumentations/crashReporting/ios/parseIosCrashTrace.js +44 -0
  118. package/dist/esm/instrumentations/crashReporting/ios/parseIosCrashTrace.js.map +1 -0
  119. package/dist/esm/instrumentations/crashReporting/types.js.map +1 -1
  120. package/dist/esm/instrumentations/errors/index.js +2 -1
  121. package/dist/esm/instrumentations/errors/index.js.map +1 -1
  122. package/dist/esm/instrumentations/session/installationId.js +48 -0
  123. package/dist/esm/instrumentations/session/installationId.js.map +1 -0
  124. package/dist/esm/instrumentations/session/sessionAttributes.js +83 -38
  125. package/dist/esm/instrumentations/session/sessionAttributes.js.map +1 -1
  126. package/dist/esm/metas/appBuildIdentity.js +56 -0
  127. package/dist/esm/metas/appBuildIdentity.js.map +1 -0
  128. package/dist/esm/testUtils/mockDeviceInfo.js +5 -0
  129. package/dist/esm/testUtils/mockDeviceInfo.js.map +1 -1
  130. package/dist/esm/testUtils/setupTests.js +7 -0
  131. package/dist/esm/testUtils/setupTests.js.map +1 -1
  132. package/dist/types/config/makeRNConfig.d.ts +4 -3
  133. package/dist/types/config/types.d.ts +2 -1
  134. package/dist/types/generated/faroRNPackageMeta.d.ts +1 -1
  135. package/dist/types/index.d.ts +2 -2
  136. package/dist/types/initialize.d.ts +4 -2
  137. package/dist/types/instrumentations/anr/anrStack.d.ts +7 -0
  138. package/dist/types/instrumentations/anr/instrumentation.d.ts +23 -28
  139. package/dist/types/instrumentations/anr/types.d.ts +5 -1
  140. package/dist/types/instrumentations/appState/index.d.ts +1 -1
  141. package/dist/types/instrumentations/console/index.d.ts +1 -1
  142. package/dist/types/instrumentations/crashReporting/BaseCrashReportingInstrumentation.d.ts +56 -0
  143. package/dist/types/instrumentations/crashReporting/NoOpCrashReportingInstrumentation.d.ts +12 -0
  144. package/dist/types/instrumentations/crashReporting/android/AndroidCrashReportingInstrumentation.d.ts +26 -0
  145. package/dist/types/instrumentations/crashReporting/android/crashErrorMessage.d.ts +23 -0
  146. package/dist/types/instrumentations/crashReporting/android/index.d.ts +4 -0
  147. package/dist/types/instrumentations/crashReporting/android/nativeTombstoneTrace.d.ts +2 -0
  148. package/dist/types/instrumentations/crashReporting/android/parseAndroidCrashTrace.d.ts +45 -0
  149. package/dist/types/instrumentations/crashReporting/index.d.ts +25 -2
  150. package/dist/types/instrumentations/crashReporting/ios/IosCrashReportingInstrumentation.d.ts +28 -0
  151. package/dist/types/instrumentations/crashReporting/ios/crashErrorMessage.d.ts +14 -0
  152. package/dist/types/instrumentations/crashReporting/ios/index.d.ts +4 -0
  153. package/dist/types/instrumentations/crashReporting/ios/parseIosCrashTrace.d.ts +38 -0
  154. package/dist/types/instrumentations/crashReporting/types.d.ts +18 -51
  155. package/dist/types/instrumentations/frameMonitoring/instrumentation.d.ts +1 -1
  156. package/dist/types/instrumentations/http/index.d.ts +1 -1
  157. package/dist/types/instrumentations/performance/index.d.ts +1 -1
  158. package/dist/types/instrumentations/session/index.d.ts +1 -1
  159. package/dist/types/instrumentations/session/installationId.d.ts +1 -0
  160. package/dist/types/instrumentations/session/sessionAttributes.d.ts +13 -4
  161. package/dist/types/instrumentations/startup/index.d.ts +1 -1
  162. package/dist/types/instrumentations/userActions/index.d.ts +1 -1
  163. package/dist/types/instrumentations/view/index.d.ts +1 -1
  164. package/dist/types/instrumentations/xhr/index.d.ts +1 -1
  165. package/dist/types/metas/appBuildIdentity.d.ts +16 -0
  166. package/dist/types/testUtils/mockFaroReactNativeTracing.d.ts +1 -1
  167. package/dist/types/transports/console/transport.d.ts +1 -1
  168. package/dist/types/transports/fetch/transport.d.ts +1 -1
  169. package/dist/types/transports/offline/transport.d.ts +1 -1
  170. package/package.json +3 -3
  171. package/src/config/getRNInstrumentations.ts +5 -1
  172. package/src/config/makeRNConfig.test.ts +59 -3
  173. package/src/config/makeRNConfig.ts +48 -9
  174. package/src/config/types.ts +2 -1
  175. package/src/generated/faroRNPackageMeta.ts +1 -1
  176. package/src/index.ts +2 -1
  177. package/src/initialize.test.ts +71 -15
  178. package/src/initialize.ts +11 -5
  179. package/src/instrumentations/anr/anrStack.test.ts +27 -0
  180. package/src/instrumentations/anr/anrStack.ts +19 -0
  181. package/src/instrumentations/anr/instrumentation.test.ts +45 -0
  182. package/src/instrumentations/anr/instrumentation.ts +301 -67
  183. package/src/instrumentations/anr/types.ts +7 -1
  184. package/src/instrumentations/console/index.ts +5 -1
  185. package/src/instrumentations/console/instrumentation.test.ts +5 -0
  186. package/src/instrumentations/crashReporting/{instrumentation.ts → BaseCrashReportingInstrumentation.ts} +119 -93
  187. package/src/instrumentations/crashReporting/NoOpCrashReportingInstrumentation.ts +23 -0
  188. package/src/instrumentations/crashReporting/android/AndroidCrashReportingInstrumentation.ts +62 -0
  189. package/src/instrumentations/crashReporting/android/crashErrorMessage.test.ts +182 -0
  190. package/src/instrumentations/crashReporting/android/crashErrorMessage.ts +135 -0
  191. package/src/instrumentations/crashReporting/android/index.ts +4 -0
  192. package/src/instrumentations/crashReporting/android/nativeTombstoneTrace.test.ts +19 -0
  193. package/src/instrumentations/crashReporting/android/nativeTombstoneTrace.ts +8 -0
  194. package/src/instrumentations/crashReporting/android/parseAndroidCrashTrace.test.ts +232 -0
  195. package/src/instrumentations/crashReporting/android/parseAndroidCrashTrace.ts +235 -0
  196. package/src/instrumentations/crashReporting/index.ts +43 -2
  197. package/src/instrumentations/crashReporting/instrumentation.test.ts +42 -0
  198. package/src/instrumentations/crashReporting/ios/IosCrashReportingInstrumentation.ts +62 -0
  199. package/src/instrumentations/crashReporting/ios/crashErrorMessage.test.ts +170 -0
  200. package/src/instrumentations/crashReporting/ios/crashErrorMessage.ts +111 -0
  201. package/src/instrumentations/crashReporting/ios/index.ts +4 -0
  202. package/src/instrumentations/crashReporting/ios/parseIosCrashTrace.test.ts +86 -0
  203. package/src/instrumentations/crashReporting/ios/parseIosCrashTrace.ts +83 -0
  204. package/src/instrumentations/crashReporting/types.ts +19 -58
  205. package/src/instrumentations/errors/index.ts +2 -1
  206. package/src/instrumentations/errors/instrumentation.test.ts +8 -2
  207. package/src/instrumentations/errors/stackTraceParser.test.ts +1 -1
  208. package/src/instrumentations/session/installationId.ts +43 -0
  209. package/src/instrumentations/session/sessionAttributes.test.ts +260 -30
  210. package/src/instrumentations/session/sessionAttributes.ts +112 -22
  211. package/src/metas/appBuildIdentity.test.ts +48 -0
  212. package/src/metas/appBuildIdentity.ts +50 -0
  213. package/src/testUtils/mockDeviceInfo.ts +5 -0
  214. package/src/testUtils/setupTests.ts +7 -0
  215. package/dist/cjs/instrumentations/crashReporting/instrumentation.js.map +0 -1
  216. package/dist/esm/instrumentations/crashReporting/instrumentation.js.map +0 -1
  217. package/dist/types/instrumentations/crashReporting/instrumentation.d.ts +0 -58
@@ -0,0 +1,51 @@
1
+ package com.grafana.faro.reactnative
2
+
3
+ import com.grafana.faro.reactnative.tombstone.TombstoneProtos
4
+ import org.junit.Assert.assertEquals
5
+ import org.junit.Assert.assertNotNull
6
+ import org.junit.Assert.assertTrue
7
+ import org.junit.Test
8
+
9
+ class TombstoneWireParserTest {
10
+
11
+ @Test
12
+ fun parse_roundTripsGeneratedTombstoneBytes() {
13
+ val frame = TombstoneProtos.BacktraceFrame.newBuilder()
14
+ .setPc(0x1234)
15
+ .setFileName("/data/app/lib/arm64-v8a/libappmodules.so")
16
+ .setFunctionName("Java_com_example_NativeCrashModule_nativeCrash")
17
+ .setFunctionOffset(8)
18
+ .setBuildId("abc123")
19
+ .build()
20
+
21
+ val thread = TombstoneProtos.Thread.newBuilder()
22
+ .setId(123)
23
+ .setName("QuickPizza")
24
+ .addCurrentBacktrace(frame)
25
+ .build()
26
+
27
+ val tombstone = TombstoneProtos.Tombstone.newBuilder()
28
+ .setArch(TombstoneProtos.Architecture.ARM64)
29
+ .setPid(1000)
30
+ .setTid(123)
31
+ .setSignalInfo(
32
+ TombstoneProtos.Signal.newBuilder()
33
+ .setName("SIGSEGV")
34
+ .setNumber(11)
35
+ .build(),
36
+ )
37
+ .putThreads(123, thread)
38
+ .setAbortMessage("null pointer dereference")
39
+ .build()
40
+
41
+ val parsed = TombstoneWireParser.parse(tombstone.toByteArray())
42
+ assertNotNull(parsed)
43
+
44
+ val formatted = TombstoneBacktraceFormatter.format(parsed!!)
45
+ assertTrue(formatted.text.contains("ABI: 'arm64'"))
46
+ assertTrue(formatted.text.contains("signal SIGSEGV (11)"))
47
+ assertTrue(formatted.text.contains("#00 pc 0000000000001234 /data/app/lib/arm64-v8a/libappmodules.so"))
48
+ assertEquals("SIGSEGV (11)", formatted.signal)
49
+ assertTrue(TombstoneBacktraceFormatter.looksLikeNativeBacktrace(formatted.text))
50
+ }
51
+ }
@@ -121,7 +121,9 @@ function getRNInstrumentations(config) {
121
121
  }
122
122
  // Crash reporting
123
123
  if (enableCrashReporting) {
124
- instrumentations.push(new crashReporting_1.CrashReportingInstrumentation());
124
+ instrumentations.push(new crashReporting_1.CrashReportingInstrumentation({
125
+ releaseBundleFilename: config.releaseBundleFilename,
126
+ }));
125
127
  }
126
128
  if (enableTracing) {
127
129
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"getRNInstrumentations.js","sourceRoot":"","sources":["../../../src/config/getRNInstrumentations.ts"],"names":[],"mappings":";;AAgDA,sD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C;IAC7D,CAAC;IAED,IAAI,aAAa,EAAE,CAAC;QAClB,IAAI,CAAC;YACK,IAAA,sBAAsB,GAAK,OAAO,CAAC,oCAAoC,CAAC,uBAAlD,CAAmD;YACjF,gBAAgB,CAAC,IAAI,CAAC,IAAI,sBAAsB,CAAC,cAAc,CAAC,CAAC,CAAC;QACpE,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,CAAC,IAAI,CACV,wFAAwF;gBACtF,oEAAoE,CACvE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["import { Platform } from 'react-native';\n\nimport type { Instrumentation, Patterns } from '@grafana/faro-core';\n\nimport { ANRInstrumentation } from '../instrumentations/anr';\nimport { AppStateInstrumentation } from '../instrumentations/appState';\nimport { ConsoleInstrumentation } from '../instrumentations/console';\nimport { CrashReportingInstrumentation } from '../instrumentations/crashReporting';\nimport { ErrorsInstrumentation } from '../instrumentations/errors';\nimport { FrameMonitoringInstrumentation } from '../instrumentations/frameMonitoring';\nimport { HttpInstrumentation } from '../instrumentations/http';\nimport { PerformanceInstrumentation } from '../instrumentations/performance';\nimport { SessionInstrumentation } from '../instrumentations/session';\nimport { StartupInstrumentation } from '../instrumentations/startup';\nimport { UserActionInstrumentation } from '../instrumentations/userActions';\nimport { ViewInstrumentation } from '../instrumentations/view';\nimport { XHRInstrumentation } from '../instrumentations/xhr';\n\nimport type { ReactNativeConfig } from './types';\n\n/** Convert Patterns (string | RegExp)[] to RegExp[] for instrumentations that require RegExp[]. */\nfunction toRegExpArray(patterns: Patterns): RegExp[] {\n return patterns.map((p) => (typeof p === 'string' ? new RegExp(p.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) : p));\n}\n\n/**\n * Returns the default set of instrumentations for React Native.\n *\n * Reads all options from the Faro config (single source of truth).\n * Property names are aligned with Flutter SDK FaroConfig:\n * - cpuUsageVitals, memoryUsageVitals, anrTracking, refreshRateVitals\n * - enableCrashReporting, enableErrorReporting\n * - fetchVitalsInterval, ignoreUrls\n *\n * @example\n * ```ts\n * const config: ReactNativeConfig = {\n * app: { name: 'my-app', version: '1.0.0' },\n * cpuUsageVitals: true,\n * memoryUsageVitals: true,\n * anrTracking: true,\n * refreshRateVitals: true,\n * enableCrashReporting: true,\n * fetchVitalsInterval: 30000,\n * instrumentations: getRNInstrumentations(config),\n * };\n * ```\n */\nexport function getRNInstrumentations(config: Partial<ReactNativeConfig> = {}): Instrumentation[] {\n // Aligned with Flutter SDK FaroConfig defaults\n const {\n // Error & crash tracking\n enableErrorReporting = true,\n enableCrashReporting = false,\n anrTracking = false,\n anrOptions = {},\n\n // Performance vitals\n cpuUsageVitals = true,\n memoryUsageVitals = true,\n refreshRateVitals = false,\n fetchVitalsInterval = 30000,\n frameMonitoringOptions = {},\n\n // Network\n ignoreUrls = [],\n enableHttpInstrumentation = {},\n\n // Console and user actions\n enableConsoleCapture = true,\n enableUserActions = true,\n\n // Tracing\n enableTracing = false,\n tracingOptions = {},\n } = config;\n\n const instrumentations: Instrumentation[] = [];\n\n // Error reporting (Flutter: enableFlutterErrorReporting)\n if (enableErrorReporting) {\n instrumentations.push(\n new ErrorsInstrumentation({\n releaseBundleFilename: config.releaseBundleFilename,\n })\n );\n }\n\n // Console capture - not in Flutter SDK, RN-specific\n if (enableConsoleCapture) {\n instrumentations.push(new ConsoleInstrumentation());\n }\n\n // Sessions - always enabled in Flutter, same here\n instrumentations.push(new SessionInstrumentation());\n\n // Views - always enabled in Flutter, same here\n instrumentations.push(new ViewInstrumentation());\n\n // App state - always enabled in Flutter, same here\n instrumentations.push(new AppStateInstrumentation());\n\n // User actions - enabled by default, opt-out via enableUserActions\n if (enableUserActions) {\n instrumentations.push(new UserActionInstrumentation());\n }\n\n // HTTP/XHR tracking: when tracing is enabled, TracingInstrumentation patches fetch and XHR.\n // When tracing is disabled, add HttpInstrumentation and/or XHRInstrumentation per enableHttpInstrumentation.\n if (!enableTracing) {\n const { fetch: enableFetch = true, xhr: enableXhr = true } = enableHttpInstrumentation;\n const ignoredUrlsRegExp = toRegExpArray(ignoreUrls);\n if (enableFetch) {\n instrumentations.push(new HttpInstrumentation({ ignoredUrls: ignoredUrlsRegExp }));\n }\n if (enableXhr) {\n instrumentations.push(new XHRInstrumentation({ ignoredUrls: ignoredUrlsRegExp }));\n }\n }\n\n // Performance vitals (CPU/memory) - only add if at least one metric is enabled\n if (cpuUsageVitals || memoryUsageVitals) {\n const perfInstrumentation = new PerformanceInstrumentation({\n memoryUsageVitals,\n cpuUsageVitals,\n fetchVitalsInterval,\n });\n instrumentations.push(perfInstrumentation);\n }\n\n // Startup tracking - always enabled\n instrumentations.push(new StartupInstrumentation());\n\n // Frame monitoring: enabled when refreshRateVitals is true\n // The instrumentation reads refreshRateVitals from faro.config (single source of truth)\n if (refreshRateVitals) {\n instrumentations.push(new FrameMonitoringInstrumentation(frameMonitoringOptions));\n }\n\n // ANR detection (Android only)\n if (anrTracking && Platform.OS === 'android') {\n instrumentations.push(new ANRInstrumentation(anrOptions));\n }\n\n // Crash reporting\n if (enableCrashReporting) {\n instrumentations.push(new CrashReportingInstrumentation());\n }\n\n if (enableTracing) {\n try {\n const { TracingInstrumentation } = require('@grafana/faro-react-native-tracing');\n instrumentations.push(new TracingInstrumentation(tracingOptions));\n } catch {\n console.warn(\n '[Faro] enableTracing is true but @grafana/faro-react-native-tracing is not installed. ' +\n 'Add it to use tracing: yarn add @grafana/faro-react-native-tracing'\n );\n }\n }\n\n return instrumentations;\n}\n"]}
1
+ {"version":3,"file":"getRNInstrumentations.js","sourceRoot":"","sources":["../../../src/config/getRNInstrumentations.ts"],"names":[],"mappings":";;AAgDA,sDAsHC;AAtKD,6CAAwC;AAIxC,+CAA6D;AAC7D,yDAAuE;AACvE,uDAAqE;AACrE,qEAAmF;AACnF,qDAAmE;AACnE,uEAAqF;AACrF,iDAA+D;AAC/D,+DAA6E;AAC7E,uDAAqE;AACrE,uDAAqE;AACrE,+DAA4E;AAC5E,iDA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AAC,IAAI,CAAC,IAAI,sBAAsB,CAAC,cAAc,CAAC,CAAC,CAAC;QACpE,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,CAAC,IAAI,CACV,wFAAwF;gBACtF,oEAAoE,CACvE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["import { Platform } from 'react-native';\n\nimport type { Instrumentation, Patterns } from '@grafana/faro-core';\n\nimport { ANRInstrumentation } from '../instrumentations/anr';\nimport { AppStateInstrumentation } from '../instrumentations/appState';\nimport { ConsoleInstrumentation } from '../instrumentations/console';\nimport { CrashReportingInstrumentation } from '../instrumentations/crashReporting';\nimport { ErrorsInstrumentation } from '../instrumentations/errors';\nimport { FrameMonitoringInstrumentation } from '../instrumentations/frameMonitoring';\nimport { HttpInstrumentation } from '../instrumentations/http';\nimport { PerformanceInstrumentation } from '../instrumentations/performance';\nimport { SessionInstrumentation } from '../instrumentations/session';\nimport { StartupInstrumentation } from '../instrumentations/startup';\nimport { UserActionInstrumentation } from '../instrumentations/userActions';\nimport { ViewInstrumentation } from '../instrumentations/view';\nimport { XHRInstrumentation } from '../instrumentations/xhr';\n\nimport type { ReactNativeConfig } from './types';\n\n/** Convert Patterns (string | RegExp)[] to RegExp[] for instrumentations that require RegExp[]. */\nfunction toRegExpArray(patterns: Patterns): RegExp[] {\n return patterns.map((p) => (typeof p === 'string' ? new RegExp(p.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')) : p));\n}\n\n/**\n * Returns the default set of instrumentations for React Native.\n *\n * Reads all options from the Faro config (single source of truth).\n * Property names are aligned with Flutter SDK FaroConfig:\n * - cpuUsageVitals, memoryUsageVitals, anrTracking, refreshRateVitals\n * - enableCrashReporting, enableErrorReporting\n * - fetchVitalsInterval, ignoreUrls\n *\n * @example\n * ```ts\n * const config: ReactNativeConfig = {\n * app: { name: 'my-app', version: '1.0.0' },\n * cpuUsageVitals: true,\n * memoryUsageVitals: true,\n * anrTracking: true,\n * refreshRateVitals: true,\n * enableCrashReporting: true,\n * fetchVitalsInterval: 30000,\n * instrumentations: getRNInstrumentations(config),\n * };\n * ```\n */\nexport function getRNInstrumentations(config: Partial<ReactNativeConfig> = {}): Instrumentation[] {\n // Aligned with Flutter SDK FaroConfig defaults\n const {\n // Error & crash tracking\n enableErrorReporting = true,\n enableCrashReporting = false,\n anrTracking = false,\n anrOptions = {},\n\n // Performance vitals\n cpuUsageVitals = true,\n memoryUsageVitals = true,\n refreshRateVitals = false,\n fetchVitalsInterval = 30000,\n frameMonitoringOptions = {},\n\n // Network\n ignoreUrls = [],\n enableHttpInstrumentation = {},\n\n // Console and user actions\n enableConsoleCapture = true,\n enableUserActions = true,\n\n // Tracing\n enableTracing = false,\n tracingOptions = {},\n } = config;\n\n const instrumentations: Instrumentation[] = [];\n\n // Error reporting (Flutter: enableFlutterErrorReporting)\n if (enableErrorReporting) {\n instrumentations.push(\n new ErrorsInstrumentation({\n releaseBundleFilename: config.releaseBundleFilename,\n })\n );\n }\n\n // Console capture - not in Flutter SDK, RN-specific\n if (enableConsoleCapture) {\n instrumentations.push(new ConsoleInstrumentation());\n }\n\n // Sessions - always enabled in Flutter, same here\n instrumentations.push(new SessionInstrumentation());\n\n // Views - always enabled in Flutter, same here\n instrumentations.push(new ViewInstrumentation());\n\n // App state - always enabled in Flutter, same here\n instrumentations.push(new AppStateInstrumentation());\n\n // User actions - enabled by default, opt-out via enableUserActions\n if (enableUserActions) {\n instrumentations.push(new UserActionInstrumentation());\n }\n\n // HTTP/XHR tracking: when tracing is enabled, TracingInstrumentation patches fetch and XHR.\n // When tracing is disabled, add HttpInstrumentation and/or XHRInstrumentation per enableHttpInstrumentation.\n if (!enableTracing) {\n const { fetch: enableFetch = true, xhr: enableXhr = true } = enableHttpInstrumentation;\n const ignoredUrlsRegExp = toRegExpArray(ignoreUrls);\n if (enableFetch) {\n instrumentations.push(new HttpInstrumentation({ ignoredUrls: ignoredUrlsRegExp }));\n }\n if (enableXhr) {\n instrumentations.push(new XHRInstrumentation({ ignoredUrls: ignoredUrlsRegExp }));\n }\n }\n\n // Performance vitals (CPU/memory) - only add if at least one metric is enabled\n if (cpuUsageVitals || memoryUsageVitals) {\n const perfInstrumentation = new PerformanceInstrumentation({\n memoryUsageVitals,\n cpuUsageVitals,\n fetchVitalsInterval,\n });\n instrumentations.push(perfInstrumentation);\n }\n\n // Startup tracking - always enabled\n instrumentations.push(new StartupInstrumentation());\n\n // Frame monitoring: enabled when refreshRateVitals is true\n // The instrumentation reads refreshRateVitals from faro.config (single source of truth)\n if (refreshRateVitals) {\n instrumentations.push(new FrameMonitoringInstrumentation(frameMonitoringOptions));\n }\n\n // ANR detection (Android only)\n if (anrTracking && Platform.OS === 'android') {\n instrumentations.push(new ANRInstrumentation(anrOptions));\n }\n\n // Crash reporting\n if (enableCrashReporting) {\n instrumentations.push(\n new CrashReportingInstrumentation({\n releaseBundleFilename: config.releaseBundleFilename,\n })\n );\n }\n\n if (enableTracing) {\n try {\n const { TracingInstrumentation } = require('@grafana/faro-react-native-tracing');\n instrumentations.push(new TracingInstrumentation(tracingOptions));\n } catch {\n console.warn(\n '[Faro] enableTracing is true but @grafana/faro-react-native-tracing is not installed. ' +\n 'Add it to use tracing: yarn add @grafana/faro-react-native-tracing'\n );\n }\n }\n\n return instrumentations;\n}\n"]}
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
13
24
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
25
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
26
  if (ar || !(i in from)) {
@@ -25,6 +36,7 @@ var faro_core_1 = require("@grafana/faro-core");
25
36
  var stackTraceParser_1 = require("../instrumentations/errors/stackTraceParser");
26
37
  var sessionConstants_1 = require("../instrumentations/session/sessionManager/sessionConstants");
27
38
  var internalLogger_1 = require("../internalLogger");
39
+ var appBuildIdentity_1 = require("../metas/appBuildIdentity");
28
40
  var page_1 = require("../metas/page");
29
41
  var screen_1 = require("../metas/screen");
30
42
  var sdk_1 = require("../metas/sdk");
@@ -33,6 +45,23 @@ var fetch_1 = require("../transports/fetch");
33
45
  var offline_1 = require("../transports/offline");
34
46
  var getRNInstrumentations_1 = require("./getRNInstrumentations");
35
47
  var DEFAULT_OFFLINE_CACHE_MS = 3 * 24 * 60 * 60 * 1000; // 3 days
48
+ /**
49
+ * Resolves `meta.app.bundleId` when it is not already supplied by faro-core from
50
+ * the Metro preamble (`registerInitialMetas` / `__faroBundleId_<appName>`).
51
+ *
52
+ * Priority: explicit `config.app.bundleId` → Metro preamble (core) → DeviceInfo
53
+ * fallback (`applicationId@versionCode@versionName`, same shape Gradle/Metro use).
54
+ */
55
+ function resolveAppBundleId(configApp, appName, appSymbolsBundleId) {
56
+ if (configApp === null || configApp === void 0 ? void 0 : configApp.bundleId) {
57
+ return configApp.bundleId;
58
+ }
59
+ var metroId = (0, appBuildIdentity_1.getMetroInjectedBundleId)(appName);
60
+ if (metroId) {
61
+ return metroId;
62
+ }
63
+ return appSymbolsBundleId;
64
+ }
36
65
  /**
37
66
  * Builds transports. FetchTransport is always added when url is provided.
38
67
  * User can enable offline and console via enableTransports.
@@ -82,21 +111,31 @@ function createParseStacktrace(releaseBundleFilename) {
82
111
  * Based on flags, builds instrumentations and transports automatically.
83
112
  * Client just enables what they need; makeRNConfig does the rest.
84
113
  *
85
- * @param preloadedSessionDeviceAttributes Device/session fields for session meta (passed from async `initializeFaro`).
114
+ * @param preloadedMobileMeta Device/session fields and structured mobile meta (passed from async `initializeFaro`).
115
+ * @param appSymbolsBundleId Encoded `meta.app.bundleId` for server-side symbol retrace.
86
116
  */
87
- function makeRNConfig(config, preloadedSessionDeviceAttributes) {
88
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
89
- var defaultMetas = [(0, sdk_1.getSdkMeta)(), (0, page_1.getPageMeta)(), (0, screen_1.getScreenMeta)()];
90
- var customMetas = (_a = config.metas) !== null && _a !== void 0 ? _a : [];
117
+ function makeRNConfig(config, preloadedMobileMeta, appSymbolsBundleId) {
118
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
119
+ var _p = (_a = preloadedMobileMeta === null || preloadedMobileMeta === void 0 ? void 0 : preloadedMobileMeta.meta) !== null && _a !== void 0 ? _a : {}, preloadedAppMeta = _p.app, structuredMobileMeta = __rest(_p, ["app"]);
120
+ var mobileMetas = Object.keys(structuredMobileMeta).length > 0 ? [structuredMobileMeta] : [];
121
+ var defaultMetas = __spreadArray([(0, sdk_1.getSdkMeta)(), (0, page_1.getPageMeta)(), (0, screen_1.getScreenMeta)()], mobileMetas, true);
122
+ var customMetas = (_b = config.metas) !== null && _b !== void 0 ? _b : [];
91
123
  var transports = buildTransports(config);
92
124
  var instrumentations = buildInstrumentations(config);
125
+ var installationId = (_c = config.app.installationId) !== null && _c !== void 0 ? _c : preloadedAppMeta === null || preloadedAppMeta === void 0 ? void 0 : preloadedAppMeta.installationId;
93
126
  var releaseBundleFilename = config.releaseBundleFilename;
94
- return __assign(__assign({ app: config.app }, (preloadedSessionDeviceAttributes != null && {
95
- preloadedSessionDeviceAttributes: preloadedSessionDeviceAttributes,
96
- })), { dedupe: (_b = config.dedupe) !== null && _b !== void 0 ? _b : true, globalObjectKey: (_c = config.globalObjectKey) !== null && _c !== void 0 ? _c : faro_core_1.defaultGlobalObjectKey, internalLoggerLevel: (_d = config.internalLoggerLevel) !== null && _d !== void 0 ? _d : internalLogger_1.InternalLoggerLevel.ERROR, isolate: (_e = config.isolate) !== null && _e !== void 0 ? _e : false, parseStacktrace: (_f = config.parseStacktrace) !== null && _f !== void 0 ? _f : createParseStacktrace(releaseBundleFilename), paused: (_g = config.paused) !== null && _g !== void 0 ? _g : false, preventGlobalExposure: (_h = config.preventGlobalExposure) !== null && _h !== void 0 ? _h : false, unpatchedConsole: (_j = config.unpatchedConsole) !== null && _j !== void 0 ? _j : faro_core_1.defaultUnpatchedConsole, batching: {
127
+ // Merge bundleId (from config, Metro, or DeviceInfo) with preloaded app meta
128
+ var bundleIdValue = resolveAppBundleId(config.app, (_d = config.app) === null || _d === void 0 ? void 0 : _d.name, appSymbolsBundleId);
129
+ var appMetasIfPresent = preloadedAppMeta || bundleIdValue
130
+ ? [{ app: __assign(__assign({}, preloadedAppMeta), (bundleIdValue && { bundleId: bundleIdValue })) }]
131
+ : [];
132
+ return __assign(__assign({ app: __assign(__assign({}, config.app), (installationId && { installationId: installationId })) }, (preloadedMobileMeta != null && {
133
+ preloadedMobileMeta: preloadedMobileMeta.meta,
134
+ preloadedSessionDeviceAttributes: preloadedMobileMeta.sessionAttributes,
135
+ })), { dedupe: (_e = config.dedupe) !== null && _e !== void 0 ? _e : true, globalObjectKey: (_f = config.globalObjectKey) !== null && _f !== void 0 ? _f : faro_core_1.defaultGlobalObjectKey, internalLoggerLevel: (_g = config.internalLoggerLevel) !== null && _g !== void 0 ? _g : internalLogger_1.InternalLoggerLevel.ERROR, isolate: (_h = config.isolate) !== null && _h !== void 0 ? _h : false, parseStacktrace: (_j = config.parseStacktrace) !== null && _j !== void 0 ? _j : createParseStacktrace(releaseBundleFilename), paused: (_k = config.paused) !== null && _k !== void 0 ? _k : false, preventGlobalExposure: (_l = config.preventGlobalExposure) !== null && _l !== void 0 ? _l : false, unpatchedConsole: (_m = config.unpatchedConsole) !== null && _m !== void 0 ? _m : faro_core_1.defaultUnpatchedConsole, batching: {
97
136
  enabled: false,
98
137
  sendTimeout: 250,
99
138
  itemLimit: 50,
100
- }, sessionTracking: __assign(__assign({}, sessionConstants_1.defaultSessionTrackingConfig), config.sessionTracking), metas: __spreadArray(__spreadArray([], defaultMetas, true), customMetas, true), instrumentations: instrumentations, transports: transports, ignoreUrls: (_k = config.ignoreUrls) !== null && _k !== void 0 ? _k : [], ignoreErrors: config.ignoreErrors, beforeSend: config.beforeSend, preserveOriginalError: config.preserveOriginalError, userActionsInstrumentation: config.userActionsOptions, consoleInstrumentation: config.consoleCaptureOptions });
139
+ }, sessionTracking: __assign(__assign({}, sessionConstants_1.defaultSessionTrackingConfig), config.sessionTracking), metas: __spreadArray(__spreadArray(__spreadArray([], defaultMetas, true), customMetas, true), appMetasIfPresent, true), instrumentations: instrumentations, transports: transports, ignoreUrls: (_o = config.ignoreUrls) !== null && _o !== void 0 ? _o : [], ignoreErrors: config.ignoreErrors, beforeSend: config.beforeSend, preserveOriginalError: config.preserveOriginalError, userActionsInstrumentation: config.userActionsOptions, consoleInstrumentation: config.consoleCaptureOptions });
101
140
  }
102
141
  //# sourceMappingURL=makeRNConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"makeRNConfig.js","sourceRoot":"","sources":["../../../src/config/makeRNConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiFA,oCA0CC;AA3HD,gDAAqF;AAGrF,gFAAsF;AAEtF,gGAA2G;AAC3G,oDAAkE;AAClE,sCAA4C;AAC5C,0CAAgD;AAChD,oCAA0C;AAC1C,iDAAyD;AACzD,6CAAqD;AACrD,iDAAyD;AAEzD,iEAAgE;AAGhE,IAAM,wBAAwB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;AAEnE;;;GAGG;AACH,SAAS,eAAe,CAAC,MAAyB;;IACxC,IAAA,KAA0D,MAAM,iBAAX,EAArD,gBAAgB,mBAAG,EAAE,OAAO,EAAE,KAAK,EA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BAAA,EAChB,UAAU,YAAA,EACV,UAAU,EAAE,MAAA,MAAM,CAAC,UAAU,mCAAI,EAAE,EACnC,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,UAAU,EAAE,MAAM,CAAC,UAAU,EAC7B,qBAAqB,EAAE,MAAM,CAAC,qBAAqB,EACnD,0BAA0B,EAAE,MAAM,CAAC,kBAAkB,EACrD,sBAAsB,EAAE,MAAM,CAAC,qBAAqB,IACpD;AACJ,CAAC","sourcesContent":["import { defaultGlobalObjectKey, defaultUnpatchedConsole } from '@grafana/faro-core';\nimport type { Config } from '@grafana/faro-core';\n\nimport { getStackFramesFromError } from '../instrumentations/errors/stackTraceParser';\nimport type { SessionAttributes } from '../instrumentations/session/sessionAttributes';\nimport { defaultSessionTrackingConfig } from '../instrumentations/session/sessionManager/sessionConstants';\nimport { InternalLoggerLevel, LogLevel } from '../internalLogger';\nimport { getPageMeta } from '../metas/page';\nimport { getScreenMeta } from '../metas/screen';\nimport { getSdkMeta } from '../metas/sdk';\nimport { ConsoleTransport } from '../transports/console';\nimport { FetchTransport } from '../transports/fetch';\nimport { OfflineTransport } from '../transports/offline';\n\nimport { getRNInstrumentations } from './getRNInstrumentations';\nimport type { ReactNativeConfig, ReactNativeFullConfig } from './types';\n\nconst DEFAULT_OFFLINE_CACHE_MS = 3 * 24 * 60 * 60 * 1000; // 3 days\n\n/**\n * Builds transports. FetchTransport is always added when url is provided.\n * User can enable offline and console via enableTransports.\n */\nfunction buildTransports(config: ReactNativeConfig): Config['transports'] {\n const { enableTransports = { offline: false, console: false } } = config;\n\n if (!config.url) {\n throw new Error('url is required. Provide the Faro collector URL.');\n }\n\n const builtTransports: Config['transports'] = [];\n\n if (enableTransports.offline) {\n builtTransports.push(\n new OfflineTransport({\n maxCacheDurationMs: DEFAULT_OFFLINE_CACHE_MS,\n })\n );\n }\n\n builtTransports.push(\n new FetchTransport({\n url: config.url,\n apiKey: config.apiKey,\n })\n );\n\n if (enableTransports.console) {\n builtTransports.push(new ConsoleTransport({ level: LogLevel.DEBUG }));\n }\n\n const extraTransports = config.transports ?? [];\n return [...builtTransports, ...extraTransports];\n}\n\n/**\n * Builds instrumentations from config flags.\n */\nfunction buildInstrumentations(config: ReactNativeConfig): Config['instrumentations'] {\n const baseInstrumentations = getRNInstrumentations(config);\n const extraInstrumentations = config.instrumentations ?? [];\n return [...baseInstrumentations, ...extraInstrumentations];\n}\n\n/**\n * React Native stacktrace parser. Uses getStackFramesFromError for RN-specific formats.\n */\nfunction createParseStacktrace(releaseBundleFilename: string | undefined): Config['parseStacktrace'] {\n return (err) => ({\n frames: getStackFramesFromError(err, { releaseBundleFilename }),\n });\n}\n\n/**\n * Creates a full Faro config from React Native flag-based config.\n *\n * Based on flags, builds instrumentations and transports automatically.\n * Client just enables what they need; makeRNConfig does the rest.\n *\n * @param preloadedSessionDeviceAttributes Device/session fields for session meta (passed from async `initializeFaro`).\n */\nexport function makeRNConfig(\n config: ReactNativeConfig,\n preloadedSessionDeviceAttributes?: SessionAttributes\n): ReactNativeFullConfig {\n const defaultMetas = [getSdkMeta(), getPageMeta(), getScreenMeta()];\n const customMetas = config.metas ?? [];\n const transports = buildTransports(config);\n const instrumentations = buildInstrumentations(config);\n\n const releaseBundleFilename = config.releaseBundleFilename;\n return {\n app: config.app,\n ...(preloadedSessionDeviceAttributes != null && {\n preloadedSessionDeviceAttributes,\n }),\n dedupe: config.dedupe ?? true,\n globalObjectKey: config.globalObjectKey ?? defaultGlobalObjectKey,\n internalLoggerLevel: config.internalLoggerLevel ?? InternalLoggerLevel.ERROR,\n isolate: config.isolate ?? false,\n parseStacktrace: config.parseStacktrace ?? createParseStacktrace(releaseBundleFilename),\n paused: config.paused ?? false,\n preventGlobalExposure: config.preventGlobalExposure ?? false,\n unpatchedConsole: config.unpatchedConsole ?? defaultUnpatchedConsole,\n batching: {\n enabled: false,\n sendTimeout: 250,\n itemLimit: 50,\n },\n sessionTracking: {\n ...defaultSessionTrackingConfig,\n ...config.sessionTracking,\n },\n metas: [...defaultMetas, ...customMetas],\n instrumentations,\n transports,\n ignoreUrls: config.ignoreUrls ?? [],\n ignoreErrors: config.ignoreErrors,\n beforeSend: config.beforeSend,\n preserveOriginalError: config.preserveOriginalError,\n userActionsInstrumentation: config.userActionsOptions,\n consoleInstrumentation: config.consoleCaptureOptions,\n };\n}\n"]}
1
+ {"version":3,"file":"makeRNConfig.js","sourceRoot":"","sources":["../../../src/config/makeRNConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,oCAyDC;AAlKD,gDAAqF;AAGrF,gFAAsF;AAEtF,gGAA2G;AAC3G,oDAAkE;AAClE,8DAAqE;AACrE,sCAA4C;AAC5C,0CAAgD;AAChD,oCAA0C;AAC1C,iDAAyD;AACzD,6CAAqD;AACrD,iDAAyD;AAEzD,iEAAgE;AAGhE,IAAM,wBAAwB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;AAEnE;;;;;;GAMG;AACH,SAAS,kBAAkB,CACzB,SAA8B,EAC9B,OAA2B,EAC3B,kBAA2B;IAE3B,IAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC,QAAQ,CAAC;IAC5B,CAAC;IACD,IAAM,OAAO,GAAG,IAAA,2CAAwB,EAAC,OAAO,CAAC,CAAC;IAClD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,MAAyB;;IACxC,IAAA,KAA0D,MAAM,iBAAX,EAArD,gBAAgB,mBAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAA,CAAY;IAEzE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAChB,MAAM,IAAI,KAA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,IAAI,IAAI,IAAI;QACjC,mBAAmB,EAAE,mBAAmB,CAAC,IAAI;QAC7C,gCAAgC,EAAE,mBAAmB,CAAC,iBAAiB;KACxE,CAAC,KACF,MAAM,EAAE,MAAA,MAAM,CAAC,MAAM,mCAAI,IAAI,EAC7B,eAAe,EAAE,MAAA,MAAM,CAAC,eAAe,mCAAI,kCAAsB,EACjE,mBAAmB,EAAE,MAAA,MAAM,CAAC,mBAAmB,mCAAI,oCAAmB,CAAC,KAAK,EAC5E,OAAO,EAAE,MAAA,MAAM,CAAC,OAAO,mCAAI,KAAK,EAChC,eAAe,EAAE,MAAA,MAAM,CAAC,eAAe,mCAAI,qBAAqB,CAAC,qBAAqB,CAAC,EACvF,MAAM,EAAE,MAAA,MAAM,CAAC,MAAM,mCAAI,KAAK,EAC9B,qBAAqB,EAAE,MAAA,MAAM,CAAC,qBAAqB,mCAAI,KAAK,EAC5D,gBAAgB,EAAE,MAAA,MAAM,CAAC,gBAAgB,mCAAI,mCAAuB,EACpE,QAAQ,EAAE;YACR,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,GAAG;YAChB,SAAS,EAAE,EAAE;SACd,EACD,eAAe,wBACV,+CAA4B,GAC5B,MAAM,CAAC,eAAe,GAE3B,KAAK,gDAAM,YAAY,SAAK,WAAW,SAAK,iBAAiB,SAC7D,gBAAgB,kBAAA,EAChB,UAAU,YAAA,EACV,UAAU,EAAE,MAAA,MAAM,CAAC,UAAU,mCAAI,EAAE,EACnC,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,UAAU,EAAE,MAAM,CAAC,UAAU,EAC7B,qBAAqB,EAAE,MAAM,CAAC,qBAAqB,EACnD,0BAA0B,EAAE,MAAM,CAAC,kBAAkB,EACrD,sBAAsB,EAAE,MAAM,CAAC,qBAAqB,IACpD;AACJ,CAAC","sourcesContent":["import { defaultGlobalObjectKey, defaultUnpatchedConsole } from '@grafana/faro-core';\nimport type { Config, MetaApp } from '@grafana/faro-core';\n\nimport { getStackFramesFromError } from '../instrumentations/errors/stackTraceParser';\nimport type { PreloadedMobileMeta } from '../instrumentations/session/sessionAttributes';\nimport { defaultSessionTrackingConfig } from '../instrumentations/session/sessionManager/sessionConstants';\nimport { InternalLoggerLevel, LogLevel } from '../internalLogger';\nimport { getMetroInjectedBundleId } from '../metas/appBuildIdentity';\nimport { getPageMeta } from '../metas/page';\nimport { getScreenMeta } from '../metas/screen';\nimport { getSdkMeta } from '../metas/sdk';\nimport { ConsoleTransport } from '../transports/console';\nimport { FetchTransport } from '../transports/fetch';\nimport { OfflineTransport } from '../transports/offline';\n\nimport { getRNInstrumentations } from './getRNInstrumentations';\nimport type { ReactNativeConfig, ReactNativeFullConfig } from './types';\n\nconst DEFAULT_OFFLINE_CACHE_MS = 3 * 24 * 60 * 60 * 1000; // 3 days\n\n/**\n * Resolves `meta.app.bundleId` when it is not already supplied by faro-core from\n * the Metro preamble (`registerInitialMetas` / `__faroBundleId_<appName>`).\n *\n * Priority: explicit `config.app.bundleId` → Metro preamble (core) → DeviceInfo\n * fallback (`applicationId@versionCode@versionName`, same shape Gradle/Metro use).\n */\nfunction resolveAppBundleId(\n configApp: MetaApp | undefined,\n appName: string | undefined,\n appSymbolsBundleId?: string\n): string | undefined {\n if (configApp?.bundleId) {\n return configApp.bundleId;\n }\n const metroId = getMetroInjectedBundleId(appName);\n if (metroId) {\n return metroId;\n }\n return appSymbolsBundleId;\n}\n\n/**\n * Builds transports. FetchTransport is always added when url is provided.\n * User can enable offline and console via enableTransports.\n */\nfunction buildTransports(config: ReactNativeConfig): Config['transports'] {\n const { enableTransports = { offline: false, console: false } } = config;\n\n if (!config.url) {\n throw new Error('url is required. Provide the Faro collector URL.');\n }\n\n const builtTransports: Config['transports'] = [];\n\n if (enableTransports.offline) {\n builtTransports.push(\n new OfflineTransport({\n maxCacheDurationMs: DEFAULT_OFFLINE_CACHE_MS,\n })\n );\n }\n\n builtTransports.push(\n new FetchTransport({\n url: config.url,\n apiKey: config.apiKey,\n })\n );\n\n if (enableTransports.console) {\n builtTransports.push(new ConsoleTransport({ level: LogLevel.DEBUG }));\n }\n\n const extraTransports = config.transports ?? [];\n return [...builtTransports, ...extraTransports];\n}\n\n/**\n * Builds instrumentations from config flags.\n */\nfunction buildInstrumentations(config: ReactNativeConfig): Config['instrumentations'] {\n const baseInstrumentations = getRNInstrumentations(config);\n const extraInstrumentations = config.instrumentations ?? [];\n return [...baseInstrumentations, ...extraInstrumentations];\n}\n\n/**\n * React Native stacktrace parser. Uses getStackFramesFromError for RN-specific formats.\n */\nfunction createParseStacktrace(releaseBundleFilename: string | undefined): Config['parseStacktrace'] {\n return (err) => ({\n frames: getStackFramesFromError(err, { releaseBundleFilename }),\n });\n}\n\n/**\n * Creates a full Faro config from React Native flag-based config.\n *\n * Based on flags, builds instrumentations and transports automatically.\n * Client just enables what they need; makeRNConfig does the rest.\n *\n * @param preloadedMobileMeta Device/session fields and structured mobile meta (passed from async `initializeFaro`).\n * @param appSymbolsBundleId Encoded `meta.app.bundleId` for server-side symbol retrace.\n */\nexport function makeRNConfig(\n config: ReactNativeConfig,\n preloadedMobileMeta?: PreloadedMobileMeta,\n appSymbolsBundleId?: string\n): ReactNativeFullConfig {\n const { app: preloadedAppMeta, ...structuredMobileMeta } = preloadedMobileMeta?.meta ?? {};\n const mobileMetas = Object.keys(structuredMobileMeta).length > 0 ? [structuredMobileMeta] : [];\n const defaultMetas = [getSdkMeta(), getPageMeta(), getScreenMeta(), ...mobileMetas];\n const customMetas = config.metas ?? [];\n const transports = buildTransports(config);\n const instrumentations = buildInstrumentations(config);\n const installationId = config.app.installationId ?? preloadedAppMeta?.installationId;\n\n const releaseBundleFilename = config.releaseBundleFilename;\n // Merge bundleId (from config, Metro, or DeviceInfo) with preloaded app meta\n const bundleIdValue = resolveAppBundleId(config.app, config.app?.name, appSymbolsBundleId);\n const appMetasIfPresent =\n preloadedAppMeta || bundleIdValue\n ? [{ app: { ...preloadedAppMeta, ...(bundleIdValue && { bundleId: bundleIdValue }) } }]\n : [];\n\n return {\n app: {\n ...config.app,\n ...(installationId && { installationId }),\n },\n ...(preloadedMobileMeta != null && {\n preloadedMobileMeta: preloadedMobileMeta.meta,\n preloadedSessionDeviceAttributes: preloadedMobileMeta.sessionAttributes,\n }),\n dedupe: config.dedupe ?? true,\n globalObjectKey: config.globalObjectKey ?? defaultGlobalObjectKey,\n internalLoggerLevel: config.internalLoggerLevel ?? InternalLoggerLevel.ERROR,\n isolate: config.isolate ?? false,\n parseStacktrace: config.parseStacktrace ?? createParseStacktrace(releaseBundleFilename),\n paused: config.paused ?? false,\n preventGlobalExposure: config.preventGlobalExposure ?? false,\n unpatchedConsole: config.unpatchedConsole ?? defaultUnpatchedConsole,\n batching: {\n enabled: false,\n sendTimeout: 250,\n itemLimit: 50,\n },\n sessionTracking: {\n ...defaultSessionTrackingConfig,\n ...config.sessionTracking,\n },\n metas: [...defaultMetas, ...customMetas, ...appMetasIfPresent],\n instrumentations,\n transports,\n ignoreUrls: config.ignoreUrls ?? [],\n ignoreErrors: config.ignoreErrors,\n beforeSend: config.beforeSend,\n preserveOriginalError: config.preserveOriginalError,\n userActionsInstrumentation: config.userActionsOptions,\n consoleInstrumentation: config.consoleCaptureOptions,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Config } from '@grafana/faro-core';\n\nimport type { ANRInstrumentationOptions } from '../instrumentations/anr';\nimport type { FrameMonitoringOptions } from '../instrumentations/frameMonitoring';\nimport type { SessionAttributes } from '../instrumentations/session/sessionAttributes';\n\nimport type { Sampling } from './sampling';\n\n/**\n * React Native session tracking config.\n * Extends Config['sessionTracking'] with sampling (Flutter-style) and RN-specific props.\n * Excludes samplingRate and sampler in favor of sampling.\n *\n * When `persistent` is true, sessions are stored with [react-native-mmkv](https://github.com/mrousavy/react-native-mmkv)\n * (synchronous). Add `react-native-mmkv` to your app and rebuild native projects.\n */\nexport type ReactNativeSessionTrackingConfig = Omit<\n NonNullable<Config['sessionTracking']>,\n 'samplingRate' | 'sampler'\n> & {\n /**\n * Session sampling. Use {@link SamplingRate} for fixed rate or\n * {@link SamplingFunction} for dynamic sampling.\n */\n sampling?: Sampling;\n};\n\n/**\n * Flags for enabling optional built-in transports.\n * FetchTransport is always instantiated when url is provided.\n */\nexport interface EnableTransportsConfig {\n /** Enable OfflineTransport for caching when offline (default: false) */\n offline?: boolean;\n /** Enable ConsoleTransport to log telemetry to Metro console for debugging (default: false) */\n console?: boolean;\n}\n\n/** RN-specific config: overrides + new props. Omit faro-core props we replace with RN equivalents. */\ntype ReactNativeConfigOverrides = {\n /** Application metadata (required) */\n app: Config['app'];\n sessionTracking?: ReactNativeSessionTrackingConfig;\n url?: string;\n apiKey?: string;\n enableTransports?: EnableTransportsConfig;\n /**\n * Which HTTP instrumentations to enable. When tracing is disabled, these control\n * HttpInstrumentation (fetch) and XHRInstrumentation (xhr). Default: both true.\n */\n enableHttpInstrumentation?: {\n /** HttpInstrumentation - patches fetch API (default: true) */\n fetch?: boolean;\n /** XHRInstrumentation - patches XMLHttpRequest (default: true) */\n xhr?: boolean;\n };\n enableTracing?: boolean;\n /** Passed to TracingInstrumentation. See TracingInstrumentationOptions in @grafana/faro-react-native-tracing. */\n tracingOptions?: Record<string, unknown>;\n cpuUsageVitals?: boolean;\n memoryUsageVitals?: boolean;\n refreshRateVitals?: boolean;\n fetchVitalsInterval?: number;\n frameMonitoringOptions?: FrameMonitoringOptions;\n enableErrorReporting?: boolean;\n enableCrashReporting?: boolean;\n anrTracking?: boolean;\n anrOptions?: ANRInstrumentationOptions;\n enableConsoleCapture?: boolean;\n consoleCaptureOptions?: Config['consoleInstrumentation'];\n enableUserActions?: boolean;\n userActionsOptions?: Config['userActionsInstrumentation'];\n /**\n * Hermes / minified release stack lines omit a file path. This must match the Metro plugin\n * source map top-level `file` (default `bundle.js`, or your `sourceMapFile` option there).\n */\n releaseBundleFilename?: string;\n};\n\n/**\n * React Native config: Config (omit replaced props) & overrides.\n * Omit: sessionTracking, consoleInstrumentation, userActionsInstrumentation.\n * instrumentations and transports inherited from Config for extras (built-ins come from flags).\n */\nexport type ReactNativeConfig = Partial<\n Omit<Config, 'sessionTracking' | 'consoleInstrumentation' | 'userActionsInstrumentation'>\n> &\n ReactNativeConfigOverrides;\n\n/**\n * Internal full config returned by `makeRNConfig`.\n * Extends faro-core `Config` with RN-specific fields that instrumentations need at init time.\n */\nexport type ReactNativeFullConfig = Config & {\n preloadedSessionDeviceAttributes?: SessionAttributes;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Config } from '@grafana/faro-core';\n\nimport type { ANRInstrumentationOptions } from '../instrumentations/anr';\nimport type { FrameMonitoringOptions } from '../instrumentations/frameMonitoring';\nimport type { PreloadedMobileMeta, SessionAttributes } from '../instrumentations/session/sessionAttributes';\n\nimport type { Sampling } from './sampling';\n\n/**\n * React Native session tracking config.\n * Extends Config['sessionTracking'] with sampling (Flutter-style) and RN-specific props.\n * Excludes samplingRate and sampler in favor of sampling.\n *\n * When `persistent` is true, sessions are stored with [react-native-mmkv](https://github.com/mrousavy/react-native-mmkv)\n * (synchronous). Add `react-native-mmkv` to your app and rebuild native projects.\n */\nexport type ReactNativeSessionTrackingConfig = Omit<\n NonNullable<Config['sessionTracking']>,\n 'samplingRate' | 'sampler'\n> & {\n /**\n * Session sampling. Use {@link SamplingRate} for fixed rate or\n * {@link SamplingFunction} for dynamic sampling.\n */\n sampling?: Sampling;\n};\n\n/**\n * Flags for enabling optional built-in transports.\n * FetchTransport is always instantiated when url is provided.\n */\nexport interface EnableTransportsConfig {\n /** Enable OfflineTransport for caching when offline (default: false) */\n offline?: boolean;\n /** Enable ConsoleTransport to log telemetry to Metro console for debugging (default: false) */\n console?: boolean;\n}\n\n/** RN-specific config: overrides + new props. Omit faro-core props we replace with RN equivalents. */\ntype ReactNativeConfigOverrides = {\n /** Application metadata (required) */\n app: Config['app'];\n sessionTracking?: ReactNativeSessionTrackingConfig;\n url?: string;\n apiKey?: string;\n enableTransports?: EnableTransportsConfig;\n /**\n * Which HTTP instrumentations to enable. When tracing is disabled, these control\n * HttpInstrumentation (fetch) and XHRInstrumentation (xhr). Default: both true.\n */\n enableHttpInstrumentation?: {\n /** HttpInstrumentation - patches fetch API (default: true) */\n fetch?: boolean;\n /** XHRInstrumentation - patches XMLHttpRequest (default: true) */\n xhr?: boolean;\n };\n enableTracing?: boolean;\n /** Passed to TracingInstrumentation. See TracingInstrumentationOptions in @grafana/faro-react-native-tracing. */\n tracingOptions?: Record<string, unknown>;\n cpuUsageVitals?: boolean;\n memoryUsageVitals?: boolean;\n refreshRateVitals?: boolean;\n fetchVitalsInterval?: number;\n frameMonitoringOptions?: FrameMonitoringOptions;\n enableErrorReporting?: boolean;\n enableCrashReporting?: boolean;\n anrTracking?: boolean;\n anrOptions?: ANRInstrumentationOptions;\n enableConsoleCapture?: boolean;\n consoleCaptureOptions?: Config['consoleInstrumentation'];\n enableUserActions?: boolean;\n userActionsOptions?: Config['userActionsInstrumentation'];\n /**\n * Hermes / minified release stack lines omit a file path. This must match the Metro plugin\n * source map top-level `file` (default `bundle.js`, or your `sourceMapFile` option there).\n */\n releaseBundleFilename?: string;\n};\n\n/**\n * React Native config: Config (omit replaced props) & overrides.\n * Omit: sessionTracking, consoleInstrumentation, userActionsInstrumentation.\n * instrumentations and transports inherited from Config for extras (built-ins come from flags).\n */\nexport type ReactNativeConfig = Partial<\n Omit<Config, 'sessionTracking' | 'consoleInstrumentation' | 'userActionsInstrumentation'>\n> &\n ReactNativeConfigOverrides;\n\n/**\n * Internal full config returned by `makeRNConfig`.\n * Extends faro-core `Config` with RN-specific fields that instrumentations need at init time.\n */\nexport type ReactNativeFullConfig = Config & {\n preloadedMobileMeta?: PreloadedMobileMeta['meta'];\n preloadedSessionDeviceAttributes?: SessionAttributes;\n};\n"]}
@@ -5,5 +5,5 @@ exports.FARO_REACT_NATIVE_NPM_VERSION = exports.FARO_REACT_NATIVE_NPM_NAME = voi
5
5
  * NPM package identity for this build. Generated by scripts/sync-faro-rn-package-meta.mjs - do not edit.
6
6
  */
7
7
  exports.FARO_REACT_NATIVE_NPM_NAME = '@grafana/faro-react-native';
8
- exports.FARO_REACT_NATIVE_NPM_VERSION = '1.2.1';
8
+ exports.FARO_REACT_NATIVE_NPM_VERSION = '1.3.0';
9
9
  //# sourceMappingURL=faroRNPackageMeta.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"faroRNPackageMeta.js","sourceRoot":"","sources":["../../../src/generated/faroRNPackageMeta.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,0BAA0B,GAAG,4BAAqC,CAAC;AACnE,QAAA,6BAA6B,GAAG,OAAgB,CAAC","sourcesContent":["/**\n * NPM package identity for this build. Generated by scripts/sync-faro-rn-package-meta.mjs - do not edit.\n */\nexport const FARO_REACT_NATIVE_NPM_NAME = '@grafana/faro-react-native' as const;\nexport const FARO_REACT_NATIVE_NPM_VERSION = '1.2.1' as const;\n"]}
1
+ {"version":3,"file":"faroRNPackageMeta.js","sourceRoot":"","sources":["../../../src/generated/faroRNPackageMeta.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,0BAA0B,GAAG,4BAAqC,CAAC;AACnE,QAAA,6BAA6B,GAAG,OAAgB,CAAC","sourcesContent":["/**\n * NPM package identity for this build. Generated by scripts/sync-faro-rn-package-meta.mjs - do not edit.\n */\nexport const FARO_REACT_NATIVE_NPM_NAME = '@grafana/faro-react-native' as const;\nexport const FARO_REACT_NATIVE_NPM_VERSION = '1.3.0' as const;\n"]}
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogLevel = exports.onNavigationStateChange = exports.getRouteName = exports.getCurrentRoute = exports.createNavigationStateChangeHandler = exports.useFaroNavigation = exports.ReactNativeNavigationIntegration = exports.setUserPersistence = exports.initializeUserPersistence = exports.getUserPersistence = exports.createUserPersistence = exports.setDataCollectionPolicy = exports.initializeDataCollectionPolicy = exports.getDataCollectionPolicy = exports.createDataCollectionPolicy = exports.OfflineTransport = exports.ConsoleTransport = exports.FetchTransport = exports.getSdkMeta = exports.getScreenMeta = exports.getPageMeta = exports.withFaroErrorBoundary = exports.FaroErrorBoundary = exports.notifyHttpRequestStart = exports.notifyHttpRequestEnd = exports.trackUserAction = exports.withFaroUserAction = exports.reactNativeLogArgsSerializer = exports.CrashReportingInstrumentation = exports.ANRInstrumentation = exports.FrameMonitoringInstrumentation = exports.StartupInstrumentation = exports.PerformanceInstrumentation = exports.XHRInstrumentation = exports.HttpInstrumentation = exports.UserActionInstrumentation = exports.AppStateInstrumentation = exports.ViewInstrumentation = exports.minimalSessionDeviceAttributes = exports.loadSessionDeviceAttributesForInit = exports.getSessionAttributes = exports.SessionInstrumentation = exports.ConsoleInstrumentation = exports.ErrorsInstrumentation = exports.ErrorMechanism = exports.getRNInstrumentations = exports.SamplingRate = exports.SamplingFunction = exports.faro = exports.initializeFaro = void 0;
4
- exports.defaultLogLevel = exports.allLogLevels = exports.InternalLoggerLevel = void 0;
3
+ exports.onNavigationStateChange = exports.getRouteName = exports.getCurrentRoute = exports.createNavigationStateChangeHandler = exports.useFaroNavigation = exports.ReactNativeNavigationIntegration = exports.setUserPersistence = exports.initializeUserPersistence = exports.getUserPersistence = exports.createUserPersistence = exports.setDataCollectionPolicy = exports.initializeDataCollectionPolicy = exports.getDataCollectionPolicy = exports.createDataCollectionPolicy = exports.OfflineTransport = exports.ConsoleTransport = exports.FetchTransport = exports.getSdkMeta = exports.getScreenMeta = exports.getPageMeta = exports.withFaroErrorBoundary = exports.FaroErrorBoundary = exports.notifyHttpRequestStart = exports.notifyHttpRequestEnd = exports.trackUserAction = exports.withFaroUserAction = exports.reactNativeLogArgsSerializer = exports.CrashReportingInstrumentation = exports.ANRInstrumentation = exports.FrameMonitoringInstrumentation = exports.StartupInstrumentation = exports.PerformanceInstrumentation = exports.XHRInstrumentation = exports.HttpInstrumentation = exports.UserActionInstrumentation = exports.AppStateInstrumentation = exports.ViewInstrumentation = exports.minimalSessionDeviceAttributes = exports.loadSessionDeviceAttributesForInit = exports.loadMobileMetaForInit = exports.getSessionAttributes = exports.SessionInstrumentation = exports.ConsoleInstrumentation = exports.ErrorsInstrumentation = exports.ErrorMechanism = exports.getRNInstrumentations = exports.SamplingRate = exports.SamplingFunction = exports.faro = exports.initializeFaro = void 0;
4
+ exports.defaultLogLevel = exports.allLogLevels = exports.InternalLoggerLevel = exports.LogLevel = void 0;
5
5
  // Main entry point for @grafana/faro-react-native
6
6
  // Apply PerformanceObserver polyfill first to prevent iOS bad_variant_access crash
7
7
  var performanceObserverPolyfill_1 = require("./util/performanceObserverPolyfill");
@@ -27,6 +27,7 @@ var session_1 = require("./instrumentations/session");
27
27
  Object.defineProperty(exports, "SessionInstrumentation", { enumerable: true, get: function () { return session_1.SessionInstrumentation; } });
28
28
  var sessionAttributes_1 = require("./instrumentations/session/sessionAttributes");
29
29
  Object.defineProperty(exports, "getSessionAttributes", { enumerable: true, get: function () { return sessionAttributes_1.getSessionAttributes; } });
30
+ Object.defineProperty(exports, "loadMobileMetaForInit", { enumerable: true, get: function () { return sessionAttributes_1.loadMobileMetaForInit; } });
30
31
  Object.defineProperty(exports, "loadSessionDeviceAttributesForInit", { enumerable: true, get: function () { return sessionAttributes_1.loadSessionDeviceAttributesForInit; } });
31
32
  Object.defineProperty(exports, "minimalSessionDeviceAttributes", { enumerable: true, get: function () { return sessionAttributes_1.minimalSessionDeviceAttributes; } });
32
33
  var view_1 = require("./instrumentations/view");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,kDAAkD;AAClD,mFAAmF;AACnF,kFAAsF;AACtF,IAAA,8DAAgC,GAAE,CAAC;AACnC,2CAA8C;AAArC,4GAAA,c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9B,eAAe;AACf,qCAA2C;AAAlC,mGAAA,WAAW,OAAA;AACpB,yCAA+C;AAAtC,uGAAA,aAAa,OAAA;AACtB,mCAAyC;AAAhC,iGAAA,UAAU,OAAA;AAEnB,oBAAoB;AACpB,4CAAoD;AAA3C,uGAAA,cAAc,OAAA;AACvB,gDAAwD;AAA/C,2GAAA,gBAAgB,OAAA;AAEzB,gDAAwD;AAA/C,2GAAA,gBAAgB,OAAA;AAGzB,gCAAgC;AAChC,mDAK0B;AAJxB,4HAAA,0BAA0B,OAAA;AAC1B,yHAAA,uBAAuB,OAAA;AACvB,gIAAA,8BAA8B,OAAA;AAC9B,yHAAA,uBAAuB,OAAA;AAIzB,0BAA0B;AAC1B,qDAK2B;AAJzB,wHAAA,qBAAqB,OAAA;AACrB,qHAAA,kBAAkB,OAAA;AAClB,4HAAA,yBAAyB,OAAA;AACzB,qHAAA,kBAAkB,OAAA;AAIpB,8BAA8B;AAC9B,sCAAmE;AAA1D,sHAAA,gCAAgC,OAAA;AACzC,2CAMsB;AALpB,+GAAA,iBAAiB,OAAA;AACjB,gIAAA,kCAAkC,OAAA;AAClC,6GAAA,eAAe,OAAA;AACf,0GAAA,YAAY,OAAA;AACZ,qHAAA,uBAAuB,OAAA;AAiBzB,oGAAoG;AACpG,mDAAgG;AAAvF,0GAAA,QAAQ,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAAE,8GAAA,YAAY,OAAA;AAAE,iHAAA,eAAe,OAAA","sourcesContent":["// Main entry point for @grafana/faro-react-native\n// Apply PerformanceObserver polyfill first to prevent iOS bad_variant_access crash\nimport { applyPerformanceObserverPolyfill } from './util/performanceObserverPolyfill';\napplyPerformanceObserverPolyfill();\nexport { initializeFaro } from './initialize';\nexport { faro } from '@grafana/faro-core';\n\n// Export types\nexport type { EnableTransportsConfig, ReactNativeConfig, ReactNativeSessionTrackingConfig } from './config/types';\n\n// Export sampling (Flutter-style interface)\nexport { SamplingFunction, SamplingRate, type Sampling, type SamplingContext } from './config/sampling';\n\n// Export instrumentation helpers\nexport { getRNInstrumentations } from './config/getRNInstrumentations';\n\n// Export instrumentations\nexport { ErrorMechanism, ErrorsInstrumentation } from './instrumentations/errors';\nexport type { ErrorMechanismType, ErrorsInstrumentationOptions } from './instrumentations/errors';\nexport { ConsoleInstrumentation } from './instrumentations/console';\nexport { SessionInstrumentation } from './instrumentations/session';\nexport {\n getSessionAttributes,\n loadSessionDeviceAttributesForInit,\n minimalSessionDeviceAttributes,\n} from './instrumentations/session/sessionAttributes';\nexport type { SessionAttributes } from './instrumentations/session/sessionAttributes';\nexport { ViewInstrumentation } from './instrumentations/view';\nexport { AppStateInstrumentation } from './instrumentations/appState';\nexport { UserActionInstrumentation } from './instrumentations/userActions';\nexport { HttpInstrumentation } from './instrumentations/http';\nexport { XHRInstrumentation } from './instrumentations/xhr';\nexport { PerformanceInstrumentation } from './instrumentations/performance';\nexport type { PerformanceInstrumentationOptions } from './instrumentations/performance/types';\nexport { StartupInstrumentation } from './instrumentations/startup';\nexport type { StartupInstrumentationOptions } from './instrumentations/startup/types';\nexport { FrameMonitoringInstrumentation } from './instrumentations/frameMonitoring';\nexport type { FrameMonitoringOptions } from './instrumentations/frameMonitoring';\nexport { ANRInstrumentation } from './instrumentations/anr';\nexport type { ANRInstrumentationOptions } from './instrumentations/anr';\nexport { CrashReportingInstrumentation } from './instrumentations/crashReporting';\nexport type { CrashReportingOptions } from './instrumentations/crashReporting';\n\n// Export console utilities\nexport { reactNativeLogArgsSerializer } from './instrumentations/console/utils';\n\n// Export user action helpers\nexport {\n withFaroUserAction,\n trackUserAction,\n type WithFaroUserActionProps,\n} from './instrumentations/userActions/withFaroUserAction';\nexport { notifyHttpRequestEnd, notifyHttpRequestStart } from './instrumentations/userActions/httpRequestMonitor';\nexport type { HttpRequestMessagePayload } from './instrumentations/userActions/httpRequestMonitor';\n\n// Export error boundary\nexport { FaroErrorBoundary } from './errorBoundary/FaroErrorBoundary';\nexport { withFaroErrorBoundary } from './errorBoundary/withFaroErrorBoundary';\nexport type {\n FaroErrorBoundaryProps,\n FaroErrorBoundaryState,\n FaroErrorBoundaryFallbackRender,\n} from './errorBoundary/types';\n\n// Export metas\nexport { getPageMeta } from './metas/page';\nexport { getScreenMeta } from './metas/screen';\nexport { getSdkMeta } from './metas/sdk';\n\n// Export transports\nexport { FetchTransport } from './transports/fetch';\nexport { ConsoleTransport } from './transports/console';\nexport type { ConsoleTransportOptions } from './transports/console';\nexport { OfflineTransport } from './transports/offline';\nexport type { OfflineTransportOptions } from './transports/offline';\n\n// Export data collection policy\nexport {\n createDataCollectionPolicy,\n getDataCollectionPolicy,\n initializeDataCollectionPolicy,\n setDataCollectionPolicy,\n} from './dataCollection';\nexport type { DataCollectionPolicy, DataCollectionPolicyOptions } from './dataCollection';\n\n// Export user persistence\nexport {\n createUserPersistence,\n getUserPersistence,\n initializeUserPersistence,\n setUserPersistence,\n} from './userPersistence';\nexport type { UserPersistence, UserPersistenceOptions } from './userPersistence';\n\n// Export navigation utilities\nexport { ReactNativeNavigationIntegration } from './navigation/v6';\nexport {\n useFaroNavigation,\n createNavigationStateChangeHandler,\n getCurrentRoute,\n getRouteName,\n onNavigationStateChange,\n} from './navigation';\nexport type { ReactNavigationDependencies, ReactNavigationConfig } from './navigation/types';\n\n// Re-export core types and enums that consumers will need\nexport type {\n Config,\n Faro,\n Instrumentation,\n Meta,\n Transport,\n PushErrorOptions,\n PushEventOptions,\n PushLogOptions,\n PushMeasurementOptions,\n} from '@grafana/faro-core';\n\n// Export LogLevel and InternalLoggerLevel from our local copy (avoid bundling faro-core's web code)\nexport { LogLevel, InternalLoggerLevel, allLogLevels, defaultLogLevel } from './internalLogger';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,kDAAkD;AAClD,mFAAmF;AACnF,kFAAsF;AACtF,IAAA,8DAAgC,GAAE,CAAC;AACnC,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AACvB,gDAA0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;AAO9B,eAAe;AACf,qCAA2C;AAAlC,mGAAA,WAAW,OAAA;AACpB,yCAA+C;AAAtC,uGAAA,aAAa,OAAA;AACtB,mCAAyC;AAAhC,iGAAA,UAAU,OAAA;AAEnB,oBAAoB;AACpB,4CAAoD;AAA3C,uGAAA,cAAc,OAAA;AACvB,gDAAwD;AAA/C,2GAAA,gBAAgB,OAAA;AAEzB,gDAAwD;AAA/C,2GAAA,gBAAgB,OAAA;AAGzB,gCAAgC;AAChC,mDAK0B;AAJxB,4HAAA,0BAA0B,OAAA;AAC1B,yHAAA,uBAAuB,OAAA;AACvB,gIAAA,8BAA8B,OAAA;AAC9B,yHAAA,uBAAuB,OAAA;AAIzB,0BAA0B;AAC1B,qDAK2B;AAJzB,wHAAA,qBAAqB,OAAA;AACrB,qHAAA,kBAAkB,OAAA;AAClB,4HAAA,yBAAyB,OAAA;AACzB,qHAAA,kBAAkB,OAAA;AAIpB,8BAA8B;AAC9B,sCAAmE;AAA1D,sHAAA,gCAAgC,OAAA;AACzC,2CAMsB;AALpB,+GAAA,iBAAiB,OAAA;AACjB,gIAAA,kCAAkC,OAAA;AAClC,6GAAA,eAAe,OAAA;AACf,0GAAA,YAAY,OAAA;AACZ,qHAAA,uBAAuB,OAAA;AAiBzB,oGAAoG;AACpG,mDAAgG;AAAvF,0GAAA,QAAQ,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAAE,8GAAA,YAAY,OAAA;AAAE,iHAAA,eAAe,OAAA","sourcesContent":["// Main entry point for @grafana/faro-react-native\n// Apply PerformanceObserver polyfill first to prevent iOS bad_variant_access crash\nimport { applyPerformanceObserverPolyfill } from './util/performanceObserverPolyfill';\napplyPerformanceObserverPolyfill();\nexport { initializeFaro } from './initialize';\nexport { faro } from '@grafana/faro-core';\n\n// Export types\nexport type { EnableTransportsConfig, ReactNativeConfig, ReactNativeSessionTrackingConfig } from './config/types';\n\n// Export sampling (Flutter-style interface)\nexport { SamplingFunction, SamplingRate, type Sampling, type SamplingContext } from './config/sampling';\n\n// Export instrumentation helpers\nexport { getRNInstrumentations } from './config/getRNInstrumentations';\n\n// Export instrumentations\nexport { ErrorMechanism, ErrorsInstrumentation } from './instrumentations/errors';\nexport type { ErrorMechanismType, ErrorsInstrumentationOptions } from './instrumentations/errors';\nexport { ConsoleInstrumentation } from './instrumentations/console';\nexport { SessionInstrumentation } from './instrumentations/session';\nexport {\n getSessionAttributes,\n loadMobileMetaForInit,\n loadSessionDeviceAttributesForInit,\n minimalSessionDeviceAttributes,\n} from './instrumentations/session/sessionAttributes';\nexport type { PreloadedMobileMeta, SessionAttributes } from './instrumentations/session/sessionAttributes';\nexport { ViewInstrumentation } from './instrumentations/view';\nexport { AppStateInstrumentation } from './instrumentations/appState';\nexport { UserActionInstrumentation } from './instrumentations/userActions';\nexport { HttpInstrumentation } from './instrumentations/http';\nexport { XHRInstrumentation } from './instrumentations/xhr';\nexport { PerformanceInstrumentation } from './instrumentations/performance';\nexport type { PerformanceInstrumentationOptions } from './instrumentations/performance/types';\nexport { StartupInstrumentation } from './instrumentations/startup';\nexport type { StartupInstrumentationOptions } from './instrumentations/startup/types';\nexport { FrameMonitoringInstrumentation } from './instrumentations/frameMonitoring';\nexport type { FrameMonitoringOptions } from './instrumentations/frameMonitoring';\nexport { ANRInstrumentation } from './instrumentations/anr';\nexport type { ANRInstrumentationOptions } from './instrumentations/anr';\nexport { CrashReportingInstrumentation } from './instrumentations/crashReporting';\nexport type { CrashReportingOptions } from './instrumentations/crashReporting';\n\n// Export console utilities\nexport { reactNativeLogArgsSerializer } from './instrumentations/console/utils';\n\n// Export user action helpers\nexport {\n withFaroUserAction,\n trackUserAction,\n type WithFaroUserActionProps,\n} from './instrumentations/userActions/withFaroUserAction';\nexport { notifyHttpRequestEnd, notifyHttpRequestStart } from './instrumentations/userActions/httpRequestMonitor';\nexport type { HttpRequestMessagePayload } from './instrumentations/userActions/httpRequestMonitor';\n\n// Export error boundary\nexport { FaroErrorBoundary } from './errorBoundary/FaroErrorBoundary';\nexport { withFaroErrorBoundary } from './errorBoundary/withFaroErrorBoundary';\nexport type {\n FaroErrorBoundaryProps,\n FaroErrorBoundaryState,\n FaroErrorBoundaryFallbackRender,\n} from './errorBoundary/types';\n\n// Export metas\nexport { getPageMeta } from './metas/page';\nexport { getScreenMeta } from './metas/screen';\nexport { getSdkMeta } from './metas/sdk';\n\n// Export transports\nexport { FetchTransport } from './transports/fetch';\nexport { ConsoleTransport } from './transports/console';\nexport type { ConsoleTransportOptions } from './transports/console';\nexport { OfflineTransport } from './transports/offline';\nexport type { OfflineTransportOptions } from './transports/offline';\n\n// Export data collection policy\nexport {\n createDataCollectionPolicy,\n getDataCollectionPolicy,\n initializeDataCollectionPolicy,\n setDataCollectionPolicy,\n} from './dataCollection';\nexport type { DataCollectionPolicy, DataCollectionPolicyOptions } from './dataCollection';\n\n// Export user persistence\nexport {\n createUserPersistence,\n getUserPersistence,\n initializeUserPersistence,\n setUserPersistence,\n} from './userPersistence';\nexport type { UserPersistence, UserPersistenceOptions } from './userPersistence';\n\n// Export navigation utilities\nexport { ReactNativeNavigationIntegration } from './navigation/v6';\nexport {\n useFaroNavigation,\n createNavigationStateChangeHandler,\n getCurrentRoute,\n getRouteName,\n onNavigationStateChange,\n} from './navigation';\nexport type { ReactNavigationDependencies, ReactNavigationConfig } from './navigation/types';\n\n// Re-export core types and enums that consumers will need\nexport type {\n Config,\n Faro,\n Instrumentation,\n Meta,\n Transport,\n PushErrorOptions,\n PushEventOptions,\n PushLogOptions,\n PushMeasurementOptions,\n} from '@grafana/faro-core';\n\n// Export LogLevel and InternalLoggerLevel from our local copy (avoid bundling faro-core's web code)\nexport { LogLevel, InternalLoggerLevel, allLogLevels, defaultLogLevel } from './internalLogger';\n"]}
@@ -40,19 +40,25 @@ exports.initializeFaro = initializeFaro;
40
40
  var faro_core_1 = require("@grafana/faro-core");
41
41
  var makeRNConfig_1 = require("./config/makeRNConfig");
42
42
  var sessionAttributes_1 = require("./instrumentations/session/sessionAttributes");
43
+ var appBuildIdentity_1 = require("./metas/appBuildIdentity");
43
44
  /**
44
- * Awaits async device/session attribute collection, then initializes Faro with core `initializeFaro`.
45
- * On failure during collection, uses `minimalSessionDeviceAttributes` before init.
45
+ * Awaits async device/session attribute collection and the build identity used
46
+ * for server-side symbol retrace, then initializes Faro with core
47
+ * `initializeFaro`. On failure during collection, uses
48
+ * `minimalSessionDeviceAttributes` / an empty build identity before init.
46
49
  */
47
50
  function initializeFaro(config) {
48
51
  return __awaiter(this, void 0, void 0, function () {
49
- var preloadedSessionDeviceAttributes, fullConfig;
50
- return __generator(this, function (_a) {
51
- switch (_a.label) {
52
- case 0: return [4 /*yield*/, (0, sessionAttributes_1.loadSessionDeviceAttributesForInit)()];
52
+ var _a, preloadedMobileMeta, appSymbolsBundleId, fullConfig;
53
+ return __generator(this, function (_b) {
54
+ switch (_b.label) {
55
+ case 0: return [4 /*yield*/, Promise.all([
56
+ (0, sessionAttributes_1.loadMobileMetaForInit)(),
57
+ (0, appBuildIdentity_1.loadAppSymbolsBundleIdForInit)(),
58
+ ])];
53
59
  case 1:
54
- preloadedSessionDeviceAttributes = _a.sent();
55
- fullConfig = (0, makeRNConfig_1.makeRNConfig)(config, preloadedSessionDeviceAttributes);
60
+ _a = _b.sent(), preloadedMobileMeta = _a[0], appSymbolsBundleId = _a[1];
61
+ fullConfig = (0, makeRNConfig_1.makeRNConfig)(config, preloadedMobileMeta, appSymbolsBundleId);
56
62
  return [2 /*return*/, (0, faro_core_1.initializeFaro)(fullConfig)];
57
63
  }
58
64
  });
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,wCAIC;AAdD,gDAAqF;AAErF,sDAAqD;AAErD,kFAAkG;AAElG;;;GAGG;AACH,SAAsB,cAAc,CAAC,MAAyB;;;;;wBACnB,qBAAM,IAAA,sDAAkC,GAAE,EAAA;;oBAA7E,gCAAgC,GAAG,SAA0C;oBAC7E,UAAU,GAAG,IAAA,2BAAY,EAAC,MAAM,EAAE,gCAAgC,CAAC,CAAC;oBAC1E,sBAAO,IAAA,0BAAkB,EAAC,UAAU,CAAC,EAAC;;;;CACvC","sourcesContent":["import { type Faro, initializeFaro as initializeFaroCore } from '@grafana/faro-core';\n\nimport { makeRNConfig } from './config/makeRNConfig';\nimport type { ReactNativeConfig } from './config/types';\nimport { loadSessionDeviceAttributesForInit } from './instrumentations/session/sessionAttributes';\n\n/**\n * Awaits async device/session attribute collection, then initializes Faro with core `initializeFaro`.\n * On failure during collection, uses `minimalSessionDeviceAttributes` before init.\n */\nexport async function initializeFaro(config: ReactNativeConfig): Promise<Faro> {\n const preloadedSessionDeviceAttributes = await loadSessionDeviceAttributesForInit();\n const fullConfig = makeRNConfig(config, preloadedSessionDeviceAttributes);\n return initializeFaroCore(fullConfig);\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,wCAOC;AApBD,gDAAqF;AAErF,sDAAqD;AAErD,kFAAqF;AACrF,6DAAyE;AAEzE;;;;;GAKG;AACH,SAAsB,cAAc,CAAC,MAAyB;;;;;wBACV,qBAAM,OAAO,CAAC,GAAG,CAAC;wBAClE,IAAA,yCAAqB,GAAE;wBACvB,IAAA,gDAA6B,GAAE;qBAChC,CAAC,EAAA;;oBAHI,KAA4C,SAGhD,EAHK,mBAAmB,QAAA,EAAE,kBAAkB,QAAA;oBAIxC,UAAU,GAAG,IAAA,2BAAY,EAAC,MAAM,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;oBACjF,sBAAO,IAAA,0BAAkB,EAAC,UAAU,CAAC,EAAC;;;;CACvC","sourcesContent":["import { type Faro, initializeFaro as initializeFaroCore } from '@grafana/faro-core';\n\nimport { makeRNConfig } from './config/makeRNConfig';\nimport type { ReactNativeConfig } from './config/types';\nimport { loadMobileMetaForInit } from './instrumentations/session/sessionAttributes';\nimport { loadAppSymbolsBundleIdForInit } from './metas/appBuildIdentity';\n\n/**\n * Awaits async device/session attribute collection and the build identity used\n * for server-side symbol retrace, then initializes Faro with core\n * `initializeFaro`. On failure during collection, uses\n * `minimalSessionDeviceAttributes` / an empty build identity before init.\n */\nexport async function initializeFaro(config: ReactNativeConfig): Promise<Faro> {\n const [preloadedMobileMeta, appSymbolsBundleId] = await Promise.all([\n loadMobileMetaForInit(),\n loadAppSymbolsBundleIdForInit(),\n ]);\n const fullConfig = makeRNConfig(config, preloadedMobileMeta, appSymbolsBundleId);\n return initializeFaroCore(fullConfig);\n}\n"]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isInvalidAnrCaptureStack = isInvalidAnrCaptureStack;
4
+ /**
5
+ * Returns true when an ANR stack was sampled on the crash-killer path instead of
6
+ * the blocked main thread (common when ANRTracker fires during process teardown).
7
+ *
8
+ * Uses only Android framework and Faro SDK frame names — no app-specific identifiers.
9
+ */
10
+ function isInvalidAnrCaptureStack(stack) {
11
+ if (!(stack === null || stack === void 0 ? void 0 : stack.trim())) {
12
+ return true;
13
+ }
14
+ var normalized = stack.toLowerCase();
15
+ return (normalized.includes('handleapplicationcrash') ||
16
+ normalized.includes('killapplicationhandler') ||
17
+ normalized.includes('farouncaughtexceptionhandler'));
18
+ }
19
+ //# sourceMappingURL=anrStack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anrStack.js","sourceRoot":"","sources":["../../../../src/instrumentations/anr/anrStack.ts"],"names":[],"mappings":";;AAMA,4DAYC;AAlBD;;;;;GAKG;AACH,SAAgB,wBAAwB,CAAC,KAAyB;IAChE,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,EAAE,CAAA,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAEvC,OAAO,CACL,UAAU,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC7C,UAAU,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC7C,UAAU,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CACpD,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Returns true when an ANR stack was sampled on the crash-killer path instead of\n * the blocked main thread (common when ANRTracker fires during process teardown).\n *\n * Uses only Android framework and Faro SDK frame names — no app-specific identifiers.\n */\nexport function isInvalidAnrCaptureStack(stack: string | undefined): boolean {\n if (!stack?.trim()) {\n return true;\n }\n\n const normalized = stack.toLowerCase();\n\n return (\n normalized.includes('handleapplicationcrash') ||\n normalized.includes('killapplicationhandler') ||\n normalized.includes('farouncaughtexceptionhandler')\n );\n}\n"]}