@nathanclaire/edge-telemetry-sdk 4.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +185 -30
  3. package/dist/appLifecycle-DS_fEclk.cjs +2 -0
  4. package/dist/appLifecycle-DS_fEclk.cjs.map +1 -0
  5. package/dist/{appLifecycle-DQErzJIR.js → appLifecycle-PffQ4vC1.js} +5 -3
  6. package/dist/appLifecycle-PffQ4vC1.js.map +1 -0
  7. package/dist/autoTaps.native-By9I4Kr2.cjs +2 -0
  8. package/dist/autoTaps.native-By9I4Kr2.cjs.map +1 -0
  9. package/dist/autoTaps.native-DQCXevD7.js +66 -0
  10. package/dist/autoTaps.native-DQCXevD7.js.map +1 -0
  11. package/dist/crashHandler.web-6KvedEB-.cjs +2 -0
  12. package/dist/crashHandler.web-6KvedEB-.cjs.map +1 -0
  13. package/dist/crashHandler.web-BUlSXYoS.js +30 -0
  14. package/dist/crashHandler.web-BUlSXYoS.js.map +1 -0
  15. package/dist/crashHandlerNative.native-CFVQ5UcO.cjs +2 -0
  16. package/dist/crashHandlerNative.native-CFVQ5UcO.cjs.map +1 -0
  17. package/dist/{crashHandlerNative.native-FupMnr1U.js → crashHandlerNative.native-DsCRd-oN.js} +13 -13
  18. package/dist/crashHandlerNative.native-DsCRd-oN.js.map +1 -0
  19. package/dist/deviceInfo.native-D5gNBG7m.cjs +2 -0
  20. package/dist/{deviceInfo.native-BoeTZcD6.cjs.map → deviceInfo.native-D5gNBG7m.cjs.map} +1 -1
  21. package/dist/deviceInfo.native-DiiHrnI3.js +53 -0
  22. package/dist/{deviceInfo.native-BJ-3Jj1T.js.map → deviceInfo.native-DiiHrnI3.js.map} +1 -1
  23. package/dist/{deviceInfo.web-BFB1-pcA.js → deviceInfo.web-BHsjVveq.js} +3 -3
  24. package/dist/{deviceInfo.web-BFB1-pcA.js.map → deviceInfo.web-BHsjVveq.js.map} +1 -1
  25. package/dist/{deviceInfo.web-3L3IDQQA.cjs → deviceInfo.web-DGCUHAnv.cjs} +2 -2
  26. package/dist/{deviceInfo.web-3L3IDQQA.cjs.map → deviceInfo.web-DGCUHAnv.cjs.map} +1 -1
  27. package/dist/deviceState.native-BEysbZ6O.js +58 -0
  28. package/dist/deviceState.native-BEysbZ6O.js.map +1 -0
  29. package/dist/deviceState.native-CrQMy11_.cjs +2 -0
  30. package/dist/deviceState.native-CrQMy11_.cjs.map +1 -0
  31. package/dist/deviceState.web-ByaQm9Ry.js +14 -0
  32. package/dist/deviceState.web-ByaQm9Ry.js.map +1 -0
  33. package/dist/deviceState.web-CSfUgHDU.cjs +2 -0
  34. package/dist/deviceState.web-CSfUgHDU.cjs.map +1 -0
  35. package/dist/frameTracker-9j0en6Zm.cjs +2 -0
  36. package/dist/frameTracker-9j0en6Zm.cjs.map +1 -0
  37. package/dist/{frameTracker-DdB8W_kC.js → frameTracker-BzXnxSkb.js} +18 -19
  38. package/dist/frameTracker-BzXnxSkb.js.map +1 -0
  39. package/dist/{httpAttributes-BrrtM8zh.js → httpAttributes-BWXOr4eP.js} +1 -1
  40. package/dist/{httpAttributes-BrrtM8zh.js.map → httpAttributes-BWXOr4eP.js.map} +1 -1
  41. package/dist/{httpAttributes-D0m6UID7.cjs → httpAttributes-COY0_kiF.cjs} +1 -1
  42. package/dist/{httpAttributes-D0m6UID7.cjs.map → httpAttributes-COY0_kiF.cjs.map} +1 -1
  43. package/dist/index.native.cjs +1 -1
  44. package/dist/index.native.cjs.map +1 -1
  45. package/dist/index.native.d.ts +1 -1
  46. package/dist/index.native.js +128 -71
  47. package/dist/index.native.js.map +1 -1
  48. package/dist/index.web.cjs +1 -1
  49. package/dist/index.web.cjs.map +1 -1
  50. package/dist/index.web.d.ts +1 -1
  51. package/dist/index.web.js +51 -38
  52. package/dist/index.web.js.map +1 -1
  53. package/dist/{interactionWeb.web-CJAviVQ7.js → interactionWeb.web-BWBjmovb.js} +8 -8
  54. package/dist/{interactionWeb.web-CJAviVQ7.js.map → interactionWeb.web-BWBjmovb.js.map} +1 -1
  55. package/dist/interactionWeb.web-CKDJLD9r.cjs +2 -0
  56. package/dist/{interactionWeb.web-Bl_cZlgh.cjs.map → interactionWeb.web-CKDJLD9r.cjs.map} +1 -1
  57. package/dist/{interceptFetchWeb.web-UXC2Lb6X.js → interceptFetchWeb.web-DjSR_Rft.js} +18 -17
  58. package/dist/interceptFetchWeb.web-DjSR_Rft.js.map +1 -0
  59. package/dist/interceptFetchWeb.web-ZHw6IQkU.cjs +2 -0
  60. package/dist/{interceptFetchWeb.web-UXC2Lb6X.js.map → interceptFetchWeb.web-ZHw6IQkU.cjs.map} +1 -1
  61. package/dist/{interceptHttpNative.native-BVpFuoNB.cjs → interceptHttpNative.native-C5scIcgY.cjs} +2 -2
  62. package/dist/{interceptHttpNative.native-BVpFuoNB.cjs.map → interceptHttpNative.native-C5scIcgY.cjs.map} +1 -1
  63. package/dist/{interceptHttpNative.native-rX-lPNST.js → interceptHttpNative.native-vF_Fksjk.js} +2 -2
  64. package/dist/{interceptHttpNative.native-rX-lPNST.js.map → interceptHttpNative.native-vF_Fksjk.js.map} +1 -1
  65. package/dist/{loadingTime-Bhomd9qq.cjs → loadingTime-Cj5Oh8lT.cjs} +1 -1
  66. package/dist/{loadingTime-Bhomd9qq.cjs.map → loadingTime-Cj5Oh8lT.cjs.map} +1 -1
  67. package/dist/{loadingTime-ZkYvFijA.js → loadingTime-DMc0zTY8.js} +1 -1
  68. package/dist/{loadingTime-ZkYvFijA.js.map → loadingTime-DMc0zTY8.js.map} +1 -1
  69. package/dist/memoryNative.native-CK3QFVjY.cjs +2 -0
  70. package/dist/memoryNative.native-CK3QFVjY.cjs.map +1 -0
  71. package/dist/{memoryNative.native-C42h9SjK.js → memoryNative.native-DkA6f7id.js} +12 -12
  72. package/dist/memoryNative.native-DkA6f7id.js.map +1 -0
  73. package/dist/nativeSender-Dt1HLaLi.js +37 -0
  74. package/dist/nativeSender-Dt1HLaLi.js.map +1 -0
  75. package/dist/nativeSender-hCgUa7Vz.cjs +2 -0
  76. package/dist/nativeSender-hCgUa7Vz.cjs.map +1 -0
  77. package/dist/navigationRef-CVIv0aIK.js +30 -0
  78. package/dist/navigationRef-CVIv0aIK.js.map +1 -0
  79. package/dist/navigationRef-CfIbeXX8.cjs +2 -0
  80. package/dist/navigationRef-CfIbeXX8.cjs.map +1 -0
  81. package/dist/navigationWeb.web-CRHpr5zl.js +51 -0
  82. package/dist/navigationWeb.web-CRHpr5zl.js.map +1 -0
  83. package/dist/navigationWeb.web-DwWjL80b.cjs +2 -0
  84. package/dist/navigationWeb.web-DwWjL80b.cjs.map +1 -0
  85. package/dist/{networkChange-CUO1hRLj.cjs → networkChange-2FGIQM-N.cjs} +2 -2
  86. package/dist/networkChange-2FGIQM-N.cjs.map +1 -0
  87. package/dist/{networkChange-D39hdSb0.js → networkChange-QA0893vW.js} +2 -2
  88. package/dist/networkChange-QA0893vW.js.map +1 -0
  89. package/dist/networkInfo.native-CcJ3JVRF.js +31 -0
  90. package/dist/networkInfo.native-CcJ3JVRF.js.map +1 -0
  91. package/dist/networkInfo.native-whB2wf6a.cjs +2 -0
  92. package/dist/networkInfo.native-whB2wf6a.cjs.map +1 -0
  93. package/dist/{networkInfo.web-B2YlLNsI.js → networkInfo.web-CcUpXMUK.js} +2 -2
  94. package/dist/networkInfo.web-CcUpXMUK.js.map +1 -0
  95. package/dist/{networkInfo.web-PltJTHsy.cjs → networkInfo.web-DfO-BUFx.cjs} +2 -2
  96. package/dist/networkInfo.web-DfO-BUFx.cjs.map +1 -0
  97. package/dist/react-bqe7KPOf.cjs +4 -0
  98. package/dist/react-bqe7KPOf.cjs.map +1 -0
  99. package/dist/react-urNtDGTL.js +413 -0
  100. package/dist/react-urNtDGTL.js.map +1 -0
  101. package/dist/runtimeReady.native-CxFl1rQR.js +35 -0
  102. package/dist/runtimeReady.native-CxFl1rQR.js.map +1 -0
  103. package/dist/runtimeReady.native-zueSbsEv.cjs +2 -0
  104. package/dist/runtimeReady.native-zueSbsEv.cjs.map +1 -0
  105. package/dist/{runtimeReady.web-C8fdIbVR.js → runtimeReady.web-JuE239Tg.js} +2 -2
  106. package/dist/{runtimeReady.web-C8fdIbVR.js.map → runtimeReady.web-JuE239Tg.js.map} +1 -1
  107. package/dist/{runtimeReady.web-DHW682RN.cjs → runtimeReady.web-vhAJFU61.cjs} +2 -2
  108. package/dist/{runtimeReady.web-DHW682RN.cjs.map → runtimeReady.web-vhAJFU61.cjs.map} +1 -1
  109. package/dist/{seedRuntimeReady-Cz8nOKoo.js → seedRuntimeReady-BlRdf3pR.js} +2 -2
  110. package/dist/{seedRuntimeReady-Cz8nOKoo.js.map → seedRuntimeReady-BlRdf3pR.js.map} +1 -1
  111. package/dist/seedRuntimeReady-CbjqbWCd.cjs +2 -0
  112. package/dist/{seedRuntimeReady-BKwkBEAF.cjs.map → seedRuntimeReady-CbjqbWCd.cjs.map} +1 -1
  113. package/dist/src/adapters/appLifecycle.d.ts +3 -3
  114. package/dist/src/adapters/batch.d.ts +44 -0
  115. package/dist/src/adapters/crashCapture.d.ts +5 -1
  116. package/dist/src/adapters/deviceState.d.ts +9 -0
  117. package/dist/src/adapters/frameAggregate.d.ts +15 -13
  118. package/dist/src/adapters/frameTracker.d.ts +1 -1
  119. package/dist/src/adapters/hangDetector.d.ts +41 -0
  120. package/dist/src/adapters/manualSpans.d.ts +41 -0
  121. package/dist/src/adapters/native/autoTaps.native.d.ts +15 -0
  122. package/dist/src/adapters/native/deviceState.native.d.ts +15 -0
  123. package/dist/src/adapters/native/memoryNative.native.d.ts +3 -3
  124. package/dist/src/adapters/native/networkInfo.native.d.ts +1 -1
  125. package/dist/src/adapters/native/runtimeReady.native.d.ts +16 -0
  126. package/dist/src/adapters/navigationRef.d.ts +17 -9
  127. package/dist/src/adapters/networkChange.d.ts +2 -2
  128. package/dist/src/adapters/traceManager.d.ts +18 -5
  129. package/dist/src/adapters/uiInteraction.d.ts +1 -1
  130. package/dist/src/adapters/viewManager.d.ts +24 -8
  131. package/dist/src/adapters/web/deviceState.web.d.ts +10 -0
  132. package/dist/src/adapters/web/navigationWeb.web.d.ts +6 -10
  133. package/dist/src/adapters/web/webVitals.web.d.ts +7 -0
  134. package/dist/src/adapters/xhrIntercept.d.ts +2 -0
  135. package/dist/src/core/breadcrumbs.d.ts +10 -0
  136. package/dist/src/core/telemetry.d.ts +139 -29
  137. package/dist/src/core/userProfile.d.ts +7 -0
  138. package/dist/src/createTelemetry.native.d.ts +3 -1
  139. package/dist/src/createTelemetry.web.d.ts +2 -1
  140. package/dist/src/golden.helper.d.ts +4 -0
  141. package/dist/src/index.base.d.ts +80 -6
  142. package/dist/src/index.native.d.ts +4 -61
  143. package/dist/src/index.web.d.ts +4 -51
  144. package/dist/src/react.d.ts +45 -0
  145. package/dist/src/telemetryNative.native.d.ts +79 -0
  146. package/dist/src/telemetryWeb.web.d.ts +59 -0
  147. package/dist/{store.native-TPqXngmF.cjs → store.native-BbS76uWV.cjs} +1 -1
  148. package/dist/{store.native-TPqXngmF.cjs.map → store.native-BbS76uWV.cjs.map} +1 -1
  149. package/dist/{store.native-BYBJcy6o.js → store.native-MlWyGgBp.js} +1 -1
  150. package/dist/{store.native-BYBJcy6o.js.map → store.native-MlWyGgBp.js.map} +1 -1
  151. package/dist/{store.web-CvqqN-_Z.cjs → store.web-BzKaP57Z.cjs} +1 -1
  152. package/dist/{store.web-CvqqN-_Z.cjs.map → store.web-BzKaP57Z.cjs.map} +1 -1
  153. package/dist/{store.web-DJAlN0nc.js → store.web-rhh0NOfs.js} +1 -1
  154. package/dist/{store.web-DJAlN0nc.js.map → store.web-rhh0NOfs.js.map} +1 -1
  155. package/dist/telemetry-60sfWkh0.js +1754 -0
  156. package/dist/telemetry-60sfWkh0.js.map +1 -0
  157. package/dist/telemetry-CW63glwb.cjs +2 -0
  158. package/dist/telemetry-CW63glwb.cjs.map +1 -0
  159. package/dist/{uiInteraction-DAqxxz0q.js → uiInteraction-BIDOMcrL.js} +39 -34
  160. package/dist/{uiInteraction-DAqxxz0q.js.map → uiInteraction-BIDOMcrL.js.map} +1 -1
  161. package/dist/uiInteraction-DxlwCVSn.cjs +2 -0
  162. package/dist/{uiInteraction-CdzvEI1p.cjs.map → uiInteraction-DxlwCVSn.cjs.map} +1 -1
  163. package/dist/{viewport-Dd85GUNO.cjs → viewport-9JcVIXYF.cjs} +1 -1
  164. package/dist/{viewport-Dd85GUNO.cjs.map → viewport-9JcVIXYF.cjs.map} +1 -1
  165. package/dist/{viewport-Dzmt5QwK.js → viewport-GWTEBt2K.js} +1 -1
  166. package/dist/{viewport-Dzmt5QwK.js.map → viewport-GWTEBt2K.js.map} +1 -1
  167. package/dist/{web-vitals.attribution-CVCPiX-h.cjs → web-vitals.attribution-DAvBvdng.cjs} +1 -1
  168. package/dist/{web-vitals.attribution-CVCPiX-h.cjs.map → web-vitals.attribution-DAvBvdng.cjs.map} +1 -1
  169. package/dist/{web-vitals.attribution-xw9N5MKQ.js → web-vitals.attribution-DcoMtvlY.js} +1 -1
  170. package/dist/{web-vitals.attribution-xw9N5MKQ.js.map → web-vitals.attribution-DcoMtvlY.js.map} +1 -1
  171. package/dist/webSender-DA087xb5.cjs +2 -0
  172. package/dist/webSender-DA087xb5.cjs.map +1 -0
  173. package/dist/webSender-g4rs5TIg.js +44 -0
  174. package/dist/webSender-g4rs5TIg.js.map +1 -0
  175. package/dist/{webVitals.web-CNIpsKlA.js → webVitals.web-DRTDK6s5.js} +39 -24
  176. package/dist/webVitals.web-DRTDK6s5.js.map +1 -0
  177. package/dist/webVitals.web-DvScDIjX.cjs +2 -0
  178. package/dist/webVitals.web-DvScDIjX.cjs.map +1 -0
  179. package/dist/{xhrIntercept-BNiA41Mj.js → xhrIntercept-9uAkQh3N.js} +16 -14
  180. package/dist/xhrIntercept-9uAkQh3N.js.map +1 -0
  181. package/dist/xhrIntercept-xG1Yl5RI.cjs +2 -0
  182. package/dist/xhrIntercept-xG1Yl5RI.cjs.map +1 -0
  183. package/docs/migration-v4.md +1 -1
  184. package/docs/migration-v5.md +178 -0
  185. package/package.json +12 -4
  186. package/dist/appLifecycle-CECgRVu_.cjs +0 -2
  187. package/dist/appLifecycle-CECgRVu_.cjs.map +0 -1
  188. package/dist/appLifecycle-DQErzJIR.js.map +0 -1
  189. package/dist/batch-CwoO7noL.js +0 -56
  190. package/dist/batch-CwoO7noL.js.map +0 -1
  191. package/dist/batch-DNu8Xr9T.cjs +0 -2
  192. package/dist/batch-DNu8Xr9T.cjs.map +0 -1
  193. package/dist/crashCapture-BOJ8nSAZ.cjs +0 -4
  194. package/dist/crashCapture-BOJ8nSAZ.cjs.map +0 -1
  195. package/dist/crashCapture-BW8WuyaU.js +0 -70
  196. package/dist/crashCapture-BW8WuyaU.js.map +0 -1
  197. package/dist/crashHandler.web-8F_k2veo.js +0 -29
  198. package/dist/crashHandler.web-8F_k2veo.js.map +0 -1
  199. package/dist/crashHandler.web-CWmF56mJ.cjs +0 -2
  200. package/dist/crashHandler.web-CWmF56mJ.cjs.map +0 -1
  201. package/dist/crashHandlerNative.native-C2kSikDt.cjs +0 -2
  202. package/dist/crashHandlerNative.native-C2kSikDt.cjs.map +0 -1
  203. package/dist/crashHandlerNative.native-FupMnr1U.js.map +0 -1
  204. package/dist/deviceInfo.native-BJ-3Jj1T.js +0 -53
  205. package/dist/deviceInfo.native-BoeTZcD6.cjs +0 -2
  206. package/dist/frameTracker-CHG6sIx9.cjs +0 -2
  207. package/dist/frameTracker-CHG6sIx9.cjs.map +0 -1
  208. package/dist/frameTracker-DdB8W_kC.js.map +0 -1
  209. package/dist/index-BtLlV1HA.js +0 -57
  210. package/dist/index-BtLlV1HA.js.map +0 -1
  211. package/dist/index-C2XQ-EYw.js +0 -1122
  212. package/dist/index-C2XQ-EYw.js.map +0 -1
  213. package/dist/index-CXsVZY35.cjs +0 -2
  214. package/dist/index-CXsVZY35.cjs.map +0 -1
  215. package/dist/index-DLquF88M.cjs +0 -2
  216. package/dist/index-DLquF88M.cjs.map +0 -1
  217. package/dist/interactionWeb.web-Bl_cZlgh.cjs +0 -2
  218. package/dist/interceptFetchWeb.web-T88kO-bE.cjs +0 -2
  219. package/dist/interceptFetchWeb.web-T88kO-bE.cjs.map +0 -1
  220. package/dist/memoryNative.native-C42h9SjK.js.map +0 -1
  221. package/dist/memoryNative.native-CA-7w9w1.cjs +0 -2
  222. package/dist/memoryNative.native-CA-7w9w1.cjs.map +0 -1
  223. package/dist/memoryStore-BIGZmmfD.cjs +0 -2
  224. package/dist/memoryStore-BIGZmmfD.cjs.map +0 -1
  225. package/dist/memoryStore-F5I-GQKM.js +0 -193
  226. package/dist/memoryStore-F5I-GQKM.js.map +0 -1
  227. package/dist/nativeSender-CfQaRuDK.cjs +0 -2
  228. package/dist/nativeSender-CfQaRuDK.cjs.map +0 -1
  229. package/dist/nativeSender-pgVSIv-X.js +0 -59
  230. package/dist/nativeSender-pgVSIv-X.js.map +0 -1
  231. package/dist/navigationRef-BzYbs8cm.js +0 -28
  232. package/dist/navigationRef-BzYbs8cm.js.map +0 -1
  233. package/dist/navigationRef-C-_qhb43.cjs +0 -2
  234. package/dist/navigationRef-C-_qhb43.cjs.map +0 -1
  235. package/dist/navigationTracker-BmywA_Bg.js +0 -19
  236. package/dist/navigationTracker-BmywA_Bg.js.map +0 -1
  237. package/dist/navigationTracker-HkwVyywz.cjs +0 -2
  238. package/dist/navigationTracker-HkwVyywz.cjs.map +0 -1
  239. package/dist/navigationWeb.web-CW_z7Ca4.cjs +0 -2
  240. package/dist/navigationWeb.web-CW_z7Ca4.cjs.map +0 -1
  241. package/dist/navigationWeb.web-CcwgKuIZ.js +0 -55
  242. package/dist/navigationWeb.web-CcwgKuIZ.js.map +0 -1
  243. package/dist/networkChange-CUO1hRLj.cjs.map +0 -1
  244. package/dist/networkChange-D39hdSb0.js.map +0 -1
  245. package/dist/networkInfo.native-CGrx9cnH.js +0 -343
  246. package/dist/networkInfo.native-CGrx9cnH.js.map +0 -1
  247. package/dist/networkInfo.native-YVySdv3S.cjs +0 -2
  248. package/dist/networkInfo.native-YVySdv3S.cjs.map +0 -1
  249. package/dist/networkInfo.web-B2YlLNsI.js.map +0 -1
  250. package/dist/networkInfo.web-PltJTHsy.cjs.map +0 -1
  251. package/dist/runtimeReady.native-Bh7EcYmK.js +0 -14
  252. package/dist/runtimeReady.native-Bh7EcYmK.js.map +0 -1
  253. package/dist/runtimeReady.native-jUmuE1lV.cjs +0 -2
  254. package/dist/runtimeReady.native-jUmuE1lV.cjs.map +0 -1
  255. package/dist/seedRuntimeReady-BKwkBEAF.cjs +0 -2
  256. package/dist/src/adapters/navigationTracker.d.ts +0 -6
  257. package/dist/src/adapters/screenTiming.d.ts +0 -15
  258. package/dist/telemetry-ByDJIz_9.js +0 -1280
  259. package/dist/telemetry-ByDJIz_9.js.map +0 -1
  260. package/dist/telemetry-CrU7i1Jc.cjs +0 -2
  261. package/dist/telemetry-CrU7i1Jc.cjs.map +0 -1
  262. package/dist/uiInteraction-CdzvEI1p.cjs +0 -2
  263. package/dist/webSender-BIwslfpT.js +0 -63
  264. package/dist/webSender-BIwslfpT.js.map +0 -1
  265. package/dist/webSender-CVtE4sOF.cjs +0 -2
  266. package/dist/webSender-CVtE4sOF.cjs.map +0 -1
  267. package/dist/webVitals.web-CNIpsKlA.js.map +0 -1
  268. package/dist/webVitals.web-DpWJ-iYp.cjs +0 -2
  269. package/dist/webVitals.web-DpWJ-iYp.cjs.map +0 -1
  270. package/dist/xhrIntercept-BADex6Cq.cjs +0 -2
  271. package/dist/xhrIntercept-BADex6Cq.cjs.map +0 -1
  272. package/dist/xhrIntercept-BNiA41Mj.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"httpAttributes-D0m6UID7.cjs","sources":["../src/adapters/httpAttributes.ts"],"sourcesContent":["// Shared http.request attribute builder — the single source of truth so the web fetch patch\n// and the shared XHR patch stay in lockstep on the v4 wire contract (§4.4, #95).\n//\n// `http.url` and `http.path` are gone outright (§9.1): the identifier lives in the path, so\n// query-stripping would not have addressed the threat. `http.host` + `http.route` replace them,\n// and the route template is normalized here, SDK-side — nothing raw ever leaves the device.\n\nconst MAX_ROUTE_DEPTH = 6;\n\n// contract §4.4.1, verbatim. This is the decision, not an illustration — do not \"improve\" it.\nfunction isVariable(s: string): boolean {\n if (/^v\\d+$/i.test(s)) return false; // version carve-out: /v2/ survives\n if (/\\d/.test(s)) return true; // any digit\n return s.length >= 32; // opaque all-alpha token / dashless UUID\n}\n\n/**\n * Path → route template. `/` stays `/`, no case folding, trailing slash dropped, depth capped\n * at 6 segments with a trailing `/…`. No cardinality guard: a client-side rolling collapse\n * would make one row mean different things on different phones.\n */\nexport function normalizeRoute(path: string): string {\n const segments = path.split(\"/\").filter((s) => s !== \"\");\n if (segments.length === 0) return \"/\";\n const kept = segments.slice(0, MAX_ROUTE_DEPTH).map((s) => (isVariable(s) ? \"{id}\" : s));\n const route = \"/\" + kept.join(\"/\");\n return segments.length > MAX_ROUTE_DEPTH ? route + \"/…\" : route;\n}\n\n/** UTF-8 byte length. v3 shipped `String.length` — UTF-16 code units, 2-3× short on non-ASCII. */\nexport function utf8Bytes(s: string): number {\n let n = 0;\n for (let i = 0; i < s.length; i++) {\n const c = s.charCodeAt(i);\n if (c < 0x80) n += 1;\n else if (c < 0x800) n += 2;\n else if (c >= 0xd800 && c <= 0xdbff && i + 1 < s.length) {\n const lo = s.charCodeAt(i + 1);\n if (lo >= 0xdc00 && lo <= 0xdfff) { n += 4; i++; } else n += 3; // lone surrogate → U+FFFD\n } else n += 3;\n }\n return n;\n}\n\n/**\n * Body size for every type measurable **without consuming the body**. `FormData` and streams\n * return undefined and the key is omitted — draining a consumer's request body is a far worse\n * bug than a missing key.\n */\nexport function requestBodySize(body: unknown): number | undefined {\n if (typeof body === \"string\") return utf8Bytes(body);\n if (body instanceof ArrayBuffer) return body.byteLength;\n if (ArrayBuffer.isView(body)) return body.byteLength; // TypedArray | DataView\n if (typeof Blob !== \"undefined\" && body instanceof Blob) return body.size;\n if (typeof URLSearchParams !== \"undefined\" && body instanceof URLSearchParams) {\n return utf8Bytes(body.toString()); // serialising a copy, not draining the body\n }\n return undefined;\n}\n\n// host keeps the port, deliberately unlike §6.4's trace gate. §4.4 omits it on a *native*\n// relative URL specifically: a browser resolves `/api/x` against the page, and RN has no\n// `location` to resolve against — a capability check, not a platform branch.\nfunction splitUrl(url: string): { host?: string; path: string } {\n const base = (globalThis as any).location?.href;\n try {\n const u = base ? new URL(url, base) : new URL(url);\n return { host: u.host, path: u.pathname };\n } catch {\n // native relative URL: no host to report, but the path is still routable\n const path = url.split(\"#\")[0].split(\"?\")[0];\n return { path: path.startsWith(\"/\") ? path : \"/\" + path };\n }\n}\n\n/** `content-length` → a response size. Absent or unparseable → undefined, so the key is omitted. */\nexport function contentLengthSize(header: string | null | undefined): number | undefined {\n if (header == null || header === \"\") return undefined;\n const n = Number(header);\n return Number.isFinite(n) ? n : undefined;\n}\n\n/** The #95 invariant, in one place: an `http.request` never describes the collector POST. */\nexport function isCollectorUrl(url: string, endpoint: string | undefined): boolean {\n return !!endpoint && url.startsWith(endpoint);\n}\n\nexport function buildHttpAttributes(args: {\n url: string;\n method: string;\n statusCode: number;\n durationMs: number;\n error?: unknown;\n requestBody?: unknown;\n responseSize?: number;\n}): Record<string, any> {\n const { url, method, statusCode, durationMs, error, requestBody, responseSize } = args;\n const { host, path } = splitUrl(url);\n\n const attrs: Record<string, any> = {\n // uppercased here, reporting-only — the forwarded request is never touched (§9.5).\n // Not defaulted: §9.5 authorises a case change, never inventing a verb. `fetch`'s own\n // GET default is applied by its caller, where it is a real observation.\n \"http.method\": String(method).toUpperCase(),\n \"http.status_code\": statusCode, // 0 = never got a response: DNS/TLS/timeout/abort\n \"http.duration_ms\": durationMs,\n \"http.success\": !error && statusCode >= 200 && statusCode < 400,\n \"http.route\": normalizeRoute(path),\n };\n if (host) attrs[\"http.host\"] = host;\n\n // §4.4's two null disciplines differ on purpose, so do not unify them:\n // request_size is \"omitted when unmeasurable, never 0\"; response_size ships a real 0.\n const reqSize = requestBodySize(requestBody);\n if (reqSize) attrs[\"http.request_size\"] = reqSize;\n if (typeof responseSize === \"number\" && Number.isFinite(responseSize)) {\n attrs[\"http.response_size\"] = responseSize;\n }\n\n return attrs;\n}\n"],"names":["isVariable","s","normalizeRoute","path","segments","route","utf8Bytes","n","i","c","lo","requestBodySize","body","splitUrl","url","base","u","contentLengthSize","header","isCollectorUrl","endpoint","buildHttpAttributes","args","method","statusCode","durationMs","error","requestBody","responseSize","host","attrs","reqSize"],"mappings":"aAUA,SAASA,EAAWC,EAAoB,CACpC,MAAI,UAAU,KAAKA,CAAC,EAAU,GAC1B,KAAK,KAAKA,CAAC,EAAU,GAClBA,EAAE,QAAU,EACvB,CAOO,SAASC,EAAeC,EAAsB,CACjD,MAAMC,EAAWD,EAAK,MAAM,GAAG,EAAE,OAAQF,GAAMA,IAAM,EAAE,EACvD,GAAIG,EAAS,SAAW,EAAG,MAAO,IAElC,MAAMC,EAAQ,IADDD,EAAS,MAAM,EAAG,CAAe,EAAE,IAAKH,GAAOD,EAAWC,CAAC,EAAI,OAASA,CAAE,EAC9D,KAAK,GAAG,EACjC,OAAOG,EAAS,OAAS,EAAkBC,EAAQ,KAAOA,CAC9D,CAGO,SAASC,EAAUL,EAAmB,CACzC,IAAIM,EAAI,EACR,QAASC,EAAI,EAAGA,EAAIP,EAAE,OAAQO,IAAK,CAC/B,MAAMC,EAAIR,EAAE,WAAWO,CAAC,EACxB,GAAIC,EAAI,IAAMF,GAAK,UACVE,EAAI,KAAOF,GAAK,UAChBE,GAAK,OAAUA,GAAK,OAAUD,EAAI,EAAIP,EAAE,OAAQ,CACrD,MAAMS,EAAKT,EAAE,WAAWO,EAAI,CAAC,EACzBE,GAAM,OAAUA,GAAM,OAAUH,GAAK,EAAGC,KAAYD,GAAK,CACjE,MAAOA,GAAK,CAChB,CACA,OAAOA,CACX,CAOO,SAASI,EAAgBC,EAAmC,CAC/D,GA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,EAAM,WAAW,EAAID,GAI/B,MAAME,EAAUpB,EAAgBgB,CAAW,EAC3C,OAAII,IAASD,EAAM,mBAAmB,EAAIC,GACtC,OAAOH,GAAiB,UAAY,OAAO,SAASA,CAAY,IAChEE,EAAM,oBAAoB,EAAIF,GAG3BE,CACX"}
