@nathanclaire/edge-telemetry-sdk 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/README.md +831 -186
  2. package/dist/appLifecycle-CECgRVu_.cjs +2 -0
  3. package/dist/appLifecycle-CECgRVu_.cjs.map +1 -0
  4. package/dist/appLifecycle-DQErzJIR.js +22 -0
  5. package/dist/appLifecycle-DQErzJIR.js.map +1 -0
  6. package/dist/batch-CwoO7noL.js +56 -0
  7. package/dist/batch-CwoO7noL.js.map +1 -0
  8. package/dist/batch-DNu8Xr9T.cjs +2 -0
  9. package/dist/batch-DNu8Xr9T.cjs.map +1 -0
  10. package/dist/crashCapture-BOJ8nSAZ.cjs +4 -0
  11. package/dist/crashCapture-BOJ8nSAZ.cjs.map +1 -0
  12. package/dist/crashCapture-BW8WuyaU.js +70 -0
  13. package/dist/crashCapture-BW8WuyaU.js.map +1 -0
  14. package/dist/crashHandler.web-8F_k2veo.js +29 -0
  15. package/dist/crashHandler.web-8F_k2veo.js.map +1 -0
  16. package/dist/crashHandler.web-CWmF56mJ.cjs +2 -0
  17. package/dist/crashHandler.web-CWmF56mJ.cjs.map +1 -0
  18. package/dist/crashHandlerNative.native-C2kSikDt.cjs +2 -0
  19. package/dist/crashHandlerNative.native-C2kSikDt.cjs.map +1 -0
  20. package/dist/crashHandlerNative.native-FupMnr1U.js +39 -0
  21. package/dist/crashHandlerNative.native-FupMnr1U.js.map +1 -0
  22. package/dist/deviceInfo.native-BJ-3Jj1T.js +53 -0
  23. package/dist/deviceInfo.native-BJ-3Jj1T.js.map +1 -0
  24. package/dist/deviceInfo.native-BoeTZcD6.cjs +2 -0
  25. package/dist/deviceInfo.native-BoeTZcD6.cjs.map +1 -0
  26. package/dist/deviceInfo.web-3L3IDQQA.cjs +2 -0
  27. package/dist/deviceInfo.web-3L3IDQQA.cjs.map +1 -0
  28. package/dist/deviceInfo.web-BFB1-pcA.js +41 -0
  29. package/dist/deviceInfo.web-BFB1-pcA.js.map +1 -0
  30. package/dist/frameTracker-CHG6sIx9.cjs +2 -0
  31. package/dist/frameTracker-CHG6sIx9.cjs.map +1 -0
  32. package/dist/frameTracker-DdB8W_kC.js +54 -0
  33. package/dist/frameTracker-DdB8W_kC.js.map +1 -0
  34. package/dist/httpAttributes-BrrtM8zh.js +70 -0
  35. package/dist/httpAttributes-BrrtM8zh.js.map +1 -0
  36. package/dist/httpAttributes-D0m6UID7.cjs +2 -0
  37. package/dist/httpAttributes-D0m6UID7.cjs.map +1 -0
  38. package/dist/index-BtLlV1HA.js +57 -0
  39. package/dist/index-BtLlV1HA.js.map +1 -0
  40. package/dist/{deviceInfo.native-D2k0LDhI.js → index-C2XQ-EYw.js} +362 -411
  41. package/dist/index-C2XQ-EYw.js.map +1 -0
  42. package/dist/index-CXsVZY35.cjs +2 -0
  43. package/dist/index-CXsVZY35.cjs.map +1 -0
  44. package/dist/index-DLquF88M.cjs +2 -0
  45. package/dist/index-DLquF88M.cjs.map +1 -0
  46. package/dist/index.native.cjs +1 -1
  47. package/dist/index.native.cjs.map +1 -1
  48. package/dist/index.native.js +94 -59
  49. package/dist/index.native.js.map +1 -1
  50. package/dist/index.web.cjs +1 -1
  51. package/dist/index.web.cjs.map +1 -1
  52. package/dist/index.web.js +88 -33
  53. package/dist/index.web.js.map +1 -1
  54. package/dist/interactionWeb.web-Bl_cZlgh.cjs +2 -0
  55. package/dist/interactionWeb.web-Bl_cZlgh.cjs.map +1 -0
  56. package/dist/interactionWeb.web-CJAviVQ7.js +109 -0
  57. package/dist/interactionWeb.web-CJAviVQ7.js.map +1 -0
  58. package/dist/interceptFetchWeb.web-T88kO-bE.cjs +2 -0
  59. package/dist/interceptFetchWeb.web-T88kO-bE.cjs.map +1 -0
  60. package/dist/interceptFetchWeb.web-UXC2Lb6X.js +61 -0
  61. package/dist/interceptFetchWeb.web-UXC2Lb6X.js.map +1 -0
  62. package/dist/interceptHttpNative.native-BVpFuoNB.cjs +2 -0
  63. package/dist/interceptHttpNative.native-BVpFuoNB.cjs.map +1 -0
  64. package/dist/interceptHttpNative.native-rX-lPNST.js +18 -0
  65. package/dist/interceptHttpNative.native-rX-lPNST.js.map +1 -0
  66. package/dist/loadingTime-Bhomd9qq.cjs +2 -0
  67. package/dist/loadingTime-Bhomd9qq.cjs.map +1 -0
  68. package/dist/loadingTime-ZkYvFijA.js +70 -0
  69. package/dist/loadingTime-ZkYvFijA.js.map +1 -0
  70. package/dist/memoryNative.native-C42h9SjK.js +54 -0
  71. package/dist/memoryNative.native-C42h9SjK.js.map +1 -0
  72. package/dist/memoryNative.native-CA-7w9w1.cjs +2 -0
  73. package/dist/memoryNative.native-CA-7w9w1.cjs.map +1 -0
  74. package/dist/memoryStore-BIGZmmfD.cjs +2 -0
  75. package/dist/memoryStore-BIGZmmfD.cjs.map +1 -0
  76. package/dist/memoryStore-F5I-GQKM.js +193 -0
  77. package/dist/memoryStore-F5I-GQKM.js.map +1 -0
  78. package/dist/nativeSender-CfQaRuDK.cjs +2 -0
  79. package/dist/nativeSender-CfQaRuDK.cjs.map +1 -0
  80. package/dist/nativeSender-pgVSIv-X.js +59 -0
  81. package/dist/nativeSender-pgVSIv-X.js.map +1 -0
  82. package/dist/navigationRef-BzYbs8cm.js +28 -0
  83. package/dist/navigationRef-BzYbs8cm.js.map +1 -0
  84. package/dist/navigationRef-C-_qhb43.cjs +2 -0
  85. package/dist/navigationRef-C-_qhb43.cjs.map +1 -0
  86. package/dist/{navigationTracker-Cts68dgG.js → navigationTracker-BmywA_Bg.js} +4 -4
  87. package/dist/navigationTracker-BmywA_Bg.js.map +1 -0
  88. package/dist/navigationTracker-HkwVyywz.cjs +2 -0
  89. package/dist/navigationTracker-HkwVyywz.cjs.map +1 -0
  90. package/dist/navigationWeb.web-CW_z7Ca4.cjs +2 -0
  91. package/dist/navigationWeb.web-CW_z7Ca4.cjs.map +1 -0
  92. package/dist/navigationWeb.web-CcwgKuIZ.js +55 -0
  93. package/dist/navigationWeb.web-CcwgKuIZ.js.map +1 -0
  94. package/dist/{networkInfo.native-BK5fpAOL.js → networkInfo.native-CGrx9cnH.js} +15 -15
  95. package/dist/{networkInfo.native-BK5fpAOL.js.map → networkInfo.native-CGrx9cnH.js.map} +1 -1
  96. package/dist/{networkInfo.native-cxuw93Uy.cjs → networkInfo.native-YVySdv3S.cjs} +2 -2
  97. package/dist/{networkInfo.native-cxuw93Uy.cjs.map → networkInfo.native-YVySdv3S.cjs.map} +1 -1
  98. package/dist/{networkInfo.web-twcNn_hc.js → networkInfo.web-B2YlLNsI.js} +3 -3
  99. package/dist/networkInfo.web-B2YlLNsI.js.map +1 -0
  100. package/dist/networkInfo.web-PltJTHsy.cjs +2 -0
  101. package/dist/networkInfo.web-PltJTHsy.cjs.map +1 -0
  102. package/dist/runtimeReady.native-Bh7EcYmK.js +14 -0
  103. package/dist/runtimeReady.native-Bh7EcYmK.js.map +1 -0
  104. package/dist/runtimeReady.native-jUmuE1lV.cjs +2 -0
  105. package/dist/runtimeReady.native-jUmuE1lV.cjs.map +1 -0
  106. package/dist/runtimeReady.web-C8fdIbVR.js +25 -0
  107. package/dist/runtimeReady.web-C8fdIbVR.js.map +1 -0
  108. package/dist/runtimeReady.web-DHW682RN.cjs +2 -0
  109. package/dist/runtimeReady.web-DHW682RN.cjs.map +1 -0
  110. package/dist/seedRuntimeReady-BKwkBEAF.cjs +2 -0
  111. package/dist/seedRuntimeReady-BKwkBEAF.cjs.map +1 -0
  112. package/dist/seedRuntimeReady-Cz8nOKoo.js +10 -0
  113. package/dist/seedRuntimeReady-Cz8nOKoo.js.map +1 -0
  114. package/dist/src/adapters/appLifecycle.d.ts +8 -1
  115. package/dist/src/adapters/batch.d.ts +2 -0
  116. package/dist/src/adapters/crashCapture.d.ts +38 -9
  117. package/dist/src/adapters/failedEvents.d.ts +43 -0
  118. package/dist/src/adapters/frameAggregate.d.ts +8 -3
  119. package/dist/src/adapters/frameTracker.d.ts +30 -0
  120. package/dist/src/adapters/httpAttributes.d.ts +18 -0
  121. package/dist/src/adapters/loadingTime.d.ts +67 -0
  122. package/dist/src/adapters/native/interceptHttpNative.native.d.ts +18 -0
  123. package/dist/src/adapters/native/memoryNative.native.d.ts +15 -11
  124. package/dist/src/adapters/native/runtimeReady.native.d.ts +1 -0
  125. package/dist/src/adapters/native/store.native.d.ts +10 -0
  126. package/dist/src/adapters/nativeSender.d.ts +2 -2
  127. package/dist/src/adapters/navigationRef.d.ts +21 -0
  128. package/dist/src/adapters/navigationTracker.d.ts +1 -1
  129. package/dist/src/adapters/screenTiming.d.ts +8 -2
  130. package/dist/src/adapters/seedRuntimeReady.d.ts +8 -0
  131. package/dist/src/adapters/traceHeader.d.ts +33 -0
  132. package/dist/src/adapters/traceManager.d.ts +131 -0
  133. package/dist/src/adapters/uiInteraction.d.ts +111 -0
  134. package/dist/src/adapters/viewManager.d.ts +161 -0
  135. package/dist/src/adapters/viewport.d.ts +15 -0
  136. package/dist/src/adapters/web/interactionWeb.web.d.ts +36 -0
  137. package/dist/src/adapters/web/interceptFetchWeb.web.d.ts +3 -11
  138. package/dist/src/adapters/web/navigationWeb.web.d.ts +10 -0
  139. package/dist/src/adapters/web/runtimeReady.web.d.ts +5 -0
  140. package/dist/src/adapters/web/store.web.d.ts +12 -0
  141. package/dist/src/adapters/web/webVitals.web.d.ts +49 -0
  142. package/dist/src/adapters/webSender.d.ts +2 -2
  143. package/dist/src/adapters/webVitals.d.ts +25 -0
  144. package/dist/src/adapters/xhrIntercept.d.ts +53 -0
  145. package/dist/src/core/beforeSend.d.ts +20 -0
  146. package/dist/src/core/debug.d.ts +7 -0
  147. package/dist/src/core/memoryStore.d.ts +23 -0
  148. package/dist/src/core/store.d.ts +41 -0
  149. package/dist/src/core/telemetry.d.ts +305 -35
  150. package/dist/src/core/userProfile.d.ts +12 -0
  151. package/dist/src/core/utils/json.d.ts +7 -0
  152. package/dist/src/core/utils/uuid.d.ts +10 -1
  153. package/dist/src/createTelemetry.native.d.ts +7 -0
  154. package/dist/src/createTelemetry.web.d.ts +7 -0
  155. package/dist/src/index.base.d.ts +17 -1
  156. package/dist/src/index.native.d.ts +46 -9
  157. package/dist/src/index.web.d.ts +33 -2
  158. package/dist/store.native-BYBJcy6o.js +32 -0
  159. package/dist/store.native-BYBJcy6o.js.map +1 -0
  160. package/dist/store.native-TPqXngmF.cjs +2 -0
  161. package/dist/store.native-TPqXngmF.cjs.map +1 -0
  162. package/dist/store.web-CvqqN-_Z.cjs +2 -0
  163. package/dist/store.web-CvqqN-_Z.cjs.map +1 -0
  164. package/dist/store.web-DJAlN0nc.js +31 -0
  165. package/dist/store.web-DJAlN0nc.js.map +1 -0
  166. package/dist/telemetry-ByDJIz_9.js +1280 -0
  167. package/dist/telemetry-ByDJIz_9.js.map +1 -0
  168. package/dist/telemetry-CrU7i1Jc.cjs +2 -0
  169. package/dist/telemetry-CrU7i1Jc.cjs.map +1 -0
  170. package/dist/uiInteraction-CdzvEI1p.cjs +2 -0
  171. package/dist/uiInteraction-CdzvEI1p.cjs.map +1 -0
  172. package/dist/uiInteraction-DAqxxz0q.js +104 -0
  173. package/dist/uiInteraction-DAqxxz0q.js.map +1 -0
  174. package/dist/viewport-Dd85GUNO.cjs +2 -0
  175. package/dist/viewport-Dd85GUNO.cjs.map +1 -0
  176. package/dist/viewport-Dzmt5QwK.js +15 -0
  177. package/dist/viewport-Dzmt5QwK.js.map +1 -0
  178. package/dist/web-vitals.attribution-CVCPiX-h.cjs +2 -0
  179. package/dist/web-vitals.attribution-CVCPiX-h.cjs.map +1 -0
  180. package/dist/web-vitals.attribution-xw9N5MKQ.js +488 -0
  181. package/dist/web-vitals.attribution-xw9N5MKQ.js.map +1 -0
  182. package/dist/webSender-BIwslfpT.js +63 -0
  183. package/dist/webSender-BIwslfpT.js.map +1 -0
  184. package/dist/webSender-CVtE4sOF.cjs +2 -0
  185. package/dist/webSender-CVtE4sOF.cjs.map +1 -0
  186. package/dist/webVitals.web-CNIpsKlA.js +85 -0
  187. package/dist/webVitals.web-CNIpsKlA.js.map +1 -0
  188. package/dist/webVitals.web-DpWJ-iYp.cjs +2 -0
  189. package/dist/webVitals.web-DpWJ-iYp.cjs.map +1 -0
  190. package/dist/xhrIntercept-BADex6Cq.cjs +2 -0
  191. package/dist/xhrIntercept-BADex6Cq.cjs.map +1 -0
  192. package/dist/xhrIntercept-BNiA41Mj.js +53 -0
  193. package/dist/xhrIntercept-BNiA41Mj.js.map +1 -0
  194. package/docs/migration-v4.md +190 -0
  195. package/package.json +12 -4
  196. package/dist/appLifecycle-Cynw0kAv.js +0 -14
  197. package/dist/appLifecycle-Cynw0kAv.js.map +0 -1
  198. package/dist/appLifecycle-DvJIt7ym.cjs +0 -2
  199. package/dist/appLifecycle-DvJIt7ym.cjs.map +0 -1
  200. package/dist/batch-CLBFgYPC.cjs +0 -2
  201. package/dist/batch-CLBFgYPC.cjs.map +0 -1
  202. package/dist/batch-DLG_gtOm.js +0 -12
  203. package/dist/batch-DLG_gtOm.js.map +0 -1
  204. package/dist/crashCapture-BYTM4FLC.cjs +0 -2
  205. package/dist/crashCapture-BYTM4FLC.cjs.map +0 -1
  206. package/dist/crashCapture-D_rkkBVa.js +0 -31
  207. package/dist/crashCapture-D_rkkBVa.js.map +0 -1
  208. package/dist/crashHandler.web-BSxDpFTo.cjs +0 -2
  209. package/dist/crashHandler.web-BSxDpFTo.cjs.map +0 -1
  210. package/dist/crashHandler.web-D59bmhg9.js +0 -32
  211. package/dist/crashHandler.web-D59bmhg9.js.map +0 -1
  212. package/dist/crashHandlerNative.native-DeAFze4E.cjs +0 -2
  213. package/dist/crashHandlerNative.native-DeAFze4E.cjs.map +0 -1
  214. package/dist/crashHandlerNative.native-d7qJkzA6.js +0 -41
  215. package/dist/crashHandlerNative.native-d7qJkzA6.js.map +0 -1
  216. package/dist/debug-DsvQ9y3W.js +0 -68
  217. package/dist/debug-DsvQ9y3W.js.map +0 -1
  218. package/dist/debug-rnOOxFpN.cjs +0 -2
  219. package/dist/debug-rnOOxFpN.cjs.map +0 -1
  220. package/dist/deviceInfo.native-7hbRYixR.cjs +0 -2
  221. package/dist/deviceInfo.native-7hbRYixR.cjs.map +0 -1
  222. package/dist/deviceInfo.native-D2k0LDhI.js.map +0 -1
  223. package/dist/deviceInfo.web-ByNAlEJh.cjs +0 -2
  224. package/dist/deviceInfo.web-ByNAlEJh.cjs.map +0 -1
  225. package/dist/deviceInfo.web-DzQyEku6.js +0 -40
  226. package/dist/deviceInfo.web-DzQyEku6.js.map +0 -1
  227. package/dist/frameAggregate-C_HoVFcK.cjs +0 -2
  228. package/dist/frameAggregate-C_HoVFcK.cjs.map +0 -1
  229. package/dist/frameAggregate-Cwh1juw1.js +0 -17
  230. package/dist/frameAggregate-Cwh1juw1.js.map +0 -1
  231. package/dist/frameDropsNative.native-CP7zrXDf.js +0 -23
  232. package/dist/frameDropsNative.native-CP7zrXDf.js.map +0 -1
  233. package/dist/frameDropsNative.native-DKqEDqip.cjs +0 -2
  234. package/dist/frameDropsNative.native-DKqEDqip.cjs.map +0 -1
  235. package/dist/frameDropsWeb.web-C9Lt3Fuj.js +0 -22
  236. package/dist/frameDropsWeb.web-C9Lt3Fuj.js.map +0 -1
  237. package/dist/frameDropsWeb.web-azpwQCUz.cjs +0 -2
  238. package/dist/frameDropsWeb.web-azpwQCUz.cjs.map +0 -1
  239. package/dist/httpAttributes-BV50UKQU.js +0 -19
  240. package/dist/httpAttributes-BV50UKQU.js.map +0 -1
  241. package/dist/httpAttributes-xXOD9trQ.cjs +0 -2
  242. package/dist/httpAttributes-xXOD9trQ.cjs.map +0 -1
  243. package/dist/interaction-CH8yoY5-.js +0 -23
  244. package/dist/interaction-CH8yoY5-.js.map +0 -1
  245. package/dist/interaction-DcNFBW7a.cjs +0 -2
  246. package/dist/interaction-DcNFBW7a.cjs.map +0 -1
  247. package/dist/interceptFetchNative.native-VlhtMG-U.js +0 -49
  248. package/dist/interceptFetchNative.native-VlhtMG-U.js.map +0 -1
  249. package/dist/interceptFetchNative.native-jEAldH14.cjs +0 -2
  250. package/dist/interceptFetchNative.native-jEAldH14.cjs.map +0 -1
  251. package/dist/interceptFetchWeb.web-DFzZliik.cjs +0 -2
  252. package/dist/interceptFetchWeb.web-DFzZliik.cjs.map +0 -1
  253. package/dist/interceptFetchWeb.web-DfsMfoRP.js +0 -77
  254. package/dist/interceptFetchWeb.web-DfsMfoRP.js.map +0 -1
  255. package/dist/memoryNative.native-BWLh2S9L.js +0 -48
  256. package/dist/memoryNative.native-BWLh2S9L.js.map +0 -1
  257. package/dist/memoryNative.native-DCXSOd4Q.cjs +0 -2
  258. package/dist/memoryNative.native-DCXSOd4Q.cjs.map +0 -1
  259. package/dist/memoryWeb.web-B3YuV-cB.js +0 -48
  260. package/dist/memoryWeb.web-B3YuV-cB.js.map +0 -1
  261. package/dist/memoryWeb.web-CheXAcJn.cjs +0 -2
  262. package/dist/memoryWeb.web-CheXAcJn.cjs.map +0 -1
  263. package/dist/nativeSender-BE_mzw_S.js +0 -70
  264. package/dist/nativeSender-BE_mzw_S.js.map +0 -1
  265. package/dist/nativeSender-DyAUGY7c.cjs +0 -2
  266. package/dist/nativeSender-DyAUGY7c.cjs.map +0 -1
  267. package/dist/navigationNative.native-3tO5JxSd.cjs +0 -2
  268. package/dist/navigationNative.native-3tO5JxSd.cjs.map +0 -1
  269. package/dist/navigationNative.native-BUCGPQX2.js +0 -25
  270. package/dist/navigationNative.native-BUCGPQX2.js.map +0 -1
  271. package/dist/navigationTracker-B2GMwyKk.cjs +0 -2
  272. package/dist/navigationTracker-B2GMwyKk.cjs.map +0 -1
  273. package/dist/navigationTracker-Cts68dgG.js.map +0 -1
  274. package/dist/navigationWeb.web-B0necr5j.cjs +0 -2
  275. package/dist/navigationWeb.web-B0necr5j.cjs.map +0 -1
  276. package/dist/navigationWeb.web-CORzE_Id.js +0 -46
  277. package/dist/navigationWeb.web-CORzE_Id.js.map +0 -1
  278. package/dist/networkInfo.web-DJmw1sNK.cjs +0 -2
  279. package/dist/networkInfo.web-DJmw1sNK.cjs.map +0 -1
  280. package/dist/networkInfo.web-twcNn_hc.js.map +0 -1
  281. package/dist/src/adapters/interaction.d.ts +0 -17
  282. package/dist/src/adapters/native/frameDropsNative.native.d.ts +0 -16
  283. package/dist/src/adapters/native/interceptFetchNative.native.d.ts +0 -23
  284. package/dist/src/adapters/native/navigationNative.native.d.ts +0 -12
  285. package/dist/src/adapters/web/frameDropsWeb.web.d.ts +0 -16
  286. package/dist/src/adapters/web/memoryWeb.web.d.ts +0 -26
  287. package/dist/telemetry-Co4MYdwa.cjs +0 -2
  288. package/dist/telemetry-Co4MYdwa.cjs.map +0 -1
  289. package/dist/telemetry-KI0x4gzC.js +0 -389
  290. package/dist/telemetry-KI0x4gzC.js.map +0 -1
  291. package/dist/v4-BysszJq8.js +0 -31
  292. package/dist/v4-BysszJq8.js.map +0 -1
  293. package/dist/v4-CqdK_b8Y.cjs +0 -2
  294. package/dist/v4-CqdK_b8Y.cjs.map +0 -1
  295. package/dist/webSender-B27tmT1w.js +0 -42
  296. package/dist/webSender-B27tmT1w.js.map +0 -1
  297. package/dist/webSender-BWi4x1df.cjs +0 -2
  298. package/dist/webSender-BWi4x1df.cjs.map +0 -1
