@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 +0,0 @@
1
- {"version":3,"file":"memoryStore-BIGZmmfD.cjs","sources":["../src/core/debug.ts","../src/index.base.ts","../src/adapters/traceHeader.ts","../src/core/memoryStore.ts"],"sourcesContent":["// SDK-internal debug gate (#23, Workstream E). Silent by default so v3 never spams the\n// host app's console; `createTelemetry({ debug: true })` flips it on. Gates log AND\n// warn/error — nothing prints unless debug is enabled.\nlet enabled = false;\n\nexport function setDebug(on: boolean): void {\n enabled = on;\n}\n\nexport const debug = {\n log: (...args: any[]) => { if (enabled) console.log(...args); },\n warn: (...args: any[]) => { if (enabled) console.warn(...args); },\n error: (...args: any[]) => { if (enabled) console.error(...args); },\n};\n\n/**\n * `__DEV__` on RN, `NODE_ENV` elsewhere. Dev-only *config* diagnostics (a malformed\n * allowlist, the `Error.stackTraceLimit` advisory) surface through this rather than the\n * `debug` gate above: they are wiring mistakes the consumer has to see while building,\n * and `debug: true` is exactly what a consumer with a wiring mistake has not set.\n */\nexport function isDev(): boolean {\n const dev = (globalThis as any).__DEV__;\n if (typeof dev === \"boolean\") return dev;\n const env = (globalThis as any).process?.env?.NODE_ENV;\n return env !== undefined && env !== \"production\";\n}\n","// Shared delegation base for TelemetryWeb / TelemetryNative.\n// Both platform classes lazily build a core `Telemetry` behind `instancePromise`\n// and forward every public call to it; these methods are identical across platforms.\n// Platform-specific capture (getDeviceInfo, track*, screen) stays in the subclasses\n// because each imports a different platform adapter.\n\nimport { debug } from \"./core/debug\";\n\ntype ProfileInput = {\n userId?: string;\n /** @deprecated Removed in v5 — use `identify({ name })`. */\n fullName?: string;\n /** @deprecated Removed in v5 — never reaches the wire (§3.4). */\n firstName?: string;\n /** @deprecated Removed in v5 — never reaches the wire (§3.4). */\n lastName?: string;\n email?: string;\n phone?: string;\n /** @deprecated Removed in v5 — never reaches the wire (§3.4). */\n avatar?: string;\n customAttributes?: Record<string, any>;\n};\n\nexport abstract class TelemetryBase {\n protected instancePromise!: Promise<any>;\n\n async log(event: string, data?: Record<string, any>) {\n const inst = await this.instancePromise;\n // §4.7 — **there is no public path to `app.crash`.** It is the one name an unfiltered\n // `COUNT(event_name='app.crash') / sessions` is read from, so a consumer's own code\n // must not be able to manufacture rows in it. Routed to `app.error` rather than\n // dropped: a reported error is data, it just isn't a crash. (#100)\n if (event === \"app.crash\") {\n debug.warn(\"app.crash is SDK-owned (§4.7); routing to app.error — use captureError()\");\n // The whole bag still rides as context; this only decides which key gets promoted\n // to `error.message`. `crash.message` is here for v3 callers the rename stranded.\n const message = data?.[\"error.message\"] ?? data?.[\"message\"] ?? data?.[\"crash.message\"];\n return inst.captureError(message, data);\n }\n return inst.log(event, data);\n }\n\n async flush() {\n const inst = await this.instancePromise;\n return inst.flush();\n }\n\n async shutdown() {\n const inst = await this.instancePromise;\n return inst.shutdown();\n }\n\n /**\n * React Navigation → rung 2 of the name ladder, on **both** builds (§4.5.1, #96).\n * `getCurrentRoute()` is a navigation-tree API that works identically on RN-Web, so a\n * consumer wires navigation once and gets the same `view.name` on web and native.\n */\n async attachNavigation(navigationRef: any) {\n debug.log(\"Attaching navigation tracker\");\n if (!navigationRef) {\n debug.warn(\"Navigation reference is undefined. Cannot attach navigation tracker.\");\n return;\n }\n const inst = await this.instancePromise;\n const { NavigationRefTracker } = await import(\"./adapters/navigationRef\");\n new NavigationRefTracker(inst).attach(navigationRef);\n }\n\n /**\n * §4.7 — report a handled error as `app.error`. Accepts `unknown`, so a `catch` block\n * that received a string or an axios rejection object needs no narrowing first.\n * There is no public path to `app.crash`, by design (#100).\n */\n async captureError(error: unknown, context?: Record<string, any>) {\n const inst = await this.instancePromise;\n return inst.captureError(error, context);\n }\n\n async trackErrors(options?: { captureConsole?: boolean }) {\n const { CrashHandlerNative } = await import(\"./adapters/native/crashHandlerNative.native\");\n const inst = await this.instancePromise;\n const crashHandler = new CrashHandlerNative(inst);\n return inst.trackErrors(crashHandler, options);\n }\n\n // ---------- User Profile Management ----------\n\n async setUserId(id: string) {\n const inst = await this.instancePromise;\n inst.setUserId(id);\n }\n\n async setUserProfile(profile: ProfileInput) {\n const inst = await this.instancePromise;\n inst.setUserProfile(profile);\n }\n\n async setUserDetails(details: ProfileInput) {\n const inst = await this.instancePromise;\n inst.setUserDetails(details);\n }\n\n async updateUserProfile(updates: ProfileInput) {\n const inst = await this.instancePromise;\n inst.updateUserProfile(updates);\n }\n\n async getUserProfile() {\n const inst = await this.instancePromise;\n return inst.getUserProfile();\n }\n\n async clearUserProfile() {\n const inst = await this.instancePromise;\n inst.clearUserProfile();\n }\n\n async setUserName(fullName: string, firstName?: string, lastName?: string) {\n const inst = await this.instancePromise;\n inst.setUserName(fullName, firstName, lastName);\n }\n\n async setUserContact(email?: string, phone?: string) {\n const inst = await this.instancePromise;\n inst.setUserContact(email, phone);\n }\n\n // EdgeRum-style identify(): emits `user.profile.update`, the **only** event carrying\n // `user.name` / `.email` / `.phone` / `user.custom.*` (§4.10, #107).\n // `userId` is optional and sets the consumer-owned `user.id` the profile upserts on —\n // omit it and `user.id` is untouched; the SDK still never mints one (§3.2).\n async identify(profile: { userId?: string; name?: string; email?: string; phone?: string; avatar?: string; customAttributes?: Record<string, any> }) {\n const inst = await this.instancePromise;\n return inst.identify(profile);\n }\n}\n","// Distributed trace header injection (§6.4/§6.5, #99) — the pure half: allowlist\n// normalization, `traceparent` parse/format and header reading. Shared by both builds; the\n// stateful half (attribution, which decides *which* `injected_*` rung fires) lives on\n// TraceManager, which owns the carrier.\n//\n// **`traceparent` only. No `b3`, no `tracestate`, ever.** The SDK reads exactly one header\n// name, for exactly one purpose (a presence check), and writes exactly one header name. That\n// is a sentence a consumer must be able to state during a security review, so it is enforced\n// by there being no other header name anywhere in this file.\n\nimport { debug, isDev } from \"../core/debug\";\n\n/** Lowercase on purpose: header names are compared case-insensitively (§6.4). */\nexport const TRACEPARENT = \"traceparent\";\n\n/** §6.5's ladder. Precedence is declaration order; **absent means not traced**. */\nexport type TraceOutcome =\n | \"skipped_off_allowlist\"\n | \"skipped_no_cors\" // fetch-only: `mode` is a concept XHR cannot express\n | \"skipped_consumer_set\" // consumer header present and **unparseable**\n | \"adopted\" // consumer header present and **valid**\n | \"injected_attributed\"\n | \"injected_expired\"\n | \"injected_unattributed\";\n\n// A malformed allowlist entry throws in dev and is dropped in production (§6.4) — a stated\n// divergence from Android's unconditional `require`, because a RUM SDK crashing a shipped\n// banking app over a config typo is the one failure worse than no tracing at all. `isDev`\n// itself lives in core/debug, shared with §4.8's stackTraceLimit advisory.\n\n/**\n * A **bare host**: no scheme, no path, no port, no wildcard. Ports are ignored by matching\n * too — ⚠ a deliberate mismatch with `http.host`, which keeps the port. Do not join them.\n *\n * `new URL()` does the punycode fold, so a unicode entry and a unicode URL land on the same\n * ASCII string. An IPv6 literal contains `:` and is therefore rejected; bare hosts only.\n */\nfunction normalizeHost(entry: unknown): string | undefined {\n if (typeof entry !== \"string\") return undefined;\n const raw = entry.trim();\n if (!raw || /[\\s/?#@*:]/.test(raw)) return undefined;\n try {\n const host = new URL(`http://${raw}`).hostname;\n return host || undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Constructor-only, exact match, empty by default — v4 is **dark on upgrade**, so nobody's\n * CORS breaks until they opt in. Listing a host is the consumer's assertion that that host\n * allows the header; that is why regexes and predicates were rejected rather than deferred.\n */\nexport function normalizeAllowlist(entries: unknown): ReadonlySet<string> {\n const out = new Set<string>();\n if (entries === undefined || entries === null) return out;\n if (!Array.isArray(entries)) {\n if (isDev()) throw new Error(\"traceHostAllowlist must be an array of bare hosts\");\n debug.warn(\"Telemetry: traceHostAllowlist must be an array of bare hosts — ignored\");\n return out;\n }\n for (const entry of entries) {\n const host = normalizeHost(entry);\n if (host) { out.add(host); continue; }\n if (isDev()) {\n throw new Error(\n `traceHostAllowlist: \"${String(entry)}\" is not a bare host (no scheme, path, port or wildcard)`\n );\n }\n debug.warn(`Telemetry: traceHostAllowlist entry \"${String(entry)}\" is not a bare host — dropped`);\n }\n return out;\n}\n\n/** Matching is on `hostname` — **ports ignored**, exact-only, no wildcards, no same-origin exemption. */\nexport function allowsHost(allowlist: ReadonlySet<string>, url: string): boolean {\n if (allowlist.size === 0) return false;\n const base = (globalThis as any).location?.href;\n try {\n return allowlist.has((base ? new URL(url, base) : new URL(url)).hostname);\n } catch {\n return false; // a relative URL with no base has no host to allow\n }\n}\n\n/**\n * W3C `traceparent`, version `00`. Used for exactly one decision: is the consumer's own\n * header valid (`adopted`) or not (`skipped_consumer_set`)? An all-zero trace-id or span-id\n * is invalid by the spec. ⚠ Its price, said out loud: Android *repairs* a malformed consumer\n * header; §6.4's never-strip forbids that here, so it goes out broken and is unattributed on\n * both ends — visible in the outcome distribution rather than silently fixed.\n */\nexport function parseTraceparent(value: string | null | undefined): { traceId: string; spanId: string } | undefined {\n if (typeof value !== \"string\") return undefined;\n const m = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/.exec(value.trim());\n if (!m || /^0+$/.test(m[1]) || /^0+$/.test(m[2])) return undefined;\n return { traceId: m[1], spanId: m[2] };\n}\n\n/** Flags are always `01`: an unsampled session injects no header at all, not a `flags=00` id. */\nexport function formatTraceparent(traceId: string, spanId: string): string {\n return `00-${traceId}-${spanId}-01`;\n}\n\n/** Walks every `HeadersInit` shape without needing a `Headers` constructor to exist. */\nfunction forEachHeader(headers: unknown, fn: (name: string, value: string) => void): void {\n if (!headers) return;\n if (Array.isArray(headers)) {\n for (const pair of headers) if (pair) fn(String(pair[0]), String(pair[1]));\n } else if (typeof (headers as any).forEach === \"function\") {\n (headers as any).forEach((v: string, k: string) => fn(String(k), String(v))); // Headers\n } else if (typeof headers === \"object\") {\n for (const [k, v] of Object.entries(headers as object)) fn(k, String(v));\n }\n}\n\n/** Presence check only — the one purpose §6.4's read-scope invariant permits. */\nexport function readHeader(headers: unknown, name: string): string | undefined {\n let found: string | undefined;\n forEachHeader(headers, (k, v) => { if (k.toLowerCase() === name) found = v; });\n return found;\n}\n\n/**\n * A **copy** with our header appended. The consumer's `Headers`/`Request`/object is never\n * mutated, which is how never-strip is satisfied by construction rather than by discipline.\n * An array of pairs is a valid `HeadersInit` everywhere, so no `Headers` global is required.\n */\nexport function withHeader(headers: unknown, name: string, value: string): [string, string][] {\n const out: [string, string][] = [];\n forEachHeader(headers, (k, v) => out.push([k, v]));\n out.push([name, value]);\n return out;\n}\n","import type { AsyncStore, Store, StoreRead, StoreWrite, SyncStore } from \"./store\";\n\nexport type MemoryStoreOpts = {\n /** Mirror the native build's Promise-returning shape instead of the web build's. */\n async?: boolean;\n /** Behave like incognito / a full disk: every call reports `unavailable`. */\n unavailable?: boolean;\n /** Pre-seeded contents. */\n seed?: Record<string, string>;\n};\n\n/**\n * In-memory Store (#89). A production-shaped seam that tests get to use, not a\n * test-only affordance — it ships, and it is the right injection for a consumer\n * that wants telemetry state to die with the process.\n *\n * Configurable to either build's shape so the sync/async asymmetry can be tested\n * deliberately rather than assumed away.\n */\nexport function memoryStore(opts: MemoryStoreOpts & { async: true }): AsyncStore;\nexport function memoryStore(opts?: MemoryStoreOpts & { async?: false }): SyncStore;\nexport function memoryStore(opts: MemoryStoreOpts = {}): Store {\n const map = new Map<string, string>(Object.entries(opts.seed ?? {}));\n const unavailable = opts.unavailable === true;\n\n const get = (key: string): StoreRead => {\n if (unavailable) return { status: \"unavailable\" };\n const value = map.get(key);\n return value === undefined ? { status: \"miss\" } : { status: \"hit\", value };\n };\n const set = (key: string, value: string): StoreWrite => {\n if (unavailable) return { status: \"unavailable\" };\n map.set(key, value);\n return { status: \"ok\" };\n };\n const remove = (key: string): StoreWrite => {\n if (unavailable) return { status: \"unavailable\" };\n map.delete(key);\n return { status: \"ok\" };\n };\n\n return opts.async\n ? {\n sync: false,\n get: async k => get(k),\n set: async (k, v) => set(k, v),\n remove: async k => remove(k),\n }\n : { sync: true, get, set, remove };\n}\n"],"names":["enabled","setDebug","on","debug","args","isDev","dev","env","TelemetryBase","event","data","inst","message","navigationRef","NavigationRefTracker","error","context","options","CrashHandlerNative","crashHandler","id","profile","details","updates","fullName","firstName","lastName","email","phone","TRACEPARENT","normalizeHost","entry","raw","normalizeAllowlist","entries","out","host","allowsHost","allowlist","url","base","parseTraceparent","value","m","formatTraceparent","traceId","spanId","forEachHeader","headers","fn","pair","v","k","readHeader","name","found","withHeader","memoryStore","opts","map","unavailable","get","key","set","remove"],"mappings":"aAGA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,EAAK,MACN,CACE,KAAM,GACN,IAAK,MAAMN,GAAKS,EAAIT,CAAC,EACrB,IAAK,MAAOA,EAAGD,IAAMY,EAAIX,EAAGD,CAAC,EAC7B,OAAQ,MAAMC,GAAKY,EAAOZ,CAAC,CAAA,EAE7B,CAAE,KAAM,GAAM,IAAAS,EAAK,IAAAE,EAAK,OAAAC,CAAA,CAClC"}
@@ -1,193 +0,0 @@
1
- let u = !1;
2
- function w(n) {
3
- u = n;
4
- }
5
- const o = {
6
- log: (...n) => {
7
- u && console.log(...n);
8
- },
9
- warn: (...n) => {
10
- u && console.warn(...n);
11
- },
12
- error: (...n) => {
13
- u && console.error(...n);
14
- }
15
- };
16
- function f() {
17
- const n = globalThis.__DEV__;
18
- if (typeof n == "boolean") return n;
19
- const t = globalThis.process?.env?.NODE_ENV;
20
- return t !== void 0 && t !== "production";
21
- }
22
- class m {
23
- async log(t, s) {
24
- const r = await this.instancePromise;
25
- if (t === "app.crash") {
26
- o.warn("app.crash is SDK-owned (§4.7); routing to app.error — use captureError()");
27
- const e = s?.["error.message"] ?? s?.message ?? s?.["crash.message"];
28
- return r.captureError(e, s);
29
- }
30
- return r.log(t, s);
31
- }
32
- async flush() {
33
- return (await this.instancePromise).flush();
34
- }
35
- async shutdown() {
36
- return (await this.instancePromise).shutdown();
37
- }
38
- /**
39
- * React Navigation → rung 2 of the name ladder, on **both** builds (§4.5.1, #96).
40
- * `getCurrentRoute()` is a navigation-tree API that works identically on RN-Web, so a
41
- * consumer wires navigation once and gets the same `view.name` on web and native.
42
- */
43
- async attachNavigation(t) {
44
- if (o.log("Attaching navigation tracker"), !t) {
45
- o.warn("Navigation reference is undefined. Cannot attach navigation tracker.");
46
- return;
47
- }
48
- const s = await this.instancePromise, { NavigationRefTracker: r } = await import("./navigationRef-BzYbs8cm.js");
49
- new r(s).attach(t);
50
- }
51
- /**
52
- * §4.7 — report a handled error as `app.error`. Accepts `unknown`, so a `catch` block
53
- * that received a string or an axios rejection object needs no narrowing first.
54
- * There is no public path to `app.crash`, by design (#100).
55
- */
56
- async captureError(t, s) {
57
- return (await this.instancePromise).captureError(t, s);
58
- }
59
- async trackErrors(t) {
60
- const { CrashHandlerNative: s } = await import("./crashHandlerNative.native-FupMnr1U.js"), r = await this.instancePromise, e = new s(r);
61
- return r.trackErrors(e, t);
62
- }
63
- // ---------- User Profile Management ----------
64
- async setUserId(t) {
65
- (await this.instancePromise).setUserId(t);
66
- }
67
- async setUserProfile(t) {
68
- (await this.instancePromise).setUserProfile(t);
69
- }
70
- async setUserDetails(t) {
71
- (await this.instancePromise).setUserDetails(t);
72
- }
73
- async updateUserProfile(t) {
74
- (await this.instancePromise).updateUserProfile(t);
75
- }
76
- async getUserProfile() {
77
- return (await this.instancePromise).getUserProfile();
78
- }
79
- async clearUserProfile() {
80
- (await this.instancePromise).clearUserProfile();
81
- }
82
- async setUserName(t, s, r) {
83
- (await this.instancePromise).setUserName(t, s, r);
84
- }
85
- async setUserContact(t, s) {
86
- (await this.instancePromise).setUserContact(t, s);
87
- }
88
- // EdgeRum-style identify(): emits `user.profile.update`, the **only** event carrying
89
- // `user.name` / `.email` / `.phone` / `user.custom.*` (§4.10, #107).
90
- // `userId` is optional and sets the consumer-owned `user.id` the profile upserts on —
91
- // omit it and `user.id` is untouched; the SDK still never mints one (§3.2).
92
- async identify(t) {
93
- return (await this.instancePromise).identify(t);
94
- }
95
- }
96
- const y = "traceparent";
97
- function h(n) {
98
- if (typeof n != "string") return;
99
- const t = n.trim();
100
- if (!(!t || /[\s/?#@*:]/.test(t)))
101
- try {
102
- return new URL(`http://${t}`).hostname || void 0;
103
- } catch {
104
- return;
105
- }
106
- }
107
- function p(n) {
108
- const t = /* @__PURE__ */ new Set();
109
- if (n == null) return t;
110
- if (!Array.isArray(n)) {
111
- if (f()) throw new Error("traceHostAllowlist must be an array of bare hosts");
112
- return o.warn("Telemetry: traceHostAllowlist must be an array of bare hosts — ignored"), t;
113
- }
114
- for (const s of n) {
115
- const r = h(s);
116
- if (r) {
117
- t.add(r);
118
- continue;
119
- }
120
- if (f())
121
- throw new Error(
122
- `traceHostAllowlist: "${String(s)}" is not a bare host (no scheme, path, port or wildcard)`
123
- );
124
- o.warn(`Telemetry: traceHostAllowlist entry "${String(s)}" is not a bare host — dropped`);
125
- }
126
- return t;
127
- }
128
- function g(n, t) {
129
- if (n.size === 0) return !1;
130
- const s = globalThis.location?.href;
131
- try {
132
- return n.has((s ? new URL(t, s) : new URL(t)).hostname);
133
- } catch {
134
- return !1;
135
- }
136
- }
137
- function d(n) {
138
- if (typeof n != "string") return;
139
- const t = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/.exec(n.trim());
140
- if (!(!t || /^0+$/.test(t[1]) || /^0+$/.test(t[2])))
141
- return { traceId: t[1], spanId: t[2] };
142
- }
143
- function v(n, t) {
144
- return `00-${n}-${t}-01`;
145
- }
146
- function l(n, t) {
147
- if (n) {
148
- if (Array.isArray(n))
149
- for (const s of n) s && t(String(s[0]), String(s[1]));
150
- else if (typeof n.forEach == "function")
151
- n.forEach((s, r) => t(String(r), String(s)));
152
- else if (typeof n == "object")
153
- for (const [s, r] of Object.entries(n)) t(s, String(r));
154
- }
155
- }
156
- function P(n, t) {
157
- let s;
158
- return l(n, (r, e) => {
159
- r.toLowerCase() === t && (s = e);
160
- }), s;
161
- }
162
- function b(n, t, s) {
163
- const r = [];
164
- return l(n, (e, c) => r.push([e, c])), r.push([t, s]), r;
165
- }
166
- function U(n = {}) {
167
- const t = new Map(Object.entries(n.seed ?? {})), s = n.unavailable === !0, r = (a) => {
168
- if (s) return { status: "unavailable" };
169
- const i = t.get(a);
170
- return i === void 0 ? { status: "miss" } : { status: "hit", value: i };
171
- }, e = (a, i) => s ? { status: "unavailable" } : (t.set(a, i), { status: "ok" }), c = (a) => s ? { status: "unavailable" } : (t.delete(a), { status: "ok" });
172
- return n.async ? {
173
- sync: !1,
174
- get: async (a) => r(a),
175
- set: async (a, i) => e(a, i),
176
- remove: async (a) => c(a)
177
- } : { sync: !0, get: r, set: e, remove: c };
178
- }
179
- export {
180
- m as T,
181
- y as a,
182
- g as b,
183
- o as d,
184
- v as f,
185
- f as i,
186
- U as m,
187
- p as n,
188
- d as p,
189
- P as r,
190
- w as s,
191
- b as w
192
- };
193
- //# sourceMappingURL=memoryStore-F5I-GQKM.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memoryStore-F5I-GQKM.js","sources":["../src/core/debug.ts","../src/index.base.ts","../src/adapters/traceHeader.ts","../src/core/memoryStore.ts"],"sourcesContent":["// SDK-internal debug gate (#23, Workstream E). Silent by default so v3 never spams the\n// host app's console; `createTelemetry({ debug: true })` flips it on. Gates log AND\n// warn/error — nothing prints unless debug is enabled.\nlet enabled = false;\n\nexport function setDebug(on: boolean): void {\n enabled = on;\n}\n\nexport const debug = {\n log: (...args: any[]) => { if (enabled) console.log(...args); },\n warn: (...args: any[]) => { if (enabled) console.warn(...args); },\n error: (...args: any[]) => { if (enabled) console.error(...args); },\n};\n\n/**\n * `__DEV__` on RN, `NODE_ENV` elsewhere. Dev-only *config* diagnostics (a malformed\n * allowlist, the `Error.stackTraceLimit` advisory) surface through this rather than the\n * `debug` gate above: they are wiring mistakes the consumer has to see while building,\n * and `debug: true` is exactly what a consumer with a wiring mistake has not set.\n */\nexport function isDev(): boolean {\n const dev = (globalThis as any).__DEV__;\n if (typeof dev === \"boolean\") return dev;\n const env = (globalThis as any).process?.env?.NODE_ENV;\n return env !== undefined && env !== \"production\";\n}\n","// Shared delegation base for TelemetryWeb / TelemetryNative.\n// Both platform classes lazily build a core `Telemetry` behind `instancePromise`\n// and forward every public call to it; these methods are identical across platforms.\n// Platform-specific capture (getDeviceInfo, track*, screen) stays in the subclasses\n// because each imports a different platform adapter.\n\nimport { debug } from \"./core/debug\";\n\ntype ProfileInput = {\n userId?: string;\n /** @deprecated Removed in v5 — use `identify({ name })`. */\n fullName?: string;\n /** @deprecated Removed in v5 — never reaches the wire (§3.4). */\n firstName?: string;\n /** @deprecated Removed in v5 — never reaches the wire (§3.4). */\n lastName?: string;\n email?: string;\n phone?: string;\n /** @deprecated Removed in v5 — never reaches the wire (§3.4). */\n avatar?: string;\n customAttributes?: Record<string, any>;\n};\n\nexport abstract class TelemetryBase {\n protected instancePromise!: Promise<any>;\n\n async log(event: string, data?: Record<string, any>) {\n const inst = await this.instancePromise;\n // §4.7 — **there is no public path to `app.crash`.** It is the one name an unfiltered\n // `COUNT(event_name='app.crash') / sessions` is read from, so a consumer's own code\n // must not be able to manufacture rows in it. Routed to `app.error` rather than\n // dropped: a reported error is data, it just isn't a crash. (#100)\n if (event === \"app.crash\") {\n debug.warn(\"app.crash is SDK-owned (§4.7); routing to app.error — use captureError()\");\n // The whole bag still rides as context; this only decides which key gets promoted\n // to `error.message`. `crash.message` is here for v3 callers the rename stranded.\n const message = data?.[\"error.message\"] ?? data?.[\"message\"] ?? data?.[\"crash.message\"];\n return inst.captureError(message, data);\n }\n return inst.log(event, data);\n }\n\n async flush() {\n const inst = await this.instancePromise;\n return inst.flush();\n }\n\n async shutdown() {\n const inst = await this.instancePromise;\n return inst.shutdown();\n }\n\n /**\n * React Navigation → rung 2 of the name ladder, on **both** builds (§4.5.1, #96).\n * `getCurrentRoute()` is a navigation-tree API that works identically on RN-Web, so a\n * consumer wires navigation once and gets the same `view.name` on web and native.\n */\n async attachNavigation(navigationRef: any) {\n debug.log(\"Attaching navigation tracker\");\n if (!navigationRef) {\n debug.warn(\"Navigation reference is undefined. Cannot attach navigation tracker.\");\n return;\n }\n const inst = await this.instancePromise;\n const { NavigationRefTracker } = await import(\"./adapters/navigationRef\");\n new NavigationRefTracker(inst).attach(navigationRef);\n }\n\n /**\n * §4.7 — report a handled error as `app.error`. Accepts `unknown`, so a `catch` block\n * that received a string or an axios rejection object needs no narrowing first.\n * There is no public path to `app.crash`, by design (#100).\n */\n async captureError(error: unknown, context?: Record<string, any>) {\n const inst = await this.instancePromise;\n return inst.captureError(error, context);\n }\n\n async trackErrors(options?: { captureConsole?: boolean }) {\n const { CrashHandlerNative } = await import(\"./adapters/native/crashHandlerNative.native\");\n const inst = await this.instancePromise;\n const crashHandler = new CrashHandlerNative(inst);\n return inst.trackErrors(crashHandler, options);\n }\n\n // ---------- User Profile Management ----------\n\n async setUserId(id: string) {\n const inst = await this.instancePromise;\n inst.setUserId(id);\n }\n\n async setUserProfile(profile: ProfileInput) {\n const inst = await this.instancePromise;\n inst.setUserProfile(profile);\n }\n\n async setUserDetails(details: ProfileInput) {\n const inst = await this.instancePromise;\n inst.setUserDetails(details);\n }\n\n async updateUserProfile(updates: ProfileInput) {\n const inst = await this.instancePromise;\n inst.updateUserProfile(updates);\n }\n\n async getUserProfile() {\n const inst = await this.instancePromise;\n return inst.getUserProfile();\n }\n\n async clearUserProfile() {\n const inst = await this.instancePromise;\n inst.clearUserProfile();\n }\n\n async setUserName(fullName: string, firstName?: string, lastName?: string) {\n const inst = await this.instancePromise;\n inst.setUserName(fullName, firstName, lastName);\n }\n\n async setUserContact(email?: string, phone?: string) {\n const inst = await this.instancePromise;\n inst.setUserContact(email, phone);\n }\n\n // EdgeRum-style identify(): emits `user.profile.update`, the **only** event carrying\n // `user.name` / `.email` / `.phone` / `user.custom.*` (§4.10, #107).\n // `userId` is optional and sets the consumer-owned `user.id` the profile upserts on —\n // omit it and `user.id` is untouched; the SDK still never mints one (§3.2).\n async identify(profile: { userId?: string; name?: string; email?: string; phone?: string; avatar?: string; customAttributes?: Record<string, any> }) {\n const inst = await this.instancePromise;\n return inst.identify(profile);\n }\n}\n","// Distributed trace header injection (§6.4/§6.5, #99) — the pure half: allowlist\n// normalization, `traceparent` parse/format and header reading. Shared by both builds; the\n// stateful half (attribution, which decides *which* `injected_*` rung fires) lives on\n// TraceManager, which owns the carrier.\n//\n// **`traceparent` only. No `b3`, no `tracestate`, ever.** The SDK reads exactly one header\n// name, for exactly one purpose (a presence check), and writes exactly one header name. That\n// is a sentence a consumer must be able to state during a security review, so it is enforced\n// by there being no other header name anywhere in this file.\n\nimport { debug, isDev } from \"../core/debug\";\n\n/** Lowercase on purpose: header names are compared case-insensitively (§6.4). */\nexport const TRACEPARENT = \"traceparent\";\n\n/** §6.5's ladder. Precedence is declaration order; **absent means not traced**. */\nexport type TraceOutcome =\n | \"skipped_off_allowlist\"\n | \"skipped_no_cors\" // fetch-only: `mode` is a concept XHR cannot express\n | \"skipped_consumer_set\" // consumer header present and **unparseable**\n | \"adopted\" // consumer header present and **valid**\n | \"injected_attributed\"\n | \"injected_expired\"\n | \"injected_unattributed\";\n\n// A malformed allowlist entry throws in dev and is dropped in production (§6.4) — a stated\n// divergence from Android's unconditional `require`, because a RUM SDK crashing a shipped\n// banking app over a config typo is the one failure worse than no tracing at all. `isDev`\n// itself lives in core/debug, shared with §4.8's stackTraceLimit advisory.\n\n/**\n * A **bare host**: no scheme, no path, no port, no wildcard. Ports are ignored by matching\n * too — ⚠ a deliberate mismatch with `http.host`, which keeps the port. Do not join them.\n *\n * `new URL()` does the punycode fold, so a unicode entry and a unicode URL land on the same\n * ASCII string. An IPv6 literal contains `:` and is therefore rejected; bare hosts only.\n */\nfunction normalizeHost(entry: unknown): string | undefined {\n if (typeof entry !== \"string\") return undefined;\n const raw = entry.trim();\n if (!raw || /[\\s/?#@*:]/.test(raw)) return undefined;\n try {\n const host = new URL(`http://${raw}`).hostname;\n return host || undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Constructor-only, exact match, empty by default — v4 is **dark on upgrade**, so nobody's\n * CORS breaks until they opt in. Listing a host is the consumer's assertion that that host\n * allows the header; that is why regexes and predicates were rejected rather than deferred.\n */\nexport function normalizeAllowlist(entries: unknown): ReadonlySet<string> {\n const out = new Set<string>();\n if (entries === undefined || entries === null) return out;\n if (!Array.isArray(entries)) {\n if (isDev()) throw new Error(\"traceHostAllowlist must be an array of bare hosts\");\n debug.warn(\"Telemetry: traceHostAllowlist must be an array of bare hosts — ignored\");\n return out;\n }\n for (const entry of entries) {\n const host = normalizeHost(entry);\n if (host) { out.add(host); continue; }\n if (isDev()) {\n throw new Error(\n `traceHostAllowlist: \"${String(entry)}\" is not a bare host (no scheme, path, port or wildcard)`\n );\n }\n debug.warn(`Telemetry: traceHostAllowlist entry \"${String(entry)}\" is not a bare host — dropped`);\n }\n return out;\n}\n\n/** Matching is on `hostname` — **ports ignored**, exact-only, no wildcards, no same-origin exemption. */\nexport function allowsHost(allowlist: ReadonlySet<string>, url: string): boolean {\n if (allowlist.size === 0) return false;\n const base = (globalThis as any).location?.href;\n try {\n return allowlist.has((base ? new URL(url, base) : new URL(url)).hostname);\n } catch {\n return false; // a relative URL with no base has no host to allow\n }\n}\n\n/**\n * W3C `traceparent`, version `00`. Used for exactly one decision: is the consumer's own\n * header valid (`adopted`) or not (`skipped_consumer_set`)? An all-zero trace-id or span-id\n * is invalid by the spec. ⚠ Its price, said out loud: Android *repairs* a malformed consumer\n * header; §6.4's never-strip forbids that here, so it goes out broken and is unattributed on\n * both ends — visible in the outcome distribution rather than silently fixed.\n */\nexport function parseTraceparent(value: string | null | undefined): { traceId: string; spanId: string } | undefined {\n if (typeof value !== \"string\") return undefined;\n const m = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/.exec(value.trim());\n if (!m || /^0+$/.test(m[1]) || /^0+$/.test(m[2])) return undefined;\n return { traceId: m[1], spanId: m[2] };\n}\n\n/** Flags are always `01`: an unsampled session injects no header at all, not a `flags=00` id. */\nexport function formatTraceparent(traceId: string, spanId: string): string {\n return `00-${traceId}-${spanId}-01`;\n}\n\n/** Walks every `HeadersInit` shape without needing a `Headers` constructor to exist. */\nfunction forEachHeader(headers: unknown, fn: (name: string, value: string) => void): void {\n if (!headers) return;\n if (Array.isArray(headers)) {\n for (const pair of headers) if (pair) fn(String(pair[0]), String(pair[1]));\n } else if (typeof (headers as any).forEach === \"function\") {\n (headers as any).forEach((v: string, k: string) => fn(String(k), String(v))); // Headers\n } else if (typeof headers === \"object\") {\n for (const [k, v] of Object.entries(headers as object)) fn(k, String(v));\n }\n}\n\n/** Presence check only — the one purpose §6.4's read-scope invariant permits. */\nexport function readHeader(headers: unknown, name: string): string | undefined {\n let found: string | undefined;\n forEachHeader(headers, (k, v) => { if (k.toLowerCase() === name) found = v; });\n return found;\n}\n\n/**\n * A **copy** with our header appended. The consumer's `Headers`/`Request`/object is never\n * mutated, which is how never-strip is satisfied by construction rather than by discipline.\n * An array of pairs is a valid `HeadersInit` everywhere, so no `Headers` global is required.\n */\nexport function withHeader(headers: unknown, name: string, value: string): [string, string][] {\n const out: [string, string][] = [];\n forEachHeader(headers, (k, v) => out.push([k, v]));\n out.push([name, value]);\n return out;\n}\n","import type { AsyncStore, Store, StoreRead, StoreWrite, SyncStore } from \"./store\";\n\nexport type MemoryStoreOpts = {\n /** Mirror the native build's Promise-returning shape instead of the web build's. */\n async?: boolean;\n /** Behave like incognito / a full disk: every call reports `unavailable`. */\n unavailable?: boolean;\n /** Pre-seeded contents. */\n seed?: Record<string, string>;\n};\n\n/**\n * In-memory Store (#89). A production-shaped seam that tests get to use, not a\n * test-only affordance — it ships, and it is the right injection for a consumer\n * that wants telemetry state to die with the process.\n *\n * Configurable to either build's shape so the sync/async asymmetry can be tested\n * deliberately rather than assumed away.\n */\nexport function memoryStore(opts: MemoryStoreOpts & { async: true }): AsyncStore;\nexport function memoryStore(opts?: MemoryStoreOpts & { async?: false }): SyncStore;\nexport function memoryStore(opts: MemoryStoreOpts = {}): Store {\n const map = new Map<string, string>(Object.entries(opts.seed ?? {}));\n const unavailable = opts.unavailable === true;\n\n const get = (key: string): StoreRead => {\n if (unavailable) return { status: \"unavailable\" };\n const value = map.get(key);\n return value === undefined ? { status: \"miss\" } : { status: \"hit\", value };\n };\n const set = (key: string, value: string): StoreWrite => {\n if (unavailable) return { status: \"unavailable\" };\n map.set(key, value);\n return { status: \"ok\" };\n };\n const remove = (key: string): StoreWrite => {\n if (unavailable) return { status: \"unavailable\" };\n map.delete(key);\n return { status: \"ok\" };\n };\n\n return opts.async\n ? {\n sync: false,\n get: async k => get(k),\n set: async (k, v) => set(k, v),\n remove: async k => remove(k),\n }\n : { sync: true, get, set, remove };\n}\n"],"names":["enabled","setDebug","on","debug","args","isDev","dev","env","TelemetryBase","event","data","inst","message","navigationRef","NavigationRefTracker","error","context","options","CrashHandlerNative","crashHandler","id","profile","details","updates","fullName","firstName","lastName","email","phone","TRACEPARENT","normalizeHost","entry","raw","normalizeAllowlist","entries","out","host","allowsHost","allowlist","url","base","parseTraceparent","value","m","formatTraceparent","traceId","spanId","forEachHeader","headers","fn","pair","v","k","readHeader","name","found","withHeader","memoryStore","opts","map","unavailable","get","key","set","remove"],"mappings":"AAGA,IAAIA,IAAU;AAEP,SAASC,EAASC,GAAmB;AAC1C,EAAAF,IAAUE;AACZ;AAEO,MAAMC,IAAQ;AAAA,EACnB,KAAK,IAAIC,MAAgB;AAAE,IAAIJ,KAAS,QAAQ,IAAI,GAAGI,CAAI;AAAA,EAAG;AAAA,EAC9D,MAAM,IAAIA,MAAgB;AAAE,IAAIJ,KAAS,QAAQ,KAAK,GAAGI,CAAI;AAAA,EAAG;AAAA,EAChE,OAAO,IAAIA,MAAgB;AAAE,IAAIJ,KAAS,QAAQ,MAAM,GAAGI,CAAI;AAAA,EAAG;AACpE;AAQO,SAASC,IAAiB;AAC/B,QAAMC,IAAO,WAAmB;AAChC,MAAI,OAAOA,KAAQ,UAAW,QAAOA;AACrC,QAAMC,IAAO,WAAmB,SAAS,KAAK;AAC9C,SAAOA,MAAQ,UAAaA,MAAQ;AACtC;ACHO,MAAeC,EAAc;AAAA,EAGhC,MAAM,IAAIC,GAAeC,GAA4B;AACjD,UAAMC,IAAO,MAAM,KAAK;AAKxB,QAAIF,MAAU,aAAa;AACvB,MAAAN,EAAM,KAAK,0EAA0E;AAGrF,YAAMS,IAAUF,IAAO,eAAe,KAAKA,GAAO,WAAcA,IAAO,eAAe;AACtF,aAAOC,EAAK,aAAaC,GAASF,CAAI;AAAA,IAC1C;AACA,WAAOC,EAAK,IAAIF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./store.native-TPqXngmF.cjs"),t=require("./batch-DNu8Xr9T.cjs");async function l(a,n){const r=t.decodeFailed(await a.get(t.FAILED_EVENTS_KEY)),{json:e,dropped:i}=t.encodeFailed(r,n);return(await a.set(t.FAILED_EVENTS_KEY,e)).status==="unavailable"&&d.debug.warn("Telemetry could not persist failed events: storage unavailable"),i}async function E(a){const n=await a.get(t.FAILED_EVENTS_KEY);return n.status==="hit"&&await a.remove(t.FAILED_EVENTS_KEY),t.decodeFailed(n)}async function c(a,n,r,e=3){let i=0,o;for(;i<e;)try{const s=await fetch(a,{method:"POST",headers:t.buildHeaders(n),body:t.buildBatch(r)});if(!s.ok)throw d.debug.warn("Telemetry send failed with status:",s.status),new Error(`Telemetry send failed: ${s.status}`);d.debug.log("Telemetry send succeeded, events sent:",r.length??0);return}catch(s){o=s,i++,i<e&&await new Promise(u=>setTimeout(u,500*2**i+Math.random()*200))}throw o}function h(a=t.DEFAULT_ENDPOINT,n,r=w.nativeStore()){return{async send(e){await c(a,n,e)},async onFailure(e){return l(r,e)},replayFailed:t.guardedDrain(async()=>{const e=await E(r);if(e.length!==0){d.debug.log("Replaying failed events, count:",e.length);try{await c(a,n,e)}catch(i){throw await l(r,e),i}}})}}exports.nativeSender=h;
2
- //# sourceMappingURL=nativeSender-CfQaRuDK.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nativeSender-CfQaRuDK.cjs","sources":["../src/adapters/nativeSender.ts"],"sourcesContent":["import { debug } from \"../core/debug\";\nimport type { TelemetryEvent, Sender } from \"../core/telemetry\";\nimport type { Store } from \"../core/store\";\nimport { nativeStore } from \"./native/store.native\";\nimport { decodeFailed, encodeFailed, guardedDrain, FAILED_EVENTS_KEY } from \"./failedEvents\";\nimport { buildBatch, buildHeaders, DEFAULT_ENDPOINT } from \"./batch\";\n\n// The offline queue goes through the Store port (#89). Unlike web, these await: on the\n// native build a write is not guaranteed to have landed when the app is killed, so the\n// crash-loss window narrows here rather than closing. That asymmetry is the port's point.\n//\n// They take the `Store` union, not `AsyncStore`. Awaiting a synchronous store is a no-op,\n// so nothing breaks if a consumer injects one — the reverse is what the types must forbid,\n// and webSender below is where that matters.\n// Returns how many rows the §9.4 cap evicted, for core's `sdk.events_dropped`.\nasync function persistFailed(store: Store, events: TelemetryEvent[]): Promise<number> {\n const existing = decodeFailed(await store.get(FAILED_EVENTS_KEY));\n const { json, dropped } = encodeFailed(existing, events);\n const written = await store.set(FAILED_EVENTS_KEY, json);\n // Storage refusing (no native module linked, full disk) is an outcome, not an error:\n // the batch is already lost, and throwing here would only lose the next one too.\n if (written.status === \"unavailable\") {\n debug.warn(\"Telemetry could not persist failed events: storage unavailable\");\n }\n return dropped;\n}\n\n// Read the queue and clear it in one step, so a replay that fails again re-persists\n// rather than double-sending on the next launch.\nasync function takeFailed(store: Store): Promise<TelemetryEvent[]> {\n const read = await store.get(FAILED_EVENTS_KEY);\n // Clear on any hit, including a payload that decoded to nothing: a half-written queue\n // is unreplayable, and keying the removal off the decoded length would make it\n // permanent as well — re-read and re-dropped on every launch, forever.\n if (read.status === \"hit\") await store.remove(FAILED_EVENTS_KEY);\n return decodeFailed(read);\n}\n\n// ⬇️ Helper: send with retries (exponential backoff + jitter)\nasync function sendWithRetry(endpoint: string, apiKey: string | undefined, events: TelemetryEvent[], retryCount: number = 3) {\n let attempts = 0;\n let lastError: any;\n\n while (attempts < retryCount) {\n try {\n const res = await fetch(endpoint, {\n method: \"POST\",\n headers: buildHeaders(apiKey),\n body: buildBatch(events),\n });\n\n if (!res.ok) {\n\n debug.warn(\"Telemetry send failed with status:\", res.status);\n throw new Error(`Telemetry send failed: ${res.status}`);\n }\n\n debug.log(\"Telemetry send succeeded, events sent:\", events.length ?? 0);\n\n return; // ✅ success\n } catch (err) {\n lastError = err;\n attempts++;\n if (attempts < retryCount) {\n // ⬇️ exponential backoff with jitter\n await new Promise(res =>\n setTimeout(res, 500 * 2 ** attempts + Math.random() * 200)\n );\n }\n }\n }\n\n // ❌ after retries still failed\n throw lastError;\n}\n\nexport function nativeSender(\n endpoint: string = DEFAULT_ENDPOINT,\n apiKey?: string,\n store: Store = nativeStore(),\n): Sender {\n return {\n async send(events) {\n // Retry + backoff here; persistence on final failure is the core flush()'s\n // job via onFailure() — kept single, so a failed batch isn't persisted twice.\n await sendWithRetry(endpoint, apiKey, events);\n },\n async onFailure(events) {\n return persistFailed(store, events);\n },\n // The single replay path on this build (#113). Core calls it once per launch from\n // its constructor; the entry no longer calls a standalone twin, which is what sent\n // every recovered batch twice.\n replayFailed: guardedDrain(async () => {\n const stored = await takeFailed(store);\n if (stored.length === 0) return;\n debug.log(\"Replaying failed events, count:\", stored.length);\n try {\n await sendWithRetry(endpoint, apiKey, stored);\n } catch (err) {\n // If replay fails again, re-store. Exactly one copy: this path never goes\n // through core's flush(), so onFailure() does not also persist it.\n await persistFailed(store, stored);\n throw err;\n }\n }),\n };\n}\n"],"names":["persistFailed","store","events","existing","decodeFailed","FAILED_EVENTS_KEY","json","dropped","encodeFailed","debug","takeFailed","read","sendWithRetry","endpoint","apiKey","retryCount","attempts","lastError","res","buildHeaders","buildBatch","err","nativeSender","DEFAULT_ENDPOINT","nativeStore","guardedDrain","stored"],"mappings":"yMAeA,eAAeA,EAAcC,EAAcC,EAA2C,CAClF,MAAMC,EAAWC,EAAAA,aAAa,MAAMH,EAAM,IAAII,EAAAA,iBAAiB,CAAC,EAC1D,CAAE,KAAAC,EAAM,QAAAC,CAAA,EAAYC,EAAAA,aAAaL,EAAUD,CAAM,EAIvD,OAHgB,MAAMD,EAAM,IAAII,EAAAA,kBAAmBC,CAAI,GAG3C,SAAW,eACnBG,EAAAA,MAAM,KAAK,gEAAgE,EAExEF,CACX,CAIA,eAAeG,EAAWT,EAAyC,CAC/D,MAAMU,EAAO,MAAMV,EAAM,IAAII,EAAAA,iBAAiB,EAI9C,OAAIM,EAAK,SAAW,OAAO,MAAMV,EAAM,OAAOI,mBAAiB,EACxDD,EAAAA,aAAaO,CAAI,CAC5B,CAGA,eAAeC,EAAcC,EAAkBC,EAA4BZ,EAA0Ba,EAAqB,EAAG,CACzH,IAAIC,EAAW,EACXC,EAEJ,KAAOD,EAAWD,GACd,GAAI,CACA,MAAMG,EAAM,MAAM,MAAML,EAAU,CAC9B,OAAQ,OACR,QAASM,EAAAA,aAAaL,CAAM,EAC5B,KAAMM,EAAAA,WAAWlB,CAAM,CAAA,CAC1B,EAED,GAAI,CAACgB,EAAI,GAELT,MAAAA,EAAAA,MAAM,KAAK,qCAAsCS,EAAI,MAAM,EACrD,IAAI,MAAM,0BAA0BA,EAAI,MAAM,EAAE,EAG1DT,EAAAA,MAAM,IAAI,yCAA0CP,EAAO,QAAU,CAAC,EAEtE,MACJ,OAASmB,EAAK,CACVJ,EAAYI,EACZL,IACIA,EAAWD,GAEX,MAAM,IAAI,QAAQG,GACd,WAAWA,EAAK,IAAM,GAAKF,EAAW,KAAK,OAAA,EAAW,GAAG,CAAA,CAGrE,CAIJ,MAAMC,CACV,CAEO,SAASK,EACZT,EAAmBU,EAAAA,iBACnBT,EACAb,EAAeuB,EAAAA,cACT,CACN,MAAO,CACH,MAAM,KAAKtB,EAAQ,CAGf,MAAMU,EAAcC,EAAUC,EAAQZ,CAAM,CAChD,EACA,MAAM,UAAUA,EAAQ,CACpB,OAAOF,EAAcC,EAAOC,CAAM,CACtC,EAIA,aAAcuB,EAAAA,aAAa,SAAY,CACnC,MAAMC,EAAS,MAAMhB,EAAWT,CAAK,EACrC,GAAIyB,EAAO,SAAW,EACtBjB,CAAAA,EAAAA,MAAM,IAAI,kCAAmCiB,EAAO,MAAM,EAC1D,GAAI,CACA,MAAMd,EAAcC,EAAUC,EAAQY,CAAM,CAChD,OAASL,EAAK,CAGV,YAAMrB,EAAcC,EAAOyB,CAAM,EAC3BL,CACV,EACJ,CAAC,CAAA,CAET"}
@@ -1,59 +0,0 @@
1
- import { d as i } from "./memoryStore-F5I-GQKM.js";
2
- import { nativeStore as f } from "./store.native-BYBJcy6o.js";
3
- import { D as h, g as m, d as u, F as d, e as y, b as g, a as p } from "./batch-CwoO7noL.js";
4
- async function l(t, a) {
5
- const r = u(await t.get(d)), { json: e, dropped: n } = y(r, a);
6
- return (await t.set(d, e)).status === "unavailable" && i.warn("Telemetry could not persist failed events: storage unavailable"), n;
7
- }
8
- async function F(t) {
9
- const a = await t.get(d);
10
- return a.status === "hit" && await t.remove(d), u(a);
11
- }
12
- async function c(t, a, r, e = 3) {
13
- let n = 0, o;
14
- for (; n < e; )
15
- try {
16
- const s = await fetch(t, {
17
- method: "POST",
18
- headers: p(a),
19
- body: g(r)
20
- });
21
- if (!s.ok)
22
- throw i.warn("Telemetry send failed with status:", s.status), new Error(`Telemetry send failed: ${s.status}`);
23
- i.log("Telemetry send succeeded, events sent:", r.length ?? 0);
24
- return;
25
- } catch (s) {
26
- o = s, n++, n < e && await new Promise(
27
- (w) => setTimeout(w, 500 * 2 ** n + Math.random() * 200)
28
- );
29
- }
30
- throw o;
31
- }
32
- function v(t = h, a, r = f()) {
33
- return {
34
- async send(e) {
35
- await c(t, a, e);
36
- },
37
- async onFailure(e) {
38
- return l(r, e);
39
- },
40
- // The single replay path on this build (#113). Core calls it once per launch from
41
- // its constructor; the entry no longer calls a standalone twin, which is what sent
42
- // every recovered batch twice.
43
- replayFailed: m(async () => {
44
- const e = await F(r);
45
- if (e.length !== 0) {
46
- i.log("Replaying failed events, count:", e.length);
47
- try {
48
- await c(t, a, e);
49
- } catch (n) {
50
- throw await l(r, e), n;
51
- }
52
- }
53
- })
54
- };
55
- }
56
- export {
57
- v as nativeSender
58
- };
59
- //# sourceMappingURL=nativeSender-pgVSIv-X.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nativeSender-pgVSIv-X.js","sources":["../src/adapters/nativeSender.ts"],"sourcesContent":["import { debug } from \"../core/debug\";\nimport type { TelemetryEvent, Sender } from \"../core/telemetry\";\nimport type { Store } from \"../core/store\";\nimport { nativeStore } from \"./native/store.native\";\nimport { decodeFailed, encodeFailed, guardedDrain, FAILED_EVENTS_KEY } from \"./failedEvents\";\nimport { buildBatch, buildHeaders, DEFAULT_ENDPOINT } from \"./batch\";\n\n// The offline queue goes through the Store port (#89). Unlike web, these await: on the\n// native build a write is not guaranteed to have landed when the app is killed, so the\n// crash-loss window narrows here rather than closing. That asymmetry is the port's point.\n//\n// They take the `Store` union, not `AsyncStore`. Awaiting a synchronous store is a no-op,\n// so nothing breaks if a consumer injects one — the reverse is what the types must forbid,\n// and webSender below is where that matters.\n// Returns how many rows the §9.4 cap evicted, for core's `sdk.events_dropped`.\nasync function persistFailed(store: Store, events: TelemetryEvent[]): Promise<number> {\n const existing = decodeFailed(await store.get(FAILED_EVENTS_KEY));\n const { json, dropped } = encodeFailed(existing, events);\n const written = await store.set(FAILED_EVENTS_KEY, json);\n // Storage refusing (no native module linked, full disk) is an outcome, not an error:\n // the batch is already lost, and throwing here would only lose the next one too.\n if (written.status === \"unavailable\") {\n debug.warn(\"Telemetry could not persist failed events: storage unavailable\");\n }\n return dropped;\n}\n\n// Read the queue and clear it in one step, so a replay that fails again re-persists\n// rather than double-sending on the next launch.\nasync function takeFailed(store: Store): Promise<TelemetryEvent[]> {\n const read = await store.get(FAILED_EVENTS_KEY);\n // Clear on any hit, including a payload that decoded to nothing: a half-written queue\n // is unreplayable, and keying the removal off the decoded length would make it\n // permanent as well — re-read and re-dropped on every launch, forever.\n if (read.status === \"hit\") await store.remove(FAILED_EVENTS_KEY);\n return decodeFailed(read);\n}\n\n// ⬇️ Helper: send with retries (exponential backoff + jitter)\nasync function sendWithRetry(endpoint: string, apiKey: string | undefined, events: TelemetryEvent[], retryCount: number = 3) {\n let attempts = 0;\n let lastError: any;\n\n while (attempts < retryCount) {\n try {\n const res = await fetch(endpoint, {\n method: \"POST\",\n headers: buildHeaders(apiKey),\n body: buildBatch(events),\n });\n\n if (!res.ok) {\n\n debug.warn(\"Telemetry send failed with status:\", res.status);\n throw new Error(`Telemetry send failed: ${res.status}`);\n }\n\n debug.log(\"Telemetry send succeeded, events sent:\", events.length ?? 0);\n\n return; // ✅ success\n } catch (err) {\n lastError = err;\n attempts++;\n if (attempts < retryCount) {\n // ⬇️ exponential backoff with jitter\n await new Promise(res =>\n setTimeout(res, 500 * 2 ** attempts + Math.random() * 200)\n );\n }\n }\n }\n\n // ❌ after retries still failed\n throw lastError;\n}\n\nexport function nativeSender(\n endpoint: string = DEFAULT_ENDPOINT,\n apiKey?: string,\n store: Store = nativeStore(),\n): Sender {\n return {\n async send(events) {\n // Retry + backoff here; persistence on final failure is the core flush()'s\n // job via onFailure() — kept single, so a failed batch isn't persisted twice.\n await sendWithRetry(endpoint, apiKey, events);\n },\n async onFailure(events) {\n return persistFailed(store, events);\n },\n // The single replay path on this build (#113). Core calls it once per launch from\n // its constructor; the entry no longer calls a standalone twin, which is what sent\n // every recovered batch twice.\n replayFailed: guardedDrain(async () => {\n const stored = await takeFailed(store);\n if (stored.length === 0) return;\n debug.log(\"Replaying failed events, count:\", stored.length);\n try {\n await sendWithRetry(endpoint, apiKey, stored);\n } catch (err) {\n // If replay fails again, re-store. Exactly one copy: this path never goes\n // through core's flush(), so onFailure() does not also persist it.\n await persistFailed(store, stored);\n throw err;\n }\n }),\n };\n}\n"],"names":["persistFailed","store","events","existing","decodeFailed","FAILED_EVENTS_KEY","json","dropped","encodeFailed","debug","takeFailed","read","sendWithRetry","endpoint","apiKey","retryCount","attempts","lastError","res","buildHeaders","buildBatch","err","nativeSender","DEFAULT_ENDPOINT","nativeStore","guardedDrain","stored"],"mappings":";;;AAeA,eAAeA,EAAcC,GAAcC,GAA2C;AAClF,QAAMC,IAAWC,EAAa,MAAMH,EAAM,IAAII,CAAiB,CAAC,GAC1D,EAAE,MAAAC,GAAM,SAAAC,EAAA,IAAYC,EAAaL,GAAUD,CAAM;AAIvD,UAHgB,MAAMD,EAAM,IAAII,GAAmBC,CAAI,GAG3C,WAAW,iBACnBG,EAAM,KAAK,gEAAgE,GAExEF;AACX;AAIA,eAAeG,EAAWT,GAAyC;AAC/D,QAAMU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ChD,SAASL,GAAK;AAGV,sBAAMrB,EAAcC,GAAOyB,CAAM,GAC3BL;AAAA,QACV;AAAA;AAAA,IACJ,CAAC;AAAA,EAAA;AAET;"}
@@ -1,28 +0,0 @@
1
- import { d as r } from "./memoryStore-F5I-GQKM.js";
2
- class c {
3
- constructor(t) {
4
- this.telemetry = t;
5
- }
6
- attach(t) {
7
- t && (r.log("NavigationRefTracker: attaching to navigationRef"), t.addListener("state", () => {
8
- const e = this.getActiveRouteName(t.getCurrentRoute());
9
- if (e && e !== this.currentRoute) {
10
- r.log(`NavigationRefTracker: route changed to ${e}`);
11
- const a = this.currentRoute ?? "init";
12
- this.currentRoute = e, this.telemetry.recordRouteChange(a, e).catch((i) => r.warn("NavigationRefTracker: route change failed:", i));
13
- }
14
- }));
15
- }
16
- getActiveRouteName(t) {
17
- if (!t) return "unknown";
18
- if (t.state) {
19
- const e = t.state.routes[t.state.index];
20
- return this.getActiveRouteName(e);
21
- }
22
- return t.name;
23
- }
24
- }
25
- export {
26
- c as NavigationRefTracker
27
- };
28
- //# sourceMappingURL=navigationRef-BzYbs8cm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigationRef-BzYbs8cm.js","sources":["../src/adapters/navigationRef.ts"],"sourcesContent":["import { debug } from \"../core/debug\";\nimport { Telemetry } from \"../core/telemetry\";\n\n/**\n * React Navigation route tracking, **shared by both builds** (§4.5.1, #96).\n *\n * `getCurrentRoute()` is a navigation-tree API, not a native one — it works identically on\n * RN-Web — and `route.name` is rung 2 of the name ladder. Wiring it once means one\n * `GROUP BY view.name` spans web and native, instead of web reverse-engineering a template\n * out of a URL the app is already holding in memory.\n *\n * Everything platform-specific stays in `Telemetry.recordRouteChange`, which gates the two\n * deprecated native feeds (§4.11) on an entry-supplied flag.\n *\n * Usage: pass your navigationContainerRef.\n */\nexport class NavigationRefTracker {\n private currentRoute?: string;\n\n constructor(private telemetry: Telemetry) {}\n\n attach(navigationRef: any) {\n if (!navigationRef) return;\n\n debug.log(\"NavigationRefTracker: attaching to navigationRef\");\n navigationRef.addListener(\"state\", () => {\n const route = this.getActiveRouteName(navigationRef.getCurrentRoute());\n if (route && route !== this.currentRoute) {\n\n debug.log(`NavigationRefTracker: route changed to ${route}`);\n const from = this.currentRoute ?? \"init\";\n this.currentRoute = route;\n this.telemetry.recordRouteChange(from, route)\n .catch((err) => debug.warn(\"NavigationRefTracker: route change failed:\", err));\n }\n });\n }\n\n private getActiveRouteName(route: any): string {\n if (!route) return \"unknown\";\n if (route.state) {\n const nested = route.state.routes[route.state.index];\n return this.getActiveRouteName(nested);\n }\n return route.name;\n }\n}\n"],"names":["NavigationRefTracker","telemetry","navigationRef","debug","route","from","err","nested"],"mappings":";AAgBO,MAAMA,EAAqB;AAAA,EAG9B,YAAoBC,GAAsB;AAAtB,SAAA,YAAAA;AAAA,EAAuB;AAAA,EAE3C,OAAOC,GAAoB;AACvB,IAAKA,MAELC,EAAM,IAAI,kDAAkD,GAC5DD,EAAc,YAAY,SAAS,MAAM;AACrC,YAAME,IAAQ,KAAK,mBAAmBF,EAAc,iBAAiB;AACrE,UAAIE,KAASA,MAAU,KAAK,cAAc;AAEtC,QAAAD,EAAM,IAAI,0CAA0CC,CAAK,EAAE;AAC3D,cAAMC,IAAO,KAAK,gBAAgB;AAClC,aAAK,eAAeD,GACpB,KAAK,UAAU,kBAAkBC,GAAMD,CAAK,EACvC,MAAM,CAACE,MAAQH,EAAM,KAAK,8CAA8CG,CAAG,CAAC;AAAA,MACrF;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEQ,mBAAmBF,GAAoB;AAC3C,QAAI,CAACA,EAAO,QAAO;AACnB,QAAIA,EAAM,OAAO;AACb,YAAMG,IAASH,EAAM,MAAM,OAAOA,EAAM,MAAM,KAAK;AACnD,aAAO,KAAK,mBAAmBG,CAAM;AAAA,IACzC;AACA,WAAOH,EAAM;AAAA,EACjB;AACJ;"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./memoryStore-BIGZmmfD.cjs");class n{constructor(e){this.telemetry=e}attach(e){e&&(r.debug.log("NavigationRefTracker: attaching to navigationRef"),e.addListener("state",()=>{const t=this.getActiveRouteName(e.getCurrentRoute());if(t&&t!==this.currentRoute){r.debug.log(`NavigationRefTracker: route changed to ${t}`);const a=this.currentRoute??"init";this.currentRoute=t,this.telemetry.recordRouteChange(a,t).catch(i=>r.debug.warn("NavigationRefTracker: route change failed:",i))}}))}getActiveRouteName(e){if(!e)return"unknown";if(e.state){const t=e.state.routes[e.state.index];return this.getActiveRouteName(t)}return e.name}}exports.NavigationRefTracker=n;
2
- //# sourceMappingURL=navigationRef-C-_qhb43.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigationRef-C-_qhb43.cjs","sources":["../src/adapters/navigationRef.ts"],"sourcesContent":["import { debug } from \"../core/debug\";\nimport { Telemetry } from \"../core/telemetry\";\n\n/**\n * React Navigation route tracking, **shared by both builds** (§4.5.1, #96).\n *\n * `getCurrentRoute()` is a navigation-tree API, not a native one — it works identically on\n * RN-Web — and `route.name` is rung 2 of the name ladder. Wiring it once means one\n * `GROUP BY view.name` spans web and native, instead of web reverse-engineering a template\n * out of a URL the app is already holding in memory.\n *\n * Everything platform-specific stays in `Telemetry.recordRouteChange`, which gates the two\n * deprecated native feeds (§4.11) on an entry-supplied flag.\n *\n * Usage: pass your navigationContainerRef.\n */\nexport class NavigationRefTracker {\n private currentRoute?: string;\n\n constructor(private telemetry: Telemetry) {}\n\n attach(navigationRef: any) {\n if (!navigationRef) return;\n\n debug.log(\"NavigationRefTracker: attaching to navigationRef\");\n navigationRef.addListener(\"state\", () => {\n const route = this.getActiveRouteName(navigationRef.getCurrentRoute());\n if (route && route !== this.currentRoute) {\n\n debug.log(`NavigationRefTracker: route changed to ${route}`);\n const from = this.currentRoute ?? \"init\";\n this.currentRoute = route;\n this.telemetry.recordRouteChange(from, route)\n .catch((err) => debug.warn(\"NavigationRefTracker: route change failed:\", err));\n }\n });\n }\n\n private getActiveRouteName(route: any): string {\n if (!route) return \"unknown\";\n if (route.state) {\n const nested = route.state.routes[route.state.index];\n return this.getActiveRouteName(nested);\n }\n return route.name;\n }\n}\n"],"names":["NavigationRefTracker","telemetry","navigationRef","debug","route","from","err","nested"],"mappings":"8HAgBO,MAAMA,CAAqB,CAG9B,YAAoBC,EAAsB,CAAtB,KAAA,UAAAA,CAAuB,CAE3C,OAAOC,EAAoB,CAClBA,IAELC,EAAAA,MAAM,IAAI,kDAAkD,EAC5DD,EAAc,YAAY,QAAS,IAAM,CACrC,MAAME,EAAQ,KAAK,mBAAmBF,EAAc,iBAAiB,EACrE,GAAIE,GAASA,IAAU,KAAK,aAAc,CAEtCD,EAAAA,MAAM,IAAI,0CAA0CC,CAAK,EAAE,EAC3D,MAAMC,EAAO,KAAK,cAAgB,OAClC,KAAK,aAAeD,EACpB,KAAK,UAAU,kBAAkBC,EAAMD,CAAK,EACvC,MAAOE,GAAQH,EAAAA,MAAM,KAAK,6CAA8CG,CAAG,CAAC,CACrF,CACJ,CAAC,EACL,CAEQ,mBAAmBF,EAAoB,CAC3C,GAAI,CAACA,EAAO,MAAO,UACnB,GAAIA,EAAM,MAAO,CACb,MAAMG,EAASH,EAAM,MAAM,OAAOA,EAAM,MAAM,KAAK,EACnD,OAAO,KAAK,mBAAmBG,CAAM,CACzC,CACA,OAAOH,EAAM,IACjB,CACJ"}
@@ -1,19 +0,0 @@
1
- class a {
2
- constructor(e) {
3
- this.telemetry = e;
4
- }
5
- // Route change → v3 `navigation`. Baseline keys follow the reference/Angular shape;
6
- // iOS (screen/previous_screen/type/kind) reconciliation is OPEN (see additions ledger).
7
- recordRouteChange(e, t) {
8
- return this.telemetry.log("navigation", {
9
- "navigation.from_screen": e,
10
- "navigation.to_screen": t,
11
- "navigation.method": "push",
12
- "navigation.route_type": "screen"
13
- });
14
- }
15
- }
16
- export {
17
- a as N
18
- };
19
- //# sourceMappingURL=navigationTracker-BmywA_Bg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigationTracker-BmywA_Bg.js","sources":["../src/adapters/navigationTracker.ts"],"sourcesContent":["import { Telemetry } from \"../core/telemetry\";\n\nexport class NavigationTracker {\n private telemetry: Telemetry;\n\n constructor(telemetry: Telemetry) {\n this.telemetry = telemetry;\n }\n\n // Route change → v3 `navigation`. Baseline keys follow the reference/Angular shape;\n // iOS (screen/previous_screen/type/kind) reconciliation is OPEN (see additions ledger).\n recordRouteChange(from: string, to: string) {\n return this.telemetry.log(\"navigation\", {\n \"navigation.from_screen\": from,\n \"navigation.to_screen\": to,\n \"navigation.method\": \"push\",\n \"navigation.route_type\": \"screen\",\n });\n }\n}\n"],"names":["NavigationTracker","telemetry","from","to"],"mappings":"AAEO,MAAMA,EAAkB;AAAA,EAG3B,YAAYC,GAAsB;AAC9B,SAAK,YAAYA;AAAA,EACrB;AAAA;AAAA;AAAA,EAIA,kBAAkBC,GAAcC,GAAY;AACxC,WAAO,KAAK,UAAU,IAAI,cAAc;AAAA,MACpC,0BAA0BD;AAAA,MAC1B,wBAAwBC;AAAA,MACxB,qBAAqB;AAAA,MACrB,yBAAyB;AAAA,IAAA,CAC5B;AAAA,EACL;AACJ;"}
@@ -1,2 +0,0 @@
1
- "use strict";class a{constructor(t){this.telemetry=t}recordRouteChange(t,e){return this.telemetry.log("navigation",{"navigation.from_screen":t,"navigation.to_screen":e,"navigation.method":"push","navigation.route_type":"screen"})}}exports.NavigationTracker=a;
2
- //# sourceMappingURL=navigationTracker-HkwVyywz.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigationTracker-HkwVyywz.cjs","sources":["../src/adapters/navigationTracker.ts"],"sourcesContent":["import { Telemetry } from \"../core/telemetry\";\n\nexport class NavigationTracker {\n private telemetry: Telemetry;\n\n constructor(telemetry: Telemetry) {\n this.telemetry = telemetry;\n }\n\n // Route change → v3 `navigation`. Baseline keys follow the reference/Angular shape;\n // iOS (screen/previous_screen/type/kind) reconciliation is OPEN (see additions ledger).\n recordRouteChange(from: string, to: string) {\n return this.telemetry.log(\"navigation\", {\n \"navigation.from_screen\": from,\n \"navigation.to_screen\": to,\n \"navigation.method\": \"push\",\n \"navigation.route_type\": \"screen\",\n });\n }\n}\n"],"names":["NavigationTracker","telemetry","from","to"],"mappings":"aAEO,MAAMA,CAAkB,CAG3B,YAAYC,EAAsB,CAC9B,KAAK,UAAYA,CACrB,CAIA,kBAAkBC,EAAcC,EAAY,CACxC,OAAO,KAAK,UAAU,IAAI,aAAc,CACpC,yBAA0BD,EAC1B,uBAAwBC,EACxB,oBAAqB,OACrB,wBAAyB,QAAA,CAC5B,CACL,CACJ"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./memoryStore-BIGZmmfD.cjs"),s=require("./navigationTracker-HkwVyywz.cjs"),h=require("./httpAttributes-D0m6UID7.cjs");class c{constructor(t){this.telemetry=t,this.tracker=new s.NavigationTracker(t),this.currentPath=""}start(){return new Promise(t=>{this.currentPath=window.location.pathname+window.location.search,this.patchHistory(),this.listenPopState(),t()})}patchHistory(){const t=history.pushState.bind(history),r=history.replaceState.bind(history),e=()=>this.handleChange();history.pushState=((a,i,o)=>{t(a,i,o),e()}),history.replaceState=((a,i,o)=>{r(a,i,o),e()})}listenPopState(){window.addEventListener("popstate",()=>this.handleChange())}handleChange(){const t=window.location.pathname+window.location.search,r=this.currentPath;this.currentPath=t,Promise.resolve(this.tracker.recordRouteChange(r,t)).then(()=>this.telemetry.enterView(h.normalizeRoute(window.location.pathname),"url")).catch(e=>n.debug.warn("NavigationTrackerWeb: route change failed:",e))}}exports.NavigationTrackerWeb=c;
2
- //# sourceMappingURL=navigationWeb.web-CW_z7Ca4.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigationWeb.web-CW_z7Ca4.cjs","sources":["../src/adapters/web/navigationWeb.web.ts"],"sourcesContent":["import { Telemetry } from \"../../core/telemetry\";\nimport { debug } from \"../../core/debug\";\nimport { NavigationTracker } from \"../navigationTracker\";\nimport { normalizeRoute } from \"../httpAttributes\";\n\n/**\n * Tracks navigation route changes in web environments by patching\n * history API methods and listening to popstate events.\n * Logs route transitions using an internal NavigationTracker instance.\n */\nexport class NavigationTrackerWeb {\n private tracker: NavigationTracker;\n private currentPath: string;\n\n constructor(private telemetry: Telemetry) {\n this.tracker = new NavigationTracker(telemetry);\n this.currentPath = \"\"; // Will be initialized on start\n }\n\n /**\n * Initializes tracking by patching history methods and listening\n * to popstate events. Should be called once after instantiation.\n *\n * @returns Promise<void> resolves immediately after setup\n */\n start(): Promise<void> {\n return new Promise((resolve) => {\n this.currentPath = window.location.pathname + window.location.search;\n this.patchHistory();\n this.listenPopState();\n resolve();\n });\n }\n\n /**\n * Patches history.pushState and history.replaceState to intercept\n * route changes and notify the NavigationTracker.\n */\n private patchHistory(): void {\n const origPush = history.pushState.bind(history);\n const origReplace = history.replaceState.bind(history);\n\n const handleChange = () => this.handleChange();\n\n history.pushState = (\n (data: any, unused: string, url?: string | URL | null) => {\n origPush(data, unused, url);\n handleChange();\n }\n ) as typeof history.pushState;\n\n history.replaceState = (\n (data: any, unused: string, url?: string | URL | null) => {\n origReplace(data, unused, url);\n handleChange();\n }\n ) as typeof history.replaceState;\n }\n\n /**\n * Sets up an event listener for popstate events (back/forward navigation)\n * to detect route changes triggered by browser controls.\n */\n private listenPopState(): void {\n window.addEventListener(\"popstate\", () => this.handleChange());\n }\n\n /**\n * One route change: the existing `navigation` row, then rung 3 of the name ladder\n * (§4.5.1) — the *last* rung, so an `attachNavigation` consumer's `route.name` outranks\n * it whichever arrives first.\n *\n * Normalized by §4.4.1's rule, and the query string is dropped: there is no `view.url`\n * and no raw path on the wire, because the identifier lives in the path\n * (`/accounts/GB29-NWBK-…`) and query-stripping alone would not have addressed that.\n */\n private handleChange(): void {\n const newPath = window.location.pathname + window.location.search;\n const from = this.currentPath;\n this.currentPath = newPath;\n void Promise.resolve(this.tracker.recordRouteChange(from, newPath))\n .then(() => this.telemetry.enterView(normalizeRoute(window.location.pathname), \"url\"))\n .catch((err) => debug.warn(\"NavigationTrackerWeb: route change failed:\", err));\n }\n}\n"],"names":["NavigationTrackerWeb","telemetry","NavigationTracker","resolve","origPush","origReplace","handleChange","data","unused","url","newPath","from","normalizeRoute","err","debug"],"mappings":"uNAUO,MAAMA,CAAqB,CAI9B,YAAoBC,EAAsB,CAAtB,KAAA,UAAAA,EAChB,KAAK,QAAU,IAAIC,EAAAA,kBAAkBD,CAAS,EAC9C,KAAK,YAAc,EACvB,CAQA,OAAuB,CACnB,OAAO,IAAI,QAASE,GAAY,CAC5B,KAAK,YAAc,OAAO,SAAS,SAAW,OAAO,SAAS,OAC9D,KAAK,aAAA,EACL,KAAK,eAAA,EACLA,EAAA,CACJ,CAAC,CACL,CAMQ,cAAqB,CACzB,MAAMC,EAAW,QAAQ,UAAU,KAAK,OAAO,EACzCC,EAAc,QAAQ,aAAa,KAAK,OAAO,EAE/CC,EAAe,IAAM,KAAK,aAAA,EAEhC,QAAQ,WACJ,CAACC,EAAWC,EAAgBC,IAA8B,CACtDL,EAASG,EAAMC,EAAQC,CAAG,EAC1BH,EAAA,CACJ,GAGJ,QAAQ,cACJ,CAACC,EAAWC,EAAgBC,IAA8B,CACtDJ,EAAYE,EAAMC,EAAQC,CAAG,EAC7BH,EAAA,CACJ,EAER,CAMQ,gBAAuB,CAC3B,OAAO,iBAAiB,WAAY,IAAM,KAAK,cAAc,CACjE,CAWQ,cAAqB,CACzB,MAAMI,EAAU,OAAO,SAAS,SAAW,OAAO,SAAS,OACrDC,EAAO,KAAK,YAClB,KAAK,YAAcD,EACd,QAAQ,QAAQ,KAAK,QAAQ,kBAAkBC,EAAMD,CAAO,CAAC,EAC7D,KAAK,IAAM,KAAK,UAAU,UAAUE,iBAAe,OAAO,SAAS,QAAQ,EAAG,KAAK,CAAC,EACpF,MAAOC,GAAQC,EAAAA,MAAM,KAAK,6CAA8CD,CAAG,CAAC,CACrF,CACJ"}
@@ -1,55 +0,0 @@
1
- import { d as n } from "./memoryStore-F5I-GQKM.js";
2
- import { N as h } from "./navigationTracker-BmywA_Bg.js";
3
- import { n as s } from "./httpAttributes-BrrtM8zh.js";
4
- class w {
5
- constructor(t) {
6
- this.telemetry = t, this.tracker = new h(t), this.currentPath = "";
7
- }
8
- /**
9
- * Initializes tracking by patching history methods and listening
10
- * to popstate events. Should be called once after instantiation.
11
- *
12
- * @returns Promise<void> resolves immediately after setup
13
- */
14
- start() {
15
- return new Promise((t) => {
16
- this.currentPath = window.location.pathname + window.location.search, this.patchHistory(), this.listenPopState(), t();
17
- });
18
- }
19
- /**
20
- * Patches history.pushState and history.replaceState to intercept
21
- * route changes and notify the NavigationTracker.
22
- */
23
- patchHistory() {
24
- const t = history.pushState.bind(history), a = history.replaceState.bind(history), e = () => this.handleChange();
25
- history.pushState = ((r, o, i) => {
26
- t(r, o, i), e();
27
- }), history.replaceState = ((r, o, i) => {
28
- a(r, o, i), e();
29
- });
30
- }
31
- /**
32
- * Sets up an event listener for popstate events (back/forward navigation)
33
- * to detect route changes triggered by browser controls.
34
- */
35
- listenPopState() {
36
- window.addEventListener("popstate", () => this.handleChange());
37
- }
38
- /**
39
- * One route change: the existing `navigation` row, then rung 3 of the name ladder
40
- * (§4.5.1) — the *last* rung, so an `attachNavigation` consumer's `route.name` outranks
41
- * it whichever arrives first.
42
- *
43
- * Normalized by §4.4.1's rule, and the query string is dropped: there is no `view.url`
44
- * and no raw path on the wire, because the identifier lives in the path
45
- * (`/accounts/GB29-NWBK-…`) and query-stripping alone would not have addressed that.
46
- */
47
- handleChange() {
48
- const t = window.location.pathname + window.location.search, a = this.currentPath;
49
- this.currentPath = t, Promise.resolve(this.tracker.recordRouteChange(a, t)).then(() => this.telemetry.enterView(s(window.location.pathname), "url")).catch((e) => n.warn("NavigationTrackerWeb: route change failed:", e));
50
- }
51
- }
52
- export {
53
- w as NavigationTrackerWeb
54
- };
55
- //# sourceMappingURL=navigationWeb.web-CcwgKuIZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigationWeb.web-CcwgKuIZ.js","sources":["../src/adapters/web/navigationWeb.web.ts"],"sourcesContent":["import { Telemetry } from \"../../core/telemetry\";\nimport { debug } from \"../../core/debug\";\nimport { NavigationTracker } from \"../navigationTracker\";\nimport { normalizeRoute } from \"../httpAttributes\";\n\n/**\n * Tracks navigation route changes in web environments by patching\n * history API methods and listening to popstate events.\n * Logs route transitions using an internal NavigationTracker instance.\n */\nexport class NavigationTrackerWeb {\n private tracker: NavigationTracker;\n private currentPath: string;\n\n constructor(private telemetry: Telemetry) {\n this.tracker = new NavigationTracker(telemetry);\n this.currentPath = \"\"; // Will be initialized on start\n }\n\n /**\n * Initializes tracking by patching history methods and listening\n * to popstate events. Should be called once after instantiation.\n *\n * @returns Promise<void> resolves immediately after setup\n */\n start(): Promise<void> {\n return new Promise((resolve) => {\n this.currentPath = window.location.pathname + window.location.search;\n this.patchHistory();\n this.listenPopState();\n resolve();\n });\n }\n\n /**\n * Patches history.pushState and history.replaceState to intercept\n * route changes and notify the NavigationTracker.\n */\n private patchHistory(): void {\n const origPush = history.pushState.bind(history);\n const origReplace = history.replaceState.bind(history);\n\n const handleChange = () => this.handleChange();\n\n history.pushState = (\n (data: any, unused: string, url?: string | URL | null) => {\n origPush(data, unused, url);\n handleChange();\n }\n ) as typeof history.pushState;\n\n history.replaceState = (\n (data: any, unused: string, url?: string | URL | null) => {\n origReplace(data, unused, url);\n handleChange();\n }\n ) as typeof history.replaceState;\n }\n\n /**\n * Sets up an event listener for popstate events (back/forward navigation)\n * to detect route changes triggered by browser controls.\n */\n private listenPopState(): void {\n window.addEventListener(\"popstate\", () => this.handleChange());\n }\n\n /**\n * One route change: the existing `navigation` row, then rung 3 of the name ladder\n * (§4.5.1) — the *last* rung, so an `attachNavigation` consumer's `route.name` outranks\n * it whichever arrives first.\n *\n * Normalized by §4.4.1's rule, and the query string is dropped: there is no `view.url`\n * and no raw path on the wire, because the identifier lives in the path\n * (`/accounts/GB29-NWBK-…`) and query-stripping alone would not have addressed that.\n */\n private handleChange(): void {\n const newPath = window.location.pathname + window.location.search;\n const from = this.currentPath;\n this.currentPath = newPath;\n void Promise.resolve(this.tracker.recordRouteChange(from, newPath))\n .then(() => this.telemetry.enterView(normalizeRoute(window.location.pathname), \"url\"))\n .catch((err) => debug.warn(\"NavigationTrackerWeb: route change failed:\", err));\n }\n}\n"],"names":["NavigationTrackerWeb","telemetry","NavigationTracker","resolve","origPush","origReplace","handleChange","data","unused","url","newPath","from","normalizeRoute","err","debug"],"mappings":";;;AAUO,MAAMA,EAAqB;AAAA,EAI9B,YAAoBC,GAAsB;AAAtB,SAAA,YAAAA,GAChB,KAAK,UAAU,IAAIC,EAAkBD,CAAS,GAC9C,KAAK,cAAc;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,QAAuB;AACnB,WAAO,IAAI,QAAQ,CAACE,MAAY;AAC5B,WAAK,cAAc,OAAO,SAAS,WAAW,OAAO,SAAS,QAC9D,KAAK,aAAA,GACL,KAAK,eAAA,GACLA,EAAA;AAAA,IACJ,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA,EAMQ,eAAqB;AACzB,UAAMC,IAAW,QAAQ,UAAU,KAAK,OAAO,GACzCC,IAAc,QAAQ,aAAa,KAAK,OAAO,GAE/CC,IAAe,MAAM,KAAK,aAAA;AAEhC,YAAQ,aACJ,CAACC,GAAWC,GAAgBC,MAA8B;AACtD,MAAAL,EAASG,GAAMC,GAAQC,CAAG,GAC1BH,EAAA;AAAA,IACJ,IAGJ,QAAQ,gBACJ,CAACC,GAAWC,GAAgBC,MAA8B;AACtD,MAAAJ,EAAYE,GAAMC,GAAQC,CAAG,GAC7BH,EAAA;AAAA,IACJ;AAAA,EAER;AAAA;AAAA;AAAA;AAAA;AAAA,EAMQ,iBAAuB;AAC3B,WAAO,iBAAiB,YAAY,MAAM,KAAK,cAAc;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWQ,eAAqB;AACzB,UAAMI,IAAU,OAAO,SAAS,WAAW,OAAO,SAAS,QACrDC,IAAO,KAAK;AAClB,SAAK,cAAcD,GACd,QAAQ,QAAQ,KAAK,QAAQ,kBAAkBC,GAAMD,CAAO,CAAC,EAC7D,KAAK,MAAM,KAAK,UAAU,UAAUE,EAAe,OAAO,SAAS,QAAQ,GAAG,KAAK,CAAC,EACpF,MAAM,CAACC,MAAQC,EAAM,KAAK,8CAA8CD,CAAG,CAAC;AAAA,EACrF;AACJ;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"networkChange-CUO1hRLj.cjs","sources":["../src/adapters/networkChange.ts"],"sourcesContent":["import { Telemetry } from \"../core/telemetry\";\n\n/**\n * Shared connectivity-transition emitter — the single source of truth so the web and\n * native network adapters stay in lockstep on the v3 `network_change` contract (#27).\n *\n * Feed it every connectivity sample via `onSample`. It emits `network_change` only on an\n * actual type transition, carrying `network.previous_type`; the current `network.*` context\n * rides on the event via the Context block (and is echoed here for an explicit at-emit value).\n */\nexport class NetworkChangeEmitter {\n private previousType?: string;\n\n constructor(private telemetry: Telemetry) {}\n\n onSample(currentType: string | undefined): void {\n const prev = this.previousType;\n if (prev !== undefined && prev !== currentType) {\n this.telemetry.log(\"network_change\", {\n \"network.previous_type\": prev,\n \"network.type\": currentType,\n });\n }\n this.previousType = currentType;\n }\n}\n"],"names":["NetworkChangeEmitter","telemetry","currentType","prev"],"mappings":"aAUO,MAAMA,CAAqB,CAGhC,YAAoBC,EAAsB,CAAtB,KAAA,UAAAA,CAAuB,CAE3C,SAASC,EAAuC,CAC9C,MAAMC,EAAO,KAAK,aACdA,IAAS,QAAaA,IAASD,GACjC,KAAK,UAAU,IAAI,iBAAkB,CACnC,wBAAyBC,EACzB,eAAgBD,CAAA,CACjB,EAEH,KAAK,aAAeA,CACtB,CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"networkChange-D39hdSb0.js","sources":["../src/adapters/networkChange.ts"],"sourcesContent":["import { Telemetry } from \"../core/telemetry\";\n\n/**\n * Shared connectivity-transition emitter — the single source of truth so the web and\n * native network adapters stay in lockstep on the v3 `network_change` contract (#27).\n *\n * Feed it every connectivity sample via `onSample`. It emits `network_change` only on an\n * actual type transition, carrying `network.previous_type`; the current `network.*` context\n * rides on the event via the Context block (and is echoed here for an explicit at-emit value).\n */\nexport class NetworkChangeEmitter {\n private previousType?: string;\n\n constructor(private telemetry: Telemetry) {}\n\n onSample(currentType: string | undefined): void {\n const prev = this.previousType;\n if (prev !== undefined && prev !== currentType) {\n this.telemetry.log(\"network_change\", {\n \"network.previous_type\": prev,\n \"network.type\": currentType,\n });\n }\n this.previousType = currentType;\n }\n}\n"],"names":["NetworkChangeEmitter","telemetry","currentType","prev"],"mappings":"AAUO,MAAMA,EAAqB;AAAA,EAGhC,YAAoBC,GAAsB;AAAtB,SAAA,YAAAA;AAAA,EAAuB;AAAA,EAE3C,SAASC,GAAuC;AAC9C,UAAMC,IAAO,KAAK;AAClB,IAAIA,MAAS,UAAaA,MAASD,KACjC,KAAK,UAAU,IAAI,kBAAkB;AAAA,MACnC,yBAAyBC;AAAA,MACzB,gBAAgBD;AAAA,IAAA,CACjB,GAEH,KAAK,eAAeA;AAAA,EACtB;AACF;"}