@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,6 +1,6 @@
1
- import { d as c } from "./memoryStore-F5I-GQKM.js";
2
- import { Q as h } from "./loadingTime-ZkYvFijA.js";
3
- import { R as u, a as l, r as m, u as p, i as v } from "./uiInteraction-DAqxxz0q.js";
1
+ import { d as a } from "./react-urNtDGTL.js";
2
+ import { Q as h } from "./loadingTime-DMc0zTY8.js";
3
+ import { RageTracker as u, RAGE_WINDOW_MS as l, resolveUiName as m, uiAttributes as p, isDeadClickExempt as v } from "./uiInteraction-BIDOMcrL.js";
4
4
  const f = h;
5
5
  class w {
6
6
  constructor(e) {
@@ -9,7 +9,7 @@ class w {
9
9
  start() {
10
10
  if (!this.started) {
11
11
  if (typeof document > "u" || !document?.addEventListener) {
12
- c.log("Web interactions: no document — ui.interaction is not captured");
12
+ a.log("Web interactions: no document — ui.interaction is not captured");
13
13
  return;
14
14
  }
15
15
  this.started = !0, document.addEventListener("click", (e) => this.onClick(e), !0), typeof window < "u" && window.addEventListener?.("pagehide", () => this.drainPending()), document.addEventListener("visibilitychange", () => {
@@ -20,7 +20,7 @@ class w {
20
20
  }
21
21
  }
22
22
  onClick(e) {
23
- const i = Date.now(), t = b(e), r = m(t, { pointerCursor: g(t[0]) }), s = this.telemetry.snapshot(i), d = this.telemetry.trace.interactionSpan(i), o = e, a = {
23
+ const i = Date.now(), t = b(e), r = m(t, { pointerCursor: g(t[0]) }), s = this.telemetry.snapshot(i), d = this.telemetry.trace.interactionSpan(i), o = e, c = {
24
24
  ...d,
25
25
  // The key block is shared with native's `trackTap` so the two cannot drift; only
26
26
  // the values are web's. `clientX/Y` is absent on a synthetic or keyboard-driven
@@ -35,7 +35,7 @@ class w {
35
35
  rage: this.rage.record(r.node, i)
36
36
  })
37
37
  };
38
- r.actionable && !v(t[0]) && this.canObserve() ? this.watchForDeath(a, s) : this.emit(a, s);
38
+ r.actionable && !v(t[0]) && this.canObserve() ? this.watchForDeath(c, s) : this.emit(c, s);
39
39
  }
40
40
  /** Arm one dead-click window and emit when it closes. */
41
41
  watchForDeath(e, i) {
@@ -60,7 +60,7 @@ class w {
60
60
  this.pending.clear(), this.disconnectObserver();
61
61
  }
62
62
  emit(e, i) {
63
- Promise.resolve(this.telemetry.log("ui.interaction", e, i)).catch((t) => c.warn("Web ui.interaction failed:", t));
63
+ Promise.resolve(this.telemetry.log("ui.interaction", e, i)).catch((t) => a.warn("Web ui.interaction failed:", t));
64
64
  }
65
65
  canObserve() {
66
66
  return typeof MutationObserver < "u";
@@ -106,4 +106,4 @@ function g(n) {
106
106
  export {
107
107
  w as InteractionTrackerWeb
108
108
  };
109
- //# sourceMappingURL=interactionWeb.web-CJAviVQ7.js.map
109
+ //# sourceMappingURL=interactionWeb.web-BWBjmovb.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interactionWeb.web-CJAviVQ7.js","sources":["../src/adapters/web/interactionWeb.web.ts"],"sourcesContent":["// `ui.interaction` on web (§4.6, #102) — one capture-phase `click` listener on `document`,\n// the role-gated name ladder from `../uiInteraction`, and the two frustration signals.\n//\n// **Every click emits, actionable or not.** Suppressing the role-less ones would destroy\n// dead-click detection at the source, and it is what makes `unnamed` vs `surface` readable\n// as \"an instrumentation gap\" vs \"someone tapped whitespace\".\n\nimport type { LogSnapshot, Telemetry } from \"../../core/telemetry\";\nimport { debug } from \"../../core/debug\";\nimport { QUIET_WINDOW_MS } from \"../loadingTime\";\nimport {\n RAGE_WINDOW_MS,\n RageTracker,\n isDeadClickExempt,\n resolveUiName,\n uiAttributes,\n type UiElement,\n} from \"../uiInteraction\";\n\n/**\n * ⚠ The dead-click window **is** §4.5.2's quiet window — one named constant, not a second\n * literal `1000`. If one moves, both move. (`RAGE_WINDOW_MS` is deliberately *not* bound to\n * it: §4.6 states the same number for rage, but tuning network settle must not retune rage.)\n */\nconst DEAD_CLICK_WINDOW_MS = QUIET_WINDOW_MS;\n\n/** One click whose dead-click window is still open. */\ntype Pending = {\n attrs: Record<string, any>;\n snapshot: LogSnapshot;\n /** The aliveness reading at mint; unchanged when the window closes means dead. */\n tick: number;\n timer: ReturnType<typeof setTimeout>;\n};\n\nexport class InteractionTrackerWeb {\n private started = false;\n private readonly rage = new RageTracker(RAGE_WINDOW_MS);\n\n /**\n * Monotonic aliveness counter. A DOM mutation, a request start or a view mint bumps it;\n * a click that sees the same value a window later saw nothing happen. A counter rather\n * than a timestamp so the comparison needs no clock and cannot be fooled by a clock that\n * moved backwards.\n */\n private aliveTick = 0;\n private readonly pending = new Set<Pending>();\n private observer?: MutationObserver;\n\n constructor(private telemetry: Telemetry) {}\n\n start(): void {\n if (this.started) return;\n if (typeof document === \"undefined\" || !document?.addEventListener) {\n debug.log(\"Web interactions: no document — ui.interaction is not captured\");\n return;\n }\n this.started = true;\n // Capture phase: the mint has to happen before the host's own handler navigates,\n // because the snapshot it takes is the whole point of §4.6's mint/emit split.\n document.addEventListener(\"click\", (e) => this.onClick(e), true);\n\n // A same-tab `<a href>` or a form submit unloads the document while its dead-click\n // window is still open, and an unemitted row also orphans the interaction root its\n // children already joined. Both edges drain what is pending — `pagehide` covers the\n // unload and the bfcache freeze, `visibilitychange` covers a tab switch and is the\n // edge mobile Safari actually fires.\n if (typeof window !== \"undefined\") {\n window.addEventListener?.(\"pagehide\", () => this.drainPending());\n }\n document.addEventListener(\"visibilitychange\", () => {\n if (document.visibilityState === \"hidden\") this.drainPending();\n });\n\n this.telemetry.views.onActivity(() => { this.aliveTick++; });\n }\n\n private onClick(e: Event): void {\n const at = Date.now();\n const path = pathOf(e);\n const resolution = resolveUiName(path, { pointerCursor: hasPointerCursor(path[0]) });\n\n // Snapshotted here, synchronously, while the click's own view is still current.\n const snapshot = this.telemetry.snapshot(at);\n // §6.2: **every** click mints an interaction root, live carrier or not.\n const span = this.telemetry.trace.interactionSpan(at);\n const mouse = e as MouseEvent;\n\n const attrs: Record<string, any> = {\n ...span,\n // The key block is shared with native's `trackTap` so the two cannot drift; only\n // the values are web's. `clientX/Y` is absent on a synthetic or keyboard-driven\n // click, and §4.6 types both never-null, so the builder floors them at 0.\n ...uiAttributes({\n type: \"click\",\n target: resolution.target,\n nameSource: resolution.nameSource,\n tag: resolution.tag,\n x: mouse.clientX,\n y: mouse.clientY,\n rage: this.rage.record(resolution.node, at),\n }),\n };\n\n // `ui.dead` is judged on **actionable** clicks only, minus text entry and\n // download/`_blank` anchors — and is **omitted when not evaluated**. That absence is\n // load-bearing: the signal must under-report rather than falsely accuse.\n if (resolution.actionable && !isDeadClickExempt(path[0]) && this.canObserve()) {\n this.watchForDeath(attrs, snapshot);\n } else {\n this.emit(attrs, snapshot);\n }\n }\n\n /** Arm one dead-click window and emit when it closes. */\n private watchForDeath(attrs: Record<string, any>, snapshot: LogSnapshot): void {\n const entry: Pending = {\n attrs,\n snapshot,\n tick: this.aliveTick,\n timer: setTimeout(() => {\n this.pending.delete(entry);\n if (this.pending.size === 0) this.disconnectObserver();\n this.emit({ ...attrs, \"ui.dead\": this.aliveTick === entry.tick }, snapshot);\n }, DEAD_CLICK_WINDOW_MS),\n };\n this.pending.add(entry);\n this.connectObserver();\n }\n\n /**\n * Emit every open window **now**, with `ui.dead` **omitted** — the window never closed,\n * so it was not evaluated, which is exactly what its absence means (§4.6). Inventing a\n * verdict from a partial window is the false accusation the key is built to avoid.\n */\n private drainPending(): void {\n for (const entry of this.pending) {\n clearTimeout(entry.timer);\n this.emit(entry.attrs, entry.snapshot);\n }\n this.pending.clear();\n this.disconnectObserver();\n }\n\n private emit(attrs: Record<string, any>, snapshot: LogSnapshot): void {\n void Promise.resolve(this.telemetry.log(\"ui.interaction\", attrs, snapshot))\n .catch((err: unknown) => debug.warn(\"Web ui.interaction failed:\", err));\n }\n\n private canObserve(): boolean {\n return typeof MutationObserver !== \"undefined\";\n }\n\n /**\n * Observed only while a window is open. A permanently-connected whole-document observer\n * is a real cost on a busy React tree, and there is nothing to answer between clicks.\n * `attributes: true` because §4.6 counts an attribute-only change as alive — a CSS class\n * flip is a response.\n */\n private connectObserver(): void {\n const root = typeof document === \"undefined\" ? undefined : document.documentElement;\n if (this.observer || !this.canObserve() || !root) return;\n this.observer = new MutationObserver(() => { this.aliveTick++; });\n this.observer.observe(root, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true,\n });\n }\n\n private disconnectObserver(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n}\n\n/**\n * `composedPath()` innermost-first, so a click inside a shadow root still finds its host's\n * role. Falls back to the parent chain where the event has no `composedPath` (older\n * browsers, and every synthetic event a test hands in).\n */\nfunction pathOf(e: Event): UiElement[] {\n const composed = typeof e.composedPath === \"function\" ? e.composedPath() : undefined;\n if (Array.isArray(composed) && composed.length > 0) return composed as unknown as UiElement[];\n const path: UiElement[] = [];\n let node = e.target as (Node & UiElement) | null;\n while (node) {\n path.push(node);\n node = ((node as any).parentElement ?? node.parentNode) as (Node & UiElement) | null;\n }\n return path;\n}\n\n/**\n * The one signal separating `unnamed` from `surface` on a role-less element. Wrapped\n * because `getComputedStyle` throws on a detached node in some engines, and a click must\n * never be lost to a style read.\n */\nfunction hasPointerCursor(el: UiElement | undefined): boolean {\n if (!el || typeof getComputedStyle === \"undefined\") return false;\n try {\n return getComputedStyle(el as unknown as Element)?.cursor === \"pointer\";\n } catch {\n return false;\n }\n}\n"],"names":["DEAD_CLICK_WINDOW_MS","QUIET_WINDOW_MS","InteractionTrackerWeb","telemetry","RageTracker","RAGE_WINDOW_MS","debug","at","path","pathOf","resolution","resolveUiName","hasPointerCursor","snapshot","span","mouse","attrs","uiAttributes","isDeadClickExempt","entry","err","root","e","composed","node","el"],"mappings":";;;AAwBA,MAAMA,IAAuBC;AAWtB,MAAMC,EAAsB;AAAA,EAc/B,YAAoBC,GAAsB;AAAtB,SAAA,YAAAA,GAbpB,KAAQ,UAAU,IAClB,KAAiB,OAAO,IAAIC,EAAYC,CAAc,GAQtD,KAAQ,YAAY,GACpB,KAAiB,8BAAc,IAAA;AAAA,EAGY;AAAA,EAE3C,QAAc;AACV,QAAI,MAAK,SACT;AAAA,UAAI,OAAO,WAAa,OAAe,CAAC,UAAU,kBAAkB;AAChE,QAAAC,EAAM,IAAI,gEAAgE;AAC1E;AAAA,MACJ;AACA,WAAK,UAAU,IAGf,SAAS,iBAAiB,SAAS,CAAC,MAAM,KAAK,QAAQ,CAAC,GAAG,EAAI,GAO3D,OAAO,SAAW,OAClB,OAAO,m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AACH,IAAAhB,EAAK,KAAKgB,CAAI,GACdA,IAASA,EAAa,iBAAiBA,EAAK;AAEhD,SAAOhB;AACX;AAOA,SAASI,EAAiBa,GAAoC;AAC1D,MAAI,CAACA,KAAM,OAAO,mBAAqB,IAAa,QAAO;AAC3D,MAAI;AACA,WAAO,iBAAiBA,CAAwB,GAAG,WAAW;AAAA,EAClE,QAAQ;AACJ,WAAO;AAAA,EACX;AACJ;"}
1
+ {"version":3,"file":"interactionWeb.web-BWBjmovb.js","sources":["../src/adapters/web/interactionWeb.web.ts"],"sourcesContent":["// `ui.interaction` on web (§4.6, #102) — one capture-phase `click` listener on `document`,\n// the role-gated name ladder from `../uiInteraction`, and the two frustration signals.\n//\n// **Every click emits, actionable or not.** Suppressing the role-less ones would destroy\n// dead-click detection at the source, and it is what makes `unnamed` vs `surface` readable\n// as \"an instrumentation gap\" vs \"someone tapped whitespace\".\n\nimport type { LogSnapshot, Telemetry } from \"../../core/telemetry\";\nimport { debug } from \"../../core/debug\";\nimport { QUIET_WINDOW_MS } from \"../loadingTime\";\nimport {\n RAGE_WINDOW_MS,\n RageTracker,\n isDeadClickExempt,\n resolveUiName,\n uiAttributes,\n type UiElement,\n} from \"../uiInteraction\";\n\n/**\n * ⚠ The dead-click window **is** §4.5.2's quiet window — one named constant, not a second\n * literal `1000`. If one moves, both move. (`RAGE_WINDOW_MS` is deliberately *not* bound to\n * it: §4.6 states the same number for rage, but tuning network settle must not retune rage.)\n */\nconst DEAD_CLICK_WINDOW_MS = QUIET_WINDOW_MS;\n\n/** One click whose dead-click window is still open. */\ntype Pending = {\n attrs: Record<string, any>;\n snapshot: LogSnapshot;\n /** The aliveness reading at mint; unchanged when the window closes means dead. */\n tick: number;\n timer: ReturnType<typeof setTimeout>;\n};\n\nexport class InteractionTrackerWeb {\n private started = false;\n private readonly rage = new RageTracker(RAGE_WINDOW_MS);\n\n /**\n * Monotonic aliveness counter. A DOM mutation, a request start or a view mint bumps it;\n * a click that sees the same value a window later saw nothing happen. A counter rather\n * than a timestamp so the comparison needs no clock and cannot be fooled by a clock that\n * moved backwards.\n */\n private aliveTick = 0;\n private readonly pending = new Set<Pending>();\n private observer?: MutationObserver;\n\n constructor(private telemetry: Telemetry) {}\n\n start(): void {\n if (this.started) return;\n if (typeof document === \"undefined\" || !document?.addEventListener) {\n debug.log(\"Web interactions: no document — ui.interaction is not captured\");\n return;\n }\n this.started = true;\n // Capture phase: the mint has to happen before the host's own handler navigates,\n // because the snapshot it takes is the whole point of §4.6's mint/emit split.\n document.addEventListener(\"click\", (e) => this.onClick(e), true);\n\n // A same-tab `<a href>` or a form submit unloads the document while its dead-click\n // window is still open, and an unemitted row also orphans the interaction root its\n // children already joined. Both edges drain what is pending — `pagehide` covers the\n // unload and the bfcache freeze, `visibilitychange` covers a tab switch and is the\n // edge mobile Safari actually fires.\n if (typeof window !== \"undefined\") {\n window.addEventListener?.(\"pagehide\", () => this.drainPending());\n }\n document.addEventListener(\"visibilitychange\", () => {\n if (document.visibilityState === \"hidden\") this.drainPending();\n });\n\n this.telemetry.views.onActivity(() => { this.aliveTick++; });\n }\n\n private onClick(e: Event): void {\n const at = Date.now();\n const path = pathOf(e);\n const resolution = resolveUiName(path, { pointerCursor: hasPointerCursor(path[0]) });\n\n // Snapshotted here, synchronously, while the click's own view is still current.\n const snapshot = this.telemetry.snapshot(at);\n // §6.2: **every** click mints an interaction root, live carrier or not.\n const span = this.telemetry.trace.interactionSpan(at);\n const mouse = e as MouseEvent;\n\n const attrs: Record<string, any> = {\n ...span,\n // The key block is shared with native's `trackTap` so the two cannot drift; only\n // the values are web's. `clientX/Y` is absent on a synthetic or keyboard-driven\n // click, and §4.6 types both never-null, so the builder floors them at 0.\n ...uiAttributes({\n type: \"click\",\n target: resolution.target,\n nameSource: resolution.nameSource,\n tag: resolution.tag,\n x: mouse.clientX,\n y: mouse.clientY,\n rage: this.rage.record(resolution.node, at),\n }),\n };\n\n // `ui.dead` is judged on **actionable** clicks only, minus text entry and\n // download/`_blank` anchors — and is **omitted when not evaluated**. That absence is\n // load-bearing: the signal must under-report rather than falsely accuse.\n if (resolution.actionable && !isDeadClickExempt(path[0]) && this.canObserve()) {\n this.watchForDeath(attrs, snapshot);\n } else {\n this.emit(attrs, snapshot);\n }\n }\n\n /** Arm one dead-click window and emit when it closes. */\n private watchForDeath(attrs: Record<string, any>, snapshot: LogSnapshot): void {\n const entry: Pending = {\n attrs,\n snapshot,\n tick: this.aliveTick,\n timer: setTimeout(() => {\n this.pending.delete(entry);\n if (this.pending.size === 0) this.disconnectObserver();\n this.emit({ ...attrs, \"ui.dead\": this.aliveTick === entry.tick }, snapshot);\n }, DEAD_CLICK_WINDOW_MS),\n };\n this.pending.add(entry);\n this.connectObserver();\n }\n\n /**\n * Emit every open window **now**, with `ui.dead` **omitted** — the window never closed,\n * so it was not evaluated, which is exactly what its absence means (§4.6). Inventing a\n * verdict from a partial window is the false accusation the key is built to avoid.\n */\n private drainPending(): void {\n for (const entry of this.pending) {\n clearTimeout(entry.timer);\n this.emit(entry.attrs, entry.snapshot);\n }\n this.pending.clear();\n this.disconnectObserver();\n }\n\n private emit(attrs: Record<string, any>, snapshot: LogSnapshot): void {\n void Promise.resolve(this.telemetry.log(\"ui.interaction\", attrs, snapshot))\n .catch((err: unknown) => debug.warn(\"Web ui.interaction failed:\", err));\n }\n\n private canObserve(): boolean {\n return typeof MutationObserver !== \"undefined\";\n }\n\n /**\n * Observed only while a window is open. A permanently-connected whole-document observer\n * is a real cost on a busy React tree, and there is nothing to answer between clicks.\n * `attributes: true` because §4.6 counts an attribute-only change as alive — a CSS class\n * flip is a response.\n */\n private connectObserver(): void {\n const root = typeof document === \"undefined\" ? undefined : document.documentElement;\n if (this.observer || !this.canObserve() || !root) return;\n this.observer = new MutationObserver(() => { this.aliveTick++; });\n this.observer.observe(root, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true,\n });\n }\n\n private disconnectObserver(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n}\n\n/**\n * `composedPath()` innermost-first, so a click inside a shadow root still finds its host's\n * role. Falls back to the parent chain where the event has no `composedPath` (older\n * browsers, and every synthetic event a test hands in).\n */\nfunction pathOf(e: Event): UiElement[] {\n const composed = typeof e.composedPath === \"function\" ? e.composedPath() : undefined;\n if (Array.isArray(composed) && composed.length > 0) return composed as unknown as UiElement[];\n const path: UiElement[] = [];\n let node = e.target as (Node & UiElement) | null;\n while (node) {\n path.push(node);\n node = ((node as any).parentElement ?? node.parentNode) as (Node & UiElement) | null;\n }\n return path;\n}\n\n/**\n * The one signal separating `unnamed` from `surface` on a role-less element. Wrapped\n * because `getComputedStyle` throws on a detached node in some engines, and a click must\n * never be lost to a style read.\n */\nfunction hasPointerCursor(el: UiElement | undefined): boolean {\n if (!el || typeof getComputedStyle === \"undefined\") return false;\n try {\n return getComputedStyle(el as unknown as Element)?.cursor === \"pointer\";\n } catch {\n return false;\n }\n}\n"],"names":["DEAD_CLICK_WINDOW_MS","QUIET_WINDOW_MS","InteractionTrackerWeb","telemetry","RageTracker","RAGE_WINDOW_MS","debug","at","path","pathOf","resolution","resolveUiName","hasPointerCursor","snapshot","span","mouse","attrs","uiAttributes","isDeadClickExempt","entry","err","root","e","composed","node","el"],"mappings":";;;AAwBA,MAAMA,IAAuBC;AAWtB,MAAMC,EAAsB;AAAA,EAc/B,YAAoBC,GAAsB;AAAtB,SAAA,YAAAA,GAbpB,KAAQ,UAAU,IAClB,KAAiB,OAAO,IAAIC,EAAYC,CAAc,GAQtD,KAAQ,YAAY,GACpB,KAAiB,8BAAc,IAAA;AAAA,EAGY;AAAA,EAE3C,QAAc;AACV,QAAI,MAAK,SACT;AAAA,UAAI,OAAO,WAAa,OAAe,CAAC,UAAU,kBAAkB;AAChE,QAAAC,EAAM,IAAI,gEAAgE;AAC1E;AAAA,MACJ;AACA,WAAK,UAAU,IAGf,SAAS,iBAAiB,SAAS,CAAC,MAAM,KAAK,QAAQ,CAAC,GAAG,EAAI,GAO3D,OAAO,SAAW,OAClB,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SAAOE;AACH,IAAAhB,EAAK,KAAKgB,CAAI,GACdA,IAASA,EAAa,iBAAiBA,EAAK;AAEhD,SAAOhB;AACX;AAOA,SAASI,EAAiBa,GAAoC;AAC1D,MAAI,CAACA,KAAM,OAAO,mBAAqB,IAAa,QAAO;AAC3D,MAAI;AACA,WAAO,iBAAiBA,CAAwB,GAAG,WAAW;AAAA,EAClE,QAAQ;AACJ,WAAO;AAAA,EACX;AACJ;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./react-bqe7KPOf.cjs"),h=require("./loadingTime-Cj5Oh8lT.cjs"),s=require("./uiInteraction-DxlwCVSn.cjs"),l=h.QUIET_WINDOW_MS;class m{constructor(e){this.telemetry=e,this.started=!1,this.rage=new s.RageTracker(s.RAGE_WINDOW_MS),this.aliveTick=0,this.pending=new Set}start(){if(!this.started){if(typeof document>"u"||!document?.addEventListener){d.debug.log("Web interactions: no document — ui.interaction is not captured");return}this.started=!0,document.addEventListener("click",e=>this.onClick(e),!0),typeof window<"u"&&window.addEventListener?.("pagehide",()=>this.drainPending()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.drainPending()}),this.telemetry.views.onActivity(()=>{this.aliveTick++})}}onClick(e){const i=Date.now(),t=v(e),r=s.resolveUiName(t,{pointerCursor:p(t[0])}),o=this.telemetry.snapshot(i),u=this.telemetry.trace.interactionSpan(i),c=e,a={...u,...s.uiAttributes({type:"click",target:r.target,nameSource:r.nameSource,tag:r.tag,x:c.clientX,y:c.clientY,rage:this.rage.record(r.node,i)})};r.actionable&&!s.isDeadClickExempt(t[0])&&this.canObserve()?this.watchForDeath(a,o):this.emit(a,o)}watchForDeath(e,i){const t={attrs:e,snapshot:i,tick:this.aliveTick,timer:setTimeout(()=>{this.pending.delete(t),this.pending.size===0&&this.disconnectObserver(),this.emit({...e,"ui.dead":this.aliveTick===t.tick},i)},l)};this.pending.add(t),this.connectObserver()}drainPending(){for(const e of this.pending)clearTimeout(e.timer),this.emit(e.attrs,e.snapshot);this.pending.clear(),this.disconnectObserver()}emit(e,i){Promise.resolve(this.telemetry.log("ui.interaction",e,i)).catch(t=>d.debug.warn("Web ui.interaction failed:",t))}canObserve(){return typeof MutationObserver<"u"}connectObserver(){const e=typeof document>"u"?void 0:document.documentElement;this.observer||!this.canObserve()||!e||(this.observer=new MutationObserver(()=>{this.aliveTick++}),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}))}disconnectObserver(){this.observer?.disconnect(),this.observer=void 0}}function v(n){const e=typeof n.composedPath=="function"?n.composedPath():void 0;if(Array.isArray(e)&&e.length>0)return e;const i=[];let t=n.target;for(;t;)i.push(t),t=t.parentElement??t.parentNode;return i}function p(n){if(!n||typeof getComputedStyle>"u")return!1;try{return getComputedStyle(n)?.cursor==="pointer"}catch{return!1}}exports.InteractionTrackerWeb=m;
2
+ //# sourceMappingURL=interactionWeb.web-CKDJLD9r.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"interactionWeb.web-Bl_cZlgh.cjs","sources":["../src/adapters/web/interactionWeb.web.ts"],"sourcesContent":["// `ui.interaction` on web (§4.6, #102) — one capture-phase `click` listener on `document`,\n// the role-gated name ladder from `../uiInteraction`, and the two frustration signals.\n//\n// **Every click emits, actionable or not.** Suppressing the role-less ones would destroy\n// dead-click detection at the source, and it is what makes `unnamed` vs `surface` readable\n// as \"an instrumentation gap\" vs \"someone tapped whitespace\".\n\nimport type { LogSnapshot, Telemetry } from \"../../core/telemetry\";\nimport { debug } from \"../../core/debug\";\nimport { QUIET_WINDOW_MS } from \"../loadingTime\";\nimport {\n RAGE_WINDOW_MS,\n RageTracker,\n isDeadClickExempt,\n resolveUiName,\n uiAttributes,\n type UiElement,\n} from \"../uiInteraction\";\n\n/**\n * ⚠ The dead-click window **is** §4.5.2's quiet window — one named constant, not a second\n * literal `1000`. If one moves, both move. (`RAGE_WINDOW_MS` is deliberately *not* bound to\n * it: §4.6 states the same number for rage, but tuning network settle must not retune rage.)\n */\nconst DEAD_CLICK_WINDOW_MS = QUIET_WINDOW_MS;\n\n/** One click whose dead-click window is still open. */\ntype Pending = {\n attrs: Record<string, any>;\n snapshot: LogSnapshot;\n /** The aliveness reading at mint; unchanged when the window closes means dead. */\n tick: number;\n timer: ReturnType<typeof setTimeout>;\n};\n\nexport class InteractionTrackerWeb {\n private started = false;\n private readonly rage = new RageTracker(RAGE_WINDOW_MS);\n\n /**\n * Monotonic aliveness counter. A DOM mutation, a request start or a view mint bumps it;\n * a click that sees the same value a window later saw nothing happen. A counter rather\n * than a timestamp so the comparison needs no clock and cannot be fooled by a clock that\n * moved backwards.\n */\n private aliveTick = 0;\n private readonly pending = new Set<Pending>();\n private observer?: MutationObserver;\n\n constructor(private telemetry: Telemetry) {}\n\n start(): void {\n if (this.started) return;\n if (typeof document === \"undefined\" || !document?.addEventListener) {\n debug.log(\"Web interactions: no document — ui.interaction is not captured\");\n return;\n }\n this.started = true;\n // Capture phase: the mint has to happen before the host's own handler navigates,\n // because the snapshot it takes is the whole point of §4.6's mint/emit split.\n document.addEventListener(\"click\", (e) => this.onClick(e), true);\n\n // A same-tab `<a href>` or a form submit unloads the document while its dead-click\n // window is still open, and an unemitted row also orphans the interaction root its\n // children already joined. Both edges drain what is pending — `pagehide` covers the\n // unload and the bfcache freeze, `visibilitychange` covers a tab switch and is the\n // edge mobile Safari actually fires.\n if (typeof window !== \"undefined\") {\n window.addEventListener?.(\"pagehide\", () => this.drainPending());\n }\n document.addEventListener(\"visibilitychange\", () => {\n if (document.visibilityState === \"hidden\") this.drainPending();\n });\n\n this.telemetry.views.onActivity(() => { this.aliveTick++; });\n }\n\n private onClick(e: Event): void {\n const at = Date.now();\n const path = pathOf(e);\n const resolution = resolveUiName(path, { pointerCursor: hasPointerCursor(path[0]) });\n\n // Snapshotted here, synchronously, while the click's own view is still current.\n const snapshot = this.telemetry.snapshot(at);\n // §6.2: **every** click mints an interaction root, live carrier or not.\n const span = this.telemetry.trace.interactionSpan(at);\n const mouse = e as MouseEvent;\n\n const attrs: Record<string, any> = {\n ...span,\n // The key block is shared with native's `trackTap` so the two cannot drift; only\n // the values are web's. `clientX/Y` is absent on a synthetic or keyboard-driven\n // click, and §4.6 types both never-null, so the builder floors them at 0.\n ...uiAttributes({\n type: \"click\",\n target: resolution.target,\n nameSource: resolution.nameSource,\n tag: resolution.tag,\n x: mouse.clientX,\n y: mouse.clientY,\n rage: this.rage.record(resolution.node, at),\n }),\n };\n\n // `ui.dead` is judged on **actionable** clicks only, minus text entry and\n // download/`_blank` anchors — and is **omitted when not evaluated**. That absence is\n // load-bearing: the signal must under-report rather than falsely accuse.\n if (resolution.actionable && !isDeadClickExempt(path[0]) && this.canObserve()) {\n this.watchForDeath(attrs, snapshot);\n } else {\n this.emit(attrs, snapshot);\n }\n }\n\n /** Arm one dead-click window and emit when it closes. */\n private watchForDeath(attrs: Record<string, any>, snapshot: LogSnapshot): void {\n const entry: Pending = {\n attrs,\n snapshot,\n tick: this.aliveTick,\n timer: setTimeout(() => {\n this.pending.delete(entry);\n if (this.pending.size === 0) this.disconnectObserver();\n this.emit({ ...attrs, \"ui.dead\": this.aliveTick === entry.tick }, snapshot);\n }, DEAD_CLICK_WINDOW_MS),\n };\n this.pending.add(entry);\n this.connectObserver();\n }\n\n /**\n * Emit every open window **now**, with `ui.dead` **omitted** — the window never closed,\n * so it was not evaluated, which is exactly what its absence means (§4.6). Inventing a\n * verdict from a partial window is the false accusation the key is built to avoid.\n */\n private drainPending(): void {\n for (const entry of this.pending) {\n clearTimeout(entry.timer);\n this.emit(entry.attrs, entry.snapshot);\n }\n this.pending.clear();\n this.disconnectObserver();\n }\n\n private emit(attrs: Record<string, any>, snapshot: LogSnapshot): void {\n void Promise.resolve(this.telemetry.log(\"ui.interaction\", attrs, snapshot))\n .catch((err: unknown) => debug.warn(\"Web ui.interaction failed:\", err));\n }\n\n private canObserve(): boolean {\n return typeof MutationObserver !== \"undefined\";\n }\n\n /**\n * Observed only while a window is open. A permanently-connected whole-document observer\n * is a real cost on a busy React tree, and there is nothing to answer between clicks.\n * `attributes: true` because §4.6 counts an attribute-only change as alive — a CSS class\n * flip is a response.\n */\n private connectObserver(): void {\n const root = typeof document === \"undefined\" ? undefined : document.documentElement;\n if (this.observer || !this.canObserve() || !root) return;\n this.observer = new MutationObserver(() => { this.aliveTick++; });\n this.observer.observe(root, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true,\n });\n }\n\n private disconnectObserver(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n}\n\n/**\n * `composedPath()` innermost-first, so a click inside a shadow root still finds its host's\n * role. Falls back to the parent chain where the event has no `composedPath` (older\n * browsers, and every synthetic event a test hands in).\n */\nfunction pathOf(e: Event): UiElement[] {\n const composed = typeof e.composedPath === \"function\" ? e.composedPath() : undefined;\n if (Array.isArray(composed) && composed.length > 0) return composed as unknown as UiElement[];\n const path: UiElement[] = [];\n let node = e.target as (Node & UiElement) | null;\n while (node) {\n path.push(node);\n node = ((node as any).parentElement ?? node.parentNode) as (Node & UiElement) | null;\n }\n return path;\n}\n\n/**\n * The one signal separating `unnamed` from `surface` on a role-less element. Wrapped\n * because `getComputedStyle` throws on a detached node in some engines, and a click must\n * never be lost to a style read.\n */\nfunction hasPointerCursor(el: UiElement | undefined): boolean {\n if (!el || typeof getComputedStyle === \"undefined\") return false;\n try {\n return getComputedStyle(el as unknown as Element)?.cursor === \"pointer\";\n } catch {\n return false;\n }\n}\n"],"names":["DEAD_CLICK_WINDOW_MS","QUIET_WINDOW_MS","InteractionTrackerWeb","telemetry","RageTracker","RAGE_WINDOW_MS","debug","at","path","pathOf","resolution","resolveUiName","hasPointerCursor","snapshot","span","mouse","attrs","uiAttributes","isDeadClickExempt","entry","err","root","e","composed","node","el"],"mappings":"gNAwBMA,EAAuBC,EAAAA,gBAWtB,MAAMC,CAAsB,CAc/B,YAAoBC,EAAsB,CAAtB,KAAA,UAAAA,EAbpB,KAAQ,QAAU,GAClB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I,EACdA,EAASA,EAAa,eAAiBA,EAAK,WAEhD,OAAOhB,CACX,CAOA,SAASI,EAAiBa,EAAoC,CAC1D,GAAI,CAACA,GAAM,OAAO,iBAAqB,IAAa,MAAO,GAC3D,GAAI,CACA,OAAO,iBAAiBA,CAAwB,GAAG,SAAW,SAClE,MAAQ,CACJ,MAAO,EACX,CACJ"}
1
+ {"version":3,"file":"interactionWeb.web-CKDJLD9r.cjs","sources":["../src/adapters/web/interactionWeb.web.ts"],"sourcesContent":["// `ui.interaction` on web (§4.6, #102) — one capture-phase `click` listener on `document`,\n// the role-gated name ladder from `../uiInteraction`, and the two frustration signals.\n//\n// **Every click emits, actionable or not.** Suppressing the role-less ones would destroy\n// dead-click detection at the source, and it is what makes `unnamed` vs `surface` readable\n// as \"an instrumentation gap\" vs \"someone tapped whitespace\".\n\nimport type { LogSnapshot, Telemetry } from \"../../core/telemetry\";\nimport { debug } from \"../../core/debug\";\nimport { QUIET_WINDOW_MS } from \"../loadingTime\";\nimport {\n RAGE_WINDOW_MS,\n RageTracker,\n isDeadClickExempt,\n resolveUiName,\n uiAttributes,\n type UiElement,\n} from \"../uiInteraction\";\n\n/**\n * ⚠ The dead-click window **is** §4.5.2's quiet window — one named constant, not a second\n * literal `1000`. If one moves, both move. (`RAGE_WINDOW_MS` is deliberately *not* bound to\n * it: §4.6 states the same number for rage, but tuning network settle must not retune rage.)\n */\nconst DEAD_CLICK_WINDOW_MS = QUIET_WINDOW_MS;\n\n/** One click whose dead-click window is still open. */\ntype Pending = {\n attrs: Record<string, any>;\n snapshot: LogSnapshot;\n /** The aliveness reading at mint; unchanged when the window closes means dead. */\n tick: number;\n timer: ReturnType<typeof setTimeout>;\n};\n\nexport class InteractionTrackerWeb {\n private started = false;\n private readonly rage = new RageTracker(RAGE_WINDOW_MS);\n\n /**\n * Monotonic aliveness counter. A DOM mutation, a request start or a view mint bumps it;\n * a click that sees the same value a window later saw nothing happen. A counter rather\n * than a timestamp so the comparison needs no clock and cannot be fooled by a clock that\n * moved backwards.\n */\n private aliveTick = 0;\n private readonly pending = new Set<Pending>();\n private observer?: MutationObserver;\n\n constructor(private telemetry: Telemetry) {}\n\n start(): void {\n if (this.started) return;\n if (typeof document === \"undefined\" || !document?.addEventListener) {\n debug.log(\"Web interactions: no document — ui.interaction is not captured\");\n return;\n }\n this.started = true;\n // Capture phase: the mint has to happen before the host's own handler navigates,\n // because the snapshot it takes is the whole point of §4.6's mint/emit split.\n document.addEventListener(\"click\", (e) => this.onClick(e), true);\n\n // A same-tab `<a href>` or a form submit unloads the document while its dead-click\n // window is still open, and an unemitted row also orphans the interaction root its\n // children already joined. Both edges drain what is pending — `pagehide` covers the\n // unload and the bfcache freeze, `visibilitychange` covers a tab switch and is the\n // edge mobile Safari actually fires.\n if (typeof window !== \"undefined\") {\n window.addEventListener?.(\"pagehide\", () => this.drainPending());\n }\n document.addEventListener(\"visibilitychange\", () => {\n if (document.visibilityState === \"hidden\") this.drainPending();\n });\n\n this.telemetry.views.onActivity(() => { this.aliveTick++; });\n }\n\n private onClick(e: Event): void {\n const at = Date.now();\n const path = pathOf(e);\n const resolution = resolveUiName(path, { pointerCursor: hasPointerCursor(path[0]) });\n\n // Snapshotted here, synchronously, while the click's own view is still current.\n const snapshot = this.telemetry.snapshot(at);\n // §6.2: **every** click mints an interaction root, live carrier or not.\n const span = this.telemetry.trace.interactionSpan(at);\n const mouse = e as MouseEvent;\n\n const attrs: Record<string, any> = {\n ...span,\n // The key block is shared with native's `trackTap` so the two cannot drift; only\n // the values are web's. `clientX/Y` is absent on a synthetic or keyboard-driven\n // click, and §4.6 types both never-null, so the builder floors them at 0.\n ...uiAttributes({\n type: \"click\",\n target: resolution.target,\n nameSource: resolution.nameSource,\n tag: resolution.tag,\n x: mouse.clientX,\n y: mouse.clientY,\n rage: this.rage.record(resolution.node, at),\n }),\n };\n\n // `ui.dead` is judged on **actionable** clicks only, minus text entry and\n // download/`_blank` anchors — and is **omitted when not evaluated**. That absence is\n // load-bearing: the signal must under-report rather than falsely accuse.\n if (resolution.actionable && !isDeadClickExempt(path[0]) && this.canObserve()) {\n this.watchForDeath(attrs, snapshot);\n } else {\n this.emit(attrs, snapshot);\n }\n }\n\n /** Arm one dead-click window and emit when it closes. */\n private watchForDeath(attrs: Record<string, any>, snapshot: LogSnapshot): void {\n const entry: Pending = {\n attrs,\n snapshot,\n tick: this.aliveTick,\n timer: setTimeout(() => {\n this.pending.delete(entry);\n if (this.pending.size === 0) this.disconnectObserver();\n this.emit({ ...attrs, \"ui.dead\": this.aliveTick === entry.tick }, snapshot);\n }, DEAD_CLICK_WINDOW_MS),\n };\n this.pending.add(entry);\n this.connectObserver();\n }\n\n /**\n * Emit every open window **now**, with `ui.dead` **omitted** — the window never closed,\n * so it was not evaluated, which is exactly what its absence means (§4.6). Inventing a\n * verdict from a partial window is the false accusation the key is built to avoid.\n */\n private drainPending(): void {\n for (const entry of this.pending) {\n clearTimeout(entry.timer);\n this.emit(entry.attrs, entry.snapshot);\n }\n this.pending.clear();\n this.disconnectObserver();\n }\n\n private emit(attrs: Record<string, any>, snapshot: LogSnapshot): void {\n void Promise.resolve(this.telemetry.log(\"ui.interaction\", attrs, snapshot))\n .catch((err: unknown) => debug.warn(\"Web ui.interaction failed:\", err));\n }\n\n private canObserve(): boolean {\n return typeof MutationObserver !== \"undefined\";\n }\n\n /**\n * Observed only while a window is open. A permanently-connected whole-document observer\n * is a real cost on a busy React tree, and there is nothing to answer between clicks.\n * `attributes: true` because §4.6 counts an attribute-only change as alive — a CSS class\n * flip is a response.\n */\n private connectObserver(): void {\n const root = typeof document === \"undefined\" ? undefined : document.documentElement;\n if (this.observer || !this.canObserve() || !root) return;\n this.observer = new MutationObserver(() => { this.aliveTick++; });\n this.observer.observe(root, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true,\n });\n }\n\n private disconnectObserver(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n}\n\n/**\n * `composedPath()` innermost-first, so a click inside a shadow root still finds its host's\n * role. Falls back to the parent chain where the event has no `composedPath` (older\n * browsers, and every synthetic event a test hands in).\n */\nfunction pathOf(e: Event): UiElement[] {\n const composed = typeof e.composedPath === \"function\" ? e.composedPath() : undefined;\n if (Array.isArray(composed) && composed.length > 0) return composed as unknown as UiElement[];\n const path: UiElement[] = [];\n let node = e.target as (Node & UiElement) | null;\n while (node) {\n path.push(node);\n node = ((node as any).parentElement ?? node.parentNode) as (Node & UiElement) | null;\n }\n return path;\n}\n\n/**\n * The one signal separating `unnamed` from `surface` on a role-less element. Wrapped\n * because `getComputedStyle` throws on a detached node in some engines, and a click must\n * never be lost to a style read.\n */\nfunction hasPointerCursor(el: UiElement | undefined): boolean {\n if (!el || typeof getComputedStyle === \"undefined\") return false;\n try {\n return getComputedStyle(el as unknown as Element)?.cursor === \"pointer\";\n } catch {\n return false;\n }\n}\n"],"names":["DEAD_CLICK_WINDOW_MS","QUIET_WINDOW_MS","InteractionTrackerWeb","telemetry","RageTracker","RAGE_WINDOW_MS","debug","at","path","pathOf","resolution","resolveUiName","hasPointerCursor","snapshot","span","mouse","attrs","uiAttributes","isDeadClickExempt","entry","err","root","e","composed","node","el"],"mappings":"0MAwBMA,EAAuBC,EAAAA,gBAWtB,MAAMC,CAAsB,CAc/B,YAAoBC,EAAsB,CAAtB,KAAA,UAAAA,EAbpB,KAAQ,QAAU,GAClB,KAAiB,KAAO,IAAIC,EAAAA,YAAYC,gBAAc,EAQtD,KAAQ,UAAY,EACpB,KAAiB,YAAc,GAGY,CAE3C,OAAc,CACV,GAAI,MAAK,QACT,IAAI,OAAO,SAAa,KAAe,CAAC,UAAU,iBAAkB,CAChEC,EAAAA,MAAM,IAAI,gEAAgE,EAC1E,MACJ,CACA,KAAK,QAAU,GAGf,SAAS,iBAAiB,QAAU,GAAM,KAAK,QAAQ,CAAC,EAAG,EAAI,EAO3D,OAAO,OAAW,KAClB,OAAO,mBAAmB,WAAY,IAAM,KAAK,cAAc,EAEnE,SAAS,iBAAiB,mBAAoB,IAAM,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,EACb,KAAK,mBAAA,CACT,CAEQ,KAAKH,EAA4BH,EAA6B,CAC7D,QAAQ,QAAQ,KAAK,UAAU,IAAI,iBAAkBG,EAAOH,CAAQ,CAAC,EACrE,MAAOO,GAAiBd,EAAAA,MAAM,KAAK,6BAA8Bc,CAAG,CAAC,CAC9E,CAEQ,YAAsB,CAC1B,OAAO,OAAO,iBAAqB,GACvC,CAQQ,iBAAwB,CAC5B,MAAMC,EAAO,OAAO,SAAa,IAAc,OAAY,SAAS,gBAChE,KAAK,UAAY,CAAC,KAAK,WAAA,GAAgB,CAACA,IAC5C,KAAK,SAAW,IAAI,iBAAiB,IAAM,CAAE,KAAK,WAAa,CAAC,EAChE,KAAK,SAAS,QAAQA,EAAM,CACxB,QAAS,GACT,UAAW,GACX,WAAY,GACZ,cAAe,EAAA,CAClB,EACL,CAEQ,oBAA2B,CAC/B,KAAK,UAAU,WAAA,EACf,KAAK,SAAW,MACpB,CACJ,CAOA,SAASZ,EAAOa,EAAuB,CACnC,MAAMC,EAAW,OAAOD,EAAE,cAAiB,WAAaA,EAAE,eAAiB,OAC3E,GAAI,MAAM,QAAQC,CAAQ,GAAKA,EAAS,OAAS,EAAG,OAAOA,EAC3D,MAAMf,EAAoB,CAAA,EAC1B,IAAIgB,EAAOF,EAAE,OACb,KAAOE,GACHhB,EAAK,KAAKgB,CAAI,EACdA,EAASA,EAAa,eAAiBA,EAAK,WAEhD,OAAOhB,CACX,CAOA,SAASI,EAAiBa,EAAoC,CAC1D,GAAI,CAACA,GAAM,OAAO,iBAAqB,IAAa,MAAO,GAC3D,GAAI,CACA,OAAO,iBAAiBA,CAAwB,GAAG,SAAW,SAClE,MAAQ,CACJ,MAAO,EACX,CACJ"}
@@ -1,8 +1,8 @@
1
- import { i as q, b as H, c as R } from "./httpAttributes-BrrtM8zh.js";
2
- import { p as T } from "./xhrIntercept-BNiA41Mj.js";
3
- import { r as b, w as v, a as m } from "./memoryStore-F5I-GQKM.js";
4
- function C(h, o) {
5
- const e = h;
1
+ import { i as q, b as H, c as b } from "./httpAttributes-BWXOr4eP.js";
2
+ import { p as R } from "./xhrIntercept-9uAkQh3N.js";
3
+ import { r as T, w as v, g as u } from "./react-urNtDGTL.js";
4
+ function C(f, o) {
5
+ const e = f;
6
6
  return o || typeof e?.referrer != "string" ? {} : { referrer: e.referrer, referrerPolicy: e.referrerPolicy };
7
7
  }
8
8
  class A {
@@ -20,42 +20,43 @@ class A {
20
20
  */
21
21
  start() {
22
22
  return new Promise((o) => {
23
- const e = this.telemetry, p = window.fetch;
23
+ const e = this.telemetry, h = window.fetch;
24
24
  window.fetch = async (t, r) => {
25
- const c = Date.now(), d = typeof t == "string" ? t : t.toString(), a = q(d, e.getEndpoint?.()), u = a ? void 0 : e.views.requestStarted(c), w = a ? void 0 : e.snapshot(), f = r?.headers !== void 0 ? r.headers : t?.headers, l = a ? void 0 : e.trace.requestTrace(c, {
25
+ if (e.isEnabled?.() === !1) return h(t, r);
26
+ const c = Date.now(), d = typeof t == "string" ? t : t.toString(), a = q(d, e.getEndpoint?.()), p = a ? void 0 : e.views.requestStarted(c), w = a ? void 0 : e.snapshot(), i = r?.headers !== void 0 ? r.headers : t?.headers, l = a ? void 0 : e.trace.requestTrace(c, {
26
27
  url: d,
27
28
  sampled: e.isSampled(),
28
- consumerTraceparent: b(f, m),
29
+ consumerTraceparent: T(i, u),
29
30
  // fetch-only, and the sharper statement than "web-only": on a `no-cors`
30
31
  // request the headers guard drops the consumer's traceparent too.
31
32
  noCors: (r?.mode ?? t?.mode) === "no-cors"
32
- }), y = l?.finish, g = l?.header ? { ...C(t, r), ...r, headers: v(f, m, l.header) } : r;
33
- let n = null, i = null;
33
+ }), y = l?.finish, g = l?.header ? { ...C(t, r), ...r, headers: v(i, u, l.header) } : r;
34
+ let n = null, m = null;
34
35
  try {
35
- return n = await p(t, g), n;
36
+ return n = await h(t, g), n;
36
37
  } catch (s) {
37
- throw i = s, s;
38
+ throw m = s, s;
38
39
  } finally {
39
40
  const s = Date.now();
40
- u?.(s), a || e.log("http.request", {
41
+ p?.(s), a || e.log("http.request", {
41
42
  ...H({
42
43
  url: d,
43
44
  method: r?.method ?? "GET",
44
45
  // fetch's own default, a real observation
45
46
  statusCode: n?.status ?? 0,
46
47
  durationMs: s - c,
47
- error: i,
48
+ error: m,
48
49
  requestBody: r?.body,
49
- responseSize: R(n?.headers.get("content-length"))
50
+ responseSize: b(n?.headers.get("content-length"))
50
51
  }),
51
52
  ...y?.(s)
52
53
  }, w);
53
54
  }
54
- }, typeof XMLHttpRequest < "u" && T(e, XMLHttpRequest), o();
55
+ }, typeof XMLHttpRequest < "u" && R(e, XMLHttpRequest), o();
55
56
  });
56
57
  }
57
58
  }
58
59
  export {
59
60
  A as NetworkTrackerWeb
60
61
  };
61
- //# sourceMappingURL=interceptFetchWeb.web-UXC2Lb6X.js.map
62
+ //# sourceMappingURL=interceptFetchWeb.web-DjSR_Rft.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interceptFetchWeb.web-DjSR_Rft.js","sources":["../src/adapters/web/interceptFetchWeb.web.ts"],"sourcesContent":["// interceptHttp.web.ts\nimport { Telemetry } from \"../../core/telemetry\";\nimport { buildHttpAttributes, contentLengthSize, isCollectorUrl } from \"../httpAttributes\";\nimport { patchXHR } from \"../xhrIntercept\";\nimport { TRACEPARENT, readHeader, withHeader } from \"../traceHeader\";\n\n/**\n * Per the fetch spec a **non-empty `init` resets a `Request`'s `referrer` and\n * `referrerPolicy`**. When the consumer passed no init at all, handing fetch one just to carry\n * our header would silently change their request — and §6.4 is explicit that the SDK does\n * nothing else at runtime. So carry both across. A consumer who already passed a non-empty\n * init has triggered the same reset themselves, and their values win over these.\n */\nfunction carriedReferrer(input: unknown, init: RequestInit | undefined): RequestInit {\n const req = input as { referrer?: unknown; referrerPolicy?: unknown };\n if (init || typeof req?.referrer !== \"string\") return {};\n return { referrer: req.referrer, referrerPolicy: req.referrerPolicy as ReferrerPolicy };\n}\n\n/**\n * NetworkTrackerWeb intercepts HTTP made through `window.fetch` and `XMLHttpRequest`.\n *\n * Both are patched here, unlike native: browser `fetch` is a native implementation, not\n * XHR-backed, so the two are genuinely separate channels and neither double-counts (§4.4).\n */\nexport class NetworkTrackerWeb {\n private telemetry: Telemetry;\n\n /**\n * Create a NetworkTrackerWeb instance.\n * @param telemetry - An instance of Telemetry used for logging network events.\n */\n constructor(telemetry: Telemetry) {\n this.telemetry = telemetry;\n }\n\n /**\n * Starts intercepting HTTP requests made through `fetch` and `XMLHttpRequest`.\n *\n * @returns A Promise that resolves immediately once interception is setup.\n */\n public start(): Promise<void> {\n return new Promise((resolve) => {\n // Capture telemetry instance to use inside patched functions\n const telemetry = this.telemetry;\n\n // --- Patch window.fetch ---\n const originalFetch = window.fetch;\n window.fetch = async (\n input: RequestInfo | URL,\n init?: RequestInit\n ): Promise<Response> => {\n // Disabled (#172): pass through untouched — no settle hold, no root, no header.\n if (telemetry.isEnabled?.() === false) return originalFetch(input, init);\n const start = Date.now();\n const url = typeof input === \"string\" ? input : input.toString();\n const isCollector = isCollectorUrl(url, telemetry.getEndpoint?.());\n // Bound to the view live at *send*, not at completion (§4.5.2). The collector's\n // own POST is excluded from settle for the same reason it is excluded from\n // `http.request`: the SDK must not hold a view open with its own traffic.\n const settled = isCollector ? undefined : telemetry.views.requestStarted(start);\n // §3.1 — `session.id`, `session.start_time` and `view.id` frozen at send.\n // No `at`: the row keeps the completion timestamp §4.4 gives it.\n const snap = isCollector ? undefined : telemetry.snapshot();\n // §6.3's Tier 1 plus §6.5's outcome ladder, captured at send for the same\n // reason: the root live *now* is the parent, and a root minted here is this\n // request's own (§6.2). `init.headers` *replaces* a Request's own headers\n // per the fetch spec, so the presence check mirrors that precedence rather\n // than merging the two — read-scope means one name, one presence check.\n const reqHeaders = init?.headers !== undefined\n ? init.headers\n : (input as any)?.headers;\n const trace = isCollector ? undefined : telemetry.trace.requestTrace(start, {\n url,\n sampled: telemetry.isSampled(),\n consumerTraceparent: readHeader(reqHeaders, TRACEPARENT),\n // fetch-only, and the sharper statement than \"web-only\": on a `no-cors`\n // request the headers guard drops the consumer's traceparent too.\n noCors: (init?.mode ?? (input as any)?.mode) === \"no-cors\",\n });\n const span = trace?.finish;\n // A **copy**. The consumer's Request/Headers object is never touched, so\n // never-strip holds by construction and their retry of the same Request\n // carries no SDK header — each attempt gets its own fresh `span.id`.\n const fetchInit = trace?.header\n ? { ...carriedReferrer(input, init), ...init, headers: withHeader(reqHeaders, TRACEPARENT, trace.header) }\n : init;\n let response: Response | null = null;\n let error: any = null;\n\n try {\n response = await originalFetch(input, fetchInit as RequestInit);\n return response;\n } catch (err) {\n error = err;\n throw err;\n } finally {\n const end = Date.now();\n settled?.(end);\n\n // Invariant: an http.request never describes the SDK's own collector POST.\n if (!isCollector) {\n telemetry.log(\"http.request\", {\n ...buildHttpAttributes({\n url,\n method: init?.method ?? \"GET\", // fetch's own default, a real observation\n statusCode: response?.status ?? 0,\n durationMs: end - start,\n error,\n requestBody: init?.body,\n responseSize: contentLengthSize(response?.headers.get(\"content-length\")),\n }),\n ...span?.(end),\n }, snap);\n }\n }\n };\n\n // --- Patch XMLHttpRequest (absent in some RN-Web runtimes) ---\n if (typeof XMLHttpRequest !== \"undefined\") patchXHR(telemetry, XMLHttpRequest);\n\n // Resolve immediately since interception setup is synchronous\n resolve();\n });\n }\n}\n"],"names":["carriedReferrer","input","init","req","NetworkTrackerWeb","telemetry","resolve","originalFetch","start","url","isCollector","isCollectorUrl","settled","snap","reqHeaders","trace","readHeader","TRACEPARENT","span","fetchInit","withHeader","response","error","err","end","buildHttpAttributes","contentLengthSize","patchXHR"],"mappings":";;;AAaA,SAASA,EAAgBC,GAAgBC,GAA4C;AACjF,QAAMC,IAAMF;AACZ,SAAIC,KAAQ,OAAOC,GAAK,YAAa,WAAiB,CAAA,IAC/C,EAAE,UAAUA,EAAI,UAAU,gBAAgBA,EAAI,eAAA;AACzD;AAQO,MAAMC,EAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAO3B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,KAAAhB;AAAA,cACA,QAAQP,GAAM,UAAU;AAAA;AAAA,cACxB,YAAYmB,GAAU,UAAU;AAAA,cAChC,YAAYG,IAAMhB;AAAA,cAClB,OAAAc;AAAA,cACA,aAAapB,GAAM;AAAA,cACnB,cAAcwB,EAAkBL,GAAU,QAAQ,IAAI,gBAAgB,CAAC;AAAA,YAAA,CAC1E;AAAA,YACD,GAAGH,IAAOM,CAAG;AAAA,UAAA,GACdX,CAAI;AAAA,QAEf;AAAA,MACJ,GAGI,OAAO,iBAAmB,OAAac,EAAStB,GAAW,cAAc,GAG7EC,EAAA;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./httpAttributes-COY0_kiF.cjs"),T=require("./xhrIntercept-xG1Yl5RI.cjs"),a=require("./react-bqe7KPOf.cjs");function b(u,o){const e=u;return o||typeof e?.referrer!="string"?{}:{referrer:e.referrer,referrerPolicy:e.referrerPolicy}}class R{constructor(o){this.telemetry=o}start(){return new Promise(o=>{const e=this.telemetry,f=window.fetch;window.fetch=async(t,r)=>{if(e.isEnabled?.()===!1)return f(t,r);const d=Date.now(),l=typeof t=="string"?t:t.toString(),n=i.isCollectorUrl(l,e.getEndpoint?.()),w=n?void 0:e.views.requestStarted(d),m=n?void 0:e.snapshot(),y=r?.headers!==void 0?r.headers:t?.headers,h=n?void 0:e.trace.requestTrace(d,{url:l,sampled:e.isSampled(),consumerTraceparent:a.readHeader(y,a.TRACEPARENT),noCors:(r?.mode??t?.mode)==="no-cors"}),g=h?.finish,q=h?.header?{...b(t,r),...r,headers:a.withHeader(y,a.TRACEPARENT,h.header)}:r;let c=null,p=null;try{return c=await f(t,q),c}catch(s){throw p=s,s}finally{const s=Date.now();w?.(s),n||e.log("http.request",{...i.buildHttpAttributes({url:l,method:r?.method??"GET",statusCode:c?.status??0,durationMs:s-d,error:p,requestBody:r?.body,responseSize:i.contentLengthSize(c?.headers.get("content-length"))}),...g?.(s)},m)}},typeof XMLHttpRequest<"u"&&T.patchXHR(e,XMLHttpRequest),o()})}}exports.NetworkTrackerWeb=R;
2
+ //# sourceMappingURL=interceptFetchWeb.web-ZHw6IQkU.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"interceptFetchWeb.web-UXC2Lb6X.js","sources":["../src/adapters/web/interceptFetchWeb.web.ts"],"sourcesContent":["// interceptHttp.web.ts\nimport { Telemetry } from \"../../core/telemetry\";\nimport { buildHttpAttributes, contentLengthSize, isCollectorUrl } from \"../httpAttributes\";\nimport { patchXHR } from \"../xhrIntercept\";\nimport { TRACEPARENT, readHeader, withHeader } from \"../traceHeader\";\n\n/**\n * Per the fetch spec a **non-empty `init` resets a `Request`'s `referrer` and\n * `referrerPolicy`**. When the consumer passed no init at all, handing fetch one just to carry\n * our header would silently change their request — and §6.4 is explicit that the SDK does\n * nothing else at runtime. So carry both across. A consumer who already passed a non-empty\n * init has triggered the same reset themselves, and their values win over these.\n */\nfunction carriedReferrer(input: unknown, init: RequestInit | undefined): RequestInit {\n const req = input as { referrer?: unknown; referrerPolicy?: unknown };\n if (init || typeof req?.referrer !== \"string\") return {};\n return { referrer: req.referrer, referrerPolicy: req.referrerPolicy as ReferrerPolicy };\n}\n\n/**\n * NetworkTrackerWeb intercepts HTTP made through `window.fetch` and `XMLHttpRequest`.\n *\n * Both are patched here, unlike native: browser `fetch` is a native implementation, not\n * XHR-backed, so the two are genuinely separate channels and neither double-counts (§4.4).\n */\nexport class NetworkTrackerWeb {\n private telemetry: Telemetry;\n\n /**\n * Create a NetworkTrackerWeb instance.\n * @param telemetry - An instance of Telemetry used for logging network events.\n */\n constructor(telemetry: Telemetry) {\n this.telemetry = telemetry;\n }\n\n /**\n * Starts intercepting HTTP requests made through `fetch` and `XMLHttpRequest`.\n *\n * @returns A Promise that resolves immediately once interception is setup.\n */\n public start(): Promise<void> {\n return new Promise((resolve) => {\n // Capture telemetry instance to use inside patched functions\n const telemetry = this.telemetry;\n\n // --- Patch window.fetch ---\n const originalFetch = window.fetch;\n window.fetch = async (\n input: RequestInfo | URL,\n init?: RequestInit\n ): Promise<Response> => {\n const start = Date.now();\n const url = typeof input === \"string\" ? input : input.toString();\n const isCollector = isCollectorUrl(url, telemetry.getEndpoint?.());\n // Bound to the view live at *send*, not at completion (§4.5.2). The collector's\n // own POST is excluded from settle for the same reason it is excluded from\n // `http.request`: the SDK must not hold a view open with its own traffic.\n const settled = isCollector ? undefined : telemetry.views.requestStarted(start);\n // §3.1 — `session.id`, `session.start_time` and `view.id` frozen at send.\n // No `at`: the row keeps the completion timestamp §4.4 gives it.\n const snap = isCollector ? undefined : telemetry.snapshot();\n // §6.3's Tier 1 plus §6.5's outcome ladder, captured at send for the same\n // reason: the root live *now* is the parent, and a root minted here is this\n // request's own (§6.2). `init.headers` *replaces* a Request's own headers\n // per the fetch spec, so the presence check mirrors that precedence rather\n // than merging the two — read-scope means one name, one presence check.\n const reqHeaders = init?.headers !== undefined\n ? init.headers\n : (input as any)?.headers;\n const trace = isCollector ? undefined : telemetry.trace.requestTrace(start, {\n url,\n sampled: telemetry.isSampled(),\n consumerTraceparent: readHeader(reqHeaders, TRACEPARENT),\n // fetch-only, and the sharper statement than \"web-only\": on a `no-cors`\n // request the headers guard drops the consumer's traceparent too.\n noCors: (init?.mode ?? (input as any)?.mode) === \"no-cors\",\n });\n const span = trace?.finish;\n // A **copy**. The consumer's Request/Headers object is never touched, so\n // never-strip holds by construction and their retry of the same Request\n // carries no SDK header — each attempt gets its own fresh `span.id`.\n const fetchInit = trace?.header\n ? { ...carriedReferrer(input, init), ...init, headers: withHeader(reqHeaders, TRACEPARENT, trace.header) }\n : init;\n let response: Response | null = null;\n let error: any = null;\n\n try {\n response = await originalFetch(input, fetchInit as RequestInit);\n return response;\n } catch (err) {\n error = err;\n throw err;\n } finally {\n const end = Date.now();\n settled?.(end);\n\n // Invariant: an http.request never describes the SDK's own collector POST.\n if (!isCollector) {\n telemetry.log(\"http.request\", {\n ...buildHttpAttributes({\n url,\n method: init?.method ?? \"GET\", // fetch's own default, a real observation\n statusCode: response?.status ?? 0,\n durationMs: end - start,\n error,\n requestBody: init?.body,\n responseSize: contentLengthSize(response?.headers.get(\"content-length\")),\n }),\n ...span?.(end),\n }, snap);\n }\n }\n };\n\n // --- Patch XMLHttpRequest (absent in some RN-Web runtimes) ---\n if (typeof XMLHttpRequest !== \"undefined\") patchXHR(telemetry, XMLHttpRequest);\n\n // Resolve immediately since interception setup is synchronous\n resolve();\n });\n }\n}\n"],"names":["carriedReferrer","input","init","req","NetworkTrackerWeb","telemetry","resolve","originalFetch","start","url","isCollector","isCollectorUrl","settled","snap","reqHeaders","trace","readHeader","TRACEPARENT","span","fetchInit","withHeader","response","error","err","end","buildHttpAttributes","contentLengthSize","patchXHR"],"mappings":";;;AAaA,SAASA,EAAgBC,GAAgBC,GAA4C;AACjF,QAAMC,IAAMF;AACZ,SAAIC,KAAQ,OAAOC,GAAK,YAAa,WAAiB,CAAA,IAC/C,EAAE,UAAUA,EAAI,UAAU,gBAAgBA,EAAI,eAAA;AACzD;AAQO,MAAMC,EAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAO3B,YAAYC,GAAsB;AAC9B,SAAK,YAAYA;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,QAAuB;AAC1B,WAAO,IAAI,QAAQ,CAACC,MAAY;AAE5B,YAAMD,IAAY,KAAK,WAGjBE,IAAgB,OAAO;AAC7B,aAAO,QAAQ,OACXN,GACAC,MACoB;AACpB,cAAMM,IAAQ,KAAK,IAAA,GACbC,IAAM,OAAOR,KAAU,WAAWA,IAAQA,EAAM,SAAA,GAChDS,IAAcC,EAAeF,GAAKJ,EAAU,eAAe,GAI3DO,IAAUF,IAAc,SAAYL,EAAU,MAAM,eAAeG,CAAK,GAGxEK,IAAOH,IAAc,SAAYL,EAAU,SAAA,GAM3CS,IAAaZ,GAAM,YAAY,SAC/BA,EAAK,UACJD,GAAe,SAChBc,IAAQL,IAAc,SAAYL,EAAU,MAAM,aAAaG,GAAO;AAAA,UACxE,KAAAC;AAAA,UACA,SAASJ,EAAU,UAAA;AAAA,UACnB,qBAAqBW,EAAWF,GAAYG,CAAW;AAAA;AAAA;AAAA,UAGvD,SAASf,GAAM,QAASD,GAAe,UAAU;AAAA,QAAA,CACpD,GACKiB,IAAOH,GAAO,QAIdI,IAAYJ,GAAO,SACnB,EAAE,GAAGf,EAAgBC,GAAOC,CAAI,GAAG,GAAGA,GAAM,SAASkB,EAAWN,GAAYG,GAAaF,EAAM,MAAM,MACrGb;AACN,YAAImB,IAA4B,MAC5BC,IAAa;AAEjB,YAAI;AACA,iBAAAD,IAAW,MAAMd,EAAcN,GAAOkB,CAAwB,GACvDE;AAAA,QACX,SAASE,GAAK;AACV,gBAAAD,IAAQC,GACFA;AAAA,QACV,UAAA;AACI,gBAAMC,IAAM,KAAK,IAAA;AACjB,UAAAZ,IAAUY,CAAG,GAGRd,KACDL,EAAU,IAAI,gBAAgB;AAAA,YAC1B,GAAGoB,EAAoB;AAAA,cACnB,KAAAhB;AAAA,cACA,QAAQP,GAAM,UAAU;AAAA;AAAA,cACxB,YAAYmB,GAAU,UAAU;AAAA,cAChC,YAAYG,IAAMhB;AAAA,cAClB,OAAAc;AAAA,cACA,aAAapB,GAAM;AAAA,cACnB,cAAcwB,EAAkBL,GAAU,QAAQ,IAAI,gBAAgB,CAAC;AAAA,YAAA,CAC1E;AAAA,YACD,GAAGH,IAAOM,CAAG;AAAA,UAAA,GACdX,CAAI;AAAA,QAEf;AAAA,MACJ,GAGI,OAAO,iBAAmB,OAAac,EAAStB,GAAW,cAAc,GAG7EC,EAAA;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;"}
1
+ {"version":3,"file":"interceptFetchWeb.web-ZHw6IQkU.cjs","sources":["../src/adapters/web/interceptFetchWeb.web.ts"],"sourcesContent":["// interceptHttp.web.ts\nimport { Telemetry } from \"../../core/telemetry\";\nimport { buildHttpAttributes, contentLengthSize, isCollectorUrl } from \"../httpAttributes\";\nimport { patchXHR } from \"../xhrIntercept\";\nimport { TRACEPARENT, readHeader, withHeader } from \"../traceHeader\";\n\n/**\n * Per the fetch spec a **non-empty `init` resets a `Request`'s `referrer` and\n * `referrerPolicy`**. When the consumer passed no init at all, handing fetch one just to carry\n * our header would silently change their request — and §6.4 is explicit that the SDK does\n * nothing else at runtime. So carry both across. A consumer who already passed a non-empty\n * init has triggered the same reset themselves, and their values win over these.\n */\nfunction carriedReferrer(input: unknown, init: RequestInit | undefined): RequestInit {\n const req = input as { referrer?: unknown; referrerPolicy?: unknown };\n if (init || typeof req?.referrer !== \"string\") return {};\n return { referrer: req.referrer, referrerPolicy: req.referrerPolicy as ReferrerPolicy };\n}\n\n/**\n * NetworkTrackerWeb intercepts HTTP made through `window.fetch` and `XMLHttpRequest`.\n *\n * Both are patched here, unlike native: browser `fetch` is a native implementation, not\n * XHR-backed, so the two are genuinely separate channels and neither double-counts (§4.4).\n */\nexport class NetworkTrackerWeb {\n private telemetry: Telemetry;\n\n /**\n * Create a NetworkTrackerWeb instance.\n * @param telemetry - An instance of Telemetry used for logging network events.\n */\n constructor(telemetry: Telemetry) {\n this.telemetry = telemetry;\n }\n\n /**\n * Starts intercepting HTTP requests made through `fetch` and `XMLHttpRequest`.\n *\n * @returns A Promise that resolves immediately once interception is setup.\n */\n public start(): Promise<void> {\n return new Promise((resolve) => {\n // Capture telemetry instance to use inside patched functions\n const telemetry = this.telemetry;\n\n // --- Patch window.fetch ---\n const originalFetch = window.fetch;\n window.fetch = async (\n input: RequestInfo | URL,\n init?: RequestInit\n ): Promise<Response> => {\n // Disabled (#172): pass through untouched — no settle hold, no root, no header.\n if (telemetry.isEnabled?.() === false) return originalFetch(input, init);\n const start = Date.now();\n const url = typeof input === \"string\" ? input : input.toString();\n const isCollector = isCollectorUrl(url, telemetry.getEndpoint?.());\n // Bound to the view live at *send*, not at completion (§4.5.2). The collector's\n // own POST is excluded from settle for the same reason it is excluded from\n // `http.request`: the SDK must not hold a view open with its own traffic.\n const settled = isCollector ? undefined : telemetry.views.requestStarted(start);\n // §3.1 — `session.id`, `session.start_time` and `view.id` frozen at send.\n // No `at`: the row keeps the completion timestamp §4.4 gives it.\n const snap = isCollector ? undefined : telemetry.snapshot();\n // §6.3's Tier 1 plus §6.5's outcome ladder, captured at send for the same\n // reason: the root live *now* is the parent, and a root minted here is this\n // request's own (§6.2). `init.headers` *replaces* a Request's own headers\n // per the fetch spec, so the presence check mirrors that precedence rather\n // than merging the two — read-scope means one name, one presence check.\n const reqHeaders = init?.headers !== undefined\n ? init.headers\n : (input as any)?.headers;\n const trace = isCollector ? undefined : telemetry.trace.requestTrace(start, {\n url,\n sampled: telemetry.isSampled(),\n consumerTraceparent: readHeader(reqHeaders, TRACEPARENT),\n // fetch-only, and the sharper statement than \"web-only\": on a `no-cors`\n // request the headers guard drops the consumer's traceparent too.\n noCors: (init?.mode ?? (input as any)?.mode) === \"no-cors\",\n });\n const span = trace?.finish;\n // A **copy**. The consumer's Request/Headers object is never touched, so\n // never-strip holds by construction and their retry of the same Request\n // carries no SDK header — each attempt gets its own fresh `span.id`.\n const fetchInit = trace?.header\n ? { ...carriedReferrer(input, init), ...init, headers: withHeader(reqHeaders, TRACEPARENT, trace.header) }\n : init;\n let response: Response | null = null;\n let error: any = null;\n\n try {\n response = await originalFetch(input, fetchInit as RequestInit);\n return response;\n } catch (err) {\n error = err;\n throw err;\n } finally {\n const end = Date.now();\n settled?.(end);\n\n // Invariant: an http.request never describes the SDK's own collector POST.\n if (!isCollector) {\n telemetry.log(\"http.request\", {\n ...buildHttpAttributes({\n url,\n method: init?.method ?? \"GET\", // fetch's own default, a real observation\n statusCode: response?.status ?? 0,\n durationMs: end - start,\n error,\n requestBody: init?.body,\n responseSize: contentLengthSize(response?.headers.get(\"content-length\")),\n }),\n ...span?.(end),\n }, snap);\n }\n }\n };\n\n // --- Patch XMLHttpRequest (absent in some RN-Web runtimes) ---\n if (typeof XMLHttpRequest !== \"undefined\") patchXHR(telemetry, XMLHttpRequest);\n\n // Resolve immediately since interception setup is synchronous\n resolve();\n });\n }\n}\n"],"names":["carriedReferrer","input","init","req","NetworkTrackerWeb","telemetry","resolve","originalFetch","start","url","isCollector","isCollectorUrl","settled","snap","reqHeaders","trace","readHeader","TRACEPARENT","span","fetchInit","withHeader","response","error","err","end","buildHttpAttributes","contentLengthSize","patchXHR"],"mappings":"4MAaA,SAASA,EAAgBC,EAAgBC,EAA4C,CACjF,MAAMC,EAAMF,EACZ,OAAIC,GAAQ,OAAOC,GAAK,UAAa,SAAiB,CAAA,EAC/C,CAAE,SAAUA,EAAI,SAAU,eAAgBA,EAAI,cAAA,CACzD,CAQO,MAAMC,CAAkB,CAO3B,YAAYC,EAAsB,CAC9B,KAAK,UAAYA,CACrB,CAOO,OAAuB,CAC1B,OAAO,IAAI,QAASC,GAAY,CAE5B,MAAMD,EAAY,KAAK,UAGjBE,EAAgB,OAAO,MAC7B,OAAO,MAAQ,MACXN,EACAC,IACoB,CAEpB,GAAIG,EAAU,gBAAkB,GAAO,OAAOE,EAAcN,EAAOC,CAAI,EACvE,MAAMM,EAAQ,KAAK,IAAA,EACbC,EAAM,OAAOR,GAAU,SAAWA,EAAQA,EAAM,SAAA,EAChDS,EAAcC,EAAAA,eAAeF,EAAKJ,EAAU,eAAe,EAI3DO,EAAUF,EAAc,OAAYL,EAAU,MAAM,eAAeG,CAAK,EAGxEK,EAAOH,EAAc,OAAYL,EAAU,SAAA,EAM3CS,EAAaZ,GAAM,UAAY,OAC/BA,EAAK,QACJD,GAAe,QAChBc,EAAQL,EAAc,OAAYL,EAAU,MAAM,aAAaG,EAAO,CACxE,IAAAC,EACA,QAASJ,EAAU,UAAA,EACnB,oBAAqBW,EAAAA,WAAWF,EAAYG,aAAW,EAGvD,QAASf,GAAM,MAASD,GAAe,QAAU,SAAA,CACpD,EACKiB,EAAOH,GAAO,OAIdI,EAAYJ,GAAO,OACnB,CAAE,GAAGf,EAAgBC,EAAOC,CAAI,EAAG,GAAGA,EAAM,QAASkB,EAAAA,WAAWN,EAAYG,EAAAA,YAAaF,EAAM,MAAM,GACrGb,EACN,IAAImB,EAA4B,KAC5BC,EAAa,KAEjB,GAAI,CACA,OAAAD,EAAW,MAAMd,EAAcN,EAAOkB,CAAwB,EACvDE,CACX,OAASE,EAAK,CACV,MAAAD,EAAQC,EACFA,CACV,QAAA,CACI,MAAMC,EAAM,KAAK,IAAA,EACjBZ,IAAUY,CAAG,EAGRd,GACDL,EAAU,IAAI,eAAgB,CAC1B,GAAGoB,sBAAoB,CACnB,IAAAhB,EACA,OAAQP,GAAM,QAAU,MACxB,WAAYmB,GAAU,QAAU,EAChC,WAAYG,EAAMhB,EAClB,MAAAc,EACA,YAAapB,GAAM,KACnB,aAAcwB,EAAAA,kBAAkBL,GAAU,QAAQ,IAAI,gBAAgB,CAAC,CAAA,CAC1E,EACD,GAAGH,IAAOM,CAAG,CAAA,EACdX,CAAI,CAEf,CACJ,EAGI,OAAO,eAAmB,KAAac,EAAAA,SAAStB,EAAW,cAAc,EAG7EC,EAAA,CACJ,CAAC,CACL,CACJ"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./xhrIntercept-BADex6Cq.cjs");class r{constructor(t){this.telemetry=t}start(){const t=globalThis.XMLHttpRequest;return t&&(this.unpatch=e.patchXHR(this.telemetry,t)),Promise.resolve()}stop(){this.unpatch?.(),this.unpatch=void 0}}exports.NetworkTrackerNative=r;
2
- //# sourceMappingURL=interceptHttpNative.native-BVpFuoNB.cjs.map
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./xhrIntercept-xG1Yl5RI.cjs");class r{constructor(t){this.telemetry=t}start(){const t=globalThis.XMLHttpRequest;return t&&(this.unpatch=e.patchXHR(this.telemetry,t)),Promise.resolve()}stop(){this.unpatch?.(),this.unpatch=void 0}}exports.NetworkTrackerNative=r;
2
+ //# sourceMappingURL=interceptHttpNative.native-C5scIcgY.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"interceptHttpNative.native-BVpFuoNB.cjs","sources":["../src/adapters/native/interceptHttpNative.native.ts"],"sourcesContent":["import { Telemetry } from \"../../core/telemetry\";\nimport { patchXHR } from \"../xhrIntercept\";\n\n/**\n * Captures all JS-originated HTTP on React Native by patching `XMLHttpRequest` — and nothing\n * else. RN's `global.fetch` is `XMLHttpRequest` underneath (contract §4.4), so patching both\n * would emit **two** `http.request` events per `fetch()` call; the one chokepoint catches\n * `fetch` *and* axios, which is why an axios app's HTTP dashboard was empty before #95.\n *\n * Outside the boundary and uncountable: rn-fetch-blob, RN Firebase, native Apollo links,\n * expo-file-system, `Image` loading and `WebSocket` — none of them touch JS HTTP.\n */\nexport class NetworkTrackerNative {\n private unpatch?: () => void;\n\n constructor(private telemetry: Telemetry) { }\n\n public start(): Promise<void> {\n const xhr = (globalThis as any).XMLHttpRequest;\n if (xhr) this.unpatch = patchXHR(this.telemetry, xhr);\n return Promise.resolve();\n }\n\n /** Restores the original XHR prototype, removing the interception. */\n public stop(): void {\n this.unpatch?.();\n this.unpatch = undefined;\n }\n}\n"],"names":["NetworkTrackerNative","telemetry","xhr","patchXHR"],"mappings":"+HAYO,MAAMA,CAAqB,CAG9B,YAAoBC,EAAsB,CAAtB,KAAA,UAAAA,CAAwB,CAErC,OAAuB,CAC1B,MAAMC,EAAO,WAAmB,eAChC,OAAIA,IAAK,KAAK,QAAUC,EAAAA,SAAS,KAAK,UAAWD,CAAG,GAC7C,QAAQ,QAAA,CACnB,CAGO,MAAa,CAChB,KAAK,UAAA,EACL,KAAK,QAAU,MACnB,CACJ"}
1
+ {"version":3,"file":"interceptHttpNative.native-C5scIcgY.cjs","sources":["../src/adapters/native/interceptHttpNative.native.ts"],"sourcesContent":["import { Telemetry } from \"../../core/telemetry\";\nimport { patchXHR } from \"../xhrIntercept\";\n\n/**\n * Captures all JS-originated HTTP on React Native by patching `XMLHttpRequest` — and nothing\n * else. RN's `global.fetch` is `XMLHttpRequest` underneath (contract §4.4), so patching both\n * would emit **two** `http.request` events per `fetch()` call; the one chokepoint catches\n * `fetch` *and* axios, which is why an axios app's HTTP dashboard was empty before #95.\n *\n * Outside the boundary and uncountable: rn-fetch-blob, RN Firebase, native Apollo links,\n * expo-file-system, `Image` loading and `WebSocket` — none of them touch JS HTTP.\n */\nexport class NetworkTrackerNative {\n private unpatch?: () => void;\n\n constructor(private telemetry: Telemetry) { }\n\n public start(): Promise<void> {\n const xhr = (globalThis as any).XMLHttpRequest;\n if (xhr) this.unpatch = patchXHR(this.telemetry, xhr);\n return Promise.resolve();\n }\n\n /** Restores the original XHR prototype, removing the interception. */\n public stop(): void {\n this.unpatch?.();\n this.unpatch = undefined;\n }\n}\n"],"names":["NetworkTrackerNative","telemetry","xhr","patchXHR"],"mappings":"+HAYO,MAAMA,CAAqB,CAG9B,YAAoBC,EAAsB,CAAtB,KAAA,UAAAA,CAAwB,CAErC,OAAuB,CAC1B,MAAMC,EAAO,WAAmB,eAChC,OAAIA,IAAK,KAAK,QAAUC,EAAAA,SAAS,KAAK,UAAWD,CAAG,GAC7C,QAAQ,QAAA,CACnB,CAGO,MAAa,CAChB,KAAK,UAAA,EACL,KAAK,QAAU,MACnB,CACJ"}
@@ -1,4 +1,4 @@
1
- import { p as e } from "./xhrIntercept-BNiA41Mj.js";
1
+ import { p as e } from "./xhrIntercept-9uAkQh3N.js";
2
2
  class o {
3
3
  constructor(t) {
4
4
  this.telemetry = t;
@@ -15,4 +15,4 @@ class o {
15
15
  export {
16
16
  o as NetworkTrackerNative
17
17
  };
18
- //# sourceMappingURL=interceptHttpNative.native-rX-lPNST.js.map
18
+ //# sourceMappingURL=interceptHttpNative.native-vF_Fksjk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interceptHttpNative.native-rX-lPNST.js","sources":["../src/adapters/native/interceptHttpNative.native.ts"],"sourcesContent":["import { Telemetry } from \"../../core/telemetry\";\nimport { patchXHR } from \"../xhrIntercept\";\n\n/**\n * Captures all JS-originated HTTP on React Native by patching `XMLHttpRequest` — and nothing\n * else. RN's `global.fetch` is `XMLHttpRequest` underneath (contract §4.4), so patching both\n * would emit **two** `http.request` events per `fetch()` call; the one chokepoint catches\n * `fetch` *and* axios, which is why an axios app's HTTP dashboard was empty before #95.\n *\n * Outside the boundary and uncountable: rn-fetch-blob, RN Firebase, native Apollo links,\n * expo-file-system, `Image` loading and `WebSocket` — none of them touch JS HTTP.\n */\nexport class NetworkTrackerNative {\n private unpatch?: () => void;\n\n constructor(private telemetry: Telemetry) { }\n\n public start(): Promise<void> {\n const xhr = (globalThis as any).XMLHttpRequest;\n if (xhr) this.unpatch = patchXHR(this.telemetry, xhr);\n return Promise.resolve();\n }\n\n /** Restores the original XHR prototype, removing the interception. */\n public stop(): void {\n this.unpatch?.();\n this.unpatch = undefined;\n }\n}\n"],"names":["NetworkTrackerNative","telemetry","xhr","patchXHR"],"mappings":";AAYO,MAAMA,EAAqB;AAAA,EAG9B,YAAoBC,GAAsB;AAAtB,SAAA,YAAAA;AAAA,EAAwB;AAAA,EAErC,QAAuB;AAC1B,UAAMC,IAAO,WAAmB;AAChC,WAAIA,MAAK,KAAK,UAAUC,EAAS,KAAK,WAAWD,CAAG,IAC7C,QAAQ,QAAA;AAAA,EACnB;AAAA;AAAA,EAGO,OAAa;AAChB,SAAK,UAAA,GACL,KAAK,UAAU;AAAA,EACnB;AACJ;"}
1
+ {"version":3,"file":"interceptHttpNative.native-vF_Fksjk.js","sources":["../src/adapters/native/interceptHttpNative.native.ts"],"sourcesContent":["import { Telemetry } from \"../../core/telemetry\";\nimport { patchXHR } from \"../xhrIntercept\";\n\n/**\n * Captures all JS-originated HTTP on React Native by patching `XMLHttpRequest` — and nothing\n * else. RN's `global.fetch` is `XMLHttpRequest` underneath (contract §4.4), so patching both\n * would emit **two** `http.request` events per `fetch()` call; the one chokepoint catches\n * `fetch` *and* axios, which is why an axios app's HTTP dashboard was empty before #95.\n *\n * Outside the boundary and uncountable: rn-fetch-blob, RN Firebase, native Apollo links,\n * expo-file-system, `Image` loading and `WebSocket` — none of them touch JS HTTP.\n */\nexport class NetworkTrackerNative {\n private unpatch?: () => void;\n\n constructor(private telemetry: Telemetry) { }\n\n public start(): Promise<void> {\n const xhr = (globalThis as any).XMLHttpRequest;\n if (xhr) this.unpatch = patchXHR(this.telemetry, xhr);\n return Promise.resolve();\n }\n\n /** Restores the original XHR prototype, removing the interception. */\n public stop(): void {\n this.unpatch?.();\n this.unpatch = undefined;\n }\n}\n"],"names":["NetworkTrackerNative","telemetry","xhr","patchXHR"],"mappings":";AAYO,MAAMA,EAAqB;AAAA,EAG9B,YAAoBC,GAAsB;AAAtB,SAAA,YAAAA;AAAA,EAAwB;AAAA,EAErC,QAAuB;AAC1B,UAAMC,IAAO,WAAmB;AAChC,WAAIA,MAAK,KAAK,UAAUC,EAAS,KAAK,WAAWD,CAAG,IAC7C,QAAQ,QAAA;AAAA,EACnB;AAAA;AAAA,EAGO,OAAa;AAChB,SAAK,UAAA,GACL,KAAK,UAAU;AAAA,EACnB;AACJ;"}
@@ -1,2 +1,2 @@
1
1
  "use strict";class n{constructor(e,t){this.viewStart=e,this.started=0,this.inFlight=0,this.awaitingRuntimeReady=t?.awaitRuntimeReady??!1}get requestCount(){return this.started}seedRuntimeReady(e){this.awaitingRuntimeReady&&(this.awaitingRuntimeReady=!1,this.runtimeReadyAt=e)}requestStarted(e=Date.now()){if(this.started++,this.freezeIfQuiet(e),this.settledAt!==void 0)return()=>{};this.inFlight++;let t=!1;return(i=Date.now())=>{t||(t=!0,this.inFlight--,(this.lastEnd===void 0||i>this.lastEnd)&&(this.lastEnd=i))}}resolve(e=Date.now()){if(this.started===0)return{loadingTime:null,outcome:"no_activity"};this.freezeIfQuiet(e);const t=this.settledAt??this.quietSince();if(t===void 0)return{loadingTime:null,outcome:e-this.viewStart>=3e4?"capped":"abandoned"};const s=Math.max(t,this.runtimeReadyAt??0)-this.viewStart;return s>=3e4?{loadingTime:null,outcome:"capped"}:{loadingTime:Math.max(0,s),outcome:"settled"}}freezeIfQuiet(e){if(this.settledAt!==void 0)return;const t=this.quietSince();t!==void 0&&e-t>=1e3&&(this.settledAt=t)}quietSince(){if(!this.awaitingRuntimeReady&&!(this.inFlight>0))return this.lastEnd}}exports.LOADING_TIME_CAP_MS=3e4;exports.NetworkSettle=n;exports.QUIET_WINDOW_MS=1e3;
2
- //# sourceMappingURL=loadingTime-Bhomd9qq.cjs.map
2
+ //# sourceMappingURL=loadingTime-Cj5Oh8lT.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadingTime-Bhomd9qq.cjs","sources":["../src/adapters/loadingTime.ts"],"sourcesContent":["// `view.loading_time` — network settle, one definition, both builds (§4.5.2, #97).\n//\n// Scoped to exactly one job: p75 route-change responsiveness by `view.name`, compared across\n// releases. That framing licenses a crude stable heuristic over a clever one, and makes a\n// **null strictly better than a plausible guess** — a wrong-but-believable 300 ms poisons a\n// release comparison silently, and a `0` makes p75 track the cache-hit rate, so a backend\n// caching win renders as a frontend regression, reversed.\n//\n// Network-only, because in-flight fetch/XHR is the one settle signal both builds genuinely\n// have. DOM-mutation quiet is meaningless under React's routine re-rendering; rAF quiet never\n// settles against RN's animation driver. So this module is shared and neither build gets its\n// own definition of the same column.\n\n/**\n * The quiet window, and **the same constant as §4.6's dead-click window** — one constant, not\n * two. `ui.dead` (web only, not built yet) must import this rather than declare a second 1000.\n */\nexport const QUIET_WINDOW_MS = 1000;\n\n/** Hard cap (§4.5.2). A capped view emits **null, not the cap**: at 30 s, 30 s and 90 s are the same row. */\nexport const LOADING_TIME_CAP_MS = 30_000;\n\n/** §4.5's `view.loading_time_outcome` domain — never null, exactly four values. */\nexport type LoadingTimeOutcome = \"settled\" | \"no_activity\" | \"capped\" | \"abandoned\";\n\nexport type LoadingTimeResult = {\n /** Milliseconds, or null — and null has three causes, which is why the outcome ships beside it. */\n loadingTime: number | null;\n outcome: LoadingTimeOutcome;\n};\n\nexport type NetworkSettleOpts = {\n /**\n * `initial_load` only: the view starts **busy** until the platform's own runtime-ready\n * marker (`loadEventEnd` on web, `performance.rnStartupTiming` on native), then settles.\n * Every other `load_type` runs the same column with no seed.\n */\n awaitRuntimeReady?: boolean;\n};\n\n/**\n * One view's settle state. Constructed per view and handed the requests that **started** in\n * it — a request in flight across a view boundary belongs to the old view and does not hold\n * the new one open (§4.5.2), which is why the completion callback is bound to this instance\n * rather than looked up on whatever view is live when the response lands.\n */\nexport class NetworkSettle {\n private started = 0;\n private inFlight = 0;\n private lastEnd?: number;\n /** Frozen the first time quiet is *observed*, so a later request cannot un-settle the view. */\n private settledAt?: number;\n private awaitingRuntimeReady: boolean;\n private runtimeReadyAt?: number;\n\n constructor(private readonly viewStart: number, opts?: NetworkSettleOpts) {\n this.awaitingRuntimeReady = opts?.awaitRuntimeReady ?? false;\n }\n\n /** `view.request_count` — requests **started** in this view, failures included (§4.5). */\n get requestCount(): number {\n return this.started;\n }\n\n /**\n * The platform's runtime-ready marker, or `undefined` where the platform has none —\n * Old Architecture, or a runtime that omits it (§4.3). Either way this releases the gate:\n * a marker that never arrives must not make every launch report `abandoned`.\n */\n seedRuntimeReady(at?: number): void {\n // A successor was never gated on the marker, and on web the `load` event routinely\n // arrives *after* the first route change — flooring that view's settle at the page's\n // load time would inflate a route-change measurement with the launch's cost.\n if (!this.awaitingRuntimeReady) return;\n this.awaitingRuntimeReady = false;\n this.runtimeReadyAt = at;\n }\n\n /**\n * A request started in this view. Returns its completion callback — idempotent, because an\n * XHR `loadend` can fire more than once for a reused instance and an unbalanced in-flight\n * count would hold the view open forever.\n */\n requestStarted(now: number = Date.now()): (endedAt?: number) => void {\n this.started++;\n this.freezeIfQuiet(now);\n // Already settled: it counts toward `request_count` but must not re-arm the view, or a\n // 30-second poller keeps one screen \"loading\" for as long as the user stays on it.\n if (this.settledAt !== undefined) return () => { };\n\n this.inFlight++;\n let done = false;\n return (endedAt: number = Date.now()) => {\n if (done) return;\n done = true;\n this.inFlight--;\n if (this.lastEnd === undefined || endedAt > this.lastEnd) this.lastEnd = endedAt;\n };\n }\n\n /**\n * The view's verdict at exit. Idempotent, not pure: it may freeze the settle timestamp as\n * a side effect, which is deliberate — once quiet has been *observed* it cannot be undone\n * by a later call, and calling this twice must not produce two different answers.\n */\n resolve(now: number = Date.now()): LoadingTimeResult {\n // The contract's free invariant, and the branch that establishes it: `no_activity` ⇔\n // `view.request_count = 0`. It is checked before the runtime-ready seed on purpose —\n // the seed is a *floor* on when settle may happen, not a source of activity, so a\n // launch that fetched nothing has no loading time to report rather than one measuring\n // the platform's own startup.\n if (this.started === 0) return { loadingTime: null, outcome: \"no_activity\" };\n\n this.freezeIfQuiet(now);\n // The view is exiting, so no further request can *start* in it — quiet is confirmed by\n // construction and the rest of the window is pure detection delay, which §4.5.2 says is\n // free. Charging it as `abandoned` would drop the fastest views out of the `settled`\n // population and bias the p75 this column exists to serve, in the wrong direction.\n // `abandoned` is left meaning what it says: the user left while it was still loading.\n const settledAt = this.settledAt ?? this.quietSince();\n if (settledAt === undefined) {\n // Capped and abandoned are different populations, read as different series, and\n // must not be merged.\n return {\n loadingTime: null,\n outcome: now - this.viewStart >= LOADING_TIME_CAP_MS ? \"capped\" : \"abandoned\",\n };\n }\n\n const settleAt = Math.max(settledAt, this.runtimeReadyAt ?? 0);\n const value = settleAt - this.viewStart;\n if (value >= LOADING_TIME_CAP_MS) return { loadingTime: null, outcome: \"capped\" };\n return { loadingTime: Math.max(0, value), outcome: \"settled\" };\n }\n\n /**\n * Settle is the *completion* timestamp, not the moment we noticed it — the quiet window is\n * detection delay and is subtracted back out. That is free precisely because the `view`\n * event emits at view exit rather than at settle, so nothing waits on the window.\n */\n private freezeIfQuiet(now: number): void {\n if (this.settledAt !== undefined) return;\n const quiet = this.quietSince();\n if (quiet !== undefined && now - quiet >= QUIET_WINDOW_MS) this.settledAt = quiet;\n }\n\n /** When the network last went quiet, or undefined while the view is still busy. */\n private quietSince(): number | undefined {\n if (this.awaitingRuntimeReady) return undefined; // initial_load is busy until the marker\n if (this.inFlight > 0) return undefined;\n return this.lastEnd;\n }\n}\n"],"names":["NetworkSettle","viewStart","opts","at","now","done","endedAt","settledAt","value","quiet"],"mappings":"aA8CO,MAAMA,CAAc,CASvB,YAA6BC,EAAmBC,EAA0B,CAA7C,KAAA,UAAAD,EAR7B,KAAQ,QAAU,EAClB,KAAQ,SAAW,EAQf,KAAK,qBAAuBC,GAAM,mBAAqB,EAC3D,CAGA,IAAI,cAAuB,CACvB,OAAO,KAAK,OAChB,CAOA,iBAAiBC,EAAmB,CAI3B,KAAK,uBACV,KAAK,qBAAuB,GAC5B,KAAK,eAAiBA,EAC1B,CAOA,eAAeC,EAAc,KAAK,MAAmC,CAKjE,GAJA,KAAK,UACL,KAAK,cAAcA,CAAG,EAGlB,KAAK,YAAc,OAAW,MAAO,IAAM,CAAE,EAEjD,KAAK,WACL,IAAIC,EAAO,GACX,MAAO,CAACC,EAAkB,KAAK,QAAU,CACjCD,IACJA,EAAO,GACP,KAAK,YACD,KAAK,UAAY,QAAaC,EAAU,KAAK,gBAAc,QAAUA,GAC7E,CACJ,CAOA,QAAQF,EAAc,KAAK,MAA0B,CAMjD,GAAI,KAAK,UAAY,EAAG,MAAO,CAAE,YAAa,KAAM,QAAS,aAAA,EAE7D,KAAK,cAAcA,CAAG,EAMtB,MAAMG,EAAY,KAAK,WAAa,KAAK,WAAA,EACzC,GAAIA,IAAc,OAGd,MAAO,CACH,YAAa,KACb,QAASH,EAAM,KAAK,WAAa,IAAsB,SAAW,WAAA,EAK1E,MAAMI,EADW,KAAK,IAAID,EAAW,KAAK,gBAAkB,CAAC,EACpC,KAAK,UAC9B,OAAIC,GAAS,IAA4B,CAAE,YAAa,KAAM,QAAS,QAAA,EAChE,CAAE,YAAa,KAAK,IAAI,EAAGA,CAAK,EAAG,QAAS,SAAA,CACvD,CAOQ,cAAcJ,EAAmB,CACrC,GAAI,KAAK,YAAc,OAAW,OAClC,MAAMK,EAAQ,KAAK,WAAA,EACfA,IAAU,QAAaL,EAAMK,GAAS,WAAsB,UAAYA,EAChF,CAGQ,YAAiC,CACrC,GAAI,MAAK,sBACL,OAAK,SAAW,GACpB,OAAO,KAAK,OAChB,CACJ"}
1
+ {"version":3,"file":"loadingTime-Cj5Oh8lT.cjs","sources":["../src/adapters/loadingTime.ts"],"sourcesContent":["// `view.loading_time` — network settle, one definition, both builds (§4.5.2, #97).\n//\n// Scoped to exactly one job: p75 route-change responsiveness by `view.name`, compared across\n// releases. That framing licenses a crude stable heuristic over a clever one, and makes a\n// **null strictly better than a plausible guess** — a wrong-but-believable 300 ms poisons a\n// release comparison silently, and a `0` makes p75 track the cache-hit rate, so a backend\n// caching win renders as a frontend regression, reversed.\n//\n// Network-only, because in-flight fetch/XHR is the one settle signal both builds genuinely\n// have. DOM-mutation quiet is meaningless under React's routine re-rendering; rAF quiet never\n// settles against RN's animation driver. So this module is shared and neither build gets its\n// own definition of the same column.\n\n/**\n * The quiet window, and **the same constant as §4.6's dead-click window** — one constant, not\n * two. `ui.dead` (web only, not built yet) must import this rather than declare a second 1000.\n */\nexport const QUIET_WINDOW_MS = 1000;\n\n/** Hard cap (§4.5.2). A capped view emits **null, not the cap**: at 30 s, 30 s and 90 s are the same row. */\nexport const LOADING_TIME_CAP_MS = 30_000;\n\n/** §4.5's `view.loading_time_outcome` domain — never null, exactly four values. */\nexport type LoadingTimeOutcome = \"settled\" | \"no_activity\" | \"capped\" | \"abandoned\";\n\nexport type LoadingTimeResult = {\n /** Milliseconds, or null — and null has three causes, which is why the outcome ships beside it. */\n loadingTime: number | null;\n outcome: LoadingTimeOutcome;\n};\n\nexport type NetworkSettleOpts = {\n /**\n * `initial_load` only: the view starts **busy** until the platform's own runtime-ready\n * marker (`loadEventEnd` on web, `performance.rnStartupTiming` on native), then settles.\n * Every other `load_type` runs the same column with no seed.\n */\n awaitRuntimeReady?: boolean;\n};\n\n/**\n * One view's settle state. Constructed per view and handed the requests that **started** in\n * it — a request in flight across a view boundary belongs to the old view and does not hold\n * the new one open (§4.5.2), which is why the completion callback is bound to this instance\n * rather than looked up on whatever view is live when the response lands.\n */\nexport class NetworkSettle {\n private started = 0;\n private inFlight = 0;\n private lastEnd?: number;\n /** Frozen the first time quiet is *observed*, so a later request cannot un-settle the view. */\n private settledAt?: number;\n private awaitingRuntimeReady: boolean;\n private runtimeReadyAt?: number;\n\n constructor(private readonly viewStart: number, opts?: NetworkSettleOpts) {\n this.awaitingRuntimeReady = opts?.awaitRuntimeReady ?? false;\n }\n\n /** `view.request_count` — requests **started** in this view, failures included (§4.5). */\n get requestCount(): number {\n return this.started;\n }\n\n /**\n * The platform's runtime-ready marker, or `undefined` where the platform has none —\n * Old Architecture, or a runtime that omits it (§4.3). Either way this releases the gate:\n * a marker that never arrives must not make every launch report `abandoned`.\n */\n seedRuntimeReady(at?: number): void {\n // A successor was never gated on the marker, and on web the `load` event routinely\n // arrives *after* the first route change — flooring that view's settle at the page's\n // load time would inflate a route-change measurement with the launch's cost.\n if (!this.awaitingRuntimeReady) return;\n this.awaitingRuntimeReady = false;\n this.runtimeReadyAt = at;\n }\n\n /**\n * A request started in this view. Returns its completion callback — idempotent, because an\n * XHR `loadend` can fire more than once for a reused instance and an unbalanced in-flight\n * count would hold the view open forever.\n */\n requestStarted(now: number = Date.now()): (endedAt?: number) => void {\n this.started++;\n this.freezeIfQuiet(now);\n // Already settled: it counts toward `request_count` but must not re-arm the view, or a\n // 30-second poller keeps one screen \"loading\" for as long as the user stays on it.\n if (this.settledAt !== undefined) return () => { };\n\n this.inFlight++;\n let done = false;\n return (endedAt: number = Date.now()) => {\n if (done) return;\n done = true;\n this.inFlight--;\n if (this.lastEnd === undefined || endedAt > this.lastEnd) this.lastEnd = endedAt;\n };\n }\n\n /**\n * The view's verdict at exit. Idempotent, not pure: it may freeze the settle timestamp as\n * a side effect, which is deliberate — once quiet has been *observed* it cannot be undone\n * by a later call, and calling this twice must not produce two different answers.\n */\n resolve(now: number = Date.now()): LoadingTimeResult {\n // The contract's free invariant, and the branch that establishes it: `no_activity` ⇔\n // `view.request_count = 0`. It is checked before the runtime-ready seed on purpose —\n // the seed is a *floor* on when settle may happen, not a source of activity, so a\n // launch that fetched nothing has no loading time to report rather than one measuring\n // the platform's own startup.\n if (this.started === 0) return { loadingTime: null, outcome: \"no_activity\" };\n\n this.freezeIfQuiet(now);\n // The view is exiting, so no further request can *start* in it — quiet is confirmed by\n // construction and the rest of the window is pure detection delay, which §4.5.2 says is\n // free. Charging it as `abandoned` would drop the fastest views out of the `settled`\n // population and bias the p75 this column exists to serve, in the wrong direction.\n // `abandoned` is left meaning what it says: the user left while it was still loading.\n const settledAt = this.settledAt ?? this.quietSince();\n if (settledAt === undefined) {\n // Capped and abandoned are different populations, read as different series, and\n // must not be merged.\n return {\n loadingTime: null,\n outcome: now - this.viewStart >= LOADING_TIME_CAP_MS ? \"capped\" : \"abandoned\",\n };\n }\n\n const settleAt = Math.max(settledAt, this.runtimeReadyAt ?? 0);\n const value = settleAt - this.viewStart;\n if (value >= LOADING_TIME_CAP_MS) return { loadingTime: null, outcome: \"capped\" };\n return { loadingTime: Math.max(0, value), outcome: \"settled\" };\n }\n\n /**\n * Settle is the *completion* timestamp, not the moment we noticed it — the quiet window is\n * detection delay and is subtracted back out. That is free precisely because the `view`\n * event emits at view exit rather than at settle, so nothing waits on the window.\n */\n private freezeIfQuiet(now: number): void {\n if (this.settledAt !== undefined) return;\n const quiet = this.quietSince();\n if (quiet !== undefined && now - quiet >= QUIET_WINDOW_MS) this.settledAt = quiet;\n }\n\n /** When the network last went quiet, or undefined while the view is still busy. */\n private quietSince(): number | undefined {\n if (this.awaitingRuntimeReady) return undefined; // initial_load is busy until the marker\n if (this.inFlight > 0) return undefined;\n return this.lastEnd;\n }\n}\n"],"names":["NetworkSettle","viewStart","opts","at","now","done","endedAt","settledAt","value","quiet"],"mappings":"aA8CO,MAAMA,CAAc,CASvB,YAA6BC,EAAmBC,EAA0B,CAA7C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
69
  };
70
- //# sourceMappingURL=loadingTime-ZkYvFijA.js.map
70
+ //# sourceMappingURL=loadingTime-DMc0zTY8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadingTime-ZkYvFijA.js","sources":["../src/adapters/loadingTime.ts"],"sourcesContent":["// `view.loading_time` — network settle, one definition, both builds (§4.5.2, #97).\n//\n// Scoped to exactly one job: p75 route-change responsiveness by `view.name`, compared across\n// releases. That framing licenses a crude stable heuristic over a clever one, and makes a\n// **null strictly better than a plausible guess** — a wrong-but-believable 300 ms poisons a\n// release comparison silently, and a `0` makes p75 track the cache-hit rate, so a backend\n// caching win renders as a frontend regression, reversed.\n//\n// Network-only, because in-flight fetch/XHR is the one settle signal both builds genuinely\n// have. DOM-mutation quiet is meaningless under React's routine re-rendering; rAF quiet never\n// settles against RN's animation driver. So this module is shared and neither build gets its\n// own definition of the same column.\n\n/**\n * The quiet window, and **the same constant as §4.6's dead-click window** — one constant, not\n * two. `ui.dead` (web only, not built yet) must import this rather than declare a second 1000.\n */\nexport const QUIET_WINDOW_MS = 1000;\n\n/** Hard cap (§4.5.2). A capped view emits **null, not the cap**: at 30 s, 30 s and 90 s are the same row. */\nexport const LOADING_TIME_CAP_MS = 30_000;\n\n/** §4.5's `view.loading_time_outcome` domain — never null, exactly four values. */\nexport type LoadingTimeOutcome = \"settled\" | \"no_activity\" | \"capped\" | \"abandoned\";\n\nexport type LoadingTimeResult = {\n /** Milliseconds, or null — and null has three causes, which is why the outcome ships beside it. */\n loadingTime: number | null;\n outcome: LoadingTimeOutcome;\n};\n\nexport type NetworkSettleOpts = {\n /**\n * `initial_load` only: the view starts **busy** until the platform's own runtime-ready\n * marker (`loadEventEnd` on web, `performance.rnStartupTiming` on native), then settles.\n * Every other `load_type` runs the same column with no seed.\n */\n awaitRuntimeReady?: boolean;\n};\n\n/**\n * One view's settle state. Constructed per view and handed the requests that **started** in\n * it — a request in flight across a view boundary belongs to the old view and does not hold\n * the new one open (§4.5.2), which is why the completion callback is bound to this instance\n * rather than looked up on whatever view is live when the response lands.\n */\nexport class NetworkSettle {\n private started = 0;\n private inFlight = 0;\n private lastEnd?: number;\n /** Frozen the first time quiet is *observed*, so a later request cannot un-settle the view. */\n private settledAt?: number;\n private awaitingRuntimeReady: boolean;\n private runtimeReadyAt?: number;\n\n constructor(private readonly viewStart: number, opts?: NetworkSettleOpts) {\n this.awaitingRuntimeReady = opts?.awaitRuntimeReady ?? false;\n }\n\n /** `view.request_count` — requests **started** in this view, failures included (§4.5). */\n get requestCount(): number {\n return this.started;\n }\n\n /**\n * The platform's runtime-ready marker, or `undefined` where the platform has none —\n * Old Architecture, or a runtime that omits it (§4.3). Either way this releases the gate:\n * a marker that never arrives must not make every launch report `abandoned`.\n */\n seedRuntimeReady(at?: number): void {\n // A successor was never gated on the marker, and on web the `load` event routinely\n // arrives *after* the first route change — flooring that view's settle at the page's\n // load time would inflate a route-change measurement with the launch's cost.\n if (!this.awaitingRuntimeReady) return;\n this.awaitingRuntimeReady = false;\n this.runtimeReadyAt = at;\n }\n\n /**\n * A request started in this view. Returns its completion callback — idempotent, because an\n * XHR `loadend` can fire more than once for a reused instance and an unbalanced in-flight\n * count would hold the view open forever.\n */\n requestStarted(now: number = Date.now()): (endedAt?: number) => void {\n this.started++;\n this.freezeIfQuiet(now);\n // Already settled: it counts toward `request_count` but must not re-arm the view, or a\n // 30-second poller keeps one screen \"loading\" for as long as the user stays on it.\n if (this.settledAt !== undefined) return () => { };\n\n this.inFlight++;\n let done = false;\n return (endedAt: number = Date.now()) => {\n if (done) return;\n done = true;\n this.inFlight--;\n if (this.lastEnd === undefined || endedAt > this.lastEnd) this.lastEnd = endedAt;\n };\n }\n\n /**\n * The view's verdict at exit. Idempotent, not pure: it may freeze the settle timestamp as\n * a side effect, which is deliberate — once quiet has been *observed* it cannot be undone\n * by a later call, and calling this twice must not produce two different answers.\n */\n resolve(now: number = Date.now()): LoadingTimeResult {\n // The contract's free invariant, and the branch that establishes it: `no_activity` ⇔\n // `view.request_count = 0`. It is checked before the runtime-ready seed on purpose —\n // the seed is a *floor* on when settle may happen, not a source of activity, so a\n // launch that fetched nothing has no loading time to report rather than one measuring\n // the platform's own startup.\n if (this.started === 0) return { loadingTime: null, outcome: \"no_activity\" };\n\n this.freezeIfQuiet(now);\n // The view is exiting, so no further request can *start* in it — quiet is confirmed by\n // construction and the rest of the window is pure detection delay, which §4.5.2 says is\n // free. Charging it as `abandoned` would drop the fastest views out of the `settled`\n // population and bias the p75 this column exists to serve, in the wrong direction.\n // `abandoned` is left meaning what it says: the user left while it was still loading.\n const settledAt = this.settledAt ?? this.quietSince();\n if (settledAt === undefined) {\n // Capped and abandoned are different populations, read as different series, and\n // must not be merged.\n return {\n loadingTime: null,\n outcome: now - this.viewStart >= LOADING_TIME_CAP_MS ? \"capped\" : \"abandoned\",\n };\n }\n\n const settleAt = Math.max(settledAt, this.runtimeReadyAt ?? 0);\n const value = settleAt - this.viewStart;\n if (value >= LOADING_TIME_CAP_MS) return { loadingTime: null, outcome: \"capped\" };\n return { loadingTime: Math.max(0, value), outcome: \"settled\" };\n }\n\n /**\n * Settle is the *completion* timestamp, not the moment we noticed it — the quiet window is\n * detection delay and is subtracted back out. That is free precisely because the `view`\n * event emits at view exit rather than at settle, so nothing waits on the window.\n */\n private freezeIfQuiet(now: number): void {\n if (this.settledAt !== undefined) return;\n const quiet = this.quietSince();\n if (quiet !== undefined && now - quiet >= QUIET_WINDOW_MS) this.settledAt = quiet;\n }\n\n /** When the network last went quiet, or undefined while the view is still busy. */\n private quietSince(): number | undefined {\n if (this.awaitingRuntimeReady) return undefined; // initial_load is busy until the marker\n if (this.inFlight > 0) return undefined;\n return this.lastEnd;\n }\n}\n"],"names":["QUIET_WINDOW_MS","LOADING_TIME_CAP_MS","NetworkSettle","viewStart","opts","at","now","done","endedAt","settledAt","value","quiet"],"mappings":"AAiBO,MAAMA,IAAkB,KAGlBC,IAAsB;AA0B5B,MAAMC,EAAc;AAAA,EASvB,YAA6BC,GAAmBC,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,QAAI,KAAK,cAAc,OAAW;AAClC,UAAMK,IAAQ,KAAK,WAAA;AACnB,IAAIA,MAAU,UAAaL,IAAMK,KAAS,aAAsB,YAAYA;AAAA,EAChF;AAAA;AAAA,EAGQ,aAAiC;AACrC,QAAI,MAAK,wBACL,OAAK,WAAW;AACpB,aAAO,KAAK;AAAA,EAChB;AACJ;"}
1
+ {"version":3,"file":"loadingTime-DMc0zTY8.js","sources":["../src/adapters/loadingTime.ts"],"sourcesContent":["// `view.loading_time` — network settle, one definition, both builds (§4.5.2, #97).\n//\n// Scoped to exactly one job: p75 route-change responsiveness by `view.name`, compared across\n// releases. That framing licenses a crude stable heuristic over a clever one, and makes a\n// **null strictly better than a plausible guess** — a wrong-but-believable 300 ms poisons a\n// release comparison silently, and a `0` makes p75 track the cache-hit rate, so a backend\n// caching win renders as a frontend regression, reversed.\n//\n// Network-only, because in-flight fetch/XHR is the one settle signal both builds genuinely\n// have. DOM-mutation quiet is meaningless under React's routine re-rendering; rAF quiet never\n// settles against RN's animation driver. So this module is shared and neither build gets its\n// own definition of the same column.\n\n/**\n * The quiet window, and **the same constant as §4.6's dead-click window** — one constant, not\n * two. `ui.dead` (web only, not built yet) must import this rather than declare a second 1000.\n */\nexport const QUIET_WINDOW_MS = 1000;\n\n/** Hard cap (§4.5.2). A capped view emits **null, not the cap**: at 30 s, 30 s and 90 s are the same row. */\nexport const LOADING_TIME_CAP_MS = 30_000;\n\n/** §4.5's `view.loading_time_outcome` domain — never null, exactly four values. */\nexport type LoadingTimeOutcome = \"settled\" | \"no_activity\" | \"capped\" | \"abandoned\";\n\nexport type LoadingTimeResult = {\n /** Milliseconds, or null — and null has three causes, which is why the outcome ships beside it. */\n loadingTime: number | null;\n outcome: LoadingTimeOutcome;\n};\n\nexport type NetworkSettleOpts = {\n /**\n * `initial_load` only: the view starts **busy** until the platform's own runtime-ready\n * marker (`loadEventEnd` on web, `performance.rnStartupTiming` on native), then settles.\n * Every other `load_type` runs the same column with no seed.\n */\n awaitRuntimeReady?: boolean;\n};\n\n/**\n * One view's settle state. Constructed per view and handed the requests that **started** in\n * it — a request in flight across a view boundary belongs to the old view and does not hold\n * the new one open (§4.5.2), which is why the completion callback is bound to this instance\n * rather than looked up on whatever view is live when the response lands.\n */\nexport class NetworkSettle {\n private started = 0;\n private inFlight = 0;\n private lastEnd?: number;\n /** Frozen the first time quiet is *observed*, so a later request cannot un-settle the view. */\n private settledAt?: number;\n private awaitingRuntimeReady: boolean;\n private runtimeReadyAt?: number;\n\n constructor(private readonly viewStart: number, opts?: NetworkSettleOpts) {\n this.awaitingRuntimeReady = opts?.awaitRuntimeReady ?? false;\n }\n\n /** `view.request_count` — requests **started** in this view, failures included (§4.5). */\n get requestCount(): number {\n return this.started;\n }\n\n /**\n * The platform's runtime-ready marker, or `undefined` where the platform has none —\n * Old Architecture, or a runtime that omits it (§4.3). Either way this releases the gate:\n * a marker that never arrives must not make every launch report `abandoned`.\n */\n seedRuntimeReady(at?: number): void {\n // A successor was never gated on the marker, and on web the `load` event routinely\n // arrives *after* the first route change — flooring that view's settle at the page's\n // load time would inflate a route-change measurement with the launch's cost.\n if (!this.awaitingRuntimeReady) return;\n this.awaitingRuntimeReady = false;\n this.runtimeReadyAt = at;\n }\n\n /**\n * A request started in this view. Returns its completion callback — idempotent, because an\n * XHR `loadend` can fire more than once for a reused instance and an unbalanced in-flight\n * count would hold the view open forever.\n */\n requestStarted(now: number = Date.now()): (endedAt?: number) => void {\n this.started++;\n this.freezeIfQuiet(now);\n // Already settled: it counts toward `request_count` but must not re-arm the view, or a\n // 30-second poller keeps one screen \"loading\" for as long as the user stays on it.\n if (this.settledAt !== undefined) return () => { };\n\n this.inFlight++;\n let done = false;\n return (endedAt: number = Date.now()) => {\n if (done) return;\n done = true;\n this.inFlight--;\n if (this.lastEnd === undefined || endedAt > this.lastEnd) this.lastEnd = endedAt;\n };\n }\n\n /**\n * The view's verdict at exit. Idempotent, not pure: it may freeze the settle timestamp as\n * a side effect, which is deliberate — once quiet has been *observed* it cannot be undone\n * by a later call, and calling this twice must not produce two different answers.\n */\n resolve(now: number = Date.now()): LoadingTimeResult {\n // The contract's free invariant, and the branch that establishes it: `no_activity` ⇔\n // `view.request_count = 0`. It is checked before the runtime-ready seed on purpose —\n // the seed is a *floor* on when settle may happen, not a source of activity, so a\n // launch that fetched nothing has no loading time to report rather than one measuring\n // the platform's own startup.\n if (this.started === 0) return { loadingTime: null, outcome: \"no_activity\" };\n\n this.freezeIfQuiet(now);\n // The view is exiting, so no further request can *start* in it — quiet is confirmed by\n // construction and the rest of the window is pure detection delay, which §4.5.2 says is\n // free. Charging it as `abandoned` would drop the fastest views out of the `settled`\n // population and bias the p75 this column exists to serve, in the wrong direction.\n // `abandoned` is left meaning what it says: the user left while it was still loading.\n const settledAt = this.settledAt ?? this.quietSince();\n if (settledAt === undefined) {\n // Capped and abandoned are different populations, read as different series, and\n // must not be merged.\n return {\n loadingTime: null,\n outcome: now - this.viewStart >= LOADING_TIME_CAP_MS ? \"capped\" : \"abandoned\",\n };\n }\n\n const settleAt = Math.max(settledAt, this.runtimeReadyAt ?? 0);\n const value = settleAt - this.viewStart;\n if (value >= LOADING_TIME_CAP_MS) return { loadingTime: null, outcome: \"capped\" };\n return { loadingTime: Math.max(0, value), outcome: \"settled\" };\n }\n\n /**\n * Settle is the *completion* timestamp, not the moment we noticed it — the quiet window is\n * detection delay and is subtracted back out. That is free precisely because the `view`\n * event emits at view exit rather than at settle, so nothing waits on the window.\n */\n private freezeIfQuiet(now: number): void {\n if (this.settledAt !== undefined) return;\n const quiet = this.quietSince();\n if (quiet !== undefined && now - quiet >= QUIET_WINDOW_MS) this.settledAt = quiet;\n }\n\n /** When the network last went quiet, or undefined while the view is still busy. */\n private quietSince(): number | undefined {\n if (this.awaitingRuntimeReady) return undefined; // initial_load is busy until the marker\n if (this.inFlight > 0) return undefined;\n return this.lastEnd;\n }\n}\n"],"names":["QUIET_WINDOW_MS","LOADING_TIME_CAP_MS","NetworkSettle","viewStart","op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aAAa,KAAK,IAAI,GAAGA,CAAK,GAAG,SAAS,UAAA;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,cAAcJ,GAAmB;AACrC,QAAI,KAAK,cAAc,OAAW;AAClC,UAAMK,IAAQ,KAAK,WAAA;AACnB,IAAIA,MAAU,UAAaL,IAAMK,KAAS,aAAsB,YAAYA;AAAA,EAChF;AAAA;AAAA,EAGQ,aAAiC;AACrC,QAAI,MAAK,wBACL,OAAK,WAAW;AACpB,aAAO,KAAK;AAAA,EAChB;AACJ;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react-native"),s=require("react-native-device-info"),l=require("./react-bqe7KPOf.cjs"),c=3e4,i=1024*1024;class m{constructor(e){this.telemetry=e,this.intervalId=null}async recordMemoryUsage(){const e=await o(()=>s.getUsedMemory());if(e===void 0)return;const a={"memory.type":"rss","memory.source":n.Platform.OS},t=await o(()=>s.getTotalMemory());t!==void 0&&t>0&&(a["memory.total_mb"]=t/i),await this.telemetry.log("memory.usage",{...a,"memory.usage_mb":e/i})}async start(){this.intervalId===null&&(this.intervalId=setInterval(()=>{this.recordMemoryUsage()},c),await this.recordMemoryUsage())}stop(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null)}}async function o(r){try{const e=await r();return Number.isFinite(e)&&e>=0?e:void 0}catch(e){l.debug.warn("memory.usage read failed:",e);return}}exports.TelemetryMemoryUsageNative=m;
2
+ //# sourceMappingURL=memoryNative.native-CK3QFVjY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoryNative.native-CK3QFVjY.cjs","sources":["../src/adapters/native/memoryNative.native.ts"],"sourcesContent":["import { Platform } from \"react-native\";\nimport DeviceInfoLib from \"react-native-device-info\";\nimport { Telemetry } from \"../../core/telemetry\";\nimport { debug } from \"../../core/debug\";\n\n/** §5.2 default sampling interval. */\nconst SAMPLE_INTERVAL_MS = 30000;\n\nconst BYTES_PER_MB = 1024 * 1024;\n\n/**\n * §5.2 / #105 — `memory.usage`: RSS, **native only**, sampled every 30 s. The rationale for\n * every part of that sentence lives in CLAUDE.md's `memory.usage` section; this file is the\n * mechanism.\n */\nexport class TelemetryMemoryUsageNative {\n private intervalId: ReturnType<typeof setInterval> | null = null;\n\n constructor(private telemetry: Telemetry) { }\n\n /**\n * One sample: `memory.usage_mb` = resident MB, with the device total alongside so headroom is\n * readable without a second join. An unusable read emits nothing — a fabricated 0 would\n * drag every percentile down and read as a memory *win*.\n *\n * The two reads are guarded separately on purpose: `value` is what §5.2 makes primary,\n * so a device-info build whose `getTotalMemory()` throws must still ship the resident\n * figure with `memory.total_mb` simply absent.\n */\n async recordMemoryUsage(): Promise<void> {\n const usedBytes = await readBytes(() => DeviceInfoLib.getUsedMemory());\n if (usedBytes === undefined) return;\n\n const attrs: Record<string, string | number> = {\n \"memory.type\": \"rss\",\n \"memory.source\": Platform.OS,\n };\n const totalBytes = await readBytes(() => DeviceInfoLib.getTotalMemory());\n if (totalBytes !== undefined && totalBytes > 0) {\n attrs[\"memory.total_mb\"] = totalBytes / BYTES_PER_MB;\n }\n\n // `memory.usage` is a catalogue *event* (#179): the MB figure rides `memory.usage_mb`.\n await this.telemetry.log(\"memory.usage\", { ...attrs, \"memory.usage_mb\": usedBytes / BYTES_PER_MB });\n }\n\n /**\n * Starts the periodic sampler. v3 never called this — `trackMemoryUsage()` fired the\n * one-shot read and applied `.catch` to its `void` return — so the metric was\n * single-shot at best.\n */\n async start(): Promise<void> {\n if (this.intervalId !== null) return; // idempotent: one loop per instance\n this.intervalId = setInterval(() => {\n void this.recordMemoryUsage();\n }, SAMPLE_INTERVAL_MS);\n await this.recordMemoryUsage();\n }\n\n /** Stops the periodic sampler. Called by `Telemetry.shutdown()`. */\n stop(): void {\n if (this.intervalId !== null) {\n clearInterval(this.intervalId);\n this.intervalId = null;\n }\n }\n}\n\n/**\n * One device-info read, reduced to `number | undefined`. Both a throw (the package is a\n * peer dep — a consumer can be on a build without the native module) and a non-finite or\n * negative reading mean \"nothing to report\", and the caller treats them the same.\n */\nasync function readBytes(read: () => Promise<number>): Promise<number | undefined> {\n try {\n const bytes = await read();\n return Number.isFinite(bytes) && bytes >= 0 ? bytes : undefined;\n } catch (err) {\n debug.warn(\"memory.usage read failed:\", err);\n return undefined;\n }\n}\n"],"names":["SAMPLE_INTERVAL_MS","BYTES_PER_MB","TelemetryMemoryUsageNative","telemetry","usedBytes","readBytes","DeviceInfoLib","attrs","Platform","totalBytes","read","bytes","err","debug"],"mappings":"wLAMMA,EAAqB,IAErBC,EAAe,KAAO,KAOrB,MAAMC,CAA2B,CAGpC,YAAoBC,EAAsB,CAAtB,KAAA,UAAAA,EAFpB,KAAQ,WAAoD,IAEhB,CAW5C,MAAM,mBAAmC,CACrC,MAAMC,EAAY,MAAMC,EAAU,IAAMC,EAAc,eAAe,EACrE,GAAIF,IAAc,OAAW,OAE7B,MAAMG,EAAyC,CAC3C,cAAe,MACf,gBAAiBC,EAAAA,SAAS,EAAA,EAExBC,EAAa,MAAMJ,EAAU,IAAMC,EAAc,gBAAgB,EACnEG,IAAe,QAAaA,EAAa,IACzCF,EAAM,iBAAiB,EAAIE,EAAaR,GAI5C,MAAM,KAAK,UAAU,IAAI,eAAgB,CAAE,GAAGM,EAAO,kBAAmBH,EAAYH,EAAc,CACtG,CAOA,MAAM,OAAuB,CACrB,KAAK,aAAe,OACxB,KAAK,WAAa,YAAY,IAAM,CAC3B,KAAK,kBAAA,CACd,EAAGD,CAAkB,EACrB,MAAM,KAAK,kBAAA,EACf,CAGA,MAAa,CACL,KAAK,aAAe,OACpB,cAAc,KAAK,UAAU,EAC7B,KAAK,WAAa,KAE1B,CACJ,CAOA,eAAeK,EAAUK,EAA0D,CAC/E,GAAI,CACA,MAAMC,EAAQ,MAAMD,EAAA,EACpB,OAAO,OAAO,SAASC,CAAK,GAAKA,GAAS,EAAIA,EAAQ,MAC1D,OAASC,EAAK,CACVC,QAAM,KAAK,4BAA6BD,CAAG,EAC3C,MACJ,CACJ"}
@@ -1,13 +1,13 @@
1
- import { Platform as n } from "react-native";
2
- import { D as a } from "./index-C2XQ-EYw.js";
3
- import { d as m } from "./memoryStore-F5I-GQKM.js";
4
- const l = 3e4, o = 1024 * 1024;
1
+ import { Platform as m } from "react-native";
2
+ import s from "react-native-device-info";
3
+ import { d as n } from "./react-urNtDGTL.js";
4
+ const l = 3e4, a = 1024 * 1024;
5
5
  class u {
6
6
  constructor(t) {
7
7
  this.telemetry = t, this.intervalId = null;
8
8
  }
9
9
  /**
10
- * One sample: `value` = resident MB, with the device total alongside so headroom is
10
+ * One sample: `memory.usage_mb` = resident MB, with the device total alongside so headroom is
11
11
  * readable without a second join. An unusable read emits nothing — a fabricated 0 would
12
12
  * drag every percentile down and read as a memory *win*.
13
13
  *
@@ -16,13 +16,13 @@ class u {
16
16
  * figure with `memory.total_mb` simply absent.
17
17
  */
18
18
  async recordMemoryUsage() {
19
- const t = await i(() => a.getUsedMemory());
19
+ const t = await i(() => s.getUsedMemory());
20
20
  if (t === void 0) return;
21
- const s = {
21
+ const o = {
22
22
  "memory.type": "rss",
23
- "memory.source": n.OS
24
- }, e = await i(() => a.getTotalMemory());
25
- e !== void 0 && e > 0 && (s["memory.total_mb"] = e / o), await this.telemetry.logMetric("memory_usage", t / o, s);
23
+ "memory.source": m.OS
24
+ }, e = await i(() => s.getTotalMemory());
25
+ e !== void 0 && e > 0 && (o["memory.total_mb"] = e / a), await this.telemetry.log("memory.usage", { ...o, "memory.usage_mb": t / a });
26
26
  }
27
27
  /**
28
28
  * Starts the periodic sampler. v3 never called this — `trackMemoryUsage()` fired the
@@ -44,11 +44,11 @@ async function i(r) {
44
44
  const t = await r();
45
45
  return Number.isFinite(t) && t >= 0 ? t : void 0;
46
46
  } catch (t) {
47
- m.warn("memory_usage read failed:", t);
47
+ n.warn("memory.usage read failed:", t);
48
48
  return;
49
49
  }
50
50
  }
51
51
  export {
52
52
  u as TelemetryMemoryUsageNative
53
53
  };
54
- //# sourceMappingURL=memoryNative.native-C42h9SjK.js.map
54
+ //# sourceMappingURL=memoryNative.native-DkA6f7id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoryNative.native-DkA6f7id.js","sources":["../src/adapters/native/memoryNative.native.ts"],"sourcesContent":["import { Platform } from \"react-native\";\nimport DeviceInfoLib from \"react-native-device-info\";\nimport { Telemetry } from \"../../core/telemetry\";\nimport { debug } from \"../../core/debug\";\n\n/** §5.2 default sampling interval. */\nconst SAMPLE_INTERVAL_MS = 30000;\n\nconst BYTES_PER_MB = 1024 * 1024;\n\n/**\n * §5.2 / #105 — `memory.usage`: RSS, **native only**, sampled every 30 s. The rationale for\n * every part of that sentence lives in CLAUDE.md's `memory.usage` section; this file is the\n * mechanism.\n */\nexport class TelemetryMemoryUsageNative {\n private intervalId: ReturnType<typeof setInterval> | null = null;\n\n constructor(private telemetry: Telemetry) { }\n\n /**\n * One sample: `memory.usage_mb` = resident MB, with the device total alongside so headroom is\n * readable without a second join. An unusable read emits nothing — a fabricated 0 would\n * drag every percentile down and read as a memory *win*.\n *\n * The two reads are guarded separately on purpose: `value` is what §5.2 makes primary,\n * so a device-info build whose `getTotalMemory()` throws must still ship the resident\n * figure with `memory.total_mb` simply absent.\n */\n async recordMemoryUsage(): Promise<void> {\n const usedBytes = await readBytes(() => DeviceInfoLib.getUsedMemory());\n if (usedBytes === undefined) return;\n\n const attrs: Record<string, string | number> = {\n \"memory.type\": \"rss\",\n \"memory.source\": Platform.OS,\n };\n const totalBytes = await readBytes(() => DeviceInfoLib.getTotalMemory());\n if (totalBytes !== undefined && totalBytes > 0) {\n attrs[\"memory.total_mb\"] = totalBytes / BYTES_PER_MB;\n }\n\n // `memory.usage` is a catalogue *event* (#179): the MB figure rides `memory.usage_mb`.\n await this.telemetry.log(\"memory.usage\", { ...attrs, \"memory.usage_mb\": usedBytes / BYTES_PER_MB });\n }\n\n /**\n * Starts the periodic sampler. v3 never called this — `trackMemoryUsage()` fired the\n * one-shot read and applied `.catch` to its `void` return — so the metric was\n * single-shot at best.\n */\n async start(): Promise<void> {\n if (this.intervalId !== null) return; // idempotent: one loop per instance\n this.intervalId = setInterval(() => {\n void this.recordMemoryUsage();\n }, SAMPLE_INTERVAL_MS);\n await this.recordMemoryUsage();\n }\n\n /** Stops the periodic sampler. Called by `Telemetry.shutdown()`. */\n stop(): void {\n if (this.intervalId !== null) {\n clearInterval(this.intervalId);\n this.intervalId = null;\n }\n }\n}\n\n/**\n * One device-info read, reduced to `number | undefined`. Both a throw (the package is a\n * peer dep — a consumer can be on a build without the native module) and a non-finite or\n * negative reading mean \"nothing to report\", and the caller treats them the same.\n */\nasync function readBytes(read: () => Promise<number>): Promise<number | undefined> {\n try {\n const bytes = await read();\n return Number.isFinite(bytes) && bytes >= 0 ? bytes : undefined;\n } catch (err) {\n debug.warn(\"memory.usage read failed:\", err);\n return undefined;\n }\n}\n"],"names":["SAMPLE_INTERVAL_MS","BYTES_PER_MB","TelemetryMemoryUsageNative","telemetry","usedBytes","readBytes","DeviceInfoLib","attrs","Platform","totalBytes","read","bytes","err","debug"],"mappings":";;;AAMA,MAAMA,IAAqB,KAErBC,IAAe,OAAO;AAOrB,MAAMC,EAA2B;AAAA,EAGpC,YAAoBC,GAAsB;AAAtB,SAAA,YAAAA,GAFpB,KAAQ,aAAoD;AAAA,EAEhB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW5C,MAAM,oBAAmC;AACrC,UAAMC,IAAY,MAAMC,EAAU,MAAMC,EAAc,eAAe;AACrE,QAAIF,MAAc,OAAW;AAE7B,UAAMG,IAAyC;AAAA,MAC3C,eAAe;AAAA,MACf,iBAAiBC,EAAS;AAAA,IAAA,GAExBC,IAAa,MAAMJ,EAAU,MAAMC,EAAc,gBAAgB;AACvE,IAAIG,MAAe,UAAaA,IAAa,MACzCF,EAAM,iBAAiB,IAAIE,IAAaR,IAI5C,MAAM,KAAK,UAAU,IAAI,gBAAgB,EAAE,GAAGM,GAAO,mBAAmBH,IAAYH,GAAc;AAAA,EACtG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,QAAuB;AACzB,IAAI,KAAK,eAAe,SACxB,KAAK,aAAa,YAAY,MAAM;AAChC,MAAK,KAAK,kBAAA;AAAA,IACd,GAAGD,CAAkB,GACrB,MAAM,KAAK,kBAAA;AAAA,EACf;AAAA;AAAA,EAGA,OAAa;AACT,IAAI,KAAK,eAAe,SACpB,cAAc,KAAK,UAAU,GAC7B,KAAK,aAAa;AAAA,EAE1B;AACJ;AAOA,eAAeK,EAAUK,GAA0D;AAC/E,MAAI;AACA,UAAMC,IAAQ,MAAMD,EAAA;AACpB,WAAO,OAAO,SAASC,CAAK,KAAKA,KAAS,IAAIA,IAAQ;AAAA,EAC1D,SAASC,GAAK;AACV,IAAAC,EAAM,KAAK,6BAA6BD,CAAG;AAC3C;AAAA,EACJ;AACJ;"}