@nathanclaire/edge-telemetry-sdk 4.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +185 -30
  3. package/dist/appLifecycle-DS_fEclk.cjs +2 -0
  4. package/dist/appLifecycle-DS_fEclk.cjs.map +1 -0
  5. package/dist/{appLifecycle-DQErzJIR.js → appLifecycle-PffQ4vC1.js} +5 -3
  6. package/dist/appLifecycle-PffQ4vC1.js.map +1 -0
  7. package/dist/autoTaps.native-By9I4Kr2.cjs +2 -0
  8. package/dist/autoTaps.native-By9I4Kr2.cjs.map +1 -0
  9. package/dist/autoTaps.native-DQCXevD7.js +66 -0
  10. package/dist/autoTaps.native-DQCXevD7.js.map +1 -0
  11. package/dist/crashHandler.web-6KvedEB-.cjs +2 -0
  12. package/dist/crashHandler.web-6KvedEB-.cjs.map +1 -0
  13. package/dist/crashHandler.web-BUlSXYoS.js +30 -0
  14. package/dist/crashHandler.web-BUlSXYoS.js.map +1 -0
  15. package/dist/crashHandlerNative.native-CFVQ5UcO.cjs +2 -0
  16. package/dist/crashHandlerNative.native-CFVQ5UcO.cjs.map +1 -0
  17. package/dist/{crashHandlerNative.native-FupMnr1U.js → crashHandlerNative.native-DsCRd-oN.js} +13 -13
  18. package/dist/crashHandlerNative.native-DsCRd-oN.js.map +1 -0
  19. package/dist/deviceInfo.native-D5gNBG7m.cjs +2 -0
  20. package/dist/{deviceInfo.native-BoeTZcD6.cjs.map → deviceInfo.native-D5gNBG7m.cjs.map} +1 -1
  21. package/dist/deviceInfo.native-DiiHrnI3.js +53 -0
  22. package/dist/{deviceInfo.native-BJ-3Jj1T.js.map → deviceInfo.native-DiiHrnI3.js.map} +1 -1
  23. package/dist/{deviceInfo.web-BFB1-pcA.js → deviceInfo.web-BHsjVveq.js} +3 -3
  24. package/dist/{deviceInfo.web-BFB1-pcA.js.map → deviceInfo.web-BHsjVveq.js.map} +1 -1
  25. package/dist/{deviceInfo.web-3L3IDQQA.cjs → deviceInfo.web-DGCUHAnv.cjs} +2 -2
  26. package/dist/{deviceInfo.web-3L3IDQQA.cjs.map → deviceInfo.web-DGCUHAnv.cjs.map} +1 -1
  27. package/dist/deviceState.native-BEysbZ6O.js +58 -0
  28. package/dist/deviceState.native-BEysbZ6O.js.map +1 -0
  29. package/dist/deviceState.native-CrQMy11_.cjs +2 -0
  30. package/dist/deviceState.native-CrQMy11_.cjs.map +1 -0
  31. package/dist/deviceState.web-ByaQm9Ry.js +14 -0
  32. package/dist/deviceState.web-ByaQm9Ry.js.map +1 -0
  33. package/dist/deviceState.web-CSfUgHDU.cjs +2 -0
  34. package/dist/deviceState.web-CSfUgHDU.cjs.map +1 -0
  35. package/dist/frameTracker-9j0en6Zm.cjs +2 -0
  36. package/dist/frameTracker-9j0en6Zm.cjs.map +1 -0
  37. package/dist/{frameTracker-DdB8W_kC.js → frameTracker-BzXnxSkb.js} +18 -19
  38. package/dist/frameTracker-BzXnxSkb.js.map +1 -0
  39. package/dist/{httpAttributes-BrrtM8zh.js → httpAttributes-BWXOr4eP.js} +1 -1
  40. package/dist/{httpAttributes-BrrtM8zh.js.map → httpAttributes-BWXOr4eP.js.map} +1 -1
  41. package/dist/{httpAttributes-D0m6UID7.cjs → httpAttributes-COY0_kiF.cjs} +1 -1
  42. package/dist/{httpAttributes-D0m6UID7.cjs.map → httpAttributes-COY0_kiF.cjs.map} +1 -1
  43. package/dist/index.native.cjs +1 -1
  44. package/dist/index.native.cjs.map +1 -1
  45. package/dist/index.native.d.ts +1 -1
  46. package/dist/index.native.js +128 -71
  47. package/dist/index.native.js.map +1 -1
  48. package/dist/index.web.cjs +1 -1
  49. package/dist/index.web.cjs.map +1 -1
  50. package/dist/index.web.d.ts +1 -1
  51. package/dist/index.web.js +51 -38
  52. package/dist/index.web.js.map +1 -1
  53. package/dist/{interactionWeb.web-CJAviVQ7.js → interactionWeb.web-BWBjmovb.js} +8 -8
  54. package/dist/{interactionWeb.web-CJAviVQ7.js.map → interactionWeb.web-BWBjmovb.js.map} +1 -1
  55. package/dist/interactionWeb.web-CKDJLD9r.cjs +2 -0
  56. package/dist/{interactionWeb.web-Bl_cZlgh.cjs.map → interactionWeb.web-CKDJLD9r.cjs.map} +1 -1
  57. package/dist/{interceptFetchWeb.web-UXC2Lb6X.js → interceptFetchWeb.web-DjSR_Rft.js} +18 -17
  58. package/dist/interceptFetchWeb.web-DjSR_Rft.js.map +1 -0
  59. package/dist/interceptFetchWeb.web-ZHw6IQkU.cjs +2 -0
  60. package/dist/{interceptFetchWeb.web-UXC2Lb6X.js.map → interceptFetchWeb.web-ZHw6IQkU.cjs.map} +1 -1
  61. package/dist/{interceptHttpNative.native-BVpFuoNB.cjs → interceptHttpNative.native-C5scIcgY.cjs} +2 -2
  62. package/dist/{interceptHttpNative.native-BVpFuoNB.cjs.map → interceptHttpNative.native-C5scIcgY.cjs.map} +1 -1
  63. package/dist/{interceptHttpNative.native-rX-lPNST.js → interceptHttpNative.native-vF_Fksjk.js} +2 -2
  64. package/dist/{interceptHttpNative.native-rX-lPNST.js.map → interceptHttpNative.native-vF_Fksjk.js.map} +1 -1
  65. package/dist/{loadingTime-Bhomd9qq.cjs → loadingTime-Cj5Oh8lT.cjs} +1 -1
  66. package/dist/{loadingTime-Bhomd9qq.cjs.map → loadingTime-Cj5Oh8lT.cjs.map} +1 -1
  67. package/dist/{loadingTime-ZkYvFijA.js → loadingTime-DMc0zTY8.js} +1 -1
  68. package/dist/{loadingTime-ZkYvFijA.js.map → loadingTime-DMc0zTY8.js.map} +1 -1
  69. package/dist/memoryNative.native-CK3QFVjY.cjs +2 -0
  70. package/dist/memoryNative.native-CK3QFVjY.cjs.map +1 -0
  71. package/dist/{memoryNative.native-C42h9SjK.js → memoryNative.native-DkA6f7id.js} +12 -12
  72. package/dist/memoryNative.native-DkA6f7id.js.map +1 -0
  73. package/dist/nativeSender-Dt1HLaLi.js +37 -0
  74. package/dist/nativeSender-Dt1HLaLi.js.map +1 -0
  75. package/dist/nativeSender-hCgUa7Vz.cjs +2 -0
  76. package/dist/nativeSender-hCgUa7Vz.cjs.map +1 -0
  77. package/dist/navigationRef-CVIv0aIK.js +30 -0
  78. package/dist/navigationRef-CVIv0aIK.js.map +1 -0
  79. package/dist/navigationRef-CfIbeXX8.cjs +2 -0
  80. package/dist/navigationRef-CfIbeXX8.cjs.map +1 -0
  81. package/dist/navigationWeb.web-CRHpr5zl.js +51 -0
  82. package/dist/navigationWeb.web-CRHpr5zl.js.map +1 -0
  83. package/dist/navigationWeb.web-DwWjL80b.cjs +2 -0
  84. package/dist/navigationWeb.web-DwWjL80b.cjs.map +1 -0
  85. package/dist/{networkChange-CUO1hRLj.cjs → networkChange-2FGIQM-N.cjs} +2 -2
  86. package/dist/networkChange-2FGIQM-N.cjs.map +1 -0
  87. package/dist/{networkChange-D39hdSb0.js → networkChange-QA0893vW.js} +2 -2
  88. package/dist/networkChange-QA0893vW.js.map +1 -0
  89. package/dist/networkInfo.native-CcJ3JVRF.js +31 -0
  90. package/dist/networkInfo.native-CcJ3JVRF.js.map +1 -0
  91. package/dist/networkInfo.native-whB2wf6a.cjs +2 -0
  92. package/dist/networkInfo.native-whB2wf6a.cjs.map +1 -0
  93. package/dist/{networkInfo.web-B2YlLNsI.js → networkInfo.web-CcUpXMUK.js} +2 -2
  94. package/dist/networkInfo.web-CcUpXMUK.js.map +1 -0
  95. package/dist/{networkInfo.web-PltJTHsy.cjs → networkInfo.web-DfO-BUFx.cjs} +2 -2
  96. package/dist/networkInfo.web-DfO-BUFx.cjs.map +1 -0
  97. package/dist/react-bqe7KPOf.cjs +4 -0
  98. package/dist/react-bqe7KPOf.cjs.map +1 -0
  99. package/dist/react-urNtDGTL.js +413 -0
  100. package/dist/react-urNtDGTL.js.map +1 -0
  101. package/dist/runtimeReady.native-CxFl1rQR.js +35 -0
  102. package/dist/runtimeReady.native-CxFl1rQR.js.map +1 -0
  103. package/dist/runtimeReady.native-zueSbsEv.cjs +2 -0
  104. package/dist/runtimeReady.native-zueSbsEv.cjs.map +1 -0
  105. package/dist/{runtimeReady.web-C8fdIbVR.js → runtimeReady.web-JuE239Tg.js} +2 -2
  106. package/dist/{runtimeReady.web-C8fdIbVR.js.map → runtimeReady.web-JuE239Tg.js.map} +1 -1
  107. package/dist/{runtimeReady.web-DHW682RN.cjs → runtimeReady.web-vhAJFU61.cjs} +2 -2
  108. package/dist/{runtimeReady.web-DHW682RN.cjs.map → runtimeReady.web-vhAJFU61.cjs.map} +1 -1
  109. package/dist/{seedRuntimeReady-Cz8nOKoo.js → seedRuntimeReady-BlRdf3pR.js} +2 -2
  110. package/dist/{seedRuntimeReady-Cz8nOKoo.js.map → seedRuntimeReady-BlRdf3pR.js.map} +1 -1
  111. package/dist/seedRuntimeReady-CbjqbWCd.cjs +2 -0
  112. package/dist/{seedRuntimeReady-BKwkBEAF.cjs.map → seedRuntimeReady-CbjqbWCd.cjs.map} +1 -1
  113. package/dist/src/adapters/appLifecycle.d.ts +3 -3
  114. package/dist/src/adapters/batch.d.ts +44 -0
  115. package/dist/src/adapters/crashCapture.d.ts +5 -1
  116. package/dist/src/adapters/deviceState.d.ts +9 -0
  117. package/dist/src/adapters/frameAggregate.d.ts +15 -13
  118. package/dist/src/adapters/frameTracker.d.ts +1 -1
  119. package/dist/src/adapters/hangDetector.d.ts +41 -0
  120. package/dist/src/adapters/manualSpans.d.ts +41 -0
  121. package/dist/src/adapters/native/autoTaps.native.d.ts +15 -0
  122. package/dist/src/adapters/native/deviceState.native.d.ts +15 -0
  123. package/dist/src/adapters/native/memoryNative.native.d.ts +3 -3
  124. package/dist/src/adapters/native/networkInfo.native.d.ts +1 -1
  125. package/dist/src/adapters/native/runtimeReady.native.d.ts +16 -0
  126. package/dist/src/adapters/navigationRef.d.ts +17 -9
  127. package/dist/src/adapters/networkChange.d.ts +2 -2
  128. package/dist/src/adapters/traceManager.d.ts +18 -5
  129. package/dist/src/adapters/uiInteraction.d.ts +1 -1
  130. package/dist/src/adapters/viewManager.d.ts +24 -8
  131. package/dist/src/adapters/web/deviceState.web.d.ts +10 -0
  132. package/dist/src/adapters/web/navigationWeb.web.d.ts +6 -10
  133. package/dist/src/adapters/web/webVitals.web.d.ts +7 -0
  134. package/dist/src/adapters/xhrIntercept.d.ts +2 -0
  135. package/dist/src/core/breadcrumbs.d.ts +10 -0
  136. package/dist/src/core/telemetry.d.ts +139 -29
  137. package/dist/src/core/userProfile.d.ts +7 -0
  138. package/dist/src/createTelemetry.native.d.ts +3 -1
  139. package/dist/src/createTelemetry.web.d.ts +2 -1
  140. package/dist/src/golden.helper.d.ts +4 -0
  141. package/dist/src/index.base.d.ts +80 -6
  142. package/dist/src/index.native.d.ts +4 -61
  143. package/dist/src/index.web.d.ts +4 -51
  144. package/dist/src/react.d.ts +45 -0
  145. package/dist/src/telemetryNative.native.d.ts +79 -0
  146. package/dist/src/telemetryWeb.web.d.ts +59 -0
  147. package/dist/{store.native-TPqXngmF.cjs → store.native-BbS76uWV.cjs} +1 -1
  148. package/dist/{store.native-TPqXngmF.cjs.map → store.native-BbS76uWV.cjs.map} +1 -1
  149. package/dist/{store.native-BYBJcy6o.js → store.native-MlWyGgBp.js} +1 -1
  150. package/dist/{store.native-BYBJcy6o.js.map → store.native-MlWyGgBp.js.map} +1 -1
  151. package/dist/{store.web-CvqqN-_Z.cjs → store.web-BzKaP57Z.cjs} +1 -1
  152. package/dist/{store.web-CvqqN-_Z.cjs.map → store.web-BzKaP57Z.cjs.map} +1 -1
  153. package/dist/{store.web-DJAlN0nc.js → store.web-rhh0NOfs.js} +1 -1
  154. package/dist/{store.web-DJAlN0nc.js.map → store.web-rhh0NOfs.js.map} +1 -1
  155. package/dist/telemetry-60sfWkh0.js +1754 -0
  156. package/dist/telemetry-60sfWkh0.js.map +1 -0
  157. package/dist/telemetry-CW63glwb.cjs +2 -0
  158. package/dist/telemetry-CW63glwb.cjs.map +1 -0
  159. package/dist/{uiInteraction-DAqxxz0q.js → uiInteraction-BIDOMcrL.js} +39 -34
  160. package/dist/{uiInteraction-DAqxxz0q.js.map → uiInteraction-BIDOMcrL.js.map} +1 -1
  161. package/dist/uiInteraction-DxlwCVSn.cjs +2 -0
  162. package/dist/{uiInteraction-CdzvEI1p.cjs.map → uiInteraction-DxlwCVSn.cjs.map} +1 -1
  163. package/dist/{viewport-Dd85GUNO.cjs → viewport-9JcVIXYF.cjs} +1 -1
  164. package/dist/{viewport-Dd85GUNO.cjs.map → viewport-9JcVIXYF.cjs.map} +1 -1
  165. package/dist/{viewport-Dzmt5QwK.js → viewport-GWTEBt2K.js} +1 -1
  166. package/dist/{viewport-Dzmt5QwK.js.map → viewport-GWTEBt2K.js.map} +1 -1
  167. package/dist/{web-vitals.attribution-CVCPiX-h.cjs → web-vitals.attribution-DAvBvdng.cjs} +1 -1
  168. package/dist/{web-vitals.attribution-CVCPiX-h.cjs.map → web-vitals.attribution-DAvBvdng.cjs.map} +1 -1
  169. package/dist/{web-vitals.attribution-xw9N5MKQ.js → web-vitals.attribution-DcoMtvlY.js} +1 -1
  170. package/dist/{web-vitals.attribution-xw9N5MKQ.js.map → web-vitals.attribution-DcoMtvlY.js.map} +1 -1
  171. package/dist/webSender-DA087xb5.cjs +2 -0
  172. package/dist/webSender-DA087xb5.cjs.map +1 -0
  173. package/dist/webSender-g4rs5TIg.js +44 -0
  174. package/dist/webSender-g4rs5TIg.js.map +1 -0
  175. package/dist/{webVitals.web-CNIpsKlA.js → webVitals.web-DRTDK6s5.js} +39 -24
  176. package/dist/webVitals.web-DRTDK6s5.js.map +1 -0
  177. package/dist/webVitals.web-DvScDIjX.cjs +2 -0
  178. package/dist/webVitals.web-DvScDIjX.cjs.map +1 -0
  179. package/dist/{xhrIntercept-BNiA41Mj.js → xhrIntercept-9uAkQh3N.js} +16 -14
  180. package/dist/xhrIntercept-9uAkQh3N.js.map +1 -0
  181. package/dist/xhrIntercept-xG1Yl5RI.cjs +2 -0
  182. package/dist/xhrIntercept-xG1Yl5RI.cjs.map +1 -0
  183. package/docs/migration-v4.md +1 -1
  184. package/docs/migration-v5.md +178 -0
  185. package/package.json +12 -4
  186. package/dist/appLifecycle-CECgRVu_.cjs +0 -2
  187. package/dist/appLifecycle-CECgRVu_.cjs.map +0 -1
  188. package/dist/appLifecycle-DQErzJIR.js.map +0 -1
  189. package/dist/batch-CwoO7noL.js +0 -56
  190. package/dist/batch-CwoO7noL.js.map +0 -1
  191. package/dist/batch-DNu8Xr9T.cjs +0 -2
  192. package/dist/batch-DNu8Xr9T.cjs.map +0 -1
  193. package/dist/crashCapture-BOJ8nSAZ.cjs +0 -4
  194. package/dist/crashCapture-BOJ8nSAZ.cjs.map +0 -1
  195. package/dist/crashCapture-BW8WuyaU.js +0 -70
  196. package/dist/crashCapture-BW8WuyaU.js.map +0 -1
  197. package/dist/crashHandler.web-8F_k2veo.js +0 -29
  198. package/dist/crashHandler.web-8F_k2veo.js.map +0 -1
  199. package/dist/crashHandler.web-CWmF56mJ.cjs +0 -2
  200. package/dist/crashHandler.web-CWmF56mJ.cjs.map +0 -1
  201. package/dist/crashHandlerNative.native-C2kSikDt.cjs +0 -2
  202. package/dist/crashHandlerNative.native-C2kSikDt.cjs.map +0 -1
  203. package/dist/crashHandlerNative.native-FupMnr1U.js.map +0 -1
  204. package/dist/deviceInfo.native-BJ-3Jj1T.js +0 -53
  205. package/dist/deviceInfo.native-BoeTZcD6.cjs +0 -2
  206. package/dist/frameTracker-CHG6sIx9.cjs +0 -2
  207. package/dist/frameTracker-CHG6sIx9.cjs.map +0 -1
  208. package/dist/frameTracker-DdB8W_kC.js.map +0 -1
  209. package/dist/index-BtLlV1HA.js +0 -57
  210. package/dist/index-BtLlV1HA.js.map +0 -1
  211. package/dist/index-C2XQ-EYw.js +0 -1122
  212. package/dist/index-C2XQ-EYw.js.map +0 -1
  213. package/dist/index-CXsVZY35.cjs +0 -2
  214. package/dist/index-CXsVZY35.cjs.map +0 -1
  215. package/dist/index-DLquF88M.cjs +0 -2
  216. package/dist/index-DLquF88M.cjs.map +0 -1
  217. package/dist/interactionWeb.web-Bl_cZlgh.cjs +0 -2
  218. package/dist/interceptFetchWeb.web-T88kO-bE.cjs +0 -2
  219. package/dist/interceptFetchWeb.web-T88kO-bE.cjs.map +0 -1
  220. package/dist/memoryNative.native-C42h9SjK.js.map +0 -1
  221. package/dist/memoryNative.native-CA-7w9w1.cjs +0 -2
  222. package/dist/memoryNative.native-CA-7w9w1.cjs.map +0 -1
  223. package/dist/memoryStore-BIGZmmfD.cjs +0 -2
  224. package/dist/memoryStore-BIGZmmfD.cjs.map +0 -1
  225. package/dist/memoryStore-F5I-GQKM.js +0 -193
  226. package/dist/memoryStore-F5I-GQKM.js.map +0 -1
  227. package/dist/nativeSender-CfQaRuDK.cjs +0 -2
  228. package/dist/nativeSender-CfQaRuDK.cjs.map +0 -1
  229. package/dist/nativeSender-pgVSIv-X.js +0 -59
  230. package/dist/nativeSender-pgVSIv-X.js.map +0 -1
  231. package/dist/navigationRef-BzYbs8cm.js +0 -28
  232. package/dist/navigationRef-BzYbs8cm.js.map +0 -1
  233. package/dist/navigationRef-C-_qhb43.cjs +0 -2
  234. package/dist/navigationRef-C-_qhb43.cjs.map +0 -1
  235. package/dist/navigationTracker-BmywA_Bg.js +0 -19
  236. package/dist/navigationTracker-BmywA_Bg.js.map +0 -1
  237. package/dist/navigationTracker-HkwVyywz.cjs +0 -2
  238. package/dist/navigationTracker-HkwVyywz.cjs.map +0 -1
  239. package/dist/navigationWeb.web-CW_z7Ca4.cjs +0 -2
  240. package/dist/navigationWeb.web-CW_z7Ca4.cjs.map +0 -1
  241. package/dist/navigationWeb.web-CcwgKuIZ.js +0 -55
  242. package/dist/navigationWeb.web-CcwgKuIZ.js.map +0 -1
  243. package/dist/networkChange-CUO1hRLj.cjs.map +0 -1
  244. package/dist/networkChange-D39hdSb0.js.map +0 -1
  245. package/dist/networkInfo.native-CGrx9cnH.js +0 -343
  246. package/dist/networkInfo.native-CGrx9cnH.js.map +0 -1
  247. package/dist/networkInfo.native-YVySdv3S.cjs +0 -2
  248. package/dist/networkInfo.native-YVySdv3S.cjs.map +0 -1
  249. package/dist/networkInfo.web-B2YlLNsI.js.map +0 -1
  250. package/dist/networkInfo.web-PltJTHsy.cjs.map +0 -1
  251. package/dist/runtimeReady.native-Bh7EcYmK.js +0 -14
  252. package/dist/runtimeReady.native-Bh7EcYmK.js.map +0 -1
  253. package/dist/runtimeReady.native-jUmuE1lV.cjs +0 -2
  254. package/dist/runtimeReady.native-jUmuE1lV.cjs.map +0 -1
  255. package/dist/seedRuntimeReady-BKwkBEAF.cjs +0 -2
  256. package/dist/src/adapters/navigationTracker.d.ts +0 -6
  257. package/dist/src/adapters/screenTiming.d.ts +0 -15
  258. package/dist/telemetry-ByDJIz_9.js +0 -1280
  259. package/dist/telemetry-ByDJIz_9.js.map +0 -1
  260. package/dist/telemetry-CrU7i1Jc.cjs +0 -2
  261. package/dist/telemetry-CrU7i1Jc.cjs.map +0 -1
  262. package/dist/uiInteraction-CdzvEI1p.cjs +0 -2
  263. package/dist/webSender-BIwslfpT.js +0 -63
  264. package/dist/webSender-BIwslfpT.js.map +0 -1
  265. package/dist/webSender-CVtE4sOF.cjs +0 -2
  266. package/dist/webSender-CVtE4sOF.cjs.map +0 -1
  267. package/dist/webVitals.web-CNIpsKlA.js.map +0 -1
  268. package/dist/webVitals.web-DpWJ-iYp.cjs +0 -2
  269. package/dist/webVitals.web-DpWJ-iYp.cjs.map +0 -1
  270. package/dist/xhrIntercept-BADex6Cq.cjs +0 -2
  271. package/dist/xhrIntercept-BADex6Cq.cjs.map +0 -1
  272. package/dist/xhrIntercept-BNiA41Mj.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","sources":["../src/createTelemetry.native.ts","../src/index.native.ts"],"sourcesContent":["import { TelemetryNative } from \"./index.native\";\nimport type { Store } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\nimport { normalizeAllowlist } from \"./adapters/traceHeader\";\nimport { setDebug } from \"./core/debug\";\n\nexport type TelemetryOpts = {\n apiKey: string; // required credential; must start with \"edge_\" (API key or JWT, #90)\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n // console.error -> app.error, console.warn -> a breadcrumb. Default OFF (§4.7, #100).\n captureConsole?: boolean;\n debug?: boolean; // SDK-internal diagnostics; off by default (#23)\n store?: Store; // persisted-state port (#89); either shape — the native path awaits\n // Constructor-only (§3.6) — there is deliberately no runtime setter for either.\n beforeSend?: BeforeSend; // sync scrubbing hook, run at enqueue over events and metrics\n sessionSampleRate?: number; // 0.0-1.0, sticky per session, re-rolled at rotation; default 1\n // §6.4/#99. Bare hosts, exact match, **ports ignored** (a deliberate mismatch with\n // `http.host`, which keeps the port — do not join them). Empty by default: v4 is dark on\n // upgrade. Listing a host asserts that host's CORS allows `traceparent`; a malformed\n // entry throws in dev and is dropped in production.\n traceHostAllowlist?: string[];\n // §4.8 — the symbolication resolve key. A git SHA or CI run number; consumer-supplied\n // (the SDK has zero OTA awareness), **omitted when unset, never `\"\"`**, and never\n // derived from app.version + app.build_number under any circumstances.\n buildId?: string;\n};\n\n// Deliberately loose: `apiKey` is the *credential*, and under AUTH_MODE=jwt it is\n// `edge_<jwt>` — a shape the collector's >=3-`_`-part API-key check would reject. Tightening\n// to that check here would hard-reject every JWT and make the segmented deployment\n// unreachable, which is the exact bug #90 exists to close. Prefix + non-empty remainder is\n// all we assert; the real catch is the 401 warn (contract §11.1).\nexport function assertApiKey(apiKey?: string) {\n if (!apiKey || !apiKey.startsWith(\"edge_\")) {\n throw new Error(\"createTelemetry: apiKey is required and must start with 'edge_'\");\n }\n}\n\n/**\n * Cross-platform factory for telemetry. The platform is chosen by the bundler\n * via the .web / .native file split — no runtime navigator sniffing.\n */\nexport function createTelemetry(opts: TelemetryOpts) {\n assertApiKey(opts?.apiKey);\n // §6.4's dev throw has to happen *here*, synchronously: the core Telemetry is built\n // inside `instancePromise`, which deliberately never rethrows, so a throw down there\n // would be a silently rejected promise instead of the loud config error dev asks for.\n // In production it drops the bad entry and reports through debug() — which is why the\n // gate has to be open first: the entry ctor's own setDebug() runs *after* this line, so\n // without this the production report would be a guaranteed no-op even with debug: true.\n // It runs again in TraceManager, where it is idempotent.\n setDebug(opts?.debug ?? false);\n normalizeAllowlist(opts?.traceHostAllowlist);\n return new TelemetryNative(opts);\n}\n","// React Native telemetry implementation\nimport { TelemetryBase } from \"./index.base\";\nimport { debug, setDebug } from \"./core/debug\";\nimport { RAGE_WINDOW_MS, RageTracker, UI_UNNAMED, uiAttributes } from \"./adapters/uiInteraction\";\nimport type { Store } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\n\nexport { createTelemetry, type TelemetryOpts } from \"./createTelemetry.native\";\n\n// The Store port (#89) — public so a consumer can inject their own persistence,\n// and so the in-memory fake is available outside the test tree.\nexport type { Store, SyncStore, AsyncStore, StoreRead, StoreWrite } from \"./core/store\";\nexport { memoryStore, type MemoryStoreOpts } from \"./core/memoryStore\";\n\n// The scrubbing hook (#93) — public so a consumer can type their beforeSend.\nexport type { BeforeSend } from \"./core/beforeSend\";\n\nexport class TelemetryNative extends TelemetryBase {\n /** ≥3 named taps in a 1000 ms window, keyed on the name — see `trackTap`. */\n private readonly tapRage = new RageTracker(RAGE_WINDOW_MS);\n /**\n * The resolved core, once `instancePromise` settles. `trackTap` is the one public method that\n * cannot afford an `await` before it reads the world: the host's own press handler\n * navigates on the very next line (§4.6's mint/emit split).\n */\n private resolved?: any;\n\n constructor(opts?: {\n apiKey?: string;\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n captureConsole?: boolean;\n debug?: boolean;\n store?: Store; // either shape: the native path awaits\n // Constructor-only (§3.6). No runtime setter: registering later leaves a window\n // where session.started and the earliest requests have already been enqueued.\n beforeSend?: BeforeSend;\n sessionSampleRate?: number;\n // §6.4/#99 — bare hosts, exact match, ports ignored, empty by default.\n traceHostAllowlist?: string[];\n // §4.8 — symbolication resolve key. Omitted when unset, never `\"\"`, never derived.\n buildId?: string;\n }) {\n setDebug(opts?.debug ?? false); // gate SDK console noise before anything logs (#23)\n super();\n\n debug.log(\"🌍 Running Native Telemetry\");\n this.instancePromise = (async () => {\n // RN ships no WebCrypto; this already-declared dependency installs\n // crypto.getRandomValues, which the id path now draws from (#91). It is a\n // no-op wherever crypto already exists, which is why a failure here is only a\n // warning — off-device (SSR, tests) crypto is already there. If it genuinely\n // isn't, randomHex() throws with the reinstall instruction.\n try { await import(\"react-native-get-random-values\"); }\n catch (err) { debug.warn(\"crypto.getRandomValues polyfill unavailable:\", err); }\n\n const { Telemetry } = await import(\"./core/telemetry\");\n const { nativeSender } = await import(\"./adapters/nativeSender\");\n\n const { nativeStore } = await import(\"./adapters/native/store.native\");\n const { DeviceInfoTrackerNative } = await import(\"./adapters/native/deviceInfo.native\");\n const { NetworkInfoTrackerNative } = await import(\"./adapters/native/networkInfo.native\");\n\n // device OS forms the device/session id suffix (ios|android)\n let platform: string | undefined;\n try {\n ({ Platform: { OS: platform } } = await import(\"react-native\") as any);\n } catch { /* non-RN context (e.g. tests) — omit the suffix */ }\n\n const networkInfoTrackerNative = new NetworkInfoTrackerNative();\n const deviceInfoTrackerNative = new DeviceInfoTrackerNative();\n\n // One store, shared by the offline queue and core (#89) — so a consumer that\n // injects a store governs both, instead of the sender quietly keeping its own.\n const store = opts?.store ?? nativeStore();\n const sender = opts?.sender ?? nativeSender(opts?.endpoint, opts?.apiKey, store);\n\n const telemetry = new Telemetry({\n sender,\n batchSize: opts?.batchSize,\n flushIntervalMs: opts?.flushIntervalMs,\n endpoint: opts?.endpoint,\n platform,\n deviceInfoHandler: deviceInfoTrackerNative,\n networkInfoHandler: networkInfoTrackerNative,\n store,\n beforeSend: opts?.beforeSend,\n sessionSampleRate: opts?.sessionSampleRate,\n traceHostAllowlist: opts?.traceHostAllowlist,\n buildId: opts?.buildId,\n });\n\n // The offline queue drains through `sender.replayFailed()`, which the core\n // constructor above already called (#113). A second call here is what sent\n // every recovered batch twice.\n\n // Resume or start the session before the instance is visible (#92), so\n // session.started can never land behind the host app's first event.\n // Never rethrown into instancePromise: finalizeSession() flushes, flush() rethrows on a\n // dead collector, and a rejected instancePromise would brick every public method for the\n // life of the process. Hydration has already run; only the emission is lost.\n // §4.5.2's `initial_load` seed: the launch view stays busy until the platform's\n // runtime-ready marker. The *module* is awaited with everything else, so the seed\n // is armed before `instancePromise` resolves; the *marker* is not, because on web\n // it arrives with the load event and blocking init on it would delay every host\n // call behind the page's own images.\n // The module is awaited so the seed is armed before `instancePromise` resolves,\n // but never rethrown into it: a failed chunk load must not brick every public\n // method for the life of the process. A missing reader just releases the gate.\n const { runtimeReadyAt } = await import(\"./adapters/native/runtimeReady.native\")\n .catch((err: unknown) => {\n debug.warn(\"Native runtime-ready module unavailable:\", err);\n return { runtimeReadyAt: async () => undefined };\n });\n const { seedRuntimeReady } = await import(\"./adapters/seedRuntimeReady\");\n seedRuntimeReady(telemetry.views, runtimeReadyAt, \"Native\");\n\n await telemetry.resumeOrStartSession()\n .catch(err => debug.warn(\"Native session resume failed:\", err));\n\n this.resolved = telemetry;\n return telemetry;\n })();\n\n // app_lifecycle on foreground/background (#30)\n this.attachAppLifecycle().catch(err => {\n debug.log(\"Native attachAppLifecycle errors\", err);\n });\n\n this.trackErrors({ captureConsole: opts?.captureConsole }).catch(err => {\n debug.warn(\"Native trackErrors failed:\", err);\n });\n\n this.trackFrameDrops().catch(err => {\n debug.log(\"Native trackFrameDrops errors\", err);\n });\n this.trackNetworkRequests().catch(err => {\n debug.log(\"Native trackNetworkRequests errors\", err);\n });\n this.trackMemoryUsage().catch(err => {\n debug.log(\"Native trackMemoryUsage errors\", err);\n });\n }\n\n // app_lifecycle on foreground/background via RN AppState (#30).\n //\n // §4.2: neither build rotates on a lifecycle transition — parity with web is reached by\n // *deleting* the old background→finalize / foreground→newSession pair, not by adding it\n // to web. Backgrounding still forces a flush, because the process is now most likely to\n // be killed and the queue only lives in memory.\n async attachAppLifecycle() {\n const { AppState } = await import(\"react-native\") as any;\n const inst = await this.instancePromise;\n const { AppLifecycleEmitter } = await import(\"./adapters/appLifecycle\");\n const emitter = new AppLifecycleEmitter(inst);\n // seed current state — a transition-only emitter, so this enqueues nothing\n emitter.onState(AppState.currentState === \"active\")\n .catch((e: any) => debug.warn(\"app lifecycle seed failed:\", e));\n AppState.addEventListener(\"change\", (next: string) => {\n const isActive = next === \"active\";\n // Awaited before the flush, not fired alongside it: backgrounding is a view\n // boundary (§4.5) and the `view` row it emits is exactly the row this flush\n // exists to rescue from the kill that usually follows.\n emitter.onState(isActive)\n .then(() => (isActive ? undefined : inst.flush()))\n .catch((e: any) => debug.warn(\"background flush failed:\", e));\n });\n }\n\n async getDeviceInfo() {\n const { DeviceInfoTrackerNative } = await import(\"./adapters/native/deviceInfo.native\");\n const inst = await this.instancePromise;\n const deviceInfoTrackerNative = new DeviceInfoTrackerNative();\n return inst.getDeviceInfo(deviceInfoTrackerNative);\n }\n\n async getNetworkInfo() {\n const { NetworkInfoTrackerNative } = await import(\"./adapters/native/networkInfo.native\");\n const inst = await this.instancePromise;\n const networkInfoTrackerNative = new NetworkInfoTrackerNative();\n return inst.getNetworkInfo(networkInfoTrackerNative);\n }\n\n async trackFrameDrops() {\n const { FrameDropTracker } = await import(\"./adapters/frameTracker\");\n const inst = await this.instancePromise;\n const frameDropTracker = new FrameDropTracker(inst);\n return inst.trackFrameDrops(frameDropTracker);\n }\n\n async trackNetworkRequests() {\n const { NetworkTrackerNative } = await import(\"./adapters/native/interceptHttpNative.native\");\n const inst = await this.instancePromise;\n const networkTracker = new NetworkTrackerNative(inst);\n return inst.trackNetworkRequests(networkTracker);\n }\n\n async trackMemoryUsage() {\n const { TelemetryMemoryUsageNative } = await import(\"./adapters/native/memoryNative.native\");\n const inst = await this.instancePromise;\n const memoryTracker = new TelemetryMemoryUsageNative(inst);\n return inst.trackMemoryUsage(memoryTracker);\n }\n\n // ---------- Screen Management ----------\n\n async screenStart(name: string) {\n const inst = await this.instancePromise;\n return inst.screens.startScreen(name);\n }\n\n async screenEnd(name: string) {\n const inst = await this.instancePromise;\n return inst.screens.endScreen(name);\n }\n\n async trackRoute(from: string, to: string) {\n const inst = await this.instancePromise;\n return inst.recordRouteChange(from, to);\n }\n\n // ---------- Interactions ----------\n\n /**\n * §4.6's native producer, explicit-only (#103). `interactionProps()` is gone with\n * `user.interaction` (#102): it sat on the consumer's **root** `<View>`, where\n * `PressEvent.nativeEvent.target` is a node tag number with no public API resolving it,\n * so it could not tell a tap on a button from a tap on padding and every row it emitted\n * was un-nameable. There is no role model to gate on and no DOM to derive from, so\n * anything auto-derived here would be either wrong or a PII leak.\n *\n * `name` is web's rung 1 — explicit author intent — so it ships **unnormalized and\n * uncapped**, and `ui.name_source` has exactly **two** values: `edge_action`, or `none`\n * for a blank name, whose `ui.target` is `unnamed`. **`surface` never appears**: it only\n * means something where role-less elements exist.\n *\n * ⚠ **The mint/emit split.** The row's `timestamp`, `view.id`, `view.name` and\n * `session.id` are snapshotted **here, synchronously**, because the host's press handler\n * navigates on the next line and the emit rides a promise. Stamping emit time would\n * attribute a navigating tap to **the view it opened**, inverting every \"which screen\n * frustrates users\" query. Before `instancePromise` settles there is no core to snapshot\n * from, so a tap that early falls back to emit-time identity — the launch view either\n * way.\n *\n * ⚠ **`ui.dead` is absent on every native row**, never `false`: with no DOM there is no\n * mutation signal, so any dead-click *rate* must filter to the web build.\n */\n async trackTap(name: string) {\n const at = Date.now();\n const named = typeof name === \"string\" && name.trim() !== \"\";\n const attrs = uiAttributes({\n type: \"tap\",\n target: named ? name : UI_UNNAMED,\n nameSource: named ? \"edge_action\" : \"none\",\n // No element model: nothing was resolved, so the tag names the platform rather\n // than inventing a `<button>` that does not exist. §4.6 types it never-null, as\n // it does the coordinates the builder floors at 0 — a `PressEvent` carries some,\n // but `trackTap(name)` deliberately takes none: the name is the whole contract.\n tag: \"native\",\n // Gated to named taps (§4.6): running rage over `unnamed` would not merely lose\n // information, it would invent a frustration event that never happened. Identity\n // is the name, which on native *is* the element — there is no node to key on.\n rage: named && this.tapRage.record(name, at),\n });\n // §6.2: **every** tap mints an interaction root, live carrier or not — a tap is a new\n // user action by definition, so the request it fires is its child and not the route\n // change's before it.\n const emit = (inst: any) =>\n inst.log(\"ui.interaction\", { ...inst.trace.interactionSpan(at), ...attrs }, inst.snapshot(at));\n // Swallowed like every other capture path: the README's own example calls this\n // un-awaited from an `onPress`, and a RUM SDK must not be able to fault the host with\n // an unhandled rejection.\n return Promise.resolve(this.resolved ? emit(this.resolved) : this.instancePromise.then(emit))\n .catch((err: unknown) => debug.warn(\"Native ui.interaction failed:\", err));\n }\n}\n"],"names":["assertApiKey","apiKey","createTelemetry","opts","setDebug","normalizeAllowlist","TelemetryNative","TelemetryBase","RageTracker","RAGE_WINDOW_MS","debug","n","err","Telemetry","nativeSender","nativeStore","DeviceInfoTrackerNative","NetworkInfoTrackerNative","platform","networkInfoTrackerNative","deviceInfoTrackerNative","store","sender","telemetry","runtimeReadyAt","seedRuntimeReady","AppState","inst","AppLifecycleEmitter","emitter","e","next","isActive","FrameDropTracker","frameDropTracker","NetworkTrackerNative","networkTracker","TelemetryMemoryUsageNative","memoryTracker","name","from","to","at","named","attrs","uiAttributes","UI_UNNAMED","emit"],"mappings":";;;AAmCO,SAASA,EAAaC,GAAiB;AAC1C,MAAI,CAACA,KAAU,CAACA,EAAO,WAAW,OAAO;AACrC,UAAM,IAAI,MAAM,iEAAiE;AAEzF;AAMO,SAASC,EAAgBC,GAAqB;AACjD,SAAAH,EAAaG,GAAM,MAAM,GAQzBC,EAASD,GAAM,SAAS,EAAK,GAC7BE,EAAmBF,GAAM,kBAAkB,GACpC,IAAIG,EAAgBH,CAAI;AACnC;ACxCO,MAAMG,UAAwBC,EAAc;AAAA,EAU/C,YAAYJ,GAiBT;AACC,IAAAC,EAASD,GAAM,SAAS,EAAK,GAC7B,MAAA,GA3BJ,KAAiB,UAAU,IAAIK,EAAYC,CAAc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;AAAA,EAEA,MAAM,UAAUA,GAAc;AAE1B,YADa,MAAM,KAAK,iBACZ,QAAQ,UAAUA,CAAI;AAAA,EACtC;AAAA,EAEA,MAAM,WAAWC,GAAcC,GAAY;AAEvC,YADa,MAAM,KAAK,iBACZ,kBAAkBD,GAAMC,CAAE;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA4BA,MAAM,SAASF,GAAc;AACzB,UAAMG,IAAK,KAAK,IAAA,GACVC,IAAQ,OAAOJ,KAAS,YAAYA,EAAK,WAAW,IACpDK,IAAQC,EAAa;AAAA,MACvB,MAAM;AAAA,MACN,QAAQF,IAAQJ,IAAOO;AAAA,MACvB,YAAYH,IAAQ,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,MAKpC,KAAK;AAAA;AAAA;AAAA;AAAA,MAIL,MAAMA,KAAS,KAAK,QAAQ,OAAOJ,GAAMG,CAAE;AAAA,IAAA,CAC9C,GAIKK,IAAO,CAACpB,MACVA,EAAK,IAAI,kBAAkB,EAAE,GAAGA,EAAK,MAAM,gBAAgBe,CAAE,GAAG,GAAGE,EAAA,GAASjB,EAAK,SAASe,CAAE,CAAC;AAIjG,WAAO,QAAQ,QAAQ,KAAK,WAAWK,EAAK,KAAK,QAAQ,IAAI,KAAK,gBAAgB,KAAKA,CAAI,CAAC,EACvF,MAAM,CAACnC,MAAiBF,EAAM,KAAK,iCAAiCE,CAAG,CAAC;AAAA,EACjF;AACJ;"}