@@ -0,0 +1,15 @@
1
+ /** §3.3 types all four never-null, so this returns all four or none of it is honest. */
2
+ export type ViewportKeys = {
3
+ screen_density: number;
4
+ screen_width_px: number;
5
+ screen_height_px: number;
6
+ orientation: Orientation;
7
+ };
8
+ /** §3.3's cardinality is 2. A square window reports `portrait`. */
9
+ export type Orientation = "portrait" | "landscape";
10
+ /**
11
+ * @param cssWidth logical width — dp on native, CSS px on web
12
+ * @param cssHeight logical height, same units
13
+ * @param density the pixel ratio, so `cssWidth * density` is physical pixels on both
14
+ */
15
+ export declare function viewportKeys(cssWidth: number, cssHeight: number, density: number): ViewportKeys;
@@ -0,0 +1,36 @@
1
+ import { Telemetry } from '../../core/telemetry';
2
+ export declare class InteractionTrackerWeb {
3
+ private telemetry;
4
+ private started;
5
+ private readonly rage;
6
+ /**
7
+ * Monotonic aliveness counter. A DOM mutation, a request start or a view mint bumps it;
8
+ * a click that sees the same value a window later saw nothing happen. A counter rather
9
+ * than a timestamp so the comparison needs no clock and cannot be fooled by a clock that
10
+ * moved backwards.
11
+ */
12
+ private aliveTick;
13
+ private readonly pending;
14
+ private observer?;
15
+ constructor(telemetry: Telemetry);
16
+ start(): void;
17
+ private onClick;
18
+ /** Arm one dead-click window and emit when it closes. */
19
+ private watchForDeath;
20
+ /**
21
+ * Emit every open window **now**, with `ui.dead` **omitted** — the window never closed,
22
+ * so it was not evaluated, which is exactly what its absence means (§4.6). Inventing a
23
+ * verdict from a partial window is the false accusation the key is built to avoid.
24
+ */
25
+ private drainPending;
26
+ private emit;
27
+ private canObserve;
28
+ /**
29
+ * Observed only while a window is open. A permanently-connected whole-document observer
30
+ * is a real cost on a busy React tree, and there is nothing to answer between clicks.
31
+ * `attributes: true` because §4.6 counts an attribute-only change as alive — a CSS class
32
+ * flip is a response.
33
+ */
34
+ private connectObserver;
35
+ private disconnectObserver;
36
+ }
@@ -1,14 +1,9 @@
1
1
  import { Telemetry } from '../../core/telemetry';