1
+ {"version":3,"file":"httpAttributes-COY0_kiF.cjs","sources":["../src/adapters/httpAttributes.ts"],"sourcesContent":["// Shared http.request attribute builder — the single source of truth so the web fetch patch\n// and the shared XHR patch stay in lockstep on the v4 wire contract (§4.4, #95).\n//\n// `http.url` and `http.path` are gone outright (§9.1): the identifier lives in the path, so\n// query-stripping would not have addressed the threat. `http.host` + `http.route` replace them,\n// and the route template is normalized here, SDK-side — nothing raw ever leaves the device.\n\nconst MAX_ROUTE_DEPTH = 6;\n\n// contract §4.4.1, verbatim. This is the decision, not an illustration — do not \"improve\" it.\nfunction isVariable(s: string): boolean {\n if (/^v\\d+$/i.test(s)) return false; // version carve-out: /v2/ survives\n if (/\\d/.test(s)) return true; // any digit\n return s.length >= 32; // opaque all-alpha token / dashless UUID\n}\n\n/**\n * Path → route template. `/` stays `/`, no case folding, trailing slash dropped, depth capped\n * at 6 segments with a trailing `/…`. No cardinality guard: a client-side rolling collapse\n * would make one row mean different things on different phones.\n */\nexport function normalizeRoute(path: string): string {\n const segments = path.split(\"/\").filter((s) => s !== \"\");\n if (segments.length === 0) return \"/\";\n const kept = segments.slice(0, MAX_ROUTE_DEPTH).map((s) => (isVariable(s) ? \"{id}\" : s));\n const route = \"/\" + kept.join(\"/\");\n return segments.length > MAX_ROUTE_DEPTH ? route + \"/…\" : route;\n}\n\n/** UTF-8 byte length. v3 shipped `String.length` — UTF-16 code units, 2-3× short on non-ASCII. */\nexport function utf8Bytes(s: string): number {\n let n = 0;\n for (let i = 0; i < s.length; i++) {\n const c = s.charCodeAt(i);\n if (c < 0x80) n += 1;\n else if (c < 0x800) n += 2;\n else if (c >= 0xd800 && c <= 0xdbff && i + 1 < s.length) {\n const lo = s.charCodeAt(i + 1);\n if (lo >= 0xdc00 && lo <= 0xdfff) { n += 4; i++; } else n += 3; // lone surrogate → U+FFFD\n } else n += 3;\n }\n return n;\n}\n\n/**\n * Body size for every type measurable **without consuming the body**. `FormData` and streams\n * return undefined and the key is omitted — draining a consumer's request body is a far worse\n * bug than a missing key.\n */\nexport function requestBodySize(body: unknown): number | undefined {\n if (typeof body === \"string\") return utf8Bytes(body);\n if (body instanceof ArrayBuffer) return body.byteLength;\n if (ArrayBuffer.isView(body)) return body.byteLength; // TypedArray | DataView\n if (typeof Blob !== \"undefined\" && body instanceof Blob) return body.size;\n if (typeof URLSearchParams !== \"undefined\" && body instanceof URLSearchParams) {\n return utf8Bytes(body.toString()); // serialising a copy, not draining the body\n }\n return undefined;\n}\n\n// host keeps the port, deliberately unlike §6.4's trace gate. §4.4 omits it on a *native*\n// relative URL specifically: a browser resolves `/api/x` against the page, and RN has no\n// `location` to resolve against — a capability check, not a platform branch.\nfunction splitUrl(url: string): { host?: string; path: string } {\n const base = (globalThis as any).location?.href;\n try {\n const u = base ? new URL(url, base) : new URL(url);\n return { host: u.host, path: u.pathname };\n } catch {\n // native relative URL: no host to report, but the path is still routable\n const path = url.split(\"#\")[0].split(\"?\")[0];\n return { path: path.startsWith(\"/\") ? path : \"/\" + path };\n }\n}\n\n/** `content-length` → a response size. Absent or unparseable → undefined, so the key is omitted. */\nexport function contentLengthSize(header: string | null | undefined): number | undefined {\n if (header == null || header === \"\") return undefined;\n const n = Number(header);\n return Number.isFinite(n) ? n : undefined;\n}\n\n/** The #95 invariant, in one place: an `http.request` never describes the collector POST. */\nexport function isCollectorUrl(url: string, endpoint: string | undefined): boolean {\n return !!endpoint && url.startsWith(endpoint);\n}\n\nexport function buildHttpAttributes(args: {\n url: string;\n method: string;\n statusCode: number;\n durationMs: number;\n error?: unknown;\n requestBody?: unknown;\n responseSize?: number;\n}): Record<string, any> {\n const { url, method, statusCode, durationMs, error, requestBody, responseSize } = args;\n const { host, path } = splitUrl(url);\n\n const attrs: Record<string, any> = {\n // uppercased here, reporting-only — the forwarded request is never touched (§9.5).\n // Not defaulted: §9.5 authorises a case change, never inventing a verb. `fetch`'s own\n // GET default is applied by its caller, where it is a real observation.\n \"http.method\": String(method).toUpperCase(),\n \"http.status_code\": statusCode, // 0 = never got a response: DNS/TLS/timeout/abort\n \"http.duration_ms\": durationMs,\n \"http.success\": !error && statusCode >= 200 && statusCode < 400,\n \"http.route\": normalizeRoute(path),\n };\n if (host) attrs[\"http.host\"] = host;\n\n // §4.4's two null disciplines differ on purpose, so do not unify them:\n // request_size is \"omitted when unmeasurable, never 0\"; response_size ships a real 0.\n const reqSize = requestBodySize(requestBody);\n if (reqSize) attrs[\"http.request_size\"] = reqSize;\n if (typeof responseSize === \"number\" && Number.isFinite(responseSize)) {\n attrs[\"http.response_size\"] = responseSize;\n }\n\n return attrs;\n}\n"],"names":["isVariable","s","normalizeRoute","path","segments","route","utf8Bytes","n","i","c","lo","requestBodySize","body","splitUrl","url","base","u","contentLengthSize","header","isCollectorUrl","endpoint","buildHttpAttributes","args","method","statusCode","durationMs","error","requestBody","responseSize","host","attrs","reqSize"],"mappings":"aAUA,SAASA,EAAWC,EAAoB,CACpC,MAAI,UAAU,KAAKA,CAAC,EAAU,GAC1B,KAAK,KAAKA,CAAC,EAAU,GAClBA,EAAE,QAAU,EACvB,CAOO,SAASC,EAAeC,EAAsB,CACjD,MAAMC,EAAWD,EAAK,MAAM,GAAG,EAAE,OAAQF,GAAMA,IAAM,EAAE,EACvD,GAAIG,EAAS,SAAW,EAAG,MAAO,IAElC,MAAMC,EAAQ,IADDD,EAAS,MAAM,EAAG,CAAe,EAAE,IAAKH,GAAOD,EAAWC,CAAC,EAAI,OAASA,CAAE,EAC9D,KAAK,GAAG,EACjC,OAAOG,EAAS,OAAS,EAAkBC,EAAQ,KAAOA,CAC9D,CAGO,SAASC,EAAUL,EAAmB,CACzC,IAAIM,EAAI,EACR,QAASC,EAAI,EAAGA,EAAIP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,EAAoBC,EAQZ,CACpB,KAAM,CAAE,IAAAR,EAAK,OAAAS,EAAQ,WAAAC,EAAY,WAAAC,EAAY,MAAAC,EAAO,YAAAC,EAAa,aAAAC,GAAiBN,EAC5E,CAAE,KAAAO,EAAM,KAAA1B,GAASU,EAASC,CAAG,EAE7BgB,EAA6B,CAI/B,cAAe,OAAOP,CAAM,EAAE,YAAA,EAC9B,mBAAoBC,EACpB,mBAAoBC,EACpB,eAAgB,CAACC,GAASF,GAAc,KAAOA,EAAa,IAC5D,aAActB,EAAeC,CAAI,CAAA,EAEjC0B,IAAMC,EAAM,WAAW,EAAID,GAI/B,MAAME,EAAUpB,EAAgBgB,CAAW,EAC3C,OAAII,IAASD,EAAM,mBAAmB,EAAIC,GACtC,OAAOH,GAAiB,UAAY,OAAO,SAASA,CAAY,IAChEE,EAAM,oBAAoB,EAAIF,GAG3BE,CACX"}
@@ -1,2 +1,2 @@
1
- "use strict";var b=Object.create;var w=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var q=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of P(e))!T.call(a,i)&&i!==t&&w(a,i,{get:()=>e[i],enumerable:!(r=p(e,i))||r.enumerable});return a};var h=(a,e,t)=>(t=a!=null?b(S(a)):{},q(e||!a||!a.__esModule?w(t,"default",{value:a,enumerable:!0}):t,a));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./memoryStore-BIGZmmfD.cjs"),m=require("./uiInteraction-CdzvEI1p.cjs");function I(a){if(!a||!a.startsWith("edge_"))throw new Error("createTelemetry: apiKey is required and must start with 'edge_'")}function R(a){return I(a?.apiKey),n.setDebug(a?.debug??!1),n.normalizeAllowlist(a?.traceHostAllowlist),new v(a)}class v extends n.TelemetryBase{constructor(e){n.setDebug(e?.debug??!1),super(),this.tapRage=new m.RageTracker(m.RAGE_WINDOW_MS),n.debug.log("🌍 Running Native Telemetry"),this.instancePromise=(async()=>{try{await Promise.resolve().then(()=>require("./index-DLquF88M.cjs")).then(c=>c.index)}catch(c){n.debug.warn("crypto.getRandomValues polyfill unavailable:",c)}const{Telemetry:t}=await Promise.resolve().then(()=>require("./telemetry-CrU7i1Jc.cjs")),{nativeSender:r}=await Promise.resolve().then(()=>require("./nativeSender-CfQaRuDK.cjs")),{nativeStore:i}=await Promise.resolve().then(()=>require("./store.native-TPqXngmF.cjs")),{DeviceInfoTrackerNative:o}=await Promise.resolve().then(()=>require("./deviceInfo.native-BoeTZcD6.cjs")),{NetworkInfoTrackerNative:s}=await Promise.resolve().then(()=>require("./networkInfo.native-YVySdv3S.cjs"));let l;try{({Platform:{OS:l}}=await import("react-native"))}catch{}const y=new s,g=new o,d=e?.store??i(),k=e?.sender??r(e?.endpoint,e?.apiKey,d),u=new t({sender:k,batchSize:e?.batchSize,flushIntervalMs:e?.flushIntervalMs,endpoint:e?.endpoint,platform:l,deviceInfoHandler:g,networkInfoHandler:y,store:d,beforeSend:e?.beforeSend,sessionSampleRate:e?.sessionSampleRate,traceHostAllowlist:e?.traceHostAllowlist,buildId:e?.buildId}),{runtimeReadyAt:f}=await Promise.resolve().then(()=>require("./runtimeReady.native-jUmuE1lV.cjs")).catch(c=>(n.debug.warn("Native runtime-ready module unavailable:",c),{runtimeReadyAt:async()=>{}})),{seedRuntimeReady:N}=await Promise.resolve().then(()=>require("./seedRuntimeReady-BKwkBEAF.cjs"));return N(u.views,f,"Native"),await u.resumeOrStartSession().catch(c=>n.debug.warn("Native session resume failed:",c)),this.resolved=u,u})(),this.attachAppLifecycle().catch(t=>{n.debug.log("Native attachAppLifecycle errors",t)}),this.trackErrors({captureConsole:e?.captureConsole}).catch(t=>{n.debug.warn("Native trackErrors failed:",t)}),this.trackFrameDrops().catch(t=>{n.debug.log("Native trackFrameDrops errors",t)}),this.trackNetworkRequests().catch(t=>{n.debug.log("Native trackNetworkRequests errors",t)}),this.trackMemoryUsage().catch(t=>{n.debug.log("Native trackMemoryUsage errors",t)})}async attachAppLifecycle(){const{AppState:e}=await import("react-native"),t=await this.instancePromise,{AppLifecycleEmitter:r}=await Promise.resolve().then(()=>require("./appLifecycle-CECgRVu_.cjs")),i=new r(t);i.onState(e.currentState==="active").catch(o=>n.debug.warn("app lifecycle seed failed:",o)),e.addEventListener("change",o=>{const s=o==="active";i.onState(s).then(()=>s?void 0:t.flush()).catch(l=>n.debug.warn("background flush failed:",l))})}async getDeviceInfo(){const{DeviceInfoTrackerNative:e}=await Promise.resolve().then(()=>require("./deviceInfo.native-BoeTZcD6.cjs")),t=await this.instancePromise,r=new e;return t.getDeviceInfo(r)}async getNetworkInfo(){const{NetworkInfoTrackerNative:e}=await Promise.resolve().then(()=>require("./networkInfo.native-YVySdv3S.cjs")),t=await this.instancePromise,r=new e;return t.getNetworkInfo(r)}async trackFrameDrops(){const{FrameDropTracker:e}=await Promise.resolve().then(()=>require("./frameTracker-CHG6sIx9.cjs")),t=await this.instancePromise,r=new e(t);return t.trackFrameDrops(r)}async trackNetworkRequests(){const{NetworkTrackerNative:e}=await Promise.resolve().then(()=>require("./interceptHttpNative.native-BVpFuoNB.cjs")),t=await this.instancePromise,r=new e(t);return t.trackNetworkRequests(r)}async trackMemoryUsage(){const{TelemetryMemoryUsageNative:e}=await Promise.resolve().then(()=>require("./memoryNative.native-CA-7w9w1.cjs")),t=await this.instancePromise,r=new e(t);return t.trackMemoryUsage(r)}async screenStart(e){return(await this.instancePromise).screens.startScreen(e)}async screenEnd(e){return(await this.instancePromise).screens.endScreen(e)}async trackRoute(e,t){return(await this.instancePromise).recordRouteChange(e,t)}async trackTap(e){const t=Date.now(),r=typeof e=="string"&&e.trim()!=="",i=m.uiAttributes({type:"tap",target:r?e:m.UI_UNNAMED,nameSource:r?"edge_action":"none",tag:"native",rage:r&&this.tapRage.record(e,t)}),o=s=>s.log("ui.interaction",{...s.trace.interactionSpan(t),...i},s.snapshot(t));return Promise.resolve(this.resolved?o(this.resolved):this.instancePromise.then(o)).catch(s=>n.debug.warn("Native ui.interaction failed:",s))}}exports.memoryStore=n.memoryStore;exports.TelemetryNative=v;exports.createTelemetry=R;
1
+ "use strict";var S=Object.create;var f=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var A=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of q(e))!R.call(i,s)&&s!==t&&f(i,s,{get:()=>e[s],enumerable:!(r=P(e,s))||r.enumerable});return i};var m=(i,e,t)=>(t=i!=null?S(I(i)):{},A(e||!i||!i.__esModule?f(t,"default",{value:i,enumerable:!0}):t,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./react-bqe7KPOf.cjs"),h=require("./uiInteraction-DxlwCVSn.cjs");class D extends a.TelemetryBase{constructor(e){a.setDebug(e?.debug??!1),super(),this.tapRage=new h.RageTracker(h.RAGE_WINDOW_MS),this.explicitTaps=0,a.debug.log("🌍 Running Native Telemetry"),this.instancePromise=(async()=>{try{await import("react-native-get-random-values")}catch(c){a.debug.warn("crypto.getRandomValues polyfill unavailable:",c)}const{Telemetry:t}=await Promise.resolve().then(()=>require("./telemetry-CW63glwb.cjs")).then(c=>c.telemetry),{nativeSender:r}=await Promise.resolve().then(()=>require("./nativeSender-hCgUa7Vz.cjs")),{nativeStore:s}=await Promise.resolve().then(()=>require("./store.native-BbS76uWV.cjs")),{DeviceInfoTrackerNative:o}=await Promise.resolve().then(()=>require("./deviceInfo.native-D5gNBG7m.cjs")),{NetworkInfoTrackerNative:n}=await Promise.resolve().then(()=>require("./networkInfo.native-whB2wf6a.cjs"));let l;try{({Platform:{OS:l}}=await import("react-native"))}catch{}const{DeviceStateNative:v}=await Promise.resolve().then(()=>require("./deviceState.native-CrQMy11_.cjs")),d=new n,y=new o,w=e?.store??s(),g=e?.sender??r(e?.endpoint,e?.apiKey,w),u=new t({sender:g,batchSize:e?.batchSize,flushIntervalMs:e?.flushIntervalMs,endpoint:e?.endpoint,platform:l,deviceInfoHandler:y,networkInfoHandler:d,store:w,beforeSend:e?.beforeSend,sessionSampleRate:e?.sessionSampleRate,traceHostAllowlist:e?.traceHostAllowlist,buildId:e?.buildId,enabled:e?.enabled,deviceStateHandler:new v}),{runtimeReadyAt:k,processStartAt:N,startupDurationMs:T}=await Promise.resolve().then(()=>require("./runtimeReady.native-zueSbsEv.cjs")).catch(c=>(a.debug.warn("Native runtime-ready module unavailable:",c),{runtimeReadyAt:async()=>{},processStartAt:()=>{},startupDurationMs:void 0})),{seedRuntimeReady:b}=await Promise.resolve().then(()=>require("./seedRuntimeReady-CbjqbWCd.cjs"));b(u.views,k,"Native");const p=N();return u.views.anchorInitial(p),u.jsReadyMs=()=>{const c=globalThis.performance?.rnStartupTiming?.executeJavaScriptBundleEntryPointEnd;return p!==void 0&&typeof c=="number"&&c>=p?c-p:void 0},u.appStartMs=T,await u.resumeOrStartSession().catch(c=>a.debug.warn("Native session resume failed:",c)),this.resolved=u,u})(),e?.autoTrackTaps&&this.autoTrackTaps().catch(t=>a.debug.warn("Native autoTrackTaps failed:",t)),this.attachAppLifecycle().catch(t=>{a.debug.log("Native attachAppLifecycle errors",t)}),this.trackErrors({captureConsole:e?.captureConsole}).catch(t=>{a.debug.warn("Native trackErrors failed:",t)}),this.trackFrameDrops().catch(t=>{a.debug.log("Native trackFrameDrops errors",t)}),this.trackNetworkRequests().catch(t=>{a.debug.log("Native trackNetworkRequests errors",t)}),this.trackMemoryUsage().catch(t=>{a.debug.log("Native trackMemoryUsage errors",t)})}async attachAppLifecycle(){const{AppState:e}=await import("react-native"),t=await this.instancePromise,{AppLifecycleEmitter:r}=await Promise.resolve().then(()=>require("./appLifecycle-DS_fEclk.cjs")),s=new r(t);s.onState(e.currentState==="active").catch(o=>a.debug.warn("app lifecycle seed failed:",o)),e.addEventListener("change",o=>{const n=o==="active";s.onState(n).then(()=>n?void 0:t.flush()).catch(l=>a.debug.warn("background flush failed:",l))})}async trackErrors(e){const{CrashHandlerNative:t}=await Promise.resolve().then(()=>require("./crashHandlerNative.native-CFVQ5UcO.cjs")),r=await this.instancePromise;return r.trackErrors(new t(r),e)}async getDeviceInfo(){const{DeviceInfoTrackerNative:e}=await Promise.resolve().then(()=>require("./deviceInfo.native-D5gNBG7m.cjs")),t=await this.instancePromise,r=new e;return t.getDeviceInfo(r)}async getNetworkInfo(){const{NetworkInfoTrackerNative:e}=await Promise.resolve().then(()=>require("./networkInfo.native-whB2wf6a.cjs")),t=await this.instancePromise,r=new e;return t.getNetworkInfo(r)}async trackFrameDrops(){const{FrameDropTracker:e}=await Promise.resolve().then(()=>require("./frameTracker-9j0en6Zm.cjs")),t=await this.instancePromise,r=new e(t);return t.trackFrameDrops(r)}async trackNetworkRequests(){const{NetworkTrackerNative:e}=await Promise.resolve().then(()=>require("./interceptHttpNative.native-C5scIcgY.cjs")),t=await this.instancePromise,r=new e(t);return t.trackNetworkRequests(r)}async trackMemoryUsage(){const{TelemetryMemoryUsageNative:e}=await Promise.resolve().then(()=>require("./memoryNative.native-CK3QFVjY.cjs")),t=await this.instancePromise,r=new e(t);return t.trackMemoryUsage(r)}async screenStart(e){return(await this.instancePromise).enterView(e,"explicit")}async screenEnd(e){}async trackRoute(e,t){}async trackTap(e){this.explicitTaps++;const t=Date.now(),r=typeof e=="string"&&e.trim()!=="",s=h.uiAttributes({type:"tap",target:r?e:h.UI_UNNAMED,nameSource:r?"edge_action":"none",tag:"native",rage:r&&this.tapRage.record(e,t)}),o=n=>n.log("ui.interaction",{...n.trace.interactionSpan(t),...s},n.snapshot(t));return Promise.resolve(this.resolved?o(this.resolved):this.instancePromise.then(o)).catch(n=>a.debug.warn("Native ui.interaction failed:",n))}async autoTrackTaps(){const{patchElementFactories:e}=await Promise.resolve().then(()=>require("./autoTaps.native-By9I4Kr2.cjs")),{normalizeUiName:t}=await Promise.resolve().then(()=>require("./uiInteraction-DxlwCVSn.cjs")),r=o=>o.then(n=>n?.default??n).catch(()=>{}),s=await Promise.all([r(import("react/jsx-runtime")),r(import("react/jsx-dev-runtime")),r(import("react"))]);e(s,{explicitCount:()=>this.explicitTaps,prepare:(o,n)=>{const l=this.resolved;if(!l)return;const v=Date.now(),d=typeof n=="string"?t(n):"",y=l.trace.interactionSpan(v),w=l.snapshot(v);return()=>{const g=h.uiAttributes({type:o,target:d||h.UI_UNNAMED,nameSource:d?"test_id":"none",tag:"native",rage:!!d&&o==="tap"&&this.tapRage.record(d,v)});l.log("ui.interaction",{...y,...g},w).catch(u=>a.debug.warn("Native auto ui.interaction failed:",u))}}})}}function E(i){if(!i||!i.startsWith("edge_"))throw new Error("createTelemetry: apiKey is required and must start with 'edge_'")}function M(i){return E(i?.apiKey),a.setDebug(i?.debug??!1),a.normalizeAllowlist(i?.traceHostAllowlist),new D(i)}exports.EdgeErrorBoundary=a.EdgeErrorBoundary;exports.memoryStore=a.memoryStore;exports.useScreenReady=a.useScreenReady;exports.createTelemetry=M;
2
2
  //# sourceMappingURL=index.native.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.cjs","sources":["../src/createTelemetry.native.ts","../src/index.native.ts"],"sourcesContent":["import { TelemetryNative } from \"./index.native\";\nimport type { Store } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\nimport { normalizeAllowlist } from \"./adapters/traceHeader\";\nimport { setDebug } from \"./core/debug\";\n\nexport type TelemetryOpts = {\n apiKey: string; // required credential; must start with \"edge_\" (API key or JWT, #90)\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n // console.error -> app.error, console.warn -> a breadcrumb. Default OFF (§4.7, #100).\n captureConsole?: boolean;\n debug?: boolean; // SDK-internal diagnostics; off by default (#23)\n store?: Store; // persisted-state port (#89); either shape — the native path awaits\n // Constructor-only (§3.6) — there is deliberately no runtime setter for either.\n beforeSend?: BeforeSend; // sync scrubbing hook, run at enqueue over events and metrics\n sessionSampleRate?: number; // 0.0-1.0, sticky per session, re-rolled at rotation; default 1\n // §6.4/#99. Bare hosts, exact match, **ports ignored** (a deliberate mismatch with\n // `http.host`, which keeps the port — do not join them). Empty by default: v4 is dark on\n // upgrade. Listing a host asserts that host's CORS allows `traceparent`; a malformed\n // entry throws in dev and is dropped in production.\n traceHostAllowlist?: string[];\n // §4.8 — the symbolication resolve key. A git SHA or CI run number; consumer-supplied\n // (the SDK has zero OTA awareness), **omitted when unset, never `\"\"`**, and never\n // derived from app.version + app.build_number under any circumstances.\n buildId?: string;\n};\n\n// Deliberately loose: `apiKey` is the *credential*, and under AUTH_MODE=jwt it is\n// `edge_<jwt>` — a shape the collector's >=3-`_`-part API-key check would reject. Tightening\n// to that check here would hard-reject every JWT and make the segmented deployment\n// unreachable, which is the exact bug #90 exists to close. Prefix + non-empty remainder is\n// all we assert; the real catch is the 401 warn (contract §11.1).\nexport function assertApiKey(apiKey?: string) {\n if (!apiKey || !apiKey.startsWith(\"edge_\")) {\n throw new Error(\"createTelemetry: apiKey is required and must start with 'edge_'\");\n }\n}\n\n/**\n * Cross-platform factory for telemetry. The platform is chosen by the bundler\n * via the .web / .native file split — no runtime navigator sniffing.\n */\nexport function createTelemetry(opts: TelemetryOpts) {\n assertApiKey(opts?.apiKey);\n // §6.4's dev throw has to happen *here*, synchronously: the core Telemetry is built\n // inside `instancePromise`, which deliberately never rethrows, so a throw down there\n // would be a silently rejected promise instead of the loud config error dev asks for.\n // In production it drops the bad entry and reports through debug() — which is why the\n // gate has to be open first: the entry ctor's own setDebug() runs *after* this line, so\n // without this the production report would be a guaranteed no-op even with debug: true.\n // It runs again in TraceManager, where it is idempotent.\n setDebug(opts?.debug ?? false);\n normalizeAllowlist(opts?.traceHostAllowlist);\n return new TelemetryNative(opts);\n}\n","// React Native telemetry implementation\nimport { TelemetryBase } from \"./index.base\";\nimport { debug, setDebug } from \"./core/debug\";\nimport { RAGE_WINDOW_MS, RageTracker, UI_UNNAMED, uiAttributes } from \"./adapters/uiInteraction\";\nimport type { Store } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\n\nexport { createTelemetry, type TelemetryOpts } from \"./createTelemetry.native\";\n\n// The Store port (#89) — public so a consumer can inject their own persistence,\n// and so the in-memory fake is available outside the test tree.\nexport type { Store, SyncStore, AsyncStore, StoreRead, StoreWrite } from \"./core/store\";\nexport { memoryStore, type MemoryStoreOpts } from \"./core/memoryStore\";\n\n// The scrubbing hook (#93) — public so a consumer can type their beforeSend.\nexport type { BeforeSend } from \"./core/beforeSend\";\n\nexport class TelemetryNative extends TelemetryBase {\n /** ≥3 named taps in a 1000 ms window, keyed on the name — see `trackTap`. */\n private readonly tapRage = new RageTracker(RAGE_WINDOW_MS);\n /**\n * The resolved core, once `instancePromise` settles. `trackTap` is the one public method that\n * cannot afford an `await` before it reads the world: the host's own press handler\n * navigates on the very next line (§4.6's mint/emit split).\n */\n private resolved?: any;\n\n constructor(opts?: {\n apiKey?: string;\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n captureConsole?: boolean;\n debug?: boolean;\n store?: Store; // either shape: the native path awaits\n // Constructor-only (§3.6). No runtime setter: registering later leaves a window\n // where session.started and the earliest requests have already been enqueued.\n beforeSend?: BeforeSend;\n sessionSampleRate?: number;\n // §6.4/#99 — bare hosts, exact match, ports ignored, empty by default.\n traceHostAllowlist?: string[];\n // §4.8 — symbolication resolve key. Omitted when unset, never `\"\"`, never derived.\n buildId?: string;\n }) {\n setDebug(opts?.debug ?? false); // gate SDK console noise before anything logs (#23)\n super();\n\n debug.log(\"🌍 Running Native Telemetry\");\n this.instancePromise = (async () => {\n // RN ships no WebCrypto; this already-declared dependency installs\n // crypto.getRandomValues, which the id path now draws from (#91). It is a\n // no-op wherever crypto already exists, which is why a failure here is only a\n // warning — off-device (SSR, tests) crypto is already there. If it genuinely\n // isn't, randomHex() throws with the reinstall instruction.\n try { await import(\"react-native-get-random-values\"); }\n catch (err) { debug.warn(\"crypto.getRandomValues polyfill unavailable:\", err); }\n\n const { Telemetry } = await import(\"./core/telemetry\");\n const { nativeSender } = await import(\"./adapters/nativeSender\");\n\n const { nativeStore } = await import(\"./adapters/native/store.native\");\n const { DeviceInfoTrackerNative } = await import(\"./adapters/native/deviceInfo.native\");\n const { NetworkInfoTrackerNative } = await import(\"./adapters/native/networkInfo.native\");\n\n // device OS forms the device/session id suffix (ios|android)\n let platform: string | undefined;\n try {\n ({ Platform: { OS: platform } } = await import(\"react-native\") as any);\n } catch { /* non-RN context (e.g. tests) — omit the suffix */ }\n\n const networkInfoTrackerNative = new NetworkInfoTrackerNative();\n const deviceInfoTrackerNative = new DeviceInfoTrackerNative();\n\n // One store, shared by the offline queue and core (#89) — so a consumer that\n // injects a store governs both, instead of the sender quietly keeping its own.\n const store = opts?.store ?? nativeStore();\n const sender = opts?.sender ?? nativeSender(opts?.endpoint, opts?.apiKey, store);\n\n const telemetry = new Telemetry({\n sender,\n batchSize: opts?.batchSize,\n flushIntervalMs: opts?.flushIntervalMs,\n endpoint: opts?.endpoint,\n platform,\n deviceInfoHandler: deviceInfoTrackerNative,\n networkInfoHandler: networkInfoTrackerNative,\n store,\n beforeSend: opts?.beforeSend,\n sessionSampleRate: opts?.sessionSampleRate,\n traceHostAllowlist: opts?.traceHostAllowlist,\n buildId: opts?.buildId,\n });\n\n // The offline queue drains through `sender.replayFailed()`, which the core\n // constructor above already called (#113). A second call here is what sent\n // every recovered batch twice.\n\n // Resume or start the session before the instance is visible (#92), so\n // session.started can never land behind the host app's first event.\n // Never rethrown into instancePromise: finalizeSession() flushes, flush() rethrows on a\n // dead collector, and a rejected instancePromise would brick every public method for the\n // life of the process. Hydration has already run; only the emission is lost.\n // §4.5.2's `initial_load` seed: the launch view stays busy until the platform's\n // runtime-ready marker. The *module* is awaited with everything else, so the seed\n // is armed before `instancePromise` resolves; the *marker* is not, because on web\n // it arrives with the load event and blocking init on it would delay every host\n // call behind the page's own images.\n // The module is awaited so the seed is armed before `instancePromise` resolves,\n // but never rethrown into it: a failed chunk load must not brick every public\n // method for the life of the process. A missing reader just releases the gate.\n const { runtimeReadyAt } = await import(\"./adapters/native/runtimeReady.native\")\n .catch((err: unknown) => {\n debug.warn(\"Native runtime-ready module unavailable:\", err);\n return { runtimeReadyAt: async () => undefined };\n });\n const { seedRuntimeReady } = await import(\"./adapters/seedRuntimeReady\");\n seedRuntimeReady(telemetry.views, runtimeReadyAt, \"Native\");\n\n await telemetry.resumeOrStartSession()\n .catch(err => debug.warn(\"Native session resume failed:\", err));\n\n this.resolved = telemetry;\n return telemetry;\n })();\n\n // app_lifecycle on foreground/background (#30)\n this.attachAppLifecycle().catch(err => {\n debug.log(\"Native attachAppLifecycle errors\", err);\n });\n\n this.trackErrors({ captureConsole: opts?.captureConsole }).catch(err => {\n debug.warn(\"Native trackErrors failed:\", err);\n });\n\n this.trackFrameDrops().catch(err => {\n debug.log(\"Native trackFrameDrops errors\", err);\n });\n this.trackNetworkRequests().catch(err => {\n debug.log(\"Native trackNetworkRequests errors\", err);\n });\n this.trackMemoryUsage().catch(err => {\n debug.log(\"Native trackMemoryUsage errors\", err);\n });\n }\n\n // app_lifecycle on foreground/background via RN AppState (#30).\n //\n // §4.2: neither build rotates on a lifecycle transition — parity with web is reached by\n // *deleting* the old background→finalize / foreground→newSession pair, not by adding it\n // to web. Backgrounding still forces a flush, because the process is now most likely to\n // be killed and the queue only lives in memory.\n async attachAppLifecycle() {\n const { AppState } = await import(\"react-native\") as any;\n const inst = await this.instancePromise;\n const { AppLifecycleEmitter } = await import(\"./adapters/appLifecycle\");\n const emitter = new AppLifecycleEmitter(inst);\n // seed current state — a transition-only emitter, so this enqueues nothing\n emitter.onState(AppState.currentState === \"active\")\n .catch((e: any) => debug.warn(\"app lifecycle seed failed:\", e));\n AppState.addEventListener(\"change\", (next: string) => {\n const isActive = next === \"active\";\n // Awaited before the flush, not fired alongside it: backgrounding is a view\n // boundary (§4.5) and the `view` row it emits is exactly the row this flush\n // exists to rescue from the kill that usually follows.\n emitter.onState(isActive)\n .then(() => (isActive ? undefined : inst.flush()))\n .catch((e: any) => debug.warn(\"background flush failed:\", e));\n });\n }\n\n async getDeviceInfo() {\n const { DeviceInfoTrackerNative } = await import(\"./adapters/native/deviceInfo.native\");\n const inst = await this.instancePromise;\n const deviceInfoTrackerNative = new DeviceInfoTrackerNative();\n return inst.getDeviceInfo(deviceInfoTrackerNative);\n }\n\n async getNetworkInfo() {\n const { NetworkInfoTrackerNative } = await import(\"./adapters/native/networkInfo.native\");\n const inst = await this.instancePromise;\n const networkInfoTrackerNative = new NetworkInfoTrackerNative();\n return inst.getNetworkInfo(networkInfoTrackerNative);\n }\n\n async trackFrameDrops() {\n const { FrameDropTracker } = await import(\"./adapters/frameTracker\");\n const inst = await this.instancePromise;\n const frameDropTracker = new FrameDropTracker(inst);\n return inst.trackFrameDrops(frameDropTracker);\n }\n\n async trackNetworkRequests() {\n const { NetworkTrackerNative } = await import(\"./adapters/native/interceptHttpNative.native\");\n const inst = await this.instancePromise;\n const networkTracker = new NetworkTrackerNative(inst);\n return inst.trackNetworkRequests(networkTracker);\n }\n\n async trackMemoryUsage() {\n const { TelemetryMemoryUsageNative } = await import(\"./adapters/native/memoryNative.native\");\n const inst = await this.instancePromise;\n const memoryTracker = new TelemetryMemoryUsageNative(inst);\n return inst.trackMemoryUsage(memoryTracker);\n }\n\n // ---------- Screen Management ----------\n\n async screenStart(name: string) {\n const inst = await this.instancePromise;\n return inst.screens.startScreen(name);\n }\n\n async screenEnd(name: string) {\n const inst = await this.instancePromise;\n return inst.screens.endScreen(name);\n }\n\n async trackRoute(from: string, to: string) {\n const inst = await this.instancePromise;\n return inst.recordRouteChange(from, to);\n }\n\n // ---------- Interactions ----------\n\n /**\n * §4.6's native producer, explicit-only (#103). `interactionProps()` is gone with\n * `user.interaction` (#102): it sat on the consumer's **root** `<View>`, where\n * `PressEvent.nativeEvent.target` is a node tag number with no public API resolving it,\n * so it could not tell a tap on a button from a tap on padding and every row it emitted\n * was un-nameable. There is no role model to gate on and no DOM to derive from, so\n * anything auto-derived here would be either wrong or a PII leak.\n *\n * `name` is web's rung 1 — explicit author intent — so it ships **unnormalized and\n * uncapped**, and `ui.name_source` has exactly **two** values: `edge_action`, or `none`\n * for a blank name, whose `ui.target` is `unnamed`. **`surface` never appears**: it only\n * means something where role-less elements exist.\n *\n * ⚠ **The mint/emit split.** The row's `timestamp`, `view.id`, `view.name` and\n * `session.id` are snapshotted **here, synchronously**, because the host's press handler\n * navigates on the next line and the emit rides a promise. Stamping emit time would\n * attribute a navigating tap to **the view it opened**, inverting every \"which screen\n * frustrates users\" query. Before `instancePromise` settles there is no core to snapshot\n * from, so a tap that early falls back to emit-time identity — the launch view either\n * way.\n *\n * ⚠ **`ui.dead` is absent on every native row**, never `false`: with no DOM there is no\n * mutation signal, so any dead-click *rate* must filter to the web build.\n */\n async trackTap(name: string) {\n const at = Date.now();\n const named = typeof name === \"string\" && name.trim() !== \"\";\n const attrs = uiAttributes({\n type: \"tap\",\n target: named ? name : UI_UNNAMED,\n nameSource: named ? \"edge_action\" : \"none\",\n // No element model: nothing was resolved, so the tag names the platform rather\n // than inventing a `<button>` that does not exist. §4.6 types it never-null, as\n // it does the coordinates the builder floors at 0 — a `PressEvent` carries some,\n // but `trackTap(name)` deliberately takes none: the name is the whole contract.\n tag: \"native\",\n // Gated to named taps (§4.6): running rage over `unnamed` would not merely lose\n // information, it would invent a frustration event that never happened. Identity\n // is the name, which on native *is* the element — there is no node to key on.\n rage: named && this.tapRage.record(name, at),\n });\n // §6.2: **every** tap mints an interaction root, live carrier or not — a tap is a new\n // user action by definition, so the request it fires is its child and not the route\n // change's before it.\n const emit = (inst: any) =>\n inst.log(\"ui.interaction\", { ...inst.trace.interactionSpan(at), ...attrs }, inst.snapshot(at));\n // Swallowed like every other capture path: the README's own example calls this\n // un-awaited from an `onPress`, and a RUM SDK must not be able to fault the host with\n // an unhandled rejection.\n return Promise.resolve(this.resolved ? emit(this.resolved) : this.instancePromise.then(emit))\n .catch((err: unknown) => debug.warn(\"Native ui.interaction failed:\", err));\n }\n}\n"],"names":["assertApiKey","apiKey","createTelemetry","opts","setDebug","normalizeAllowlist","TelemetryNative","TelemetryBase","RageTracker","RAGE_WINDOW_MS","debug","n","err","Telemetry","nativeSender","nativeStore","DeviceInfoTrackerNative","NetworkInfoTrackerNative","platform","networkInfoTrackerNative","deviceInfoTrackerNative","store","sender","telemetry","runtimeReadyAt","seedRuntimeReady","AppState","inst","AppLifecycleEmitter","emitter","e","next","isActive","FrameDropTracker","frameDropTracker","NetworkTrackerNative","networkTracker","TelemetryMemoryUsageNative","memoryTracker","name","from","to","at","named","attrs","uiAttributes","UI_UNNAMED","emit"],"mappings":"mnBAmCO,SAASA,EAAaC,EAAiB,CAC1C,GAAI,CAACA,GAAU,CAACA,EAAO,WAAW,OAAO,EACrC,MAAM,IAAI,MAAM,iEAAiE,CAEzF,CAMO,SAASC,EAAgBC,EAAqB,CACjD,OAAAH,EAAaG,GAAM,MAAM,EAQzBC,WAASD,GAAM,OAAS,EAAK,EAC7BE,EAAAA,mBAAmBF,GAAM,kBAAkB,EACpC,IAAIG,EAAgBH,CAAI,CACnC,CCxCO,MAAMG,UAAwBC,EAAAA,aAAc,CAU/C,YAAYJ,EAiBT,CACCC,WAASD,GAAM,OAAS,EAAK,EAC7B,MAAA,EA3BJ,KAAiB,QAAU,IAAIK,EAAAA,YAAYC,gBAAc,EA6BrDC,EAAAA,MAAM,IAAI,6BAA6B,EACvC,KAAK,iBAAmB,SAAY,CAMhC,GAAI,CAAE,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,sBAAgC,CAAA,EAAA,KAAAC,GAAAA,EAAA,KAAA,CAAG,OAC/CC,EAAK,CAAEF,QAAM,KAAK,+CAAgDE,CAAG,CAAG,CAE/E,KAAM,CAAE,UAAAC,CAAA,EAAc,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,0BAAkB,CAAA,EAC/C,CAAE,aAAAC,CAAA,EAAiB,MAAM,QAAA,QAAA,E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SAAW,GACpDK,EAAQC,EAAAA,aAAa,CACvB,KAAM,MACN,OAAQF,EAAQJ,EAAOO,EAAAA,WACvB,WAAYH,EAAQ,cAAgB,OAKpC,IAAK,SAIL,KAAMA,GAAS,KAAK,QAAQ,OAAOJ,EAAMG,CAAE,CAAA,CAC9C,EAIKK,EAAQpB,GACVA,EAAK,IAAI,iBAAkB,CAAE,GAAGA,EAAK,MAAM,gBAAgBe,CAAE,EAAG,GAAGE,CAAA,EAASjB,EAAK,SAASe,CAAE,CAAC,EAIjG,OAAO,QAAQ,QAAQ,KAAK,SAAWK,EAAK,KAAK,QAAQ,EAAI,KAAK,gBAAgB,KAAKA,CAAI,CAAC,EACvF,MAAOnC,GAAiBF,EAAAA,MAAM,KAAK,gCAAiCE,CAAG,CAAC,CACjF,CACJ"}
1
+ {"version":3,"file":"index.native.cjs","sources":["../src/telemetryNative.native.ts","../src/createTelemetry.native.ts"],"sourcesContent":["// React Native telemetry implementation\nimport { TelemetryBase } from \"./index.base\";\nimport { debug, setDebug } from \"./core/debug\";\nimport { RAGE_WINDOW_MS, RageTracker, UI_UNNAMED, uiAttributes } from \"./adapters/uiInteraction\";\nimport type { Store } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\n\nexport class TelemetryNative extends TelemetryBase {\n /** ≥3 named taps in a 1000 ms window, keyed on the name — see `trackTap`. */\n private readonly tapRage = new RageTracker(RAGE_WINDOW_MS);\n /** Explicit `trackTap()` calls so far — an auto row is skipped when one fired inside its handler. */\n private explicitTaps = 0;\n\n constructor(opts?: {\n apiKey?: string;\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n captureConsole?: boolean;\n debug?: boolean;\n store?: Store; // either shape: the native path awaits\n // Constructor-only (§3.6). No runtime setter: registering later leaves a window\n // where session.started and the earliest requests have already been enqueued.\n beforeSend?: BeforeSend;\n sessionSampleRate?: number;\n // §6.4/#99 — bare hosts, exact match, ports ignored, empty by default.\n traceHostAllowlist?: string[];\n // §4.8 — symbolication resolve key. Omitted when unset, never `\"\"`, never derived.\n buildId?: string;\n enabled?: boolean;\n autoTrackTaps?: boolean;\n }) {\n setDebug(opts?.debug ?? false); // gate SDK console noise before anything logs (#23)\n super();\n\n debug.log(\"🌍 Running Native Telemetry\");\n this.instancePromise = (async () => {\n // RN ships no WebCrypto; this already-declared dependency installs\n // crypto.getRandomValues, which the id path now draws from (#91). It is a\n // no-op wherever crypto already exists, which is why a failure here is only a\n // warning — off-device (SSR, tests) crypto is already there. If it genuinely\n // isn't, randomHex() throws with the reinstall instruction.\n try { await import(\"react-native-get-random-values\"); }\n catch (err) { debug.warn(\"crypto.getRandomValues polyfill unavailable:\", err); }\n\n const { Telemetry } = await import(\"./core/telemetry\");\n const { nativeSender } = await import(\"./adapters/nativeSender\");\n\n const { nativeStore } = await import(\"./adapters/native/store.native\");\n const { DeviceInfoTrackerNative } = await import(\"./adapters/native/deviceInfo.native\");\n const { NetworkInfoTrackerNative } = await import(\"./adapters/native/networkInfo.native\");\n\n // device OS forms the device/session id suffix (ios|android)\n let platform: string | undefined;\n try {\n ({ Platform: { OS: platform } } = await import(\"react-native\") as any);\n } catch { /* non-RN context (e.g. tests) — omit the suffix */ }\n\n const { DeviceStateNative } = await import(\"./adapters/native/deviceState.native\");\n const networkInfoTrackerNative = new NetworkInfoTrackerNative();\n const deviceInfoTrackerNative = new DeviceInfoTrackerNative();\n\n // One store, shared by the offline queue and core (#89) — so a consumer that\n // injects a store governs both, instead of the sender quietly keeping its own.\n const store = opts?.store ?? nativeStore();\n const sender = opts?.sender ?? nativeSender(opts?.endpoint, opts?.apiKey, store);\n\n const telemetry = new Telemetry({\n sender,\n batchSize: opts?.batchSize,\n flushIntervalMs: opts?.flushIntervalMs,\n endpoint: opts?.endpoint,\n platform,\n deviceInfoHandler: deviceInfoTrackerNative,\n networkInfoHandler: networkInfoTrackerNative,\n store,\n beforeSend: opts?.beforeSend,\n sessionSampleRate: opts?.sessionSampleRate,\n traceHostAllowlist: opts?.traceHostAllowlist,\n buildId: opts?.buildId,\n enabled: opts?.enabled,\n deviceStateHandler: new DeviceStateNative(),\n });\n\n // The offline queue drains through `sender.replayFailed()`, which the core\n // constructor above already called (#113). A second call here is what sent\n // every recovered batch twice.\n\n // Resume or start the session before the instance is visible (#92), so\n // session.started can never land behind the host app's first event.\n // Never rethrown into instancePromise: finalizeSession() flushes, flush() rethrows on a\n // dead collector, and a rejected instancePromise would brick every public method for the\n // life of the process. Hydration has already run; only the emission is lost.\n // §4.5.2's `initial_load` seed: the launch view stays busy until the platform's\n // runtime-ready marker. The *module* is awaited with everything else, so the seed\n // is armed before `instancePromise` resolves; the *marker* is not, because on web\n // it arrives with the load event and blocking init on it would delay every host\n // call behind the page's own images.\n // The module is awaited so the seed is armed before `instancePromise` resolves,\n // but never rethrown into it: a failed chunk load must not brick every public\n // method for the life of the process. A missing reader just releases the gate.\n const { runtimeReadyAt, processStartAt, startupDurationMs } = await import(\"./adapters/native/runtimeReady.native\")\n .catch((err: unknown) => {\n debug.warn(\"Native runtime-ready module unavailable:\", err);\n return { runtimeReadyAt: async () => undefined, processStartAt: () => undefined, startupDurationMs: undefined };\n });\n const { seedRuntimeReady } = await import(\"./adapters/seedRuntimeReady\");\n seedRuntimeReady(telemetry.views, runtimeReadyAt, \"Native\");\n // #171: the initial view's ready anchor, and `app.start.js_ready_ms` — read when\n // `app.start` is emitted, not here: the bundle-end field is stamped just after a\n // module-scope `createTelemetry()`, and by then the session resume's AsyncStorage\n // round-trip has put a macrotask between the two. Never awaited — init must not\n // block on a timer for one key.\n const processStart = processStartAt();\n telemetry.views.anchorInitial(processStart);\n telemetry.jsReadyMs = () => {\n const end = (globalThis as any).performance?.rnStartupTiming?.executeJavaScriptBundleEntryPointEnd;\n return processStart !== undefined && typeof end === \"number\" && end >= processStart\n ? end - processStart : undefined;\n };\n\n telemetry.appStartMs = startupDurationMs; // #179: process start → first display\n await telemetry.resumeOrStartSession()\n .catch(err => debug.warn(\"Native session resume failed:\", err));\n\n this.resolved = telemetry;\n return telemetry;\n })();\n\n // #174 — opt-in only: off means the JSX runtime is never touched.\n if (opts?.autoTrackTaps) this.autoTrackTaps().catch(err => debug.warn(\"Native autoTrackTaps failed:\", err));\n\n // app_lifecycle on foreground/background (#30)\n this.attachAppLifecycle().catch(err => {\n debug.log(\"Native attachAppLifecycle errors\", err);\n });\n\n this.trackErrors({ captureConsole: opts?.captureConsole }).catch(err => {\n debug.warn(\"Native trackErrors failed:\", err);\n });\n\n this.trackFrameDrops().catch(err => {\n debug.log(\"Native trackFrameDrops errors\", err);\n });\n this.trackNetworkRequests().catch(err => {\n debug.log(\"Native trackNetworkRequests errors\", err);\n });\n this.trackMemoryUsage().catch(err => {\n debug.log(\"Native trackMemoryUsage errors\", err);\n });\n }\n\n // app_lifecycle on foreground/background via RN AppState (#30).\n //\n // §4.2: neither build rotates on a lifecycle transition — parity with web is reached by\n // *deleting* the old background→finalize / foreground→newSession pair, not by adding it\n // to web. Backgrounding still forces a flush, because the process is now most likely to\n // be killed and the queue only lives in memory.\n async attachAppLifecycle() {\n const { AppState } = await import(\"react-native\") as any;\n const inst = await this.instancePromise;\n const { AppLifecycleEmitter } = await import(\"./adapters/appLifecycle\");\n const emitter = new AppLifecycleEmitter(inst);\n // seed current state — a transition-only emitter, so this enqueues nothing\n emitter.onState(AppState.currentState === \"active\")\n .catch((e: any) => debug.warn(\"app lifecycle seed failed:\", e));\n AppState.addEventListener(\"change\", (next: string) => {\n const isActive = next === \"active\";\n // Awaited before the flush, not fired alongside it: backgrounding is a view\n // boundary (§4.5) and the `view` row it emits is exactly the row this flush\n // exists to rescue from the kill that usually follows.\n emitter.onState(isActive)\n .then(() => (isActive ? undefined : inst.flush()))\n .catch((e: any) => debug.warn(\"background flush failed:\", e));\n });\n }\n\n async trackErrors(options?: { captureConsole?: boolean }) {\n const { CrashHandlerNative } = await import(\"./adapters/native/crashHandlerNative.native\");\n const inst = await this.instancePromise;\n return inst.trackErrors(new CrashHandlerNative(inst), options);\n }\n\n async getDeviceInfo() {\n const { DeviceInfoTrackerNative } = await import(\"./adapters/native/deviceInfo.native\");\n const inst = await this.instancePromise;\n const deviceInfoTrackerNative = new DeviceInfoTrackerNative();\n return inst.getDeviceInfo(deviceInfoTrackerNative);\n }\n\n async getNetworkInfo() {\n const { NetworkInfoTrackerNative } = await import(\"./adapters/native/networkInfo.native\");\n const inst = await this.instancePromise;\n const networkInfoTrackerNative = new NetworkInfoTrackerNative();\n return inst.getNetworkInfo(networkInfoTrackerNative);\n }\n\n async trackFrameDrops() {\n const { FrameDropTracker } = await import(\"./adapters/frameTracker\");\n const inst = await this.instancePromise;\n const frameDropTracker = new FrameDropTracker(inst);\n return inst.trackFrameDrops(frameDropTracker);\n }\n\n async trackNetworkRequests() {\n const { NetworkTrackerNative } = await import(\"./adapters/native/interceptHttpNative.native\");\n const inst = await this.instancePromise;\n const networkTracker = new NetworkTrackerNative(inst);\n return inst.trackNetworkRequests(networkTracker);\n }\n\n async trackMemoryUsage() {\n const { TelemetryMemoryUsageNative } = await import(\"./adapters/native/memoryNative.native\");\n const inst = await this.instancePromise;\n const memoryTracker = new TelemetryMemoryUsageNative(inst);\n return inst.trackMemoryUsage(memoryTracker);\n }\n\n // ---------- Screen Management ----------\n\n /**\n * Rung 1 of the name ladder (§4.5.1) — `explicit`, and never normalized: a host naming a\n * screen \"Step 2 of 3\" must not receive \"Step {id} of {id}\". Emits no `navigation` (#163).\n */\n async screenStart(name: string) {\n const inst = await this.instancePromise;\n return inst.enterView(name, \"explicit\");\n }\n\n /** @deprecated No-op since v5 (#163) — `screen.duration` is gone; `view.time_spent` replaces it. Deleted in v6. */\n async screenEnd(_name: string) { }\n\n /** @deprecated No-op since v5 (#163) — use `attachNavigation(ref)` or `screenStart(name)`. Deleted in v6. */\n async trackRoute(_from: string, _to: string) { }\n\n // ---------- Interactions ----------\n\n /**\n * §4.6's native producer, explicit-only (#103). `interactionProps()` is gone with\n * `user.interaction` (#102): it sat on the consumer's **root** `<View>`, where\n * `PressEvent.nativeEvent.target` is a node tag number with no public API resolving it,\n * so it could not tell a tap on a button from a tap on padding and every row it emitted\n * was un-nameable. There is no role model to gate on and no DOM to derive from, so\n * anything auto-derived here would be either wrong or a PII leak.\n *\n * `name` is web's rung 1 — explicit author intent — so it ships **unnormalized and\n * uncapped**, and `ui.name_source` has exactly **two** values: `edge_action`, or `none`\n * for a blank name, whose `ui.target` is `unnamed`. **`surface` never appears**: it only\n * means something where role-less elements exist.\n *\n * ⚠ **The mint/emit split.** The row's `timestamp`, `view.id`, `view.name` and\n * `session.id` are snapshotted **here, synchronously**, because the host's press handler\n * navigates on the next line and the emit rides a promise. Stamping emit time would\n * attribute a navigating tap to **the view it opened**, inverting every \"which screen\n * frustrates users\" query. Before `instancePromise` settles there is no core to snapshot\n * from, so a tap that early falls back to emit-time identity — the launch view either\n * way.\n *\n * ⚠ **`ui.dead` is absent on every native row**, never `false`: with no DOM there is no\n * mutation signal, so any dead-click *rate* must filter to the web build.\n */\n async trackTap(name: string) {\n this.explicitTaps++;\n const at = Date.now();\n const named = typeof name === \"string\" && name.trim() !== \"\";\n const attrs = uiAttributes({\n type: \"tap\",\n target: named ? name : UI_UNNAMED,\n nameSource: named ? \"edge_action\" : \"none\",\n // No element model: nothing was resolved, so the tag names the platform rather\n // than inventing a `<button>` that does not exist. §4.6 types it never-null, as\n // it does the coordinates the builder floors at 0 — a `PressEvent` carries some,\n // but `trackTap(name)` deliberately takes none: the name is the whole contract.\n tag: \"native\",\n // Gated to named taps (§4.6): running rage over `unnamed` would not merely lose\n // information, it would invent a frustration event that never happened. Identity\n // is the name, which on native *is* the element — there is no node to key on.\n rage: named && this.tapRage.record(name, at),\n });\n // §6.2: **every** tap mints an interaction root, live carrier or not — a tap is a new\n // user action by definition, so the request it fires is its child and not the route\n // change's before it.\n const emit = (inst: any) =>\n inst.log(\"ui.interaction\", { ...inst.trace.interactionSpan(at), ...attrs }, inst.snapshot(at));\n // Swallowed like every other capture path: the README's own example calls this\n // un-awaited from an `onPress`, and a RUM SDK must not be able to fault the host with\n // an unhandled rejection.\n return Promise.resolve(this.resolved ? emit(this.resolved) : this.instancePromise.then(emit))\n .catch((err: unknown) => debug.warn(\"Native ui.interaction failed:\", err));\n }\n\n /**\n * #174's hook. Patches `react/jsx-runtime`, `react/jsx-dev-runtime` and `React.createElement`\n * — the module exports objects, which is what Babel's `(0, _jsxRuntime.jsx)` reads — so an\n * element with a function `onPress`/`onLongPress` gets a wrapper that emits on activation.\n *\n * Names never come from text or accessibility labels (`\"Pay John Kamau KES 5,000\"`):\n * `trackTap(name)` > `testID` (normalized like web rung 2, cap 64) > `unnamed`. Identity is\n * snapshotted and the interaction root minted **before** the handler runs; the row is emitted\n * after it, and skipped if the handler called `trackTap` itself.\n */\n private async autoTrackTaps() {\n const { patchElementFactories } = await import(\"./adapters/native/autoTaps.native\");\n const { normalizeUiName } = await import(\"./adapters/uiInteraction\");\n // `.default` is the CJS `module.exports` behind an interop namespace — the object\n // Babel-compiled code actually reads; the namespace itself is a copy.\n const load = (p: Promise<any>) => p.then((ns) => ns?.default ?? ns).catch(() => undefined);\n const modules = await Promise.all([\n load(import(\"react/jsx-runtime\")), load(import(\"react/jsx-dev-runtime\")), load(import(\"react\")),\n ]);\n patchElementFactories(modules, {\n explicitCount: () => this.explicitTaps,\n prepare: (kind, testID) => {\n const inst = this.resolved;\n if (!inst) return undefined; // before init: no core to snapshot from\n const at = Date.now();\n const name = typeof testID === \"string\" ? normalizeUiName(testID) : \"\";\n const span = inst.trace.interactionSpan(at);\n const snap = inst.snapshot(at);\n return () => {\n const attrs = uiAttributes({\n type: kind,\n target: name || UI_UNNAMED,\n nameSource: name ? \"test_id\" : \"none\",\n tag: \"native\",\n // Name-keyed and off for `unnamed`, as for `trackTap` — and recorded only\n // for a row that ships, so a handler's own `trackTap` is not counted twice.\n // Unreachable on a long press (3 holds of ≥500 ms cannot fit 1000 ms).\n rage: !!name && kind === \"tap\" && this.tapRage.record(name, at),\n });\n inst.log(\"ui.interaction\", { ...span, ...attrs }, snap)\n .catch((err: unknown) => debug.warn(\"Native auto ui.interaction failed:\", err));\n };\n },\n });\n }\n}\n","import { TelemetryNative } from \"./telemetryNative.native\";\nimport type { Store } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\nimport { normalizeAllowlist } from \"./adapters/traceHeader\";\nimport { setDebug } from \"./core/debug\";\n\nexport type TelemetryOpts = {\n apiKey: string; // required credential; must start with \"edge_\" (API key or JWT, #90)\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n // console.error -> app.error, console.warn -> a breadcrumb. Default OFF (§4.7, #100).\n captureConsole?: boolean;\n debug?: boolean; // SDK-internal diagnostics; off by default (#23)\n store?: Store; // persisted-state port (#89); either shape — the native path awaits\n // Constructor-only (§3.6) — there is deliberately no runtime setter for either.\n beforeSend?: BeforeSend; // sync scrubbing hook, run at enqueue over events and metrics\n sessionSampleRate?: number; // 0.0-1.0, sticky per session, re-rolled at rotation; default 1\n // §6.4/#99. Bare hosts, exact match, **ports ignored** (a deliberate mismatch with\n // `http.host`, which keeps the port — do not join them). Empty by default: v4 is dark on\n // upgrade. Listing a host asserts that host's CORS allows `traceparent`; a malformed\n // entry throws in dev and is dropped in production.\n traceHostAllowlist?: string[];\n // §4.8 — the symbolication resolve key. A git SHA or CI run number; consumer-supplied\n // (the SDK has zero OTA awareness), **omitted when unset, never `\"\"`**, and never\n // derived from app.version + app.build_number under any circumstances.\n buildId?: string;\n // #172 — consent. `false` constructs dark: nothing is sent or stored until `enable()`.\n enabled?: boolean;\n // #174 — native only, constructor-only, default false: capture every `onPress` /\n // `onLongPress` by patching the JSX runtime. Dark by default, like the trace allowlist.\n autoTrackTaps?: boolean;\n};\n\n// Deliberately loose: `apiKey` is the *credential*, and under AUTH_MODE=jwt it is\n// `edge_<jwt>` — a shape the collector's >=3-`_`-part API-key check would reject. Tightening\n// to that check here would hard-reject every JWT and make the segmented deployment\n// unreachable, which is the exact bug #90 exists to close. Prefix + non-empty remainder is\n// all we assert; the real catch is the 401 warn (contract §11.1).\nexport function assertApiKey(apiKey?: string) {\n if (!apiKey || !apiKey.startsWith(\"edge_\")) {\n throw new Error(\"createTelemetry: apiKey is required and must start with 'edge_'\");\n }\n}\n\n/**\n * Cross-platform factory for telemetry. The platform is chosen by the bundler\n * via the .web / .native file split — no runtime navigator sniffing.\n */\nexport function createTelemetry(opts: TelemetryOpts) {\n assertApiKey(opts?.apiKey);\n // §6.4's dev throw has to happen *here*, synchronously: the core Telemetry is built\n // inside `instancePromise`, which deliberately never rethrows, so a throw down there\n // would be a silently rejected promise instead of the loud config error dev asks for.\n // In production it drops the bad entry and reports through debug() — which is why the\n // gate has to be open first: the entry ctor's own setDebug() runs *after* this line, so\n // without this the production report would be a guaranteed no-op even with debug: true.\n // It runs again in TraceManager, where it is idempotent.\n setDebug(opts?.debug ?? false);\n normalizeAllowlist(opts?.traceHostAllowlist);\n return new TelemetryNative(opts);\n}\n"],"names":["TelemetryNative","TelemetryBase","opts","setDebug","RageTracker","RAGE_WINDOW_MS","debug","err","Telemetry","n","nativeSender","nativeStore","DeviceInfoTrackerNative","NetworkInfoTrackerNative","platform","DeviceStateNative","networkInfoTrackerNative","deviceInfoTrackerNative","store","sender","telemetry","runtimeReadyAt","processStartAt","startupDurationMs","seedRuntimeReady","processStart","end","AppState","inst","AppLifecycleEmitter","emitter","e","next","isActive","options","CrashHandlerNative","FrameDropTracker","frameDropTracker","NetworkTrackerNative","networkTracker","TelemetryMemoryUsageNative","memoryTracker","name","_name","_from","_to","at","named","attrs","uiAttributes","UI_UNNAMED","emit","patchElementFactories","normalizeUiName","load","p","ns","modules","kind","testID","span","snap","assertApiKey","apiKey","createTelemetry","normalizeAllowlist"],"mappings":"6mBAOO,MAAMA,UAAwBC,EAAAA,aAAc,CAM/C,YAAYC,EAmBT,CACCC,WAASD,GAAM,OAAS,EAAK,EAC7B,MAAA,EAzBJ,KAAiB,QAAU,IAAIE,EAAAA,YA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,CAAE,CAAA,CACjE,EACDlB,EAAK,IAAI,iBAAkB,CAAE,GAAGgC,EAAM,GAAGZ,GAASa,CAAI,EACjD,MAAOtD,GAAiBD,EAAAA,MAAM,KAAK,qCAAsCC,CAAG,CAAC,CACtF,CACJ,CAAA,CACH,CACL,CACJ,CCzSO,SAASuD,EAAaC,EAAiB,CAC1C,GAAI,CAACA,GAAU,CAACA,EAAO,WAAW,OAAO,EACrC,MAAM,IAAI,MAAM,iEAAiE,CAEzF,CAMO,SAASC,EAAgB9D,EAAqB,CACjD,OAAA4D,EAAa5D,GAAM,MAAM,EAQzBC,WAASD,GAAM,OAAS,EAAK,EAC7B+D,EAAAA,mBAAmB/D,GAAM,kBAAkB,EACpC,IAAIF,EAAgBE,CAAI,CACnC"}
@@ -1,2 +1,2 @@
1
- export * from './src/index.native'
1
+ export * from './src/index.native.js'
2
2
  export {}
@@ -1,53 +1,54 @@
1
- import { s as u, n as k, T as f, d as r } from "./memoryStore-F5I-GQKM.js";
2
- import { m as E } from "./memoryStore-F5I-GQKM.js";
3
- import { R as g, a as N, u as T, U as S } from "./uiInteraction-DAqxxz0q.js";
4
- function I(i) {
5
- if (!i || !i.startsWith("edge_"))
6
- throw new Error("createTelemetry: apiKey is required and must start with 'edge_'");
7
- }
8
- function D(i) {
9
- return I(i?.apiKey), u(i?.debug ?? !1), k(i?.traceHostAllowlist), new R(i);
10
- }
11
- class R extends f {
12
- constructor(e) {
13
- u(e?.debug ?? !1), super(), this.tapRage = new g(N), r.log("🌍 Running Native Telemetry"), this.instancePromise = (async () => {
1
+ import { T as I, s as k, d as i, n as R } from "./react-urNtDGTL.js";
2
+ import { E as H, m as F, u as q } from "./react-urNtDGTL.js";
3
+ import { RageTracker as b, RAGE_WINDOW_MS as A, uiAttributes as y, UI_UNNAMED as f } from "./uiInteraction-BIDOMcrL.js";
4
+ class D extends I {
5
+ constructor(t) {
6
+ k(t?.debug ?? !1), super(), this.tapRage = new b(A), this.explicitTaps = 0, i.log("🌍 Running Native Telemetry"), this.instancePromise = (async () => {
14
7
  try {
15
- await import("./index-BtLlV1HA.js").then((c) => c.i);
16
- } catch (c) {
17
- r.warn("crypto.getRandomValues polyfill unavailable:", c);
8
+ await import("react-native-get-random-values");
9
+ } catch (s) {
10
+ i.warn("crypto.getRandomValues polyfill unavailable:", s);
18
11
  }
19
- const { Telemetry: t } = await import("./telemetry-ByDJIz_9.js"), { nativeSender: a } = await import("./nativeSender-pgVSIv-X.js"), { nativeStore: o } = await import("./store.native-BYBJcy6o.js"), { DeviceInfoTrackerNative: s } = await import("./deviceInfo.native-BJ-3Jj1T.js"), { NetworkInfoTrackerNative: n } = await import("./networkInfo.native-CGrx9cnH.js");
20
- let m;
12
+ const { Telemetry: e } = await import("./telemetry-60sfWkh0.js").then((s) => s.t), { nativeSender: a } = await import("./nativeSender-Dt1HLaLi.js"), { nativeStore: m } = await import("./store.native-MlWyGgBp.js"), { DeviceInfoTrackerNative: n } = await import("./deviceInfo.native-DiiHrnI3.js"), { NetworkInfoTrackerNative: r } = await import("./networkInfo.native-CcJ3JVRF.js");
13
+ let o;
21
14
  try {
22
- ({ Platform: { OS: m } } = await import("react-native"));
15
+ ({ Platform: { OS: o } } = await import("react-native"));
23
16
  } catch {
24
17
  }
25
- const d = new n(), h = new s(), w = e?.store ?? o(), v = e?.sender ?? a(e?.endpoint, e?.apiKey, w), l = new t({
18
+ const { DeviceStateNative: u } = await import("./deviceState.native-BEysbZ6O.js"), p = new r(), h = new n(), w = t?.store ?? m(), v = t?.sender ?? a(t?.endpoint, t?.apiKey, w), c = new e({
26
19
  sender: v,
27
- batchSize: e?.batchSize,
28
- flushIntervalMs: e?.flushIntervalMs,
29
- endpoint: e?.endpoint,
30
- platform: m,
20
+ batchSize: t?.batchSize,
21
+ flushIntervalMs: t?.flushIntervalMs,
22
+ endpoint: t?.endpoint,
23
+ platform: o,
31
24
  deviceInfoHandler: h,
32
- networkInfoHandler: d,
25
+ networkInfoHandler: p,
33
26
  store: w,
34
- beforeSend: e?.beforeSend,
35
- sessionSampleRate: e?.sessionSampleRate,
36
- traceHostAllowlist: e?.traceHostAllowlist,
37
- buildId: e?.buildId
38
- }), { runtimeReadyAt: p } = await import("./runtimeReady.native-Bh7EcYmK.js").catch((c) => (r.warn("Native runtime-ready module unavailable:", c), { runtimeReadyAt: async () => {
39
- } })), { seedRuntimeReady: y } = await import("./seedRuntimeReady-Cz8nOKoo.js");
40
- return y(l.views, p, "Native"), await l.resumeOrStartSession().catch((c) => r.warn("Native session resume failed:", c)), this.resolved = l, l;
41
- })(), this.attachAppLifecycle().catch((t) => {
42
- r.log("Native attachAppLifecycle errors", t);
43
- }), this.trackErrors({ captureConsole: e?.captureConsole }).catch((t) => {
44
- r.warn("Native trackErrors failed:", t);
45
- }), this.trackFrameDrops().catch((t) => {
46
- r.log("Native trackFrameDrops errors", t);
47
- }), this.trackNetworkRequests().catch((t) => {
48
- r.log("Native trackNetworkRequests errors", t);
49
- }), this.trackMemoryUsage().catch((t) => {
50
- r.log("Native trackMemoryUsage errors", t);
27
+ beforeSend: t?.beforeSend,
28
+ sessionSampleRate: t?.sessionSampleRate,
29
+ traceHostAllowlist: t?.traceHostAllowlist,
30
+ buildId: t?.buildId,
31
+ enabled: t?.enabled,
32
+ deviceStateHandler: new u()
33
+ }), { runtimeReadyAt: g, processStartAt: N, startupDurationMs: T } = await import("./runtimeReady.native-CxFl1rQR.js").catch((s) => (i.warn("Native runtime-ready module unavailable:", s), { runtimeReadyAt: async () => {
34
+ }, processStartAt: () => {
35
+ }, startupDurationMs: void 0 })), { seedRuntimeReady: S } = await import("./seedRuntimeReady-BlRdf3pR.js");
36
+ S(c.views, g, "Native");
37
+ const d = N();
38
+ return c.views.anchorInitial(d), c.jsReadyMs = () => {
39
+ const s = globalThis.performance?.rnStartupTiming?.executeJavaScriptBundleEntryPointEnd;
40
+ return d !== void 0 && typeof s == "number" && s >= d ? s - d : void 0;
41
+ }, c.appStartMs = T, await c.resumeOrStartSession().catch((s) => i.warn("Native session resume failed:", s)), this.resolved = c, c;
42
+ })(), t?.autoTrackTaps && this.autoTrackTaps().catch((e) => i.warn("Native autoTrackTaps failed:", e)), this.attachAppLifecycle().catch((e) => {
43
+ i.log("Native attachAppLifecycle errors", e);
44
+ }), this.trackErrors({ captureConsole: t?.captureConsole }).catch((e) => {
45
+ i.warn("Native trackErrors failed:", e);
46
+ }), this.trackFrameDrops().catch((e) => {
47
+ i.log("Native trackFrameDrops errors", e);
48
+ }), this.trackNetworkRequests().catch((e) => {
49
+ i.log("Native trackNetworkRequests errors", e);
50
+ }), this.trackMemoryUsage().catch((e) => {
51
+ i.log("Native trackMemoryUsage errors", e);
51
52
  });
52
53
  }
53
54
  // app_lifecycle on foreground/background via RN AppState (#30).
@@ -57,41 +58,49 @@ class R extends f {
57
58
  // to web. Backgrounding still forces a flush, because the process is now most likely to
58
59
  // be killed and the queue only lives in memory.
59
60
  async attachAppLifecycle() {
60
- const { AppState: e } = await import("react-native"), t = await this.instancePromise, { AppLifecycleEmitter: a } = await import("./appLifecycle-DQErzJIR.js"), o = new a(t);
61
- o.onState(e.currentState === "active").catch((s) => r.warn("app lifecycle seed failed:", s)), e.addEventListener("change", (s) => {
62
- const n = s === "active";
63
- o.onState(n).then(() => n ? void 0 : t.flush()).catch((m) => r.warn("background flush failed:", m));
61
+ const { AppState: t } = await import("react-native"), e = await this.instancePromise, { AppLifecycleEmitter: a } = await import("./appLifecycle-PffQ4vC1.js"), m = new a(e);
62
+ m.onState(t.currentState === "active").catch((n) => i.warn("app lifecycle seed failed:", n)), t.addEventListener("change", (n) => {
63
+ const r = n === "active";
64
+ m.onState(r).then(() => r ? void 0 : e.flush()).catch((o) => i.warn("background flush failed:", o));
64
65
  });
65
66
  }
67
+ async trackErrors(t) {
68
+ const { CrashHandlerNative: e } = await import("./crashHandlerNative.native-DsCRd-oN.js"), a = await this.instancePromise;
69
+ return a.trackErrors(new e(a), t);
70
+ }
66
71
  async getDeviceInfo() {
67
- const { DeviceInfoTrackerNative: e } = await import("./deviceInfo.native-BJ-3Jj1T.js"), t = await this.instancePromise, a = new e();
68
- return t.getDeviceInfo(a);
72
+ const { DeviceInfoTrackerNative: t } = await import("./deviceInfo.native-DiiHrnI3.js"), e = await this.instancePromise, a = new t();
73
+ return e.getDeviceInfo(a);
69
74
  }
70
75
  async getNetworkInfo() {
71
- const { NetworkInfoTrackerNative: e } = await import("./networkInfo.native-CGrx9cnH.js"), t = await this.instancePromise, a = new e();
72
- return t.getNetworkInfo(a);
76
+ const { NetworkInfoTrackerNative: t } = await import("./networkInfo.native-CcJ3JVRF.js"), e = await this.instancePromise, a = new t();
77
+ return e.getNetworkInfo(a);
73
78
  }
74
79
  async trackFrameDrops() {
75
- const { FrameDropTracker: e } = await import("./frameTracker-DdB8W_kC.js"), t = await this.instancePromise, a = new e(t);
76
- return t.trackFrameDrops(a);
80
+ const { FrameDropTracker: t } = await import("./frameTracker-BzXnxSkb.js"), e = await this.instancePromise, a = new t(e);
81
+ return e.trackFrameDrops(a);
77
82
  }
78
83
  async trackNetworkRequests() {
79
- const { NetworkTrackerNative: e } = await import("./interceptHttpNative.native-rX-lPNST.js"), t = await this.instancePromise, a = new e(t);
80
- return t.trackNetworkRequests(a);
84
+ const { NetworkTrackerNative: t } = await import("./interceptHttpNative.native-vF_Fksjk.js"), e = await this.instancePromise, a = new t(e);
85
+ return e.trackNetworkRequests(a);
81
86
  }
82
87
  async trackMemoryUsage() {
83
- const { TelemetryMemoryUsageNative: e } = await import("./memoryNative.native-C42h9SjK.js"), t = await this.instancePromise, a = new e(t);
84
- return t.trackMemoryUsage(a);
88
+ const { TelemetryMemoryUsageNative: t } = await import("./memoryNative.native-DkA6f7id.js"), e = await this.instancePromise, a = new t(e);
89
+ return e.trackMemoryUsage(a);
85
90
  }
86
91
  // ---------- Screen Management ----------
87
- async screenStart(e) {
88
- return (await this.instancePromise).screens.startScreen(e);
92
+ /**
93
+ * Rung 1 of the name ladder (§4.5.1) — `explicit`, and never normalized: a host naming a
94
+ * screen "Step 2 of 3" must not receive "Step {id} of {id}". Emits no `navigation` (#163).
95
+ */
96
+ async screenStart(t) {
97
+ return (await this.instancePromise).enterView(t, "explicit");
89
98
  }
90
- async screenEnd(e) {
91
- return (await this.instancePromise).screens.endScreen(e);
99
+ /** @deprecated No-op since v5 (#163) — `screen.duration` is gone; `view.time_spent` replaces it. Deleted in v6. */
100
+ async screenEnd(t) {
92
101
  }
93
- async trackRoute(e, t) {
94
- return (await this.instancePromise).recordRouteChange(e, t);
102
+ /** @deprecated No-op since v5 (#163) — use `attachNavigation(ref)` or `screenStart(name)`. Deleted in v6. */
103
+ async trackRoute(t, e) {
95
104
  }
96
105
  // ---------- Interactions ----------
97
106
  /**
@@ -118,10 +127,11 @@ class R extends f {
118
127
  * ⚠ **`ui.dead` is absent on every native row**, never `false`: with no DOM there is no
119
128
  * mutation signal, so any dead-click *rate* must filter to the web build.
120
129
  */
121
- async trackTap(e) {
122
- const t = Date.now(), a = typeof e == "string" && e.trim() !== "", o = T({
130
+ async trackTap(t) {
131
+ this.explicitTaps++;
132
+ const e = Date.now(), a = typeof t == "string" && t.trim() !== "", m = y({
123
133
  type: "tap",
124
- target: a ? e : S,
134
+ target: a ? t : f,
125
135
  nameSource: a ? "edge_action" : "none",
126
136
  // No element model: nothing was resolved, so the tag names the platform rather
127
137
  // than inventing a `<button>` that does not exist. §4.6 types it never-null, as
@@ -131,14 +141,61 @@ class R extends f {
131
141
  // Gated to named taps (§4.6): running rage over `unnamed` would not merely lose
132
142
  // information, it would invent a frustration event that never happened. Identity
133
143
  // is the name, which on native *is* the element — there is no node to key on.
134
- rage: a && this.tapRage.record(e, t)
135
- }), s = (n) => n.log("ui.interaction", { ...n.trace.interactionSpan(t), ...o }, n.snapshot(t));
136
- return Promise.resolve(this.resolved ? s(this.resolved) : this.instancePromise.then(s)).catch((n) => r.warn("Native ui.interaction failed:", n));
144
+ rage: a && this.tapRage.record(t, e)
145
+ }), n = (r) => r.log("ui.interaction", { ...r.trace.interactionSpan(e), ...m }, r.snapshot(e));
146
+ return Promise.resolve(this.resolved ? n(this.resolved) : this.instancePromise.then(n)).catch((r) => i.warn("Native ui.interaction failed:", r));
137
147
  }
148
+ /**
149
+ * #174's hook. Patches `react/jsx-runtime`, `react/jsx-dev-runtime` and `React.createElement`
150
+ * — the module exports objects, which is what Babel's `(0, _jsxRuntime.jsx)` reads — so an
151
+ * element with a function `onPress`/`onLongPress` gets a wrapper that emits on activation.
152
+ *
153
+ * Names never come from text or accessibility labels (`"Pay John Kamau KES 5,000"`):
154
+ * `trackTap(name)` > `testID` (normalized like web rung 2, cap 64) > `unnamed`. Identity is
155
+ * snapshotted and the interaction root minted **before** the handler runs; the row is emitted
156
+ * after it, and skipped if the handler called `trackTap` itself.
157
+ */
158
+ async autoTrackTaps() {
159
+ const { patchElementFactories: t } = await import("./autoTaps.native-DQCXevD7.js"), { normalizeUiName: e } = await import("./uiInteraction-BIDOMcrL.js"), a = (n) => n.then((r) => r?.default ?? r).catch(() => {
160
+ }), m = await Promise.all([
161
+ a(import("react/jsx-runtime")),
162
+ a(import("react/jsx-dev-runtime")),
163
+ a(import("react"))
164
+ ]);
165
+ t(m, {
166
+ explicitCount: () => this.explicitTaps,
167
+ prepare: (n, r) => {
168
+ const o = this.resolved;
169
+ if (!o) return;
170
+ const u = Date.now(), p = typeof r == "string" ? e(r) : "", h = o.trace.interactionSpan(u), w = o.snapshot(u);
171
+ return () => {
172
+ const v = y({
173
+ type: n,
174
+ target: p || f,
175
+ nameSource: p ? "test_id" : "none",
176
+ tag: "native",
177
+ // Name-keyed and off for `unnamed`, as for `trackTap` — and recorded only
178
+ // for a row that ships, so a handler's own `trackTap` is not counted twice.
179
+ // Unreachable on a long press (3 holds of ≥500 ms cannot fit 1000 ms).
180
+ rage: !!p && n === "tap" && this.tapRage.record(p, u)
181
+ });
182
+ o.log("ui.interaction", { ...h, ...v }, w).catch((c) => i.warn("Native auto ui.interaction failed:", c));
183
+ };
184
+ }
185
+ });
186
+ }
187
+ }
188
+ function E(l) {
189
+ if (!l || !l.startsWith("edge_"))
190
+ throw new Error("createTelemetry: apiKey is required and must start with 'edge_'");
191
+ }
192
+ function _(l) {
193
+ return E(l?.apiKey), k(l?.debug ?? !1), R(l?.traceHostAllowlist), new D(l);
138
194
  }
139
195
  export {
140
- R as TelemetryNative,
141
- D as createTelemetry,
142
- E as memoryStore
196
+ H as EdgeErrorBoundary,
197
+ _ as createTelemetry,
198
+ F as memoryStore,
199
+ q as useScreenReady
143
200
  };
144
201
  //# sourceMappingURL=index.native.js.map