1
+ {"version":3,"file":"index.native.js","sources":["../src/telemetryNative.native.ts","../src/createTelemetry.native.ts"],"sourcesContent":["// React Native telemetry implementation\nimport { TelemetryBase } from \"./index.base\";\nimport { debug, setDebug } from \"./core/debug\";\nimport { RAGE_WINDOW_MS, RageTracker, UI_UNNAMED, uiAttributes } from \"./adapters/uiInteraction\";\nimport type { Store } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\n\nexport class TelemetryNative extends TelemetryBase {\n /** ≥3 named taps in a 1000 ms window, keyed on the name — see `trackTap`. */\n private readonly tapRage = new RageTracker(RAGE_WINDOW_MS);\n /** Explicit `trackTap()` calls so far — an auto row is skipped when one fired inside its handler. */\n private explicitTaps = 0;\n\n constructor(opts?: {\n apiKey?: string;\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n captureConsole?: boolean;\n debug?: boolean;\n store?: Store; // either shape: the native path awaits\n // Constructor-only (§3.6). No runtime setter: registering later leaves a window\n // where session.started and the earliest requests have already been enqueued.\n beforeSend?: BeforeSend;\n sessionSampleRate?: number;\n // §6.4/#99 — bare hosts, exact match, ports ignored, empty by default.\n traceHostAllowlist?: string[];\n // §4.8 — symbolication resolve key. Omitted when unset, never `\"\"`, never derived.\n buildId?: string;\n enabled?: boolean;\n autoTrackTaps?: boolean;\n }) {\n setDebug(opts?.debug ?? false); // gate SDK console noise before anything logs (#23)\n super();\n\n debug.log(\"🌍 Running Native Telemetry\");\n this.instancePromise = (async () => {\n // RN ships no WebCrypto; this already-declared dependency installs\n // crypto.getRandomValues, which the id path now draws from (#91). It is a\n // no-op wherever crypto already exists, which is why a failure here is only a\n // warning — off-device (SSR, tests) crypto is already there. If it genuinely\n // isn't, randomHex() throws with the reinstall instruction.\n try { await import(\"react-native-get-random-values\"); }\n catch (err) { debug.warn(\"crypto.getRandomValues polyfill unavailable:\", err); }\n\n const { Telemetry } = await import(\"./core/telemetry\");\n const { nativeSender } = await import(\"./adapters/nativeSender\");\n\n const { nativeStore } = await import(\"./adapters/native/store.native\");\n const { DeviceInfoTrackerNative } = await import(\"./adapters/native/deviceInfo.native\");\n const { NetworkInfoTrackerNative } = await import(\"./adapters/native/networkInfo.native\");\n\n // device OS forms the device/session id suffix (ios|android)\n let platform: string | undefined;\n try {\n ({ Platform: { OS: platform } } = await import(\"react-native\") as any);\n } catch { /* non-RN context (e.g. tests) — omit the suffix */ }\n\n const { DeviceStateNative } = await import(\"./adapters/native/deviceState.native\");\n const networkInfoTrackerNative = new NetworkInfoTrackerNative();\n const deviceInfoTrackerNative = new DeviceInfoTrackerNative();\n\n // One store, shared by the offline queue and core (#89) — so a consumer that\n // injects a store governs both, instead of the sender quietly keeping its own.\n const store = opts?.store ?? nativeStore();\n const sender = opts?.sender ?? nativeSender(opts?.endpoint, opts?.apiKey, store);\n\n const telemetry = new Telemetry({\n sender,\n batchSize: opts?.batchSize,\n flushIntervalMs: opts?.flushIntervalMs,\n endpoint: opts?.endpoint,\n platform,\n deviceInfoHandler: deviceInfoTrackerNative,\n networkInfoHandler: networkInfoTrackerNative,\n store,\n beforeSend: opts?.beforeSend,\n sessionSampleRate: opts?.sessionSampleRate,\n traceHostAllowlist: opts?.traceHostAllowlist,\n buildId: opts?.buildId,\n enabled: opts?.enabled,\n deviceStateHandler: new DeviceStateNative(),\n });\n\n // The offline queue drains through `sender.replayFailed()`, which the core\n // constructor above already called (#113). A second call here is what sent\n // every recovered batch twice.\n\n // Resume or start the session before the instance is visible (#92), so\n // session.started can never land behind the host app's first event.\n // Never rethrown into instancePromise: finalizeSession() flushes, flush() rethrows on a\n // dead collector, and a rejected instancePromise would brick every public method for the\n // life of the process. Hydration has already run; only the emission is lost.\n // §4.5.2's `initial_load` seed: the launch view stays busy until the platform's\n // runtime-ready marker. The *module* is awaited with everything else, so the seed\n // is armed before `instancePromise` resolves; the *marker* is not, because on web\n // it arrives with the load event and blocking init on it would delay every host\n // call behind the page's own images.\n // The module is awaited so the seed is armed before `instancePromise` resolves,\n // but never rethrown into it: a failed chunk load must not brick every public\n // method for the life of the process. A missing reader just releases the gate.\n const { runtimeReadyAt, processStartAt, startupDurationMs } = await import(\"./adapters/native/runtimeReady.native\")\n .catch((err: unknown) => {\n debug.warn(\"Native runtime-ready module unavailable:\", err);\n return { runtimeReadyAt: async () => undefined, processStartAt: () => undefined, startupDurationMs: undefined };\n });\n const { seedRuntimeReady } = await import(\"./adapters/seedRuntimeReady\");\n seedRuntimeReady(telemetry.views, runtimeReadyAt, \"Native\");\n // #171: the initial view's ready anchor, and `app.start.js_ready_ms` — read when\n // `app.start` is emitted, not here: the bundle-end field is stamped just after a\n // module-scope `createTelemetry()`, and by then the session resume's AsyncStorage\n // round-trip has put a macrotask between the two. Never awaited — init must not\n // block on a timer for one key.\n const processStart = processStartAt();\n telemetry.views.anchorInitial(processStart);\n telemetry.jsReadyMs = () => {\n const end = (globalThis as any).performance?.rnStartupTiming?.executeJavaScriptBundleEntryPointEnd;\n return processStart !== undefined && typeof end === \"number\" && end >= processStart\n ? end - processStart : undefined;\n };\n\n telemetry.appStartMs = startupDurationMs; // #179: process start → first display\n await telemetry.resumeOrStartSession()\n .catch(err => debug.warn(\"Native session resume failed:\", err));\n\n this.resolved = telemetry;\n return telemetry;\n })();\n\n // #174 — opt-in only: off means the JSX runtime is never touched.\n if (opts?.autoTrackTaps) this.autoTrackTaps().catch(err => debug.warn(\"Native autoTrackTaps failed:\", err));\n\n // app_lifecycle on foreground/background (#30)\n this.attachAppLifecycle().catch(err => {\n debug.log(\"Native attachAppLifecycle errors\", err);\n });\n\n this.trackErrors({ captureConsole: opts?.captureConsole }).catch(err => {\n debug.warn(\"Native trackErrors failed:\", err);\n });\n\n this.trackFrameDrops().catch(err => {\n debug.log(\"Native trackFrameDrops errors\", err);\n });\n this.trackNetworkRequests().catch(err => {\n debug.log(\"Native trackNetworkRequests errors\", err);\n });\n this.trackMemoryUsage().catch(err => {\n debug.log(\"Native trackMemoryUsage errors\", err);\n });\n }\n\n // app_lifecycle on foreground/background via RN AppState (#30).\n //\n // §4.2: neither build rotates on a lifecycle transition — parity with web is reached by\n // *deleting* the old background→finalize / foreground→newSession pair, not by adding it\n // to web. Backgrounding still forces a flush, because the process is now most likely to\n // be killed and the queue only lives in memory.\n async attachAppLifecycle() {\n const { AppState } = await import(\"react-native\") as any;\n const inst = await this.instancePromise;\n const { AppLifecycleEmitter } = await import(\"./adapters/appLifecycle\");\n const emitter = new AppLifecycleEmitter(inst);\n // seed current state — a transition-only emitter, so this enqueues nothing\n emitter.onState(AppState.currentState === \"active\")\n .catch((e: any) => debug.warn(\"app lifecycle seed failed:\", e));\n AppState.addEventListener(\"change\", (next: string) => {\n const isActive = next === \"active\";\n // Awaited before the flush, not fired alongside it: backgrounding is a view\n // boundary (§4.5) and the `view` row it emits is exactly the row this flush\n // exists to rescue from the kill that usually follows.\n emitter.onState(isActive)\n .then(() => (isActive ? undefined : inst.flush()))\n .catch((e: any) => debug.warn(\"background flush failed:\", e));\n });\n }\n\n async trackErrors(options?: { captureConsole?: boolean }) {\n const { CrashHandlerNative } = await import(\"./adapters/native/crashHandlerNative.native\");\n const inst = await this.instancePromise;\n return inst.trackErrors(new CrashHandlerNative(inst), options);\n }\n\n async getDeviceInfo() {\n const { DeviceInfoTrackerNative } = await import(\"./adapters/native/deviceInfo.native\");\n const inst = await this.instancePromise;\n const deviceInfoTrackerNative = new DeviceInfoTrackerNative();\n return inst.getDeviceInfo(deviceInfoTrackerNative);\n }\n\n async getNetworkInfo() {\n const { NetworkInfoTrackerNative } = await import(\"./adapters/native/networkInfo.native\");\n const inst = await this.instancePromise;\n const networkInfoTrackerNative = new NetworkInfoTrackerNative();\n return inst.getNetworkInfo(networkInfoTrackerNative);\n }\n\n async trackFrameDrops() {\n const { FrameDropTracker } = await import(\"./adapters/frameTracker\");\n const inst = await this.instancePromise;\n const frameDropTracker = new FrameDropTracker(inst);\n return inst.trackFrameDrops(frameDropTracker);\n }\n\n async trackNetworkRequests() {\n const { NetworkTrackerNative } = await import(\"./adapters/native/interceptHttpNative.native\");\n const inst = await this.instancePromise;\n const networkTracker = new NetworkTrackerNative(inst);\n return inst.trackNetworkRequests(networkTracker);\n }\n\n async trackMemoryUsage() {\n const { TelemetryMemoryUsageNative } = await import(\"./adapters/native/memoryNative.native\");\n const inst = await this.instancePromise;\n const memoryTracker = new TelemetryMemoryUsageNative(inst);\n return inst.trackMemoryUsage(memoryTracker);\n }\n\n // ---------- Screen Management ----------\n\n /**\n * Rung 1 of the name ladder (§4.5.1) — `explicit`, and never normalized: a host naming a\n * screen \"Step 2 of 3\" must not receive \"Step {id} of {id}\". Emits no `navigation` (#163).\n */\n async screenStart(name: string) {\n const inst = await this.instancePromise;\n return inst.enterView(name, \"explicit\");\n }\n\n /** @deprecated No-op since v5 (#163) — `screen.duration` is gone; `view.time_spent` replaces it. Deleted in v6. */\n async screenEnd(_name: string) { }\n\n /** @deprecated No-op since v5 (#163) — use `attachNavigation(ref)` or `screenStart(name)`. Deleted in v6. */\n async trackRoute(_from: string, _to: string) { }\n\n // ---------- Interactions ----------\n\n /**\n * §4.6's native producer, explicit-only (#103). `interactionProps()` is gone with\n * `user.interaction` (#102): it sat on the consumer's **root** `<View>`, where\n * `PressEvent.nativeEvent.target` is a node tag number with no public API resolving it,\n * so it could not tell a tap on a button from a tap on padding and every row it emitted\n * was un-nameable. There is no role model to gate on and no DOM to derive from, so\n * anything auto-derived here would be either wrong or a PII leak.\n *\n * `name` is web's rung 1 — explicit author intent — so it ships **unnormalized and\n * uncapped**, and `ui.name_source` has exactly **two** values: `edge_action`, or `none`\n * for a blank name, whose `ui.target` is `unnamed`. **`surface` never appears**: it only\n * means something where role-less elements exist.\n *\n * ⚠ **The mint/emit split.** The row's `timestamp`, `view.id`, `view.name` and\n * `session.id` are snapshotted **here, synchronously**, because the host's press handler\n * navigates on the next line and the emit rides a promise. Stamping emit time would\n * attribute a navigating tap to **the view it opened**, inverting every \"which screen\n * frustrates users\" query. Before `instancePromise` settles there is no core to snapshot\n * from, so a tap that early falls back to emit-time identity — the launch view either\n * way.\n *\n * ⚠ **`ui.dead` is absent on every native row**, never `false`: with no DOM there is no\n * mutation signal, so any dead-click *rate* must filter to the web build.\n */\n async trackTap(name: string) {\n this.explicitTaps++;\n const at = Date.now();\n const named = typeof name === \"string\" && name.trim() !== \"\";\n const attrs = uiAttributes({\n type: \"tap\",\n target: named ? name : UI_UNNAMED,\n nameSource: named ? \"edge_action\" : \"none\",\n // No element model: nothing was resolved, so the tag names the platform rather\n // than inventing a `<button>` that does not exist. §4.6 types it never-null, as\n // it does the coordinates the builder floors at 0 — a `PressEvent` carries some,\n // but `trackTap(name)` deliberately takes none: the name is the whole contract.\n tag: \"native\",\n // Gated to named taps (§4.6): running rage over `unnamed` would not merely lose\n // information, it would invent a frustration event that never happened. Identity\n // is the name, which on native *is* the element — there is no node to key on.\n rage: named && this.tapRage.record(name, at),\n });\n // §6.2: **every** tap mints an interaction root, live carrier or not — a tap is a new\n // user action by definition, so the request it fires is its child and not the route\n // change's before it.\n const emit = (inst: any) =>\n inst.log(\"ui.interaction\", { ...inst.trace.interactionSpan(at), ...attrs }, inst.snapshot(at));\n // Swallowed like every other capture path: the README's own example calls this\n // un-awaited from an `onPress`, and a RUM SDK must not be able to fault the host with\n // an unhandled rejection.\n return Promise.resolve(this.resolved ? emit(this.resolved) : this.instancePromise.then(emit))\n .catch((err: unknown) => debug.warn(\"Native ui.interaction failed:\", err));\n }\n\n /**\n * #174's hook. Patches `react/jsx-runtime`, `react/jsx-dev-runtime` and `React.createElement`\n * — the module exports objects, which is what Babel's `(0, _jsxRuntime.jsx)` reads — so an\n * element with a function `onPress`/`onLongPress` gets a wrapper that emits on activation.\n *\n * Names never come from text or accessibility labels (`\"Pay John Kamau KES 5,000\"`):\n * `trackTap(name)` > `testID` (normalized like web rung 2, cap 64) > `unnamed`. Identity is\n * snapshotted and the interaction root minted **before** the handler runs; the row is emitted\n * after it, and skipped if the handler called `trackTap` itself.\n */\n private async autoTrackTaps() {\n const { patchElementFactories } = await import(\"./adapters/native/autoTaps.native\");\n const { normalizeUiName } = await import(\"./adapters/uiInteraction\");\n // `.default` is the CJS `module.exports` behind an interop namespace — the object\n // Babel-compiled code actually reads; the namespace itself is a copy.\n const load = (p: Promise<any>) => p.then((ns) => ns?.default ?? ns).catch(() => undefined);\n const modules = await Promise.all([\n load(import(\"react/jsx-runtime\")), load(import(\"react/jsx-dev-runtime\")), load(import(\"react\")),\n ]);\n patchElementFactories(modules, {\n explicitCount: () => this.explicitTaps,\n prepare: (kind, testID) => {\n const inst = this.resolved;\n if (!inst) return undefined; // before init: no core to snapshot from\n const at = Date.now();\n const name = typeof testID === \"string\" ? normalizeUiName(testID) : \"\";\n const span = inst.trace.interactionSpan(at);\n const snap = inst.snapshot(at);\n return () => {\n const attrs = uiAttributes({\n type: kind,\n target: name || UI_UNNAMED,\n nameSource: name ? \"test_id\" : \"none\",\n tag: \"native\",\n // Name-keyed and off for `unnamed`, as for `trackTap` — and recorded only\n // for a row that ships, so a handler's own `trackTap` is not counted twice.\n // Unreachable on a long press (3 holds of ≥500 ms cannot fit 1000 ms).\n rage: !!name && kind === \"tap\" && this.tapRage.record(name, at),\n });\n inst.log(\"ui.interaction\", { ...span, ...attrs }, snap)\n .catch((err: unknown) => debug.warn(\"Native auto ui.interaction failed:\", err));\n };\n },\n });\n }\n}\n","import { TelemetryNative } from \"./telemetryNative.native\";\nimport type { Store } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\nimport { normalizeAllowlist } from \"./adapters/traceHeader\";\nimport { setDebug } from \"./core/debug\";\n\nexport type TelemetryOpts = {\n apiKey: string; // required credential; must start with \"edge_\" (API key or JWT, #90)\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n // console.error -> app.error, console.warn -> a breadcrumb. Default OFF (§4.7, #100).\n captureConsole?: boolean;\n debug?: boolean; // SDK-internal diagnostics; off by default (#23)\n store?: Store; // persisted-state port (#89); either shape — the native path awaits\n // Constructor-only (§3.6) — there is deliberately no runtime setter for either.\n beforeSend?: BeforeSend; // sync scrubbing hook, run at enqueue over events and metrics\n sessionSampleRate?: number; // 0.0-1.0, sticky per session, re-rolled at rotation; default 1\n // §6.4/#99. Bare hosts, exact match, **ports ignored** (a deliberate mismatch with\n // `http.host`, which keeps the port — do not join them). Empty by default: v4 is dark on\n // upgrade. Listing a host asserts that host's CORS allows `traceparent`; a malformed\n // entry throws in dev and is dropped in production.\n traceHostAllowlist?: string[];\n // §4.8 — the symbolication resolve key. A git SHA or CI run number; consumer-supplied\n // (the SDK has zero OTA awareness), **omitted when unset, never `\"\"`**, and never\n // derived from app.version + app.build_number under any circumstances.\n buildId?: string;\n // #172 — consent. `false` constructs dark: nothing is sent or stored until `enable()`.\n enabled?: boolean;\n // #174 — native only, constructor-only, default false: capture every `onPress` /\n // `onLongPress` by patching the JSX runtime. Dark by default, like the trace allowlist.\n autoTrackTaps?: boolean;\n};\n\n// Deliberately loose: `apiKey` is the *credential*, and under AUTH_MODE=jwt it is\n// `edge_<jwt>` — a shape the collector's >=3-`_`-part API-key check would reject. Tightening\n// to that check here would hard-reject every JWT and make the segmented deployment\n// unreachable, which is the exact bug #90 exists to close. Prefix + non-empty remainder is\n// all we assert; the real catch is the 401 warn (contract §11.1).\nexport function assertApiKey(apiKey?: string) {\n if (!apiKey || !apiKey.startsWith(\"edge_\")) {\n throw new Error(\"createTelemetry: apiKey is required and must start with 'edge_'\");\n }\n}\n\n/**\n * Cross-platform factory for telemetry. The platform is chosen by the bundler\n * via the .web / .native file split — no runtime navigator sniffing.\n */\nexport function createTelemetry(opts: TelemetryOpts) {\n assertApiKey(opts?.apiKey);\n // §6.4's dev throw has to happen *here*, synchronously: the core Telemetry is built\n // inside `instancePromise`, which deliberately never rethrows, so a throw down there\n // would be a silently rejected promise instead of the loud config error dev asks for.\n // In production it drops the bad entry and reports through debug() — which is why the\n // gate has to be open first: the entry ctor's own setDebug() runs *after* this line, so\n // without this the production report would be a guaranteed no-op even with debug: true.\n // It runs again in TraceManager, where it is idempotent.\n setDebug(opts?.debug ?? false);\n normalizeAllowlist(opts?.traceHostAllowlist);\n return new TelemetryNative(opts);\n}\n"],"names":["TelemetryNative","TelemetryBase","opts","setDebug","RageTracker","RAGE_WINDOW_MS","debug","err","Telemetry","n","nativeSender","nativeStore","DeviceInfoTrackerNative","NetworkInfoTrackerNative","platform","DeviceStateNative","networkInfoTrackerNative","deviceInfoTrackerNative","store","sender","telemetry","runtimeReadyAt","processStartAt","startupDurationMs","seedRuntimeReady","processStart","end","AppState","inst","AppLifecycleEmitter","emitter","e","next","isActive","options","CrashHandlerNative","FrameDropTracker","frameDropTracker","NetworkTrackerNative","networkTracker","TelemetryMemoryUsageNative","memoryTracker","name","_name","_from","_to","at","named","attrs","uiAttributes","UI_UNNAMED","emit","patchElementFactories","normalizeUiName","load","p","ns","modules","kind","testID","span","snap","assertApiKey","apiKey","createTelemetry","normalizeAllowlist"],"mappings":";;;AAOO,MAAMA,UAAwBC,EAAc;AAAA,EAM/C,YAAYC,GAmBT;AACC,IAAAC,EAASD,GAAM,SAAS,EAAK,GAC7B,MAAA,GAzBJ,KAAiB,UAAU,IAAIE,EAAYC,CAAc,GAEzD,KAAQ,eAAe,GAyBnBC,EAAM,IAAI,6BAA6B,GACvC,KAAK,mBAAmB,YAAY;AAMhC,UAAI;AAAE,cAAM,OAAO,gCAAgC;AAAA,MAAG,SAC/CC,GAAK;AAAE,QAAAD,EAAM,KAAK,gDAAgDC,CAAG;AAAA,MAAG;AAE/E,YAAM,EAAE,WAAAC,EAAA,IAAc,MAAM,OAAO,yBAAkB,EAAA,KAAA,CAAAC,MAAAA,EAAA,CAAA,GAC/C,EAAE,cAAAC,EAAA,IAAiB,MAAM,OAAO,4BAAyB,GAEzD,EAAE,aAAAC,EAAA,IAAgB,MAAM,OAAO,4BAAgC,GAC/D,EAAE,yBAAAC,EAAA,IAA4B,MAAM,OAAO,iCAAqC,GAChF,EAAE,0BAAAC,EAAA,IAA6B,MAAM,OAAO,kCAAsC;AAGxF,UAAIC;AACJ,UAAI;AACA,SAAC,EAAE,UAAU,EAAE,IAAIA,IAAS,IAAM,MAAM,OAAO,cAAc;AAAA,MACjE,QAAQ;AAAA,MAAsD;AAE9D,YAAM,EAAE,mBAAAC,EAAA,IAAsB,MAAM,OAAO,kCAAs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GAC7B+D,EAAmB/D,GAAM,kBAAkB,GACpC,IAAIF,EAAgBE,CAAI;AACnC;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./memoryStore-BIGZmmfD.cjs");function k(n){if(!n||!n.startsWith("edge_"))throw new Error("createTelemetry: apiKey is required and must start with 'edge_'")}function y(n){return k(n?.apiKey),a.setDebug(n?.debug??!1),a.normalizeAllowlist(n?.traceHostAllowlist),new w(n)}class w extends a.TelemetryBase{constructor(t){a.setDebug(t?.debug??!1),super(),a.debug.log("🌍 Running Web Telemetry"),this.instancePromise=(async()=>{const{Telemetry:e}=await Promise.resolve().then(()=>require("./telemetry-CrU7i1Jc.cjs")),{webSender:r}=await Promise.resolve().then(()=>require("./webSender-CVtE4sOF.cjs")),{webStore:s}=await Promise.resolve().then(()=>require("./store.web-CvqqN-_Z.cjs")),{DeviceInfoTrackerWeb:i}=await Promise.resolve().then(()=>require("./deviceInfo.web-3L3IDQQA.cjs")),{NetworkInfoTrackerWeb:o}=await Promise.resolve().then(()=>require("./networkInfo.web-PltJTHsy.cjs")),d=new i,h=new o,u=t?.store??s(),m=t?.sender??r(t?.endpoint,t?.apiKey,u),c=new e({sender:m,batchSize:t?.batchSize,flushIntervalMs:t?.flushIntervalMs,endpoint:t?.endpoint,platform:"web",traceLaunchStart:typeof performance<"u"?performance.timeOrigin:void 0,deviceInfoHandler:d,networkInfoHandler:h,store:u,beforeSend:t?.beforeSend,sessionSampleRate:t?.sessionSampleRate,traceHostAllowlist:t?.traceHostAllowlist,buildId:t?.buildId,deprecatedScreenFeeds:!1}),{runtimeReadyAt:b}=await Promise.resolve().then(()=>require("./runtimeReady.web-DHW682RN.cjs")).catch(l=>(a.debug.warn("Web runtime-ready module unavailable:",l),{runtimeReadyAt:async()=>{}})),{seedRuntimeReady:f}=await Promise.resolve().then(()=>require("./seedRuntimeReady-BKwkBEAF.cjs"));return f(c.views,b,"Web"),await c.resumeOrStartSession().catch(l=>a.debug.warn("Web session resume failed:",l)),c})(),this.trackErrors({captureConsole:t?.captureConsole}).catch(e=>{a.debug.warn("Web trackErrors failed:",e)}),this.trackFrameDrops().catch(e=>{a.debug.log("Web trackFrameDrops errors",e)}),this.trackNetworkRequests().catch(e=>{a.debug.log("Web trackNetworkRequests errors",e)}),this.autoTrackNavigation().catch(e=>{a.debug.log("Web autoTrackNavigation errors",e)}),this.trackInteractions().catch(e=>{a.debug.log("Web trackInteractions errors",e)}),this.trackWebVitals().catch(e=>{a.debug.log("Web trackWebVitals errors",e)}),this.attachAppLifecycle().catch(e=>{a.debug.log("Web attachAppLifecycle errors",e)}),this.attachBfcacheRestore().catch(e=>{a.debug.log("Web attachBfcacheRestore errors",e)})}async attachBfcacheRestore(){if(typeof window>"u")return;const t=await this.instancePromise;window.addEventListener("pageshow",e=>{e.persisted&&t.resumeOrStartSession().catch(r=>a.debug.warn("Web bfcache session resume failed:",r))})}async attachAppLifecycle(){if(typeof document>"u")return;const t=await this.instancePromise,{AppLifecycleEmitter:e}=await Promise.resolve().then(()=>require("./appLifecycle-CECgRVu_.cjs")),r=new e(t),s=()=>{const i=document.visibilityState==="visible";return r.onState(i).then(()=>i?void 0:t.flush()).catch(o=>a.debug.warn("Web app lifecycle failed:",o))};s(),document.addEventListener("visibilitychange",s)}async trackErrors(t){const{CrashHandler:e}=await Promise.resolve().then(()=>require("./crashHandler.web-CWmF56mJ.cjs")),r=await this.instancePromise,s=new e(r);return r.trackErrors(s,t)}async trackFrameDrops(){const{FrameDropTracker:t}=await Promise.resolve().then(()=>require("./frameTracker-CHG6sIx9.cjs")),e=await this.instancePromise,r=new t(e);return e.trackFrameDrops(r)}async trackNetworkRequests(){const{NetworkTrackerWeb:t}=await Promise.resolve().then(()=>require("./interceptFetchWeb.web-T88kO-bE.cjs")),e=await this.instancePromise,r=new t(e);return e.trackNetworkRequests(r)}async trackInteractions(){const{InteractionTrackerWeb:t}=await Promise.resolve().then(()=>require("./interactionWeb.web-Bl_cZlgh.cjs")),e=await this.instancePromise;(e.webInteractions??=new t(e)).start()}async trackWebVitals(){const{WebVitalsTracker:t}=await Promise.resolve().then(()=>require("./webVitals.web-DpWJ-iYp.cjs")),e=await this.instancePromise;await(e.webVitals??=new t(e)).start()}async autoTrackNavigation(){const{NavigationTrackerWeb:t}=await Promise.resolve().then(()=>require("./navigationWeb.web-CW_z7Ca4.cjs")),e=await this.instancePromise,r=new t(e);return e.start(r)}async getDeviceInfo(){const{DeviceInfoTrackerWeb:t}=await Promise.resolve().then(()=>require("./deviceInfo.web-3L3IDQQA.cjs")),e=await this.instancePromise,r=new t;return e.getDeviceInfo(r)}async getNetworkInfo(){const{NetworkInfoTrackerWeb:t}=await Promise.resolve().then(()=>require("./networkInfo.web-PltJTHsy.cjs")),e=await this.instancePromise,r=new t;return e.getNetworkInfo(r)}}exports.memoryStore=a.memoryStore;exports.TelemetryWeb=w;exports.createTelemetry=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./react-bqe7KPOf.cjs");class y extends r.TelemetryBase{constructor(t){r.setDebug(t?.debug??!1),super(),r.debug.log("🌍 Running Web Telemetry"),this.instancePromise=(async()=>{const{Telemetry:e}=await Promise.resolve().then(()=>require("./telemetry-CW63glwb.cjs")).then(i=>i.telemetry),{webSender:a}=await Promise.resolve().then(()=>require("./webSender-DA087xb5.cjs")),{webStore:s}=await Promise.resolve().then(()=>require("./store.web-BzKaP57Z.cjs")),{DeviceInfoTrackerWeb:c}=await Promise.resolve().then(()=>require("./deviceInfo.web-DGCUHAnv.cjs")),{NetworkInfoTrackerWeb:u}=await Promise.resolve().then(()=>require("./networkInfo.web-DfO-BUFx.cjs")),{DeviceStateWeb:w}=await Promise.resolve().then(()=>require("./deviceState.web-CSfUgHDU.cjs")),h=new c,m=new u,l=t?.store??s(),b=t?.sender??a(t?.endpoint,t?.apiKey,l),o=new e({sender:b,batchSize:t?.batchSize,flushIntervalMs:t?.flushIntervalMs,endpoint:t?.endpoint,platform:"web",traceLaunchStart:typeof performance<"u"?performance.timeOrigin:void 0,deviceInfoHandler:h,networkInfoHandler:m,store:l,beforeSend:t?.beforeSend,sessionSampleRate:t?.sessionSampleRate,traceHostAllowlist:t?.traceHostAllowlist,buildId:t?.buildId,enabled:t?.enabled,deviceStateHandler:new w}),{runtimeReadyAt:d}=await Promise.resolve().then(()=>require("./runtimeReady.web-vhAJFU61.cjs")).catch(i=>(r.debug.warn("Web runtime-ready module unavailable:",i),{runtimeReadyAt:async()=>{}})),{seedRuntimeReady:f}=await Promise.resolve().then(()=>require("./seedRuntimeReady-CbjqbWCd.cjs"));return f(o.views,d,"Web"),o.views.anchorInitial(typeof performance<"u"?performance.timeOrigin:void 0),o.appStartMs=()=>d().then(i=>i===void 0?void 0:i-performance.timeOrigin),await o.resumeOrStartSession().catch(i=>r.debug.warn("Web session resume failed:",i)),this.resolved=o,o})(),this.trackErrors({captureConsole:t?.captureConsole}).catch(e=>{r.debug.warn("Web trackErrors failed:",e)}),this.trackFrameDrops().catch(e=>{r.debug.log("Web trackFrameDrops errors",e)}),this.trackNetworkRequests().catch(e=>{r.debug.log("Web trackNetworkRequests errors",e)}),this.autoTrackNavigation().catch(e=>{r.debug.log("Web autoTrackNavigation errors",e)}),this.trackInteractions().catch(e=>{r.debug.log("Web trackInteractions errors",e)}),this.trackWebVitals().catch(e=>{r.debug.log("Web trackWebVitals errors",e)}),this.attachAppLifecycle().catch(e=>{r.debug.log("Web attachAppLifecycle errors",e)}),this.attachBfcacheRestore().catch(e=>{r.debug.log("Web attachBfcacheRestore errors",e)}),this.attachCrossTabSync().catch(e=>{r.debug.log("Web attachCrossTabSync errors",e)})}async attachCrossTabSync(){if(typeof window>"u")return;const t=await this.instancePromise,{SESSION_KEY:e}=await Promise.resolve().then(()=>require("./telemetry-CW63glwb.cjs")).then(a=>a.telemetry);window.addEventListener("storage",a=>{a.key===e&&t.adoptSessionRecord(a.newValue).catch(s=>r.debug.warn("Web cross-tab session sync failed:",s))})}async attachBfcacheRestore(){if(typeof window>"u")return;const t=await this.instancePromise;window.addEventListener("pageshow",e=>{e.persisted&&t.resumeOrStartSession().catch(a=>r.debug.warn("Web bfcache session resume failed:",a))})}async attachAppLifecycle(){if(typeof document>"u")return;const t=await this.instancePromise,{AppLifecycleEmitter:e}=await Promise.resolve().then(()=>require("./appLifecycle-DS_fEclk.cjs")),a=new e(t),s=()=>{const c=document.visibilityState==="visible";return a.onState(c).then(()=>c?void 0:t.flush()).catch(u=>r.debug.warn("Web app lifecycle failed:",u))};s(),document.addEventListener("visibilitychange",s)}async trackErrors(t){const{CrashHandler:e}=await Promise.resolve().then(()=>require("./crashHandler.web-6KvedEB-.cjs")),a=await this.instancePromise,s=new e(a);return a.trackErrors(s,t)}async trackFrameDrops(){const{FrameDropTracker:t}=await Promise.resolve().then(()=>require("./frameTracker-9j0en6Zm.cjs")),e=await this.instancePromise,a=new t(e);return e.trackFrameDrops(a)}async trackNetworkRequests(){const{NetworkTrackerWeb:t}=await Promise.resolve().then(()=>require("./interceptFetchWeb.web-ZHw6IQkU.cjs")),e=await this.instancePromise,a=new t(e);return e.trackNetworkRequests(a)}async trackInteractions(){const{InteractionTrackerWeb:t}=await Promise.resolve().then(()=>require("./interactionWeb.web-CKDJLD9r.cjs")),e=await this.instancePromise;(e.webInteractions??=new t(e)).start()}async trackWebVitals(){const{WebVitalsTracker:t}=await Promise.resolve().then(()=>require("./webVitals.web-DvScDIjX.cjs")),e=await this.instancePromise;await(e.webVitals??=new t(e)).start()}async autoTrackNavigation(){const{NavigationTrackerWeb:t}=await Promise.resolve().then(()=>require("./navigationWeb.web-DwWjL80b.cjs")),e=await this.instancePromise;return e.autoTrackNavigation(new t(e))}async getDeviceInfo(){const{DeviceInfoTrackerWeb:t}=await Promise.resolve().then(()=>require("./deviceInfo.web-DGCUHAnv.cjs")),e=await this.instancePromise,a=new t;return e.getDeviceInfo(a)}async getNetworkInfo(){const{NetworkInfoTrackerWeb:t}=await Promise.resolve().then(()=>require("./networkInfo.web-DfO-BUFx.cjs")),e=await this.instancePromise,a=new t;return e.getNetworkInfo(a)}}function v(n){if(!n||!n.startsWith("edge_"))throw new Error("createTelemetry: apiKey is required and must start with 'edge_'")}function k(n){return v(n?.apiKey),r.setDebug(n?.debug??!1),r.normalizeAllowlist(n?.traceHostAllowlist),new y(n)}exports.EdgeErrorBoundary=r.EdgeErrorBoundary;exports.memoryStore=r.memoryStore;exports.useScreenReady=r.useScreenReady;exports.createTelemetry=k;
2
2
  //# sourceMappingURL=index.web.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.web.cjs","sources":["../src/createTelemetry.web.ts","../src/index.web.ts"],"sourcesContent":["import { TelemetryWeb } from \"./index.web\";\nimport type { SyncStore } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\nimport { normalizeAllowlist } from \"./adapters/traceHeader\";\nimport { setDebug } from \"./core/debug\";\n\nexport type TelemetryOpts = {\n apiKey: string; // required credential; must start with \"edge_\" (API key or JWT, #90)\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n // console.error -> app.error, console.warn -> a breadcrumb. Default OFF (§4.7, #100).\n captureConsole?: boolean;\n debug?: boolean; // SDK-internal diagnostics; off by default (#23)\n store?: SyncStore; // persisted-state port (#89); MUST be sync — see core/store.ts\n // Constructor-only (§3.6) — there is deliberately no runtime setter for either.\n beforeSend?: BeforeSend; // sync scrubbing hook, run at enqueue over events and metrics\n sessionSampleRate?: number; // 0.0-1.0, sticky per session, re-rolled at rotation; default 1\n // §6.4/#99. Bare hosts, exact match, **ports ignored** (a deliberate mismatch with\n // `http.host`, which keeps the port — do not join them). Empty by default: v4 is dark on\n // upgrade. Listing a host asserts that host's CORS allows `traceparent`; a malformed\n // entry throws in dev and is dropped in production.\n traceHostAllowlist?: string[];\n // §4.8 — the symbolication resolve key. A git SHA or CI run number; consumer-supplied\n // (the SDK has zero OTA awareness), **omitted when unset, never `\"\"`**, and never\n // derived from app.version + app.build_number under any circumstances.\n buildId?: string;\n};\n\n// Deliberately loose: `apiKey` is the *credential*, and under AUTH_MODE=jwt it is\n// `edge_<jwt>` — a shape the collector's >=3-`_`-part API-key check would reject. Tightening\n// to that check here would hard-reject every JWT and make the segmented deployment\n// unreachable, which is the exact bug #90 exists to close. Prefix + non-empty remainder is\n// all we assert; the real catch is the 401 warn (contract §11.1).\nexport function assertApiKey(apiKey?: string) {\n if (!apiKey || !apiKey.startsWith(\"edge_\")) {\n throw new Error(\"createTelemetry: apiKey is required and must start with 'edge_'\");\n }\n}\n\n/**\n * Cross-platform factory for telemetry. The platform is chosen by the bundler\n * via the .web / .native file split — no runtime navigator sniffing.\n */\nexport function createTelemetry(opts: TelemetryOpts) {\n assertApiKey(opts?.apiKey);\n // §6.4's dev throw has to happen *here*, synchronously: the core Telemetry is built\n // inside `instancePromise`, which deliberately never rethrows, so a throw down there\n // would be a silently rejected promise instead of the loud config error dev asks for.\n // In production it drops the bad entry and reports through debug() — which is why the\n // gate has to be open first: the entry ctor's own setDebug() runs *after* this line, so\n // without this the production report would be a guaranteed no-op even with debug: true.\n // It runs again in TraceManager, where it is idempotent.\n setDebug(opts?.debug ?? false);\n normalizeAllowlist(opts?.traceHostAllowlist);\n return new TelemetryWeb(opts);\n}\n","// src/index.web.ts\nimport { TelemetryBase } from \"./index.base\";\nimport { debug, setDebug } from \"./core/debug\";\nimport type { SyncStore } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\n\nexport { createTelemetry, type TelemetryOpts } from \"./createTelemetry.web\";\n\n// The Store port (#89) — public so a consumer can inject their own persistence,\n// and so the in-memory fake is available outside the test tree.\nexport type { Store, SyncStore, AsyncStore, StoreRead, StoreWrite } from \"./core/store\";\nexport { memoryStore, type MemoryStoreOpts } from \"./core/memoryStore\";\n\n// The scrubbing hook (#93) — public so a consumer can type their beforeSend.\nexport type { BeforeSend } from \"./core/beforeSend\";\n\nexport class TelemetryWeb extends TelemetryBase {\n constructor(opts?: {\n apiKey?: string;\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n captureConsole?: boolean;\n debug?: boolean;\n store?: SyncStore; // sync only: the web build's guarantee depends on it\n // Constructor-only (§3.6). No runtime setter: registering later leaves a window\n // where session.started and the earliest requests have already been enqueued.\n beforeSend?: BeforeSend;\n sessionSampleRate?: number;\n // §6.4/#99 — bare hosts, exact match, ports ignored, empty by default.\n traceHostAllowlist?: string[];\n // §4.8 — symbolication resolve key. Omitted when unset, never `\"\"`, never derived.\n buildId?: string;\n }) {\n setDebug(opts?.debug ?? false); // gate SDK console noise before anything logs (#23)\n super();\n\n debug.log(\"🌍 Running Web Telemetry\");\n\n this.instancePromise = (async () => {\n const { Telemetry } = await import(\"./core/telemetry\");\n const { webSender } = await import(\"./adapters/webSender\");\n const { webStore } = await import(\"./adapters/web/store.web\");\n\n const { DeviceInfoTrackerWeb } = await import(\"./adapters/web/deviceInfo.web\");\n const { NetworkInfoTrackerWeb } = await import(\"./adapters/web/networkInfo.web\");\n const deviceInfoTrackerWeb = new DeviceInfoTrackerWeb();\n const networkInfoTrackerWeb = new NetworkInfoTrackerWeb();\n\n // One store, shared by the offline queue and core (#89) — so a consumer that\n // injects a store governs both, instead of the sender quietly keeping its own.\n const store = opts?.store ?? webStore();\n const sender = opts?.sender ?? webSender(opts?.endpoint, opts?.apiKey, store);\n\n const telemetry = new Telemetry({\n sender,\n batchSize: opts?.batchSize,\n flushIntervalMs: opts?.flushIntervalMs,\n endpoint: opts?.endpoint,\n // device.id is suffixed `_web`; session.id is not — §3.3 gives session.id a\n // `_web` suffix only in v4. generateSessionId() holds that rule.\n platform: \"web\",\n // §6.2: web's launch root reports true navigation start, which is *better*\n // than Android's fork-time-free approximation — and is why native's and\n // web's launch envelopes must not be compared as the same interval.\n traceLaunchStart: typeof performance !== \"undefined\" ? performance.timeOrigin : undefined,\n deviceInfoHandler: deviceInfoTrackerWeb,\n networkInfoHandler: networkInfoTrackerWeb,\n store,\n beforeSend: opts?.beforeSend,\n sessionSampleRate: opts?.sessionSampleRate,\n traceHostAllowlist: opts?.traceHostAllowlist,\n buildId: opts?.buildId,\n // §4.11: web has never emitted `screen.duration`, and a now-shared\n // attachNavigation must not be what starts it. `navigation` is untouched by\n // this flag — web's own history+popstate path still emits it (see the known\n // gap in CLAUDE.md); the flag only stops the ref path adding a second feed.\n deprecatedScreenFeeds: false,\n });\n\n // Resume or start the session before the instance is visible (#92). On web the\n // Store is localStorage, so a hard reload, a bfcache restore and a second tab\n // all resume the same session.\n // Never rethrown into instancePromise: finalizeSession() flushes, flush() rethrows on a\n // dead collector, and a rejected instancePromise would brick every public method for the\n // life of the process. Hydration has already run; only the emission is lost.\n // §4.5.2's `initial_load` seed: the launch view stays busy until the platform's\n // runtime-ready marker. The *module* is awaited with everything else, so the seed\n // is armed before `instancePromise` resolves; the *marker* is not, because on web\n // it arrives with the load event and blocking init on it would delay every host\n // call behind the page's own images.\n // The module is awaited so the seed is armed before `instancePromise` resolves,\n // but never rethrown into it: a failed chunk load must not brick every public\n // method for the life of the process. A missing reader just releases the gate.\n const { runtimeReadyAt } = await import(\"./adapters/web/runtimeReady.web\")\n .catch((err: unknown) => {\n debug.warn(\"Web runtime-ready module unavailable:\", err);\n return { runtimeReadyAt: async () => undefined };\n });\n const { seedRuntimeReady } = await import(\"./adapters/seedRuntimeReady\");\n seedRuntimeReady(telemetry.views, runtimeReadyAt, \"Web\");\n\n await telemetry.resumeOrStartSession()\n .catch(err => debug.warn(\"Web session resume failed:\", err));\n\n return telemetry;\n })();\n\n this.trackErrors({ captureConsole: opts?.captureConsole }).catch(err => {\n debug.warn(\"Web trackErrors failed:\", err);\n });\n\n this.trackFrameDrops().catch(err => {\n debug.log(\"Web trackFrameDrops errors\", err);\n });\n this.trackNetworkRequests().catch(err => {\n debug.log(\"Web trackNetworkRequests errors\", err);\n });\n this.autoTrackNavigation().catch(err => {\n debug.log(\"Web autoTrackNavigation errors\", err);\n });\n this.trackInteractions().catch(err => {\n debug.log(\"Web trackInteractions errors\", err);\n });\n this.trackWebVitals().catch(err => {\n debug.log(\"Web trackWebVitals errors\", err);\n });\n this.attachAppLifecycle().catch(err => {\n debug.log(\"Web attachAppLifecycle errors\", err);\n });\n this.attachBfcacheRestore().catch(err => {\n debug.log(\"Web attachBfcacheRestore errors\", err);\n });\n }\n\n /**\n * A bfcache restore resumes a frozen JS context, so the in-memory session survives on its\n * own — but the freeze can have outlasted the idle window, and a sibling tab may have\n * rotated the shared localStorage record while this one was suspended. Re-running the\n * init decision against the Store is what reconciles both (#92, §4.2).\n */\n private async attachBfcacheRestore() {\n if (typeof window === \"undefined\") return;\n const inst = await this.instancePromise;\n window.addEventListener(\"pageshow\", (e: PageTransitionEvent) => {\n if (!e.persisted) return; // an ordinary load already ran this at init\n inst.resumeOrStartSession()\n .catch((err: any) => debug.warn(\"Web bfcache session resume failed:\", err));\n });\n }\n\n // app_lifecycle on tab visibility change — web equivalent of native AppState (#30)\n async attachAppLifecycle() {\n if (typeof document === \"undefined\") return;\n const inst = await this.instancePromise;\n const { AppLifecycleEmitter } = await import(\"./adapters/appLifecycle\");\n const emitter = new AppLifecycleEmitter(inst);\n const onState = () => {\n const isActive = document.visibilityState === \"visible\";\n // Awaited before the flush, not fired alongside it — the same ordering native has\n // (§4.5). Backgrounding is a view boundary, and the rows it emits are exactly the\n // rows this flush exists to rescue: the `view` row, and §5.3's drained CLS and INP,\n // whose whole reason for being held is that the library's page-hide report loses\n // them on a closed tab. Holding them and then not flushing would move that defect\n // rather than close it. Web's sender uses `fetch({keepalive:true})`, which is what\n // lets a hidden tab's batch outlive the document.\n return emitter.onState(isActive)\n .then(() => (isActive ? undefined : inst.flush()))\n .catch((e: any) => debug.warn(\"Web app lifecycle failed:\", e));\n };\n onState(); // seed current state\n document.addEventListener(\"visibilitychange\", onState);\n }\n\n // Web uses the web crash handler (window.onerror/onunhandledrejection), not the native one.\n async trackErrors(options?: { captureConsole?: boolean }) {\n const { CrashHandler } = await import(\"./adapters/web/crashHandler.web\");\n const inst = await this.instancePromise;\n const crashHandler = new CrashHandler(inst);\n return inst.trackErrors(crashHandler, options);\n }\n\n async trackFrameDrops() {\n const { FrameDropTracker } = await import(\"./adapters/frameTracker\");\n const inst = await this.instancePromise;\n const frameDropTracker = new FrameDropTracker(inst);\n return inst.trackFrameDrops(frameDropTracker);\n }\n\n async trackNetworkRequests() {\n const { NetworkTrackerWeb } = await import(\"./adapters/web/interceptFetchWeb.web\");\n const inst = await this.instancePromise;\n const networkTracker = new NetworkTrackerWeb(inst);\n return inst.trackNetworkRequests(networkTracker);\n }\n\n // §5.2/#105: web emits no `memory_usage` at all, and exposes no `trackMemoryUsage`.\n // Why, in CLAUDE.md's `memory_usage` section.\n\n /**\n * §4.6/#102 — one capture-phase `click` listener on `document`. Auto-started, like every\n * other capture: `ui.interaction` is what §6.2's interaction root hangs off, so a\n * consumer forgetting to call it would leave every tap-driven request unattributed.\n */\n async trackInteractions() {\n const { InteractionTrackerWeb } = await import(\"./adapters/web/interactionWeb.web\");\n const inst = await this.instancePromise;\n // One tracker per core instance, like the XHR patch: `start()`'s own guard is\n // per-tracker, so constructing a fresh one on a second call would add a second\n // capture-phase listener and double every `ui.interaction` row.\n (inst.webInteractions ??= new InteractionTrackerWeb(inst)).start();\n }\n\n /**\n * §5.3/#106 — the five Core Web Vitals on the metric path, web only. Auto-started and\n * deliberately not public API: there is nothing for a consumer to configure, and a vital\n * that only fires if someone remembered to call a method is a vital nobody has.\n *\n * `web-vitals/attribution` is bundled, so this is the only import of it in the tree and\n * `index.native` never reaches it. A failed chunk load is caught by the caller and costs\n * the vitals, nothing else.\n */\n private async trackWebVitals() {\n const { WebVitalsTracker } = await import(\"./adapters/web/webVitals.web\");\n const inst = await this.instancePromise;\n // One tracker per core instance: `start()`'s guard is per-tracker, so a fresh one on a\n // second call would double-subscribe and double every vital row.\n await (inst.webVitals ??= new WebVitalsTracker(inst)).start();\n }\n\n async autoTrackNavigation() {\n const { NavigationTrackerWeb } = await import(\"./adapters/web/navigationWeb.web\");\n const inst = await this.instancePromise;\n const navigationTracker = new NavigationTrackerWeb(inst);\n return inst.start(navigationTracker);\n }\n\n async getDeviceInfo() {\n const { DeviceInfoTrackerWeb } = await import(\"./adapters/web/deviceInfo.web\");\n const inst = await this.instancePromise;\n const deviceInfoTrackerWeb = new DeviceInfoTrackerWeb();\n return inst.getDeviceInfo(deviceInfoTrackerWeb);\n }\n\n async getNetworkInfo() {\n const { NetworkInfoTrackerWeb } = await import(\"./adapters/web/networkInfo.web\");\n const inst = await this.instancePromise;\n const networkInfoTrackerWeb = new NetworkInfoTrackerWeb();\n return inst.getNetworkInfo(networkInfoTrackerWeb);\n }\n}\n"],"names":["assertApiKey","apiKey","createTelemetry","opts","setDebug","normalizeAllowlist","TelemetryWeb","TelemetryBase","debug","Telemetry","webSender","webStore","DeviceInfoTrackerWeb","NetworkInfoTrackerWeb","deviceInfoTrackerWeb","networkInfoTrackerWeb","store","sender","telemetry","runtimeReadyAt","err","seedRuntimeReady","inst","AppLifecycleEmitter","emitter","onState","isActive","e","options","CrashHandler","crashHandler","FrameDropTracker","frameDropTracker","NetworkTrackerWeb","networkTracker","InteractionTrackerWeb","WebVitalsTracker","NavigationTrackerWeb","navigationTracker"],"mappings":"8HAmCO,SAASA,EAAaC,EAAiB,CAC1C,GAAI,CAACA,GAAU,CAACA,EAAO,WAAW,OAAO,EACrC,MAAM,IAAI,MAAM,iEAAiE,CAEzF,CAMO,SAASC,EAAgBC,EAAqB,CACjD,OAAAH,EAAaG,GAAM,MAAM,EAQzBC,WAASD,GAAM,OAAS,EAAK,EAC7BE,EAAAA,mBAAmBF,GAAM,kBAAkB,EACpC,IAAIG,EAAaH,CAAI,CAChC,CCzCO,MAAMG,UAAqBC,EAAAA,aAAc,CAC5C,YAAYJ,EAiBT,CACCC,WAASD,GAAM,OAAS,EAAK,EAC7B,MAAA,EAEAK,EAAAA,MAAM,IAAI,0BAA0B,EAEpC,KAAK,iBAAmB,SAAY,CACh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AA,IAAA,QAAO,8BAA8B,CAAA,EAClEd,EAAO,MAAM,KAAK,gBAGxB,MAAOA,EAAK,YAAc,IAAIc,EAAiBd,CAAI,GAAG,MAAA,CAC1D,CAEA,MAAM,qBAAsB,CACxB,KAAM,CAAE,qBAAAe,CAAA,EAAyB,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,kCAAkC,CAAA,EAC1Ef,EAAO,MAAM,KAAK,gBAClBgB,EAAoB,IAAID,EAAqBf,CAAI,EACvD,OAAOA,EAAK,MAAMgB,CAAiB,CACvC,CAEA,MAAM,eAAgB,CAClB,KAAM,CAAE,qBAAA1B,CAAA,EAAyB,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,+BAA+B,CAAA,EACvEU,EAAO,MAAM,KAAK,gBAClBR,EAAuB,IAAIF,EACjC,OAAOU,EAAK,cAAcR,CAAoB,CAClD,CAEA,MAAM,gBAAiB,CACnB,KAAM,CAAE,sBAAAD,CAAA,EAA0B,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,gCAAgC,CAAA,EACzES,EAAO,MAAM,KAAK,gBAClBP,EAAwB,IAAIF,EAClC,OAAOS,EAAK,eAAeP,CAAqB,CACpD,CACJ"}