2
2
  /**
3
- * NetworkTrackerWeb intercepts all HTTP requests made through
4
- * `window.fetch` and `XMLHttpRequest` in a browser environment.
3
+ * NetworkTrackerWeb intercepts HTTP made through `window.fetch` and `XMLHttpRequest`.
5
4
  *
6
- * It logs detailed telemetry data such as request URL, HTTP method,
7
- * response status, request and response body sizes, request duration,
8
- * and error information, if any.
9
- *
10
- * This class should be instantiated once and the `start` method called
11
- * during application initialization to begin interception.
5
+ * Both are patched here, unlike native: browser `fetch` is a native implementation, not
6
+ * XHR-backed, so the two are genuinely separate channels and neither double-counts (§4.4).
12
7
  */
13
8
  export declare class NetworkTrackerWeb {
14
9
  private telemetry;
@@ -20,9 +15,6 @@ export declare class NetworkTrackerWeb {
20
15
  /**
21
16
  * Starts intercepting HTTP requests made through `fetch` and `XMLHttpRequest`.
22
17
  *
23
- * This method patches the global `fetch` function and `XMLHttpRequest` methods
24
- * `open` and `send` to gather telemetry and log it asynchronously.
25
- *
26
18
  * @returns A Promise that resolves immediately once interception is setup.
27
19
  */
28
20
  start(): Promise<void>;
@@ -26,4 +26,14 @@ export declare class NavigationTrackerWeb {
26
26
  * to detect route changes triggered by browser controls.
27
27
  */
28
28
  private listenPopState;
29
+ /**
30
+ * One route change: the existing `navigation` row, then rung 3 of the name ladder
31
+ * (§4.5.1) — the *last* rung, so an `attachNavigation` consumer's `route.name` outranks
32
+ * it whichever arrives first.
33
+ *
34
+ * Normalized by §4.4.1's rule, and the query string is dropped: there is no `view.url`
35
+ * and no raw path on the wire, because the identifier lives in the path
36
+ * (`/accounts/GB29-NWBK-…`) and query-stripping alone would not have addressed that.
37
+ */
38
+ private handleChange;
29
39
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Resolves once the marker is known — `undefined` when the platform has none to give, which
3
+ * releases the gate rather than leaving every launch reporting `abandoned` (§4.5.2).
4
+ */
5
+ export declare function runtimeReadyAt(): Promise<number | undefined>;
@@ -0,0 +1,12 @@
1
+ import { SyncStore } from '../../core/store';
2
+ /**
3
+ * localStorage-backed Store for the web build (#89). Reads are synchronous, and
4
+ * that is the point: state written here is durable before the next line runs, so
5
+ * the crash-loss window closes rather than narrows.
6
+ *
7
+ * Every access is guarded. Touching `localStorage` throws — not returns null — in
8
+ * incognito with cookies blocked, in a partitioned third-party iframe, and once
9
+ * quota is exhausted; and the identifier isn't declared at all outside a browser.
10
+ * All of those are `unavailable`, never an exception out of the SDK.
11
+ */
12
+ export declare function webStore(): SyncStore;
@@ -0,0 +1,49 @@
1
+ import { ViewLoadType } from '../viewManager';
2
+ /**
3
+ * All this tracker needs of core. Structural, so it is testable without a `Telemetry`.
4
+ */
5
+ type VitalsEmitter = {
6
+ logMetric(name: string, value: number, data?: Record<string, any>): unknown;
7
+ views: {
8
+ onBoundary(fn: (successorLoadType: ViewLoadType) => unknown): () => void;
9
+ };
10
+ };
11
+ export declare class WebVitalsTracker {
12
+ private telemetry;
13
+ /** The running values, held rather than emitted — see `start()`. */
14
+ private held;
15
+ /** What each held name last shipped, so an unchanged value does not re-ship at every hide. */
16
+ private emitted;
17
+ private started;
18
+ constructor(telemetry: VitalsEmitter);
19
+ /**
20
+ * Idempotent: a second call must not double-subscribe and double every vital row.
21
+ *
22
+ * LCP, FCP and TTFB fire once on the initial load, so they emit straight from the callback.
23
+ *
24
+ * ⚠ **CLS and INP subscribe with `reportAllChanges: true` as a running-value subscription,
25
+ * not an emission trigger.** The latest value is held in memory and shipped at the
26
+ * `ViewManager`'s background boundary — the library's default page-hide report loses both
27
+ * on a closed tab, because that report races the document's own teardown.
28
+ *
29
+ * ⚠ **All five are page-load-scoped, not view-scoped.** `LCP`, `FCP` and `TTFB` physically
30
+ * cannot recur on a soft navigation, so `view.id` on a vital row is always the *initial*
31
+ * view's. It is a real join key, it is just not "the view this happened in" for CLS and INP:
32
+ * `GROUP BY view.name` over vitals reads **"by entry point"**. Documented, not engineered
33
+ * around — view-scoping would need the Chrome-only Soft Navigations API.
34
+ */
35
+ start(): Promise<void>;
36
+ /**
37
+ * Awaited inside `beginView` while the departing view is still current, so the rows carry
38
+ * the view they were accumulated under. A name whose running value has not moved since its
39
+ * last row is skipped — a tab hidden twice with no shifts in between is not two CLS
40
+ * samples, and the library's own report has the same no-delta-no-report property.
41
+ *
42
+ * Keying on `value` alone is exact for both held vitals, not a shortcut: CLS is cumulative,
43
+ * so *any* shift moves it, and INP only changes when a worse interaction happens. An
44
+ * unchanged value therefore means the attribution is unchanged too.
45
+ */
46
+ private drain;
47
+ private emit;
48
+ }
49
+ export {};
@@ -1,3 +1,3 @@
1
1
  import { Sender } from '../core/telemetry';
2
- export declare function webSender(endpoint?: string, apiKey?: string, retryCount?: number): Sender;
3
- export declare function replayFailedWeb(endpoint?: string, apiKey?: string, retryCount?: number): Promise<void> | undefined;
2
+ import { SyncStore } from '../core/store';
3
+ export declare function webSender(endpoint?: string, apiKey?: string, store?: SyncStore, retryCount?: number): Sender;
@@ -0,0 +1,25 @@
1
+ /** The five names. All are already on `ALLOWED_NAMES`, and all ride the **metric** path. */
2
+ export type VitalName = "LCP" | "FCP" | "CLS" | "INP" | "TTFB";
3
+ /**
4
+ * Structurally typed against `web-vitals/attribution`'s metric, so this module compiles and
5
+ * tests without the library and cannot pull it into a shared import graph.
6
+ */
7
+ export type VitalMetric = {
8
+ name: string;
9
+ value: number;
10
+ rating: string;
11
+ navigationType: string;
12
+ attribution?: Record<string, any>;
13
+ };
14
+ /**
15
+ * Build a vital row's attribute bag: four shared keys plus the per-vital ones (§5.3).
16
+ *
17
+ * ⚠ **LCP's four phases sum exactly to `value`** — that is the library's own guarantee and a
18
+ * testable claim, which is why `lcp.time_to_first_byte` deliberately duplicates the `TTFB` row
19
+ * rather than forcing a cross-row join to decompose one number.
20
+ *
21
+ * Everything the library did not produce is **omitted**, never nulled: `vital.target` and
22
+ * `vital.load_state` are absent on the vitals that have no element and no load state, and the
23
+ * SDK's absent-means-nothing discipline is what tells that apart from a zero.
24
+ */
25
+ export declare function vitalAttributes(m: VitalMetric): Record<string, any>;
@@ -0,0 +1,53 @@
1
+ import { Telemetry, LogSnapshot } from '../core/telemetry';
2
+ import { TraceAttributes } from './traceManager';
3
+ declare const PATCHED = "__edgeTelemetryXhrPatched";
4
+ interface PendingRequest {
5
+ method: string;
6
+ url: string;
7
+ start: number;
8
+ body?: unknown;
9
+ /**
10
+ * Closes this request's contribution to §4.5.2's network settle. Bound at `send()` to the
11
+ * view that was live *then*, so a response landing after a route change belongs to the view
12
+ * it started in and does not hold the arriving one open.
13
+ */
14
+ settled?: (endedAt?: number) => void;
15
+ /**
16
+ * §6.3's Tier 1 keys, captured at `send()` so the parent is the root live *then* and
17
+ * `span.start_time` is the send. Called at `loadend` to stamp `span.duration_ms` off
18
+ * the same pair of timestamps `http.duration_ms` uses.
19
+ */
20
+ span?: (endedAt: number) => TraceAttributes;
21
+ /**
22
+ * §6.4's ownership flag: the consumer's own `traceparent`, recorded **at their write
23
+ * time** in the `setRequestHeader` patch. Never inferred from the value's shape — an
24
+ * SDK-minted and a consumer-minted header are byte-identical by construction — and reset
25
+ * by `open()`, which per spec clears the author request headers anyway.
26
+ */
27
+ consumerTraceparent?: string;
28
+ /**
29
+ * §3.1's attribution freeze: `session.id`, `session.start_time` and `view.id` as they
30
+ * were at `send()`. The 4-hour cap can rotate a session *while this request is in
31
+ * flight*, which would otherwise put S1's trace on an S2 row. No `at` — the row still
32
+ * reports its completion timestamp (§4.4).
33
+ */
34
+ snap?: LogSnapshot;
35
+ }
36
+ interface PatchedXhr extends XMLHttpRequest {
37
+ _telemetryRequest?: PendingRequest;
38
+ _telemetryListening?: boolean;
39
+ }
40
+ type XhrCtor = {
41
+ prototype: PatchedXhr;
42
+ [PATCHED]?: boolean;
43
+ };
44
+ /**
45
+ * Patches an `XMLHttpRequest` prototype so every completed request emits one `http.request`.
46
+ * Shared because the native build is XHR-*only* (§4.4: RN's `global.fetch` is XHR underneath,
47
+ * so patching both emits two events per call) while the web build patches XHR alongside its
48
+ * own `fetch` patch — same emit rules, two different sets of callers.
49
+ *
50
+ * @returns the unpatch, so `stop()` can restore the prototype.
51
+ */
52
+ export declare function patchXHR(telemetry: Telemetry, xhr: XhrCtor): () => void;
53
+ export {};
@@ -0,0 +1,20 @@
1
+ import { TelemetryEvent } from './telemetry';
2
+ /**
3
+ * The consumer's scrubbing hook (§3.6). One event, **synchronous**, run at **enqueue**.
4
+ *
5
+ * Enqueue and not flush: a failed send persists the batch through the `Store`, so a
6
+ * flush-time hook would let unscrubbed PII hit disk — and on native that disk outlives
7
+ * the process. Synchronous because `app.crash` flushes during teardown and a
8
+ * Promise-returning hook would put a host `await` in a dying app's path.
9
+ */
10
+ export type BeforeSend = (event: TelemetryEvent) => TelemetryEvent | null;
11
+ export type HookOutcome = {
12
+ kind: "kept";
13
+ event: TelemetryEvent;
14
+ } | {
15
+ kind: "dropped";
16
+ } | {
17
+ kind: "failed";
18
+ };
19
+ /** Run the hook and enforce the tiers on what comes back. */
20
+ export declare function applyBeforeSend(original: TelemetryEvent, hook: BeforeSend): HookOutcome;
@@ -4,3 +4,10 @@ export declare const debug: {
4
4
  warn: (...args: any[]) => void;
5
5
  error: (...args: any[]) => void;
6
6
  };
7
+ /**
8
+ * `__DEV__` on RN, `NODE_ENV` elsewhere. Dev-only *config* diagnostics (a malformed
9
+ * allowlist, the `Error.stackTraceLimit` advisory) surface through this rather than the
10
+ * `debug` gate above: they are wiring mistakes the consumer has to see while building,
11
+ * and `debug: true` is exactly what a consumer with a wiring mistake has not set.
12
+ */
13
+ export declare function isDev(): boolean;
@@ -0,0 +1,23 @@
1
+ import { AsyncStore, SyncStore } from './store';
2
+ export type MemoryStoreOpts = {
3
+ /** Mirror the native build's Promise-returning shape instead of the web build's. */
4
+ async?: boolean;
5
+ /** Behave like incognito / a full disk: every call reports `unavailable`. */
6
+ unavailable?: boolean;
7
+ /** Pre-seeded contents. */
8
+ seed?: Record<string, string>;
9
+ };
10
+ /**
11
+ * In-memory Store (#89). A production-shaped seam that tests get to use, not a
12
+ * test-only affordance — it ships, and it is the right injection for a consumer
13
+ * that wants telemetry state to die with the process.
14
+ *
15
+ * Configurable to either build's shape so the sync/async asymmetry can be tested
16
+ * deliberately rather than assumed away.
17
+ */
18
+ export declare function memoryStore(opts: MemoryStoreOpts & {
19
+ async: true;
20
+ }): AsyncStore;
21
+ export declare function memoryStore(opts?: MemoryStoreOpts & {
22
+ async?: false;
23
+ }): SyncStore;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Reading storage has three outcomes, not two.
3
+ *
4
+ * `unavailable` is a first-class path, not an error: incognito, partitioned iframes,
5
+ * Safari ITP eviction and full disks all land here, and they are the population
6
+ * `device.id_ephemeral` reports (wire contract §3.2). It is deliberately distinct
7
+ * from `miss` — "storage said no" is not "storage had nothing stored".
8
+ */
9
+ export type StoreRead = {
10
+ status: "hit";
11
+ value: string;
12
+ } | {
13
+ status: "miss";
14
+ } | {
15
+ status: "unavailable";
16
+ };
17
+ /** Writes and removes carry the same unavailable path — quota exceeded, disk full. */
18
+ export type StoreWrite = {
19
+ status: "ok";
20
+ } | {
21
+ status: "unavailable";
22
+ };
23
+ /** Storage whose reads have completed by the time they return. The web build. */
24
+ export interface SyncStore {
25
+ readonly sync: true;
26
+ get(key: string): StoreRead;
27
+ set(key: string, value: string): StoreWrite;
28
+ remove(key: string): StoreWrite;
29
+ }
30
+ /** Storage whose reads settle later. The native build. */
31
+ export interface AsyncStore {
32
+ readonly sync: false;
33
+ get(key: string): Promise<StoreRead>;
34
+ set(key: string, value: string): Promise<StoreWrite>;
35
+ remove(key: string): Promise<StoreWrite>;
36
+ }
37
+ /**
38
+ * Either build. Shared core takes this; a caller that needs the synchronous
39
+ * guarantee narrows with `if (store.sync)` or takes `SyncStore` outright.
40
+ */
41
+ export type Store = SyncStore | AsyncStore;