1
+ {"version":3,"file":"index.web.cjs","sources":["../src/telemetryWeb.web.ts","../src/createTelemetry.web.ts"],"sourcesContent":["import { TelemetryBase } from \"./index.base\";\nimport { debug, setDebug } from \"./core/debug\";\nimport type { SyncStore } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\n\nexport class TelemetryWeb extends TelemetryBase {\n constructor(opts?: {\n apiKey?: string;\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n captureConsole?: boolean;\n debug?: boolean;\n store?: SyncStore; // sync only: the web build's guarantee depends on it\n // Constructor-only (§3.6). No runtime setter: registering later leaves a window\n // where session.started and the earliest requests have already been enqueued.\n beforeSend?: BeforeSend;\n sessionSampleRate?: number;\n // §6.4/#99 — bare hosts, exact match, ports ignored, empty by default.\n traceHostAllowlist?: string[];\n // §4.8 — symbolication resolve key. Omitted when unset, never `\"\"`, never derived.\n buildId?: string;\n enabled?: boolean;\n }) {\n setDebug(opts?.debug ?? false); // gate SDK console noise before anything logs (#23)\n super();\n\n debug.log(\"🌍 Running Web Telemetry\");\n\n this.instancePromise = (async () => {\n const { Telemetry } = await import(\"./core/telemetry\");\n const { webSender } = await import(\"./adapters/webSender\");\n const { webStore } = await import(\"./adapters/web/store.web\");\n\n const { DeviceInfoTrackerWeb } = await import(\"./adapters/web/deviceInfo.web\");\n const { NetworkInfoTrackerWeb } = await import(\"./adapters/web/networkInfo.web\");\n const { DeviceStateWeb } = await import(\"./adapters/web/deviceState.web\");\n const deviceInfoTrackerWeb = new DeviceInfoTrackerWeb();\n const networkInfoTrackerWeb = new NetworkInfoTrackerWeb();\n\n // One store, shared by the offline queue and core (#89) — so a consumer that\n // injects a store governs both, instead of the sender quietly keeping its own.\n const store = opts?.store ?? webStore();\n const sender = opts?.sender ?? webSender(opts?.endpoint, opts?.apiKey, store);\n\n const telemetry = new Telemetry({\n sender,\n batchSize: opts?.batchSize,\n flushIntervalMs: opts?.flushIntervalMs,\n endpoint: opts?.endpoint,\n // device.id is suffixed `_web`; session.id is not — §3.3 gives session.id a\n // `_web` suffix only in v4. generateSessionId() holds that rule.\n platform: \"web\",\n // §6.2: web's launch root reports true navigation start, which is *better*\n // than Android's fork-time-free approximation — and is why native's and\n // web's launch envelopes must not be compared as the same interval.\n traceLaunchStart: typeof performance !== \"undefined\" ? performance.timeOrigin : undefined,\n deviceInfoHandler: deviceInfoTrackerWeb,\n networkInfoHandler: networkInfoTrackerWeb,\n store,\n beforeSend: opts?.beforeSend,\n sessionSampleRate: opts?.sessionSampleRate,\n traceHostAllowlist: opts?.traceHostAllowlist,\n buildId: opts?.buildId,\n enabled: opts?.enabled,\n deviceStateHandler: new DeviceStateWeb(),\n });\n\n // Resume or start the session before the instance is visible (#92). On web the\n // Store is localStorage, so a hard reload, a bfcache restore and a second tab\n // all resume the same session.\n // Never rethrown into instancePromise: finalizeSession() flushes, flush() rethrows on a\n // dead collector, and a rejected instancePromise would brick every public method for the\n // life of the process. Hydration has already run; only the emission is lost.\n // §4.5.2's `initial_load` seed: the launch view stays busy until the platform's\n // runtime-ready marker. The *module* is awaited with everything else, so the seed\n // is armed before `instancePromise` resolves; the *marker* is not, because on web\n // it arrives with the load event and blocking init on it would delay every host\n // call behind the page's own images.\n // The module is awaited so the seed is armed before `instancePromise` resolves,\n // but never rethrown into it: a failed chunk load must not brick every public\n // method for the life of the process. A missing reader just releases the gate.\n const { runtimeReadyAt } = await import(\"./adapters/web/runtimeReady.web\")\n .catch((err: unknown) => {\n debug.warn(\"Web runtime-ready module unavailable:\", err);\n return { runtimeReadyAt: async () => undefined };\n });\n const { seedRuntimeReady } = await import(\"./adapters/seedRuntimeReady\");\n seedRuntimeReady(telemetry.views, runtimeReadyAt, \"Web\");\n // #171: the initial view's ready anchor is true navigation start. Web never ships\n // `app.start.js_ready_ms` — it has no bundle-evaluated marker.\n telemetry.views.anchorInitial(typeof performance !== \"undefined\" ? performance.timeOrigin : undefined);\n // #179: app.start.duration_ms — navigation start → the document's load marker.\n telemetry.appStartMs = () => runtimeReadyAt().then((at) => at === undefined ? undefined : at - performance.timeOrigin);\n\n await telemetry.resumeOrStartSession()\n .catch(err => debug.warn(\"Web session resume failed:\", err));\n\n this.resolved = telemetry;\n return telemetry;\n })();\n\n this.trackErrors({ captureConsole: opts?.captureConsole }).catch(err => {\n debug.warn(\"Web trackErrors failed:\", err);\n });\n\n this.trackFrameDrops().catch(err => {\n debug.log(\"Web trackFrameDrops errors\", err);\n });\n this.trackNetworkRequests().catch(err => {\n debug.log(\"Web trackNetworkRequests errors\", err);\n });\n this.autoTrackNavigation().catch(err => {\n debug.log(\"Web autoTrackNavigation errors\", err);\n });\n this.trackInteractions().catch(err => {\n debug.log(\"Web trackInteractions errors\", err);\n });\n this.trackWebVitals().catch(err => {\n debug.log(\"Web trackWebVitals errors\", err);\n });\n this.attachAppLifecycle().catch(err => {\n debug.log(\"Web attachAppLifecycle errors\", err);\n });\n this.attachBfcacheRestore().catch(err => {\n debug.log(\"Web attachBfcacheRestore errors\", err);\n });\n this.attachCrossTabSync().catch(err => {\n debug.log(\"Web attachCrossTabSync errors\", err);\n });\n }\n\n /**\n * #161 — the session record is `localStorage`, shared by every tab, but each tab keeps its\n * own in-memory `lastActivity`. The `storage` event fires in every *other* tab on a write,\n * so this tab adopts the sibling's progress — or its rotation — instead of diverging and\n * finalizing the same `session.id` a second time. Native has no sibling and no listener.\n */\n private async attachCrossTabSync() {\n if (typeof window === \"undefined\") return;\n const inst = await this.instancePromise;\n const { SESSION_KEY } = await import(\"./core/telemetry\");\n window.addEventListener(\"storage\", (e: StorageEvent) => {\n if (e.key !== SESSION_KEY) return;\n inst.adoptSessionRecord(e.newValue)\n .catch((err: any) => debug.warn(\"Web cross-tab session sync failed:\", err));\n });\n }\n\n /**\n * A bfcache restore resumes a frozen JS context, so the in-memory session survives on its\n * own — but the freeze can have outlasted the idle window, and a sibling tab may have\n * rotated the shared localStorage record while this one was suspended. Re-running the\n * init decision against the Store is what reconciles both (#92, §4.2).\n */\n private async attachBfcacheRestore() {\n if (typeof window === \"undefined\") return;\n const inst = await this.instancePromise;\n window.addEventListener(\"pageshow\", (e: PageTransitionEvent) => {\n if (!e.persisted) return; // an ordinary load already ran this at init\n inst.resumeOrStartSession()\n .catch((err: any) => debug.warn(\"Web bfcache session resume failed:\", err));\n });\n }\n\n // app_lifecycle on tab visibility change — web equivalent of native AppState (#30)\n async attachAppLifecycle() {\n if (typeof document === \"undefined\") return;\n const inst = await this.instancePromise;\n const { AppLifecycleEmitter } = await import(\"./adapters/appLifecycle\");\n const emitter = new AppLifecycleEmitter(inst);\n const onState = () => {\n const isActive = document.visibilityState === \"visible\";\n // Awaited before the flush, not fired alongside it — the same ordering native has\n // (§4.5). Backgrounding is a view boundary, and the rows it emits are exactly the\n // rows this flush exists to rescue: the `view` row, and §5.3's drained CLS and INP,\n // whose whole reason for being held is that the library's page-hide report loses\n // them on a closed tab. Holding them and then not flushing would move that defect\n // rather than close it. Web's sender uses `fetch({keepalive:true})`, which is what\n // lets a hidden tab's batch outlive the document.\n return emitter.onState(isActive)\n .then(() => (isActive ? undefined : inst.flush()))\n .catch((e: any) => debug.warn(\"Web app lifecycle failed:\", e));\n };\n onState(); // seed current state\n document.addEventListener(\"visibilitychange\", onState);\n }\n\n // Web uses the web crash handler (window.onerror/onunhandledrejection), not the native one.\n async trackErrors(options?: { captureConsole?: boolean }) {\n const { CrashHandler } = await import(\"./adapters/web/crashHandler.web\");\n const inst = await this.instancePromise;\n const crashHandler = new CrashHandler(inst);\n return inst.trackErrors(crashHandler, options);\n }\n\n async trackFrameDrops() {\n const { FrameDropTracker } = await import(\"./adapters/frameTracker\");\n const inst = await this.instancePromise;\n const frameDropTracker = new FrameDropTracker(inst);\n return inst.trackFrameDrops(frameDropTracker);\n }\n\n async trackNetworkRequests() {\n const { NetworkTrackerWeb } = await import(\"./adapters/web/interceptFetchWeb.web\");\n const inst = await this.instancePromise;\n const networkTracker = new NetworkTrackerWeb(inst);\n return inst.trackNetworkRequests(networkTracker);\n }\n\n // §5.2/#105: web emits no `memory_usage` at all, and exposes no `trackMemoryUsage`.\n // Why, in CLAUDE.md's `memory_usage` section.\n\n /**\n * §4.6/#102 — one capture-phase `click` listener on `document`. Auto-started, like every\n * other capture: `ui.interaction` is what §6.2's interaction root hangs off, so a\n * consumer forgetting to call it would leave every tap-driven request unattributed.\n */\n async trackInteractions() {\n const { InteractionTrackerWeb } = await import(\"./adapters/web/interactionWeb.web\");\n const inst = await this.instancePromise;\n // One tracker per core instance, like the XHR patch: `start()`'s own guard is\n // per-tracker, so constructing a fresh one on a second call would add a second\n // capture-phase listener and double every `ui.interaction` row.\n (inst.webInteractions ??= new InteractionTrackerWeb(inst)).start();\n }\n\n /**\n * §5.3/#106 — the five Core Web Vitals on the metric path, web only. Auto-started and\n * deliberately not public API: there is nothing for a consumer to configure, and a vital\n * that only fires if someone remembered to call a method is a vital nobody has.\n *\n * `web-vitals/attribution` is bundled, so this is the only import of it in the tree and\n * `index.native` never reaches it. A failed chunk load is caught by the caller and costs\n * the vitals, nothing else.\n */\n private async trackWebVitals() {\n const { WebVitalsTracker } = await import(\"./adapters/web/webVitals.web\");\n const inst = await this.instancePromise;\n // One tracker per core instance: `start()`'s guard is per-tracker, so a fresh one on a\n // second call would double-subscribe and double every vital row.\n await (inst.webVitals ??= new WebVitalsTracker(inst)).start();\n }\n\n async autoTrackNavigation() {\n const { NavigationTrackerWeb } = await import(\"./adapters/web/navigationWeb.web\");\n const inst = await this.instancePromise;\n // `autoTrackNavigation`, not `start` (#163): v4 called a method core never had, so the\n // history path — rung 3 of the ladder — silently never ran.\n return inst.autoTrackNavigation(new NavigationTrackerWeb(inst));\n }\n\n async getDeviceInfo() {\n const { DeviceInfoTrackerWeb } = await import(\"./adapters/web/deviceInfo.web\");\n const inst = await this.instancePromise;\n const deviceInfoTrackerWeb = new DeviceInfoTrackerWeb();\n return inst.getDeviceInfo(deviceInfoTrackerWeb);\n }\n\n async getNetworkInfo() {\n const { NetworkInfoTrackerWeb } = await import(\"./adapters/web/networkInfo.web\");\n const inst = await this.instancePromise;\n const networkInfoTrackerWeb = new NetworkInfoTrackerWeb();\n return inst.getNetworkInfo(networkInfoTrackerWeb);\n }\n}\n","import { TelemetryWeb } from \"./telemetryWeb.web\";\nimport type { SyncStore } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\nimport { normalizeAllowlist } from \"./adapters/traceHeader\";\nimport { setDebug } from \"./core/debug\";\n\nexport type TelemetryOpts = {\n apiKey: string; // required credential; must start with \"edge_\" (API key or JWT, #90)\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n // console.error -> app.error, console.warn -> a breadcrumb. Default OFF (§4.7, #100).\n captureConsole?: boolean;\n debug?: boolean; // SDK-internal diagnostics; off by default (#23)\n store?: SyncStore; // persisted-state port (#89); MUST be sync — see core/store.ts\n // Constructor-only (§3.6) — there is deliberately no runtime setter for either.\n beforeSend?: BeforeSend; // sync scrubbing hook, run at enqueue over events and metrics\n sessionSampleRate?: number; // 0.0-1.0, sticky per session, re-rolled at rotation; default 1\n // §6.4/#99. Bare hosts, exact match, **ports ignored** (a deliberate mismatch with\n // `http.host`, which keeps the port — do not join them). Empty by default: v4 is dark on\n // upgrade. Listing a host asserts that host's CORS allows `traceparent`; a malformed\n // entry throws in dev and is dropped in production.\n traceHostAllowlist?: string[];\n // §4.8 — the symbolication resolve key. A git SHA or CI run number; consumer-supplied\n // (the SDK has zero OTA awareness), **omitted when unset, never `\"\"`**, and never\n // derived from app.version + app.build_number under any circumstances.\n buildId?: string;\n // #172 — consent. `false` constructs dark: nothing is sent or stored until `enable()`.\n enabled?: boolean;\n};\n\n// Deliberately loose: `apiKey` is the *credential*, and under AUTH_MODE=jwt it is\n// `edge_<jwt>` — a shape the collector's >=3-`_`-part API-key check would reject. Tightening\n// to that check here would hard-reject every JWT and make the segmented deployment\n// unreachable, which is the exact bug #90 exists to close. Prefix + non-empty remainder is\n// all we assert; the real catch is the 401 warn (contract §11.1).\nexport function assertApiKey(apiKey?: string) {\n if (!apiKey || !apiKey.startsWith(\"edge_\")) {\n throw new Error(\"createTelemetry: apiKey is required and must start with 'edge_'\");\n }\n}\n\n/**\n * Cross-platform factory for telemetry. The platform is chosen by the bundler\n * via the .web / .native file split — no runtime navigator sniffing.\n */\nexport function createTelemetry(opts: TelemetryOpts) {\n assertApiKey(opts?.apiKey);\n // §6.4's dev throw has to happen *here*, synchronously: the core Telemetry is built\n // inside `instancePromise`, which deliberately never rethrows, so a throw down there\n // would be a silently rejected promise instead of the loud config error dev asks for.\n // In production it drops the bad entry and reports through debug() — which is why the\n // gate has to be open first: the entry ctor's own setDebug() runs *after* this line, so\n // without this the production report would be a guaranteed no-op even with debug: true.\n // It runs again in TraceManager, where it is idempotent.\n setDebug(opts?.debug ?? false);\n normalizeAllowlist(opts?.traceHostAllowlist);\n return new TelemetryWeb(opts);\n}\n"],"names":["TelemetryWeb","TelemetryBase","opts","setDebug","debug","Telemetry","n","webSender","webStore","DeviceInfoTrackerWeb","NetworkInfoTrackerWeb","DeviceStateWeb","deviceInfoTrackerWeb","networkInfoTrackerWeb","store","sender","telemetry","runtimeReadyAt","err","seedRuntimeReady","at","inst","SESSION_KEY","e","AppLifecycleEmitter","emitter","onState","isActive","options","CrashHandler","crashHandler","FrameDropTracker","frameDropTracker","NetworkTrackerWeb","networkTracker","InteractionTrackerWeb","WebVitalsTracker","NavigationTrackerWeb","assertApiKey","apiKey","createTelemetry","normalizeAllowlist"],"mappings":"wHAKO,MAAMA,UAAqBC,EAAAA,aAAc,CAC5C,YAAYC,EAkBT,CACCC,WAASD,GAAM,OAAS,EAAK,EAC7B,MAAA,EAEAE,EAAAA,MAAM,IAAI,0BAA0B,EAEpC,KAAK,iBAAmB,SAAY,CAChC,KAAM,CAAE,UAAAC,CAAA,EAAc,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,0BAAkB,CAAA,EAAA,KAAAC,GAAAA,EAAA,SAAA,EAC/C,CAAE,UAAAC,CAAA,EAAc,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,0BAAsB,CAAA,EACnD,CAAE,SAAAC,CAAA,EAAa,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,0BAA0B,CAAA,EAEtD,CAAE,qBAAAC,CAAA,EAAyB,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,+BAA+B,CAAA,EACvE,CAAE,sBAAAC,CAAA,EAA0B,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,gCAAgC,CAAA,EACzE,CAAE,eAAAC,CAAA,EAAmB,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,gCAAgC,CAAA,EAClEC,EAAuB,IAAIH,EAC3BI,EAAwB,IA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
1
+ export * from './src/index.web.js'
2
2
  export {}
package/dist/index.web.js CHANGED
@@ -1,17 +1,10 @@
1
- import { s as m, n as k, T as p, d as a } from "./memoryStore-F5I-GQKM.js";
2
- import { m as S } from "./memoryStore-F5I-GQKM.js";
3
- function y(n) {
4
- if (!n || !n.startsWith("edge_"))
5
- throw new Error("createTelemetry: apiKey is required and must start with 'edge_'");
6
- }
7
- function T(n) {
8
- return y(n?.apiKey), m(n?.debug ?? !1), k(n?.traceHostAllowlist), new W(n);
9
- }
1
+ import { T as p, s as m, d as a, n as y } from "./react-urNtDGTL.js";
2
+ import { E as R, m as N, u as E } from "./react-urNtDGTL.js";
10
3
  class W extends p {
11
4
  constructor(t) {
12
5
  m(t?.debug ?? !1), super(), a.log("🌍 Running Web Telemetry"), this.instancePromise = (async () => {
13
- const { Telemetry: e } = await import("./telemetry-ByDJIz_9.js"), { webSender: r } = await import("./webSender-BIwslfpT.js"), { webStore: s } = await import("./store.web-DJAlN0nc.js"), { DeviceInfoTrackerWeb: i } = await import("./deviceInfo.web-BFB1-pcA.js"), { NetworkInfoTrackerWeb: c } = await import("./networkInfo.web-B2YlLNsI.js"), d = new i(), h = new c(), l = t?.store ?? s(), u = t?.sender ?? r(t?.endpoint, t?.apiKey, l), o = new e({
14
- sender: u,
6
+ const { Telemetry: e } = await import("./telemetry-60sfWkh0.js").then((s) => s.t), { webSender: r } = await import("./webSender-g4rs5TIg.js"), { webStore: i } = await import("./store.web-rhh0NOfs.js"), { DeviceInfoTrackerWeb: o } = await import("./deviceInfo.web-BHsjVveq.js"), { NetworkInfoTrackerWeb: w } = await import("./networkInfo.web-CcUpXMUK.js"), { DeviceStateWeb: h } = await import("./deviceState.web-ByaQm9Ry.js"), u = new o(), f = new w(), d = t?.store ?? i(), b = t?.sender ?? r(t?.endpoint, t?.apiKey, d), c = new e({
7
+ sender: b,
15
8
  batchSize: t?.batchSize,
16
9
  flushIntervalMs: t?.flushIntervalMs,
17
10
  endpoint: t?.endpoint,
@@ -22,21 +15,18 @@ class W extends p {
22
15
  // than Android's fork-time-free approximation — and is why native's and
23
16
  // web's launch envelopes must not be compared as the same interval.
24
17
  traceLaunchStart: typeof performance < "u" ? performance.timeOrigin : void 0,
25
- deviceInfoHandler: d,
26
- networkInfoHandler: h,
27
- store: l,
18
+ deviceInfoHandler: u,
19
+ networkInfoHandler: f,
20
+ store: d,
28
21
  beforeSend: t?.beforeSend,
29
22
  sessionSampleRate: t?.sessionSampleRate,
30
23
  traceHostAllowlist: t?.traceHostAllowlist,
31
24
  buildId: t?.buildId,
32
- // §4.11: web has never emitted `screen.duration`, and a now-shared
33
- // attachNavigation must not be what starts it. `navigation` is untouched by
34
- // this flag — web's own history+popstate path still emits it (see the known
35
- // gap in CLAUDE.md); the flag only stops the ref path adding a second feed.
36
- deprecatedScreenFeeds: !1
37
- }), { runtimeReadyAt: f } = await import("./runtimeReady.web-C8fdIbVR.js").catch((w) => (a.warn("Web runtime-ready module unavailable:", w), { runtimeReadyAt: async () => {
38
- } })), { seedRuntimeReady: b } = await import("./seedRuntimeReady-Cz8nOKoo.js");
39
- return b(o.views, f, "Web"), await o.resumeOrStartSession().catch((w) => a.warn("Web session resume failed:", w)), o;
25
+ enabled: t?.enabled,
26
+ deviceStateHandler: new h()
27
+ }), { runtimeReadyAt: l } = await import("./runtimeReady.web-JuE239Tg.js").catch((s) => (a.warn("Web runtime-ready module unavailable:", s), { runtimeReadyAt: async () => {
28
+ } })), { seedRuntimeReady: k } = await import("./seedRuntimeReady-BlRdf3pR.js");
29
+ return k(c.views, l, "Web"), c.views.anchorInitial(typeof performance < "u" ? performance.timeOrigin : void 0), c.appStartMs = () => l().then((s) => s === void 0 ? void 0 : s - performance.timeOrigin), await c.resumeOrStartSession().catch((s) => a.warn("Web session resume failed:", s)), this.resolved = c, c;
40
30
  })(), this.trackErrors({ captureConsole: t?.captureConsole }).catch((e) => {
41
31
  a.warn("Web trackErrors failed:", e);
42
32
  }), this.trackFrameDrops().catch((e) => {
@@ -53,6 +43,21 @@ class W extends p {
53
43
  a.log("Web attachAppLifecycle errors", e);
54
44
  }), this.attachBfcacheRestore().catch((e) => {
55
45
  a.log("Web attachBfcacheRestore errors", e);
46
+ }), this.attachCrossTabSync().catch((e) => {
47
+ a.log("Web attachCrossTabSync errors", e);
48
+ });
49
+ }
50
+ /**
51
+ * #161 — the session record is `localStorage`, shared by every tab, but each tab keeps its
52
+ * own in-memory `lastActivity`. The `storage` event fires in every *other* tab on a write,
53
+ * so this tab adopts the sibling's progress — or its rotation — instead of diverging and
54
+ * finalizing the same `session.id` a second time. Native has no sibling and no listener.
55
+ */
56
+ async attachCrossTabSync() {
57
+ if (typeof window > "u") return;
58
+ const t = await this.instancePromise, { SESSION_KEY: e } = await import("./telemetry-60sfWkh0.js").then((r) => r.t);
59
+ window.addEventListener("storage", (r) => {
60
+ r.key === e && t.adoptSessionRecord(r.newValue).catch((i) => a.warn("Web cross-tab session sync failed:", i));
56
61
  });
57
62
  }
58
63
  /**
@@ -71,23 +76,23 @@ class W extends p {
71
76
  // app_lifecycle on tab visibility change — web equivalent of native AppState (#30)
72
77
  async attachAppLifecycle() {
73
78
  if (typeof document > "u") return;
74
- const t = await this.instancePromise, { AppLifecycleEmitter: e } = await import("./appLifecycle-DQErzJIR.js"), r = new e(t), s = () => {
75
- const i = document.visibilityState === "visible";
76
- return r.onState(i).then(() => i ? void 0 : t.flush()).catch((c) => a.warn("Web app lifecycle failed:", c));
79
+ const t = await this.instancePromise, { AppLifecycleEmitter: e } = await import("./appLifecycle-PffQ4vC1.js"), r = new e(t), i = () => {
80
+ const o = document.visibilityState === "visible";
81
+ return r.onState(o).then(() => o ? void 0 : t.flush()).catch((w) => a.warn("Web app lifecycle failed:", w));
77
82
  };
78
- s(), document.addEventListener("visibilitychange", s);
83
+ i(), document.addEventListener("visibilitychange", i);
79
84
  }
80
85
  // Web uses the web crash handler (window.onerror/onunhandledrejection), not the native one.
81
86
  async trackErrors(t) {
82
- const { CrashHandler: e } = await import("./crashHandler.web-8F_k2veo.js"), r = await this.instancePromise, s = new e(r);
83
- return r.trackErrors(s, t);
87
+ const { CrashHandler: e } = await import("./crashHandler.web-BUlSXYoS.js"), r = await this.instancePromise, i = new e(r);
88
+ return r.trackErrors(i, t);
84
89
  }
85
90
  async trackFrameDrops() {
86
- const { FrameDropTracker: t } = await import("./frameTracker-DdB8W_kC.js"), e = await this.instancePromise, r = new t(e);
91
+ const { FrameDropTracker: t } = await import("./frameTracker-BzXnxSkb.js"), e = await this.instancePromise, r = new t(e);
87
92
  return e.trackFrameDrops(r);
88
93
  }
89
94
  async trackNetworkRequests() {
90
- const { NetworkTrackerWeb: t } = await import("./interceptFetchWeb.web-UXC2Lb6X.js"), e = await this.instancePromise, r = new t(e);
95
+ const { NetworkTrackerWeb: t } = await import("./interceptFetchWeb.web-DjSR_Rft.js"), e = await this.instancePromise, r = new t(e);
91
96
  return e.trackNetworkRequests(r);
92
97
  }
93
98
  // §5.2/#105: web emits no `memory_usage` at all, and exposes no `trackMemoryUsage`.
@@ -98,7 +103,7 @@ class W extends p {
98
103
  * consumer forgetting to call it would leave every tap-driven request unattributed.
99
104
  */
100
105
  async trackInteractions() {
101
- const { InteractionTrackerWeb: t } = await import("./interactionWeb.web-CJAviVQ7.js"), e = await this.instancePromise;
106
+ const { InteractionTrackerWeb: t } = await import("./interactionWeb.web-BWBjmovb.js"), e = await this.instancePromise;
102
107
  (e.webInteractions ??= new t(e)).start();
103
108
  }
104
109
  /**
@@ -111,25 +116,33 @@ class W extends p {
111
116
  * the vitals, nothing else.
112
117
  */
113
118
  async trackWebVitals() {
114
- const { WebVitalsTracker: t } = await import("./webVitals.web-CNIpsKlA.js"), e = await this.instancePromise;
119
+ const { WebVitalsTracker: t } = await import("./webVitals.web-DRTDK6s5.js"), e = await this.instancePromise;
115
120
  await (e.webVitals ??= new t(e)).start();
116
121
  }
117
122
  async autoTrackNavigation() {
118
- const { NavigationTrackerWeb: t } = await import("./navigationWeb.web-CcwgKuIZ.js"), e = await this.instancePromise, r = new t(e);
119
- return e.start(r);
123
+ const { NavigationTrackerWeb: t } = await import("./navigationWeb.web-CRHpr5zl.js"), e = await this.instancePromise;
124
+ return e.autoTrackNavigation(new t(e));
120
125
  }
121
126
  async getDeviceInfo() {
122
- const { DeviceInfoTrackerWeb: t } = await import("./deviceInfo.web-BFB1-pcA.js"), e = await this.instancePromise, r = new t();
127
+ const { DeviceInfoTrackerWeb: t } = await import("./deviceInfo.web-BHsjVveq.js"), e = await this.instancePromise, r = new t();
123
128
  return e.getDeviceInfo(r);
124
129
  }
125
130
  async getNetworkInfo() {
126
- const { NetworkInfoTrackerWeb: t } = await import("./networkInfo.web-B2YlLNsI.js"), e = await this.instancePromise, r = new t();
131
+ const { NetworkInfoTrackerWeb: t } = await import("./networkInfo.web-CcUpXMUK.js"), e = await this.instancePromise, r = new t();
127
132
  return e.getNetworkInfo(r);
128
133
  }
129
134
  }
135
+ function v(n) {
136
+ if (!n || !n.startsWith("edge_"))
137
+ throw new Error("createTelemetry: apiKey is required and must start with 'edge_'");
138
+ }
139
+ function T(n) {
140
+ return v(n?.apiKey), m(n?.debug ?? !1), y(n?.traceHostAllowlist), new W(n);
141
+ }
130
142
  export {
131
- W as TelemetryWeb,
143
+ R as EdgeErrorBoundary,
132
144
  T as createTelemetry,
133
- S as memoryStore
145
+ N as memoryStore,
146
+ E as useScreenReady
134
147
  };
135
148
  //# sourceMappingURL=index.web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.web.js","sources":["../src/createTelemetry.web.ts","../src/index.web.ts"],"sourcesContent":["import { TelemetryWeb } from \"./index.web\";\nimport type { SyncStore } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\nimport { normalizeAllowlist } from \"./adapters/traceHeader\";\nimport { setDebug } from \"./core/debug\";\n\nexport type TelemetryOpts = {\n apiKey: string; // required credential; must start with \"edge_\" (API key or JWT, #90)\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n // console.error -> app.error, console.warn -> a breadcrumb. Default OFF (§4.7, #100).\n captureConsole?: boolean;\n debug?: boolean; // SDK-internal diagnostics; off by default (#23)\n store?: SyncStore; // persisted-state port (#89); MUST be sync — see core/store.ts\n // Constructor-only (§3.6) — there is deliberately no runtime setter for either.\n beforeSend?: BeforeSend; // sync scrubbing hook, run at enqueue over events and metrics\n sessionSampleRate?: number; // 0.0-1.0, sticky per session, re-rolled at rotation; default 1\n // §6.4/#99. Bare hosts, exact match, **ports ignored** (a deliberate mismatch with\n // `http.host`, which keeps the port — do not join them). Empty by default: v4 is dark on\n // upgrade. Listing a host asserts that host's CORS allows `traceparent`; a malformed\n // entry throws in dev and is dropped in production.\n traceHostAllowlist?: string[];\n // §4.8 — the symbolication resolve key. A git SHA or CI run number; consumer-supplied\n // (the SDK has zero OTA awareness), **omitted when unset, never `\"\"`**, and never\n // derived from app.version + app.build_number under any circumstances.\n buildId?: string;\n};\n\n// Deliberately loose: `apiKey` is the *credential*, and under AUTH_MODE=jwt it is\n// `edge_<jwt>` — a shape the collector's >=3-`_`-part API-key check would reject. Tightening\n// to that check here would hard-reject every JWT and make the segmented deployment\n// unreachable, which is the exact bug #90 exists to close. Prefix + non-empty remainder is\n// all we assert; the real catch is the 401 warn (contract §11.1).\nexport function assertApiKey(apiKey?: string) {\n if (!apiKey || !apiKey.startsWith(\"edge_\")) {\n throw new Error(\"createTelemetry: apiKey is required and must start with 'edge_'\");\n }\n}\n\n/**\n * Cross-platform factory for telemetry. The platform is chosen by the bundler\n * via the .web / .native file split — no runtime navigator sniffing.\n */\nexport function createTelemetry(opts: TelemetryOpts) {\n assertApiKey(opts?.apiKey);\n // §6.4's dev throw has to happen *here*, synchronously: the core Telemetry is built\n // inside `instancePromise`, which deliberately never rethrows, so a throw down there\n // would be a silently rejected promise instead of the loud config error dev asks for.\n // In production it drops the bad entry and reports through debug() — which is why the\n // gate has to be open first: the entry ctor's own setDebug() runs *after* this line, so\n // without this the production report would be a guaranteed no-op even with debug: true.\n // It runs again in TraceManager, where it is idempotent.\n setDebug(opts?.debug ?? false);\n normalizeAllowlist(opts?.traceHostAllowlist);\n return new TelemetryWeb(opts);\n}\n","// src/index.web.ts\nimport { TelemetryBase } from \"./index.base\";\nimport { debug, setDebug } from \"./core/debug\";\nimport type { SyncStore } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\n\nexport { createTelemetry, type TelemetryOpts } from \"./createTelemetry.web\";\n\n// The Store port (#89) — public so a consumer can inject their own persistence,\n// and so the in-memory fake is available outside the test tree.\nexport type { Store, SyncStore, AsyncStore, StoreRead, StoreWrite } from \"./core/store\";\nexport { memoryStore, type MemoryStoreOpts } from \"./core/memoryStore\";\n\n// The scrubbing hook (#93) — public so a consumer can type their beforeSend.\nexport type { BeforeSend } from \"./core/beforeSend\";\n\nexport class TelemetryWeb extends TelemetryBase {\n constructor(opts?: {\n apiKey?: string;\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n captureConsole?: boolean;\n debug?: boolean;\n store?: SyncStore; // sync only: the web build's guarantee depends on it\n // Constructor-only (§3.6). No runtime setter: registering later leaves a window\n // where session.started and the earliest requests have already been enqueued.\n beforeSend?: BeforeSend;\n sessionSampleRate?: number;\n // §6.4/#99 — bare hosts, exact match, ports ignored, empty by default.\n traceHostAllowlist?: string[];\n // §4.8 — symbolication resolve key. Omitted when unset, never `\"\"`, never derived.\n buildId?: string;\n }) {\n setDebug(opts?.debug ?? false); // gate SDK console noise before anything logs (#23)\n super();\n\n debug.log(\"🌍 Running Web Telemetry\");\n\n this.instancePromise = (async () => {\n const { Telemetry } = await import(\"./core/telemetry\");\n const { webSender } = await import(\"./adapters/webSender\");\n const { webStore } = await import(\"./adapters/web/store.web\");\n\n const { DeviceInfoTrackerWeb } = await import(\"./adapters/web/deviceInfo.web\");\n const { NetworkInfoTrackerWeb } = await import(\"./adapters/web/networkInfo.web\");\n const deviceInfoTrackerWeb = new DeviceInfoTrackerWeb();\n const networkInfoTrackerWeb = new NetworkInfoTrackerWeb();\n\n // One store, shared by the offline queue and core (#89) — so a consumer that\n // injects a store governs both, instead of the sender quietly keeping its own.\n const store = opts?.store ?? webStore();\n const sender = opts?.sender ?? webSender(opts?.endpoint, opts?.apiKey, store);\n\n const telemetry = new Telemetry({\n sender,\n batchSize: opts?.batchSize,\n flushIntervalMs: opts?.flushIntervalMs,\n endpoint: opts?.endpoint,\n // device.id is suffixed `_web`; session.id is not — §3.3 gives session.id a\n // `_web` suffix only in v4. generateSessionId() holds that rule.\n platform: \"web\",\n // §6.2: web's launch root reports true navigation start, which is *better*\n // than Android's fork-time-free approximation — and is why native's and\n // web's launch envelopes must not be compared as the same interval.\n traceLaunchStart: typeof performance !== \"undefined\" ? performance.timeOrigin : undefined,\n deviceInfoHandler: deviceInfoTrackerWeb,\n networkInfoHandler: networkInfoTrackerWeb,\n store,\n beforeSend: opts?.beforeSend,\n sessionSampleRate: opts?.sessionSampleRate,\n traceHostAllowlist: opts?.traceHostAllowlist,\n buildId: opts?.buildId,\n // §4.11: web has never emitted `screen.duration`, and a now-shared\n // attachNavigation must not be what starts it. `navigation` is untouched by\n // this flag — web's own history+popstate path still emits it (see the known\n // gap in CLAUDE.md); the flag only stops the ref path adding a second feed.\n deprecatedScreenFeeds: false,\n });\n\n // Resume or start the session before the instance is visible (#92). On web the\n // Store is localStorage, so a hard reload, a bfcache restore and a second tab\n // all resume the same session.\n // Never rethrown into instancePromise: finalizeSession() flushes, flush() rethrows on a\n // dead collector, and a rejected instancePromise would brick every public method for the\n // life of the process. Hydration has already run; only the emission is lost.\n // §4.5.2's `initial_load` seed: the launch view stays busy until the platform's\n // runtime-ready marker. The *module* is awaited with everything else, so the seed\n // is armed before `instancePromise` resolves; the *marker* is not, because on web\n // it arrives with the load event and blocking init on it would delay every host\n // call behind the page's own images.\n // The module is awaited so the seed is armed before `instancePromise` resolves,\n // but never rethrown into it: a failed chunk load must not brick every public\n // method for the life of the process. A missing reader just releases the gate.\n const { runtimeReadyAt } = await import(\"./adapters/web/runtimeReady.web\")\n .catch((err: unknown) => {\n debug.warn(\"Web runtime-ready module unavailable:\", err);\n return { runtimeReadyAt: async () => undefined };\n });\n const { seedRuntimeReady } = await import(\"./adapters/seedRuntimeReady\");\n seedRuntimeReady(telemetry.views, runtimeReadyAt, \"Web\");\n\n await telemetry.resumeOrStartSession()\n .catch(err => debug.warn(\"Web session resume failed:\", err));\n\n return telemetry;\n })();\n\n this.trackErrors({ captureConsole: opts?.captureConsole }).catch(err => {\n debug.warn(\"Web trackErrors failed:\", err);\n });\n\n this.trackFrameDrops().catch(err => {\n debug.log(\"Web trackFrameDrops errors\", err);\n });\n this.trackNetworkRequests().catch(err => {\n debug.log(\"Web trackNetworkRequests errors\", err);\n });\n this.autoTrackNavigation().catch(err => {\n debug.log(\"Web autoTrackNavigation errors\", err);\n });\n this.trackInteractions().catch(err => {\n debug.log(\"Web trackInteractions errors\", err);\n });\n this.trackWebVitals().catch(err => {\n debug.log(\"Web trackWebVitals errors\", err);\n });\n this.attachAppLifecycle().catch(err => {\n debug.log(\"Web attachAppLifecycle errors\", err);\n });\n this.attachBfcacheRestore().catch(err => {\n debug.log(\"Web attachBfcacheRestore errors\", err);\n });\n }\n\n /**\n * A bfcache restore resumes a frozen JS context, so the in-memory session survives on its\n * own — but the freeze can have outlasted the idle window, and a sibling tab may have\n * rotated the shared localStorage record while this one was suspended. Re-running the\n * init decision against the Store is what reconciles both (#92, §4.2).\n */\n private async attachBfcacheRestore() {\n if (typeof window === \"undefined\") return;\n const inst = await this.instancePromise;\n window.addEventListener(\"pageshow\", (e: PageTransitionEvent) => {\n if (!e.persisted) return; // an ordinary load already ran this at init\n inst.resumeOrStartSession()\n .catch((err: any) => debug.warn(\"Web bfcache session resume failed:\", err));\n });\n }\n\n // app_lifecycle on tab visibility change — web equivalent of native AppState (#30)\n async attachAppLifecycle() {\n if (typeof document === \"undefined\") return;\n const inst = await this.instancePromise;\n const { AppLifecycleEmitter } = await import(\"./adapters/appLifecycle\");\n const emitter = new AppLifecycleEmitter(inst);\n const onState = () => {\n const isActive = document.visibilityState === \"visible\";\n // Awaited before the flush, not fired alongside it — the same ordering native has\n // (§4.5). Backgrounding is a view boundary, and the rows it emits are exactly the\n // rows this flush exists to rescue: the `view` row, and §5.3's drained CLS and INP,\n // whose whole reason for being held is that the library's page-hide report loses\n // them on a closed tab. Holding them and then not flushing would move that defect\n // rather than close it. Web's sender uses `fetch({keepalive:true})`, which is what\n // lets a hidden tab's batch outlive the document.\n return emitter.onState(isActive)\n .then(() => (isActive ? undefined : inst.flush()))\n .catch((e: any) => debug.warn(\"Web app lifecycle failed:\", e));\n };\n onState(); // seed current state\n document.addEventListener(\"visibilitychange\", onState);\n }\n\n // Web uses the web crash handler (window.onerror/onunhandledrejection), not the native one.\n async trackErrors(options?: { captureConsole?: boolean }) {\n const { CrashHandler } = await import(\"./adapters/web/crashHandler.web\");\n const inst = await this.instancePromise;\n const crashHandler = new CrashHandler(inst);\n return inst.trackErrors(crashHandler, options);\n }\n\n async trackFrameDrops() {\n const { FrameDropTracker } = await import(\"./adapters/frameTracker\");\n const inst = await this.instancePromise;\n const frameDropTracker = new FrameDropTracker(inst);\n return inst.trackFrameDrops(frameDropTracker);\n }\n\n async trackNetworkRequests() {\n const { NetworkTrackerWeb } = await import(\"./adapters/web/interceptFetchWeb.web\");\n const inst = await this.instancePromise;\n const networkTracker = new NetworkTrackerWeb(inst);\n return inst.trackNetworkRequests(networkTracker);\n }\n\n // §5.2/#105: web emits no `memory_usage` at all, and exposes no `trackMemoryUsage`.\n // Why, in CLAUDE.md's `memory_usage` section.\n\n /**\n * §4.6/#102 — one capture-phase `click` listener on `document`. Auto-started, like every\n * other capture: `ui.interaction` is what §6.2's interaction root hangs off, so a\n * consumer forgetting to call it would leave every tap-driven request unattributed.\n */\n async trackInteractions() {\n const { InteractionTrackerWeb } = await import(\"./adapters/web/interactionWeb.web\");\n const inst = await this.instancePromise;\n // One tracker per core instance, like the XHR patch: `start()`'s own guard is\n // per-tracker, so constructing a fresh one on a second call would add a second\n // capture-phase listener and double every `ui.interaction` row.\n (inst.webInteractions ??= new InteractionTrackerWeb(inst)).start();\n }\n\n /**\n * §5.3/#106 — the five Core Web Vitals on the metric path, web only. Auto-started and\n * deliberately not public API: there is nothing for a consumer to configure, and a vital\n * that only fires if someone remembered to call a method is a vital nobody has.\n *\n * `web-vitals/attribution` is bundled, so this is the only import of it in the tree and\n * `index.native` never reaches it. A failed chunk load is caught by the caller and costs\n * the vitals, nothing else.\n */\n private async trackWebVitals() {\n const { WebVitalsTracker } = await import(\"./adapters/web/webVitals.web\");\n const inst = await this.instancePromise;\n // One tracker per core instance: `start()`'s guard is per-tracker, so a fresh one on a\n // second call would double-subscribe and double every vital row.\n await (inst.webVitals ??= new WebVitalsTracker(inst)).start();\n }\n\n async autoTrackNavigation() {\n const { NavigationTrackerWeb } = await import(\"./adapters/web/navigationWeb.web\");\n const inst = await this.instancePromise;\n const navigationTracker = new NavigationTrackerWeb(inst);\n return inst.start(navigationTracker);\n }\n\n async getDeviceInfo() {\n const { DeviceInfoTrackerWeb } = await import(\"./adapters/web/deviceInfo.web\");\n const inst = await this.instancePromise;\n const deviceInfoTrackerWeb = new DeviceInfoTrackerWeb();\n return inst.getDeviceInfo(deviceInfoTrackerWeb);\n }\n\n async getNetworkInfo() {\n const { NetworkInfoTrackerWeb } = await import(\"./adapters/web/networkInfo.web\");\n const inst = await this.instancePromise;\n const networkInfoTrackerWeb = new NetworkInfoTrackerWeb();\n return inst.getNetworkInfo(networkInfoTrackerWeb);\n }\n}\n"],"names":["assertApiKey","apiKey","createTelemetry","opts","setDebug","normalizeAllowlist","TelemetryWeb","TelemetryBase","debug","Telemetry","webSender","webStore","DeviceInfoTrackerWeb","NetworkInfoTrackerWeb","deviceInfoTrackerWeb","networkInfoTrackerWeb","store","sender","telemetry","runtimeReadyAt","err","seedRuntimeReady","inst","AppLifecycleEmitter","emitter","onState","isActive","e","options","CrashHandler","crashHandler","FrameDropTracker","frameDropTracker","NetworkTrackerWeb","networkTracker","InteractionTrackerWeb","WebVitalsTracker","NavigationTrackerWeb","navigationTracker"],"mappings":";;AAmCO,SAASA,EAAaC,GAAiB;AAC1C,MAAI,CAACA,KAAU,CAACA,EAAO,WAAW,OAAO;AACrC,UAAM,IAAI,MAAM,iEAAiE;AAEzF;AAMO,SAASC,EAAgBC,GAAqB;AACjD,SAAAH,EAAaG,GAAM,MAAM,GAQzBC,EAASD,GAAM,SAAS,EAAK,GAC7BE,EAAmBF,GAAM,kBAAkB,GACpC,IAAIG,EAAaH,CAAI;AAChC;ACzCO,MAAMG,UAAqBC,EAAc;AAAA,EAC5C,YAAYJ,GAiBT;AACC,IAAAC,EAASD,GAAM,SAAS,EAAK,GAC7B,MAAA,GAEAK,EAAM,IAAI,0BAA0B,GAEpC,KAAK,mBAAmB,YAAY;AAChC,YAAM,EAAE,WAAAC,EAAA,IAAc,MAAM,OAAO,yBAAkB,GAC/C,EAAE,WAAAC,EAAA,IAAc,MAAM,OAAO,yBAAsB,GACnD,EAAE,UAAAC,EAAA,IAAa,MAAM,OAAO,yBAA0B,GAEtD,EAAE,sBAAAC,EAAA,IAAyB,MAAM,OAAO,8BAA+B,GACvE,EAAE,uBAAAC,EAAA,IAA0B,MAAM,OAAO,+BAAgC,GACzEC,IAAuB,IAAIF,EAAA,GAC3BG,IAAwB,IAAIF,EAAA,GAI5BG,IAAQb,GAAM,SAASQ,EAAA,GACvBM,IAASd,GAAM,UAAUO,EAAUP,GAAM,UAAUA,GAAM,QAAQa,CAAK,GAEtEE,IAAY,IAAIT,EAAU;AAAA,QAC5B,QAAAQ;AAAA,QACA,WAAWd,GAAM;AAAA,QACjB,iBAAiBA,GAAM;AAAA,QACvB,UAAUA,GAAM;AAAA;AAAA;AAAA,QAGhB,UAAU;AAAA;AAAA;AAAA;AAAA,QAIV,kBAAkB,OAAO,cAAgB,MAAc,YAAY,aAAa;AAAA,QAChF,mBAAmBW;AAAA,QACnB,oBAAoBC;AA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+BAAgC,GACzES,IAAO,MAAM,KAAK,iBAClBP,IAAwB,IAAIF,EAAA;AAClC,WAAOS,EAAK,eAAeP,CAAqB;AAAA,EACpD;AACJ;"}
1
+ {"version":3,"file":"index.web.js","sources":["../src/telemetryWeb.web.ts","../src/createTelemetry.web.ts"],"sourcesContent":["import { TelemetryBase } from \"./index.base\";\nimport { debug, setDebug } from \"./core/debug\";\nimport type { SyncStore } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\n\nexport class TelemetryWeb extends TelemetryBase {\n constructor(opts?: {\n apiKey?: string;\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n captureConsole?: boolean;\n debug?: boolean;\n store?: SyncStore; // sync only: the web build's guarantee depends on it\n // Constructor-only (§3.6). No runtime setter: registering later leaves a window\n // where session.started and the earliest requests have already been enqueued.\n beforeSend?: BeforeSend;\n sessionSampleRate?: number;\n // §6.4/#99 — bare hosts, exact match, ports ignored, empty by default.\n traceHostAllowlist?: string[];\n // §4.8 — symbolication resolve key. Omitted when unset, never `\"\"`, never derived.\n buildId?: string;\n enabled?: boolean;\n }) {\n setDebug(opts?.debug ?? false); // gate SDK console noise before anything logs (#23)\n super();\n\n debug.log(\"🌍 Running Web Telemetry\");\n\n this.instancePromise = (async () => {\n const { Telemetry } = await import(\"./core/telemetry\");\n const { webSender } = await import(\"./adapters/webSender\");\n const { webStore } = await import(\"./adapters/web/store.web\");\n\n const { DeviceInfoTrackerWeb } = await import(\"./adapters/web/deviceInfo.web\");\n const { NetworkInfoTrackerWeb } = await import(\"./adapters/web/networkInfo.web\");\n const { DeviceStateWeb } = await import(\"./adapters/web/deviceState.web\");\n const deviceInfoTrackerWeb = new DeviceInfoTrackerWeb();\n const networkInfoTrackerWeb = new NetworkInfoTrackerWeb();\n\n // One store, shared by the offline queue and core (#89) — so a consumer that\n // injects a store governs both, instead of the sender quietly keeping its own.\n const store = opts?.store ?? webStore();\n const sender = opts?.sender ?? webSender(opts?.endpoint, opts?.apiKey, store);\n\n const telemetry = new Telemetry({\n sender,\n batchSize: opts?.batchSize,\n flushIntervalMs: opts?.flushIntervalMs,\n endpoint: opts?.endpoint,\n // device.id is suffixed `_web`; session.id is not — §3.3 gives session.id a\n // `_web` suffix only in v4. generateSessionId() holds that rule.\n platform: \"web\",\n // §6.2: web's launch root reports true navigation start, which is *better*\n // than Android's fork-time-free approximation — and is why native's and\n // web's launch envelopes must not be compared as the same interval.\n traceLaunchStart: typeof performance !== \"undefined\" ? performance.timeOrigin : undefined,\n deviceInfoHandler: deviceInfoTrackerWeb,\n networkInfoHandler: networkInfoTrackerWeb,\n store,\n beforeSend: opts?.beforeSend,\n sessionSampleRate: opts?.sessionSampleRate,\n traceHostAllowlist: opts?.traceHostAllowlist,\n buildId: opts?.buildId,\n enabled: opts?.enabled,\n deviceStateHandler: new DeviceStateWeb(),\n });\n\n // Resume or start the session before the instance is visible (#92). On web the\n // Store is localStorage, so a hard reload, a bfcache restore and a second tab\n // all resume the same session.\n // Never rethrown into instancePromise: finalizeSession() flushes, flush() rethrows on a\n // dead collector, and a rejected instancePromise would brick every public method for the\n // life of the process. Hydration has already run; only the emission is lost.\n // §4.5.2's `initial_load` seed: the launch view stays busy until the platform's\n // runtime-ready marker. The *module* is awaited with everything else, so the seed\n // is armed before `instancePromise` resolves; the *marker* is not, because on web\n // it arrives with the load event and blocking init on it would delay every host\n // call behind the page's own images.\n // The module is awaited so the seed is armed before `instancePromise` resolves,\n // but never rethrown into it: a failed chunk load must not brick every public\n // method for the life of the process. A missing reader just releases the gate.\n const { runtimeReadyAt } = await import(\"./adapters/web/runtimeReady.web\")\n .catch((err: unknown) => {\n debug.warn(\"Web runtime-ready module unavailable:\", err);\n return { runtimeReadyAt: async () => undefined };\n });\n const { seedRuntimeReady } = await import(\"./adapters/seedRuntimeReady\");\n seedRuntimeReady(telemetry.views, runtimeReadyAt, \"Web\");\n // #171: the initial view's ready anchor is true navigation start. Web never ships\n // `app.start.js_ready_ms` — it has no bundle-evaluated marker.\n telemetry.views.anchorInitial(typeof performance !== \"undefined\" ? performance.timeOrigin : undefined);\n // #179: app.start.duration_ms — navigation start → the document's load marker.\n telemetry.appStartMs = () => runtimeReadyAt().then((at) => at === undefined ? undefined : at - performance.timeOrigin);\n\n await telemetry.resumeOrStartSession()\n .catch(err => debug.warn(\"Web session resume failed:\", err));\n\n this.resolved = telemetry;\n return telemetry;\n })();\n\n this.trackErrors({ captureConsole: opts?.captureConsole }).catch(err => {\n debug.warn(\"Web trackErrors failed:\", err);\n });\n\n this.trackFrameDrops().catch(err => {\n debug.log(\"Web trackFrameDrops errors\", err);\n });\n this.trackNetworkRequests().catch(err => {\n debug.log(\"Web trackNetworkRequests errors\", err);\n });\n this.autoTrackNavigation().catch(err => {\n debug.log(\"Web autoTrackNavigation errors\", err);\n });\n this.trackInteractions().catch(err => {\n debug.log(\"Web trackInteractions errors\", err);\n });\n this.trackWebVitals().catch(err => {\n debug.log(\"Web trackWebVitals errors\", err);\n });\n this.attachAppLifecycle().catch(err => {\n debug.log(\"Web attachAppLifecycle errors\", err);\n });\n this.attachBfcacheRestore().catch(err => {\n debug.log(\"Web attachBfcacheRestore errors\", err);\n });\n this.attachCrossTabSync().catch(err => {\n debug.log(\"Web attachCrossTabSync errors\", err);\n });\n }\n\n /**\n * #161 — the session record is `localStorage`, shared by every tab, but each tab keeps its\n * own in-memory `lastActivity`. The `storage` event fires in every *other* tab on a write,\n * so this tab adopts the sibling's progress — or its rotation — instead of diverging and\n * finalizing the same `session.id` a second time. Native has no sibling and no listener.\n */\n private async attachCrossTabSync() {\n if (typeof window === \"undefined\") return;\n const inst = await this.instancePromise;\n const { SESSION_KEY } = await import(\"./core/telemetry\");\n window.addEventListener(\"storage\", (e: StorageEvent) => {\n if (e.key !== SESSION_KEY) return;\n inst.adoptSessionRecord(e.newValue)\n .catch((err: any) => debug.warn(\"Web cross-tab session sync failed:\", err));\n });\n }\n\n /**\n * A bfcache restore resumes a frozen JS context, so the in-memory session survives on its\n * own — but the freeze can have outlasted the idle window, and a sibling tab may have\n * rotated the shared localStorage record while this one was suspended. Re-running the\n * init decision against the Store is what reconciles both (#92, §4.2).\n */\n private async attachBfcacheRestore() {\n if (typeof window === \"undefined\") return;\n const inst = await this.instancePromise;\n window.addEventListener(\"pageshow\", (e: PageTransitionEvent) => {\n if (!e.persisted) return; // an ordinary load already ran this at init\n inst.resumeOrStartSession()\n .catch((err: any) => debug.warn(\"Web bfcache session resume failed:\", err));\n });\n }\n\n // app_lifecycle on tab visibility change — web equivalent of native AppState (#30)\n async attachAppLifecycle() {\n if (typeof document === \"undefined\") return;\n const inst = await this.instancePromise;\n const { AppLifecycleEmitter } = await import(\"./adapters/appLifecycle\");\n const emitter = new AppLifecycleEmitter(inst);\n const onState = () => {\n const isActive = document.visibilityState === \"visible\";\n // Awaited before the flush, not fired alongside it — the same ordering native has\n // (§4.5). Backgrounding is a view boundary, and the rows it emits are exactly the\n // rows this flush exists to rescue: the `view` row, and §5.3's drained CLS and INP,\n // whose whole reason for being held is that the library's page-hide report loses\n // them on a closed tab. Holding them and then not flushing would move that defect\n // rather than close it. Web's sender uses `fetch({keepalive:true})`, which is what\n // lets a hidden tab's batch outlive the document.\n return emitter.onState(isActive)\n .then(() => (isActive ? undefined : inst.flush()))\n .catch((e: any) => debug.warn(\"Web app lifecycle failed:\", e));\n };\n onState(); // seed current state\n document.addEventListener(\"visibilitychange\", onState);\n }\n\n // Web uses the web crash handler (window.onerror/onunhandledrejection), not the native one.\n async trackErrors(options?: { captureConsole?: boolean }) {\n const { CrashHandler } = await import(\"./adapters/web/crashHandler.web\");\n const inst = await this.instancePromise;\n const crashHandler = new CrashHandler(inst);\n return inst.trackErrors(crashHandler, options);\n }\n\n async trackFrameDrops() {\n const { FrameDropTracker } = await import(\"./adapters/frameTracker\");\n const inst = await this.instancePromise;\n const frameDropTracker = new FrameDropTracker(inst);\n return inst.trackFrameDrops(frameDropTracker);\n }\n\n async trackNetworkRequests() {\n const { NetworkTrackerWeb } = await import(\"./adapters/web/interceptFetchWeb.web\");\n const inst = await this.instancePromise;\n const networkTracker = new NetworkTrackerWeb(inst);\n return inst.trackNetworkRequests(networkTracker);\n }\n\n // §5.2/#105: web emits no `memory_usage` at all, and exposes no `trackMemoryUsage`.\n // Why, in CLAUDE.md's `memory_usage` section.\n\n /**\n * §4.6/#102 — one capture-phase `click` listener on `document`. Auto-started, like every\n * other capture: `ui.interaction` is what §6.2's interaction root hangs off, so a\n * consumer forgetting to call it would leave every tap-driven request unattributed.\n */\n async trackInteractions() {\n const { InteractionTrackerWeb } = await import(\"./adapters/web/interactionWeb.web\");\n const inst = await this.instancePromise;\n // One tracker per core instance, like the XHR patch: `start()`'s own guard is\n // per-tracker, so constructing a fresh one on a second call would add a second\n // capture-phase listener and double every `ui.interaction` row.\n (inst.webInteractions ??= new InteractionTrackerWeb(inst)).start();\n }\n\n /**\n * §5.3/#106 — the five Core Web Vitals on the metric path, web only. Auto-started and\n * deliberately not public API: there is nothing for a consumer to configure, and a vital\n * that only fires if someone remembered to call a method is a vital nobody has.\n *\n * `web-vitals/attribution` is bundled, so this is the only import of it in the tree and\n * `index.native` never reaches it. A failed chunk load is caught by the caller and costs\n * the vitals, nothing else.\n */\n private async trackWebVitals() {\n const { WebVitalsTracker } = await import(\"./adapters/web/webVitals.web\");\n const inst = await this.instancePromise;\n // One tracker per core instance: `start()`'s guard is per-tracker, so a fresh one on a\n // second call would double-subscribe and double every vital row.\n await (inst.webVitals ??= new WebVitalsTracker(inst)).start();\n }\n\n async autoTrackNavigation() {\n const { NavigationTrackerWeb } = await import(\"./adapters/web/navigationWeb.web\");\n const inst = await this.instancePromise;\n // `autoTrackNavigation`, not `start` (#163): v4 called a method core never had, so the\n // history path — rung 3 of the ladder — silently never ran.\n return inst.autoTrackNavigation(new NavigationTrackerWeb(inst));\n }\n\n async getDeviceInfo() {\n const { DeviceInfoTrackerWeb } = await import(\"./adapters/web/deviceInfo.web\");\n const inst = await this.instancePromise;\n const deviceInfoTrackerWeb = new DeviceInfoTrackerWeb();\n return inst.getDeviceInfo(deviceInfoTrackerWeb);\n }\n\n async getNetworkInfo() {\n const { NetworkInfoTrackerWeb } = await import(\"./adapters/web/networkInfo.web\");\n const inst = await this.instancePromise;\n const networkInfoTrackerWeb = new NetworkInfoTrackerWeb();\n return inst.getNetworkInfo(networkInfoTrackerWeb);\n }\n}\n","import { TelemetryWeb } from \"./telemetryWeb.web\";\nimport type { SyncStore } from \"./core/store\";\nimport type { BeforeSend } from \"./core/beforeSend\";\nimport { normalizeAllowlist } from \"./adapters/traceHeader\";\nimport { setDebug } from \"./core/debug\";\n\nexport type TelemetryOpts = {\n apiKey: string; // required credential; must start with \"edge_\" (API key or JWT, #90)\n sender?: any;\n batchSize?: number;\n flushIntervalMs?: number;\n endpoint?: string;\n // console.error -> app.error, console.warn -> a breadcrumb. Default OFF (§4.7, #100).\n captureConsole?: boolean;\n debug?: boolean; // SDK-internal diagnostics; off by default (#23)\n store?: SyncStore; // persisted-state port (#89); MUST be sync — see core/store.ts\n // Constructor-only (§3.6) — there is deliberately no runtime setter for either.\n beforeSend?: BeforeSend; // sync scrubbing hook, run at enqueue over events and metrics\n sessionSampleRate?: number; // 0.0-1.0, sticky per session, re-rolled at rotation; default 1\n // §6.4/#99. Bare hosts, exact match, **ports ignored** (a deliberate mismatch with\n // `http.host`, which keeps the port — do not join them). Empty by default: v4 is dark on\n // upgrade. Listing a host asserts that host's CORS allows `traceparent`; a malformed\n // entry throws in dev and is dropped in production.\n traceHostAllowlist?: string[];\n // §4.8 — the symbolication resolve key. A git SHA or CI run number; consumer-supplied\n // (the SDK has zero OTA awareness), **omitted when unset, never `\"\"`**, and never\n // derived from app.version + app.build_number under any circumstances.\n buildId?: string;\n // #172 — consent. `false` constructs dark: nothing is sent or stored until `enable()`.\n enabled?: boolean;\n};\n\n// Deliberately loose: `apiKey` is the *credential*, and under AUTH_MODE=jwt it is\n// `edge_<jwt>` — a shape the collector's >=3-`_`-part API-key check would reject. Tightening\n// to that check here would hard-reject every JWT and make the segmented deployment\n// unreachable, which is the exact bug #90 exists to close. Prefix + non-empty remainder is\n// all we assert; the real catch is the 401 warn (contract §11.1).\nexport function assertApiKey(apiKey?: string) {\n if (!apiKey || !apiKey.startsWith(\"edge_\")) {\n throw new Error(\"createTelemetry: apiKey is required and must start with 'edge_'\");\n }\n}\n\n/**\n * Cross-platform factory for telemetry. The platform is chosen by the bundler\n * via the .web / .native file split — no runtime navigator sniffing.\n */\nexport function createTelemetry(opts: TelemetryOpts) {\n assertApiKey(opts?.apiKey);\n // §6.4's dev throw has to happen *here*, synchronously: the core Telemetry is built\n // inside `instancePromise`, which deliberately never rethrows, so a throw down there\n // would be a silently rejected promise instead of the loud config error dev asks for.\n // In production it drops the bad entry and reports through debug() — which is why the\n // gate has to be open first: the entry ctor's own setDebug() runs *after* this line, so\n // without this the production report would be a guaranteed no-op even with debug: true.\n // It runs again in TraceManager, where it is idempotent.\n setDebug(opts?.debug ?? false);\n normalizeAllowlist(opts?.traceHostAllowlist);\n return new TelemetryWeb(opts);\n}\n"],"names":["TelemetryWeb","TelemetryBase","opts","setDebug","debug","Telemetry","n","webSender","webStore","DeviceInfoTrackerWeb","NetworkInfoTrackerWeb","DeviceStateWeb","deviceInfoTrackerWeb","networkInfoTrackerWeb","store","sender","telemetry","runtimeReadyAt","err","seedRuntimeReady","at","inst","SESSION_KEY","e","AppLifecycleEmitter","emitter","onState","isActive","options","CrashHandler","crashHandler","FrameDropTracker","frameDropTracker","NetworkTrackerWeb","networkTracker","InteractionTrackerWeb","WebVitalsTracker","NavigationTrackerWeb","assertApiKey","apiKey","createTelemetry","normalizeAllowlist"],"mappings":";;AAKO,MAAMA,UAAqBC,EAAc;AAAA,EAC5C,YAAYC,GAkBT;AACC,IAAAC,EAASD,GAAM,SAAS,EAAK,GAC7B,MAAA,GAEAE,EAAM,IAAI,0BAA0B,GAEpC,KAAK,mBAAmB,YAAY;AAChC,YAAM,EAAE,WAAAC,EAAA,I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