@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.
- package/LICENSE +21 -0
- package/README.md +185 -30
- package/dist/appLifecycle-DS_fEclk.cjs +2 -0
- package/dist/appLifecycle-DS_fEclk.cjs.map +1 -0
- package/dist/{appLifecycle-DQErzJIR.js → appLifecycle-PffQ4vC1.js} +5 -3
- package/dist/appLifecycle-PffQ4vC1.js.map +1 -0
- package/dist/autoTaps.native-By9I4Kr2.cjs +2 -0
- package/dist/autoTaps.native-By9I4Kr2.cjs.map +1 -0
- package/dist/autoTaps.native-DQCXevD7.js +66 -0
- package/dist/autoTaps.native-DQCXevD7.js.map +1 -0
- package/dist/crashHandler.web-6KvedEB-.cjs +2 -0
- package/dist/crashHandler.web-6KvedEB-.cjs.map +1 -0
- package/dist/crashHandler.web-BUlSXYoS.js +30 -0
- package/dist/crashHandler.web-BUlSXYoS.js.map +1 -0
- package/dist/crashHandlerNative.native-CFVQ5UcO.cjs +2 -0
- package/dist/crashHandlerNative.native-CFVQ5UcO.cjs.map +1 -0
- package/dist/{crashHandlerNative.native-FupMnr1U.js → crashHandlerNative.native-DsCRd-oN.js} +13 -13
- package/dist/crashHandlerNative.native-DsCRd-oN.js.map +1 -0
- package/dist/deviceInfo.native-D5gNBG7m.cjs +2 -0
- package/dist/{deviceInfo.native-BoeTZcD6.cjs.map → deviceInfo.native-D5gNBG7m.cjs.map} +1 -1
- package/dist/deviceInfo.native-DiiHrnI3.js +53 -0
- package/dist/{deviceInfo.native-BJ-3Jj1T.js.map → deviceInfo.native-DiiHrnI3.js.map} +1 -1
- package/dist/{deviceInfo.web-BFB1-pcA.js → deviceInfo.web-BHsjVveq.js} +3 -3
- package/dist/{deviceInfo.web-BFB1-pcA.js.map → deviceInfo.web-BHsjVveq.js.map} +1 -1
- package/dist/{deviceInfo.web-3L3IDQQA.cjs → deviceInfo.web-DGCUHAnv.cjs} +2 -2
- package/dist/{deviceInfo.web-3L3IDQQA.cjs.map → deviceInfo.web-DGCUHAnv.cjs.map} +1 -1
- package/dist/deviceState.native-BEysbZ6O.js +58 -0
- package/dist/deviceState.native-BEysbZ6O.js.map +1 -0
- package/dist/deviceState.native-CrQMy11_.cjs +2 -0
- package/dist/deviceState.native-CrQMy11_.cjs.map +1 -0
- package/dist/deviceState.web-ByaQm9Ry.js +14 -0
- package/dist/deviceState.web-ByaQm9Ry.js.map +1 -0
- package/dist/deviceState.web-CSfUgHDU.cjs +2 -0
- package/dist/deviceState.web-CSfUgHDU.cjs.map +1 -0
- package/dist/frameTracker-9j0en6Zm.cjs +2 -0
- package/dist/frameTracker-9j0en6Zm.cjs.map +1 -0
- package/dist/{frameTracker-DdB8W_kC.js → frameTracker-BzXnxSkb.js} +18 -19
- package/dist/frameTracker-BzXnxSkb.js.map +1 -0
- package/dist/{httpAttributes-BrrtM8zh.js → httpAttributes-BWXOr4eP.js} +1 -1
- package/dist/{httpAttributes-BrrtM8zh.js.map → httpAttributes-BWXOr4eP.js.map} +1 -1
- package/dist/{httpAttributes-D0m6UID7.cjs → httpAttributes-COY0_kiF.cjs} +1 -1
- package/dist/{httpAttributes-D0m6UID7.cjs.map → httpAttributes-COY0_kiF.cjs.map} +1 -1
- package/dist/index.native.cjs +1 -1
- package/dist/index.native.cjs.map +1 -1
- package/dist/index.native.d.ts +1 -1
- package/dist/index.native.js +128 -71
- package/dist/index.native.js.map +1 -1
- package/dist/index.web.cjs +1 -1
- package/dist/index.web.cjs.map +1 -1
- package/dist/index.web.d.ts +1 -1
- package/dist/index.web.js +51 -38
- package/dist/index.web.js.map +1 -1
- package/dist/{interactionWeb.web-CJAviVQ7.js → interactionWeb.web-BWBjmovb.js} +8 -8
- package/dist/{interactionWeb.web-CJAviVQ7.js.map → interactionWeb.web-BWBjmovb.js.map} +1 -1
- package/dist/interactionWeb.web-CKDJLD9r.cjs +2 -0
- package/dist/{interactionWeb.web-Bl_cZlgh.cjs.map → interactionWeb.web-CKDJLD9r.cjs.map} +1 -1
- package/dist/{interceptFetchWeb.web-UXC2Lb6X.js → interceptFetchWeb.web-DjSR_Rft.js} +18 -17
- package/dist/interceptFetchWeb.web-DjSR_Rft.js.map +1 -0
- package/dist/interceptFetchWeb.web-ZHw6IQkU.cjs +2 -0
- package/dist/{interceptFetchWeb.web-UXC2Lb6X.js.map → interceptFetchWeb.web-ZHw6IQkU.cjs.map} +1 -1
- package/dist/{interceptHttpNative.native-BVpFuoNB.cjs → interceptHttpNative.native-C5scIcgY.cjs} +2 -2
- package/dist/{interceptHttpNative.native-BVpFuoNB.cjs.map → interceptHttpNative.native-C5scIcgY.cjs.map} +1 -1
- package/dist/{interceptHttpNative.native-rX-lPNST.js → interceptHttpNative.native-vF_Fksjk.js} +2 -2
- package/dist/{interceptHttpNative.native-rX-lPNST.js.map → interceptHttpNative.native-vF_Fksjk.js.map} +1 -1
- package/dist/{loadingTime-Bhomd9qq.cjs → loadingTime-Cj5Oh8lT.cjs} +1 -1
- package/dist/{loadingTime-Bhomd9qq.cjs.map → loadingTime-Cj5Oh8lT.cjs.map} +1 -1
- package/dist/{loadingTime-ZkYvFijA.js → loadingTime-DMc0zTY8.js} +1 -1
- package/dist/{loadingTime-ZkYvFijA.js.map → loadingTime-DMc0zTY8.js.map} +1 -1
- package/dist/memoryNative.native-CK3QFVjY.cjs +2 -0
- package/dist/memoryNative.native-CK3QFVjY.cjs.map +1 -0
- package/dist/{memoryNative.native-C42h9SjK.js → memoryNative.native-DkA6f7id.js} +12 -12
- package/dist/memoryNative.native-DkA6f7id.js.map +1 -0
- package/dist/nativeSender-Dt1HLaLi.js +37 -0
- package/dist/nativeSender-Dt1HLaLi.js.map +1 -0
- package/dist/nativeSender-hCgUa7Vz.cjs +2 -0
- package/dist/nativeSender-hCgUa7Vz.cjs.map +1 -0
- package/dist/navigationRef-CVIv0aIK.js +30 -0
- package/dist/navigationRef-CVIv0aIK.js.map +1 -0
- package/dist/navigationRef-CfIbeXX8.cjs +2 -0
- package/dist/navigationRef-CfIbeXX8.cjs.map +1 -0
- package/dist/navigationWeb.web-CRHpr5zl.js +51 -0
- package/dist/navigationWeb.web-CRHpr5zl.js.map +1 -0
- package/dist/navigationWeb.web-DwWjL80b.cjs +2 -0
- package/dist/navigationWeb.web-DwWjL80b.cjs.map +1 -0
- package/dist/{networkChange-CUO1hRLj.cjs → networkChange-2FGIQM-N.cjs} +2 -2
- package/dist/networkChange-2FGIQM-N.cjs.map +1 -0
- package/dist/{networkChange-D39hdSb0.js → networkChange-QA0893vW.js} +2 -2
- package/dist/networkChange-QA0893vW.js.map +1 -0
- package/dist/networkInfo.native-CcJ3JVRF.js +31 -0
- package/dist/networkInfo.native-CcJ3JVRF.js.map +1 -0
- package/dist/networkInfo.native-whB2wf6a.cjs +2 -0
- package/dist/networkInfo.native-whB2wf6a.cjs.map +1 -0
- package/dist/{networkInfo.web-B2YlLNsI.js → networkInfo.web-CcUpXMUK.js} +2 -2
- package/dist/networkInfo.web-CcUpXMUK.js.map +1 -0
- package/dist/{networkInfo.web-PltJTHsy.cjs → networkInfo.web-DfO-BUFx.cjs} +2 -2
- package/dist/networkInfo.web-DfO-BUFx.cjs.map +1 -0
- package/dist/react-bqe7KPOf.cjs +4 -0
- package/dist/react-bqe7KPOf.cjs.map +1 -0
- package/dist/react-urNtDGTL.js +413 -0
- package/dist/react-urNtDGTL.js.map +1 -0
- package/dist/runtimeReady.native-CxFl1rQR.js +35 -0
- package/dist/runtimeReady.native-CxFl1rQR.js.map +1 -0
- package/dist/runtimeReady.native-zueSbsEv.cjs +2 -0
- package/dist/runtimeReady.native-zueSbsEv.cjs.map +1 -0
- package/dist/{runtimeReady.web-C8fdIbVR.js → runtimeReady.web-JuE239Tg.js} +2 -2
- package/dist/{runtimeReady.web-C8fdIbVR.js.map → runtimeReady.web-JuE239Tg.js.map} +1 -1
- package/dist/{runtimeReady.web-DHW682RN.cjs → runtimeReady.web-vhAJFU61.cjs} +2 -2
- package/dist/{runtimeReady.web-DHW682RN.cjs.map → runtimeReady.web-vhAJFU61.cjs.map} +1 -1
- package/dist/{seedRuntimeReady-Cz8nOKoo.js → seedRuntimeReady-BlRdf3pR.js} +2 -2
- package/dist/{seedRuntimeReady-Cz8nOKoo.js.map → seedRuntimeReady-BlRdf3pR.js.map} +1 -1
- package/dist/seedRuntimeReady-CbjqbWCd.cjs +2 -0
- package/dist/{seedRuntimeReady-BKwkBEAF.cjs.map → seedRuntimeReady-CbjqbWCd.cjs.map} +1 -1
- package/dist/src/adapters/appLifecycle.d.ts +3 -3
- package/dist/src/adapters/batch.d.ts +44 -0
- package/dist/src/adapters/crashCapture.d.ts +5 -1
- package/dist/src/adapters/deviceState.d.ts +9 -0
- package/dist/src/adapters/frameAggregate.d.ts +15 -13
- package/dist/src/adapters/frameTracker.d.ts +1 -1
- package/dist/src/adapters/hangDetector.d.ts +41 -0
- package/dist/src/adapters/manualSpans.d.ts +41 -0
- package/dist/src/adapters/native/autoTaps.native.d.ts +15 -0
- package/dist/src/adapters/native/deviceState.native.d.ts +15 -0
- package/dist/src/adapters/native/memoryNative.native.d.ts +3 -3
- package/dist/src/adapters/native/networkInfo.native.d.ts +1 -1
- package/dist/src/adapters/native/runtimeReady.native.d.ts +16 -0
- package/dist/src/adapters/navigationRef.d.ts +17 -9
- package/dist/src/adapters/networkChange.d.ts +2 -2
- package/dist/src/adapters/traceManager.d.ts +18 -5
- package/dist/src/adapters/uiInteraction.d.ts +1 -1
- package/dist/src/adapters/viewManager.d.ts +24 -8
- package/dist/src/adapters/web/deviceState.web.d.ts +10 -0
- package/dist/src/adapters/web/navigationWeb.web.d.ts +6 -10
- package/dist/src/adapters/web/webVitals.web.d.ts +7 -0
- package/dist/src/adapters/xhrIntercept.d.ts +2 -0
- package/dist/src/core/breadcrumbs.d.ts +10 -0
- package/dist/src/core/telemetry.d.ts +139 -29
- package/dist/src/core/userProfile.d.ts +7 -0
- package/dist/src/createTelemetry.native.d.ts +3 -1
- package/dist/src/createTelemetry.web.d.ts +2 -1
- package/dist/src/golden.helper.d.ts +4 -0
- package/dist/src/index.base.d.ts +80 -6
- package/dist/src/index.native.d.ts +4 -61
- package/dist/src/index.web.d.ts +4 -51
- package/dist/src/react.d.ts +45 -0
- package/dist/src/telemetryNative.native.d.ts +79 -0
- package/dist/src/telemetryWeb.web.d.ts +59 -0
- package/dist/{store.native-TPqXngmF.cjs → store.native-BbS76uWV.cjs} +1 -1
- package/dist/{store.native-TPqXngmF.cjs.map → store.native-BbS76uWV.cjs.map} +1 -1
- package/dist/{store.native-BYBJcy6o.js → store.native-MlWyGgBp.js} +1 -1
- package/dist/{store.native-BYBJcy6o.js.map → store.native-MlWyGgBp.js.map} +1 -1
- package/dist/{store.web-CvqqN-_Z.cjs → store.web-BzKaP57Z.cjs} +1 -1
- package/dist/{store.web-CvqqN-_Z.cjs.map → store.web-BzKaP57Z.cjs.map} +1 -1
- package/dist/{store.web-DJAlN0nc.js → store.web-rhh0NOfs.js} +1 -1
- package/dist/{store.web-DJAlN0nc.js.map → store.web-rhh0NOfs.js.map} +1 -1
- package/dist/telemetry-60sfWkh0.js +1754 -0
- package/dist/telemetry-60sfWkh0.js.map +1 -0
- package/dist/telemetry-CW63glwb.cjs +2 -0
- package/dist/telemetry-CW63glwb.cjs.map +1 -0
- package/dist/{uiInteraction-DAqxxz0q.js → uiInteraction-BIDOMcrL.js} +39 -34
- package/dist/{uiInteraction-DAqxxz0q.js.map → uiInteraction-BIDOMcrL.js.map} +1 -1
- package/dist/uiInteraction-DxlwCVSn.cjs +2 -0
- package/dist/{uiInteraction-CdzvEI1p.cjs.map → uiInteraction-DxlwCVSn.cjs.map} +1 -1
- package/dist/{viewport-Dd85GUNO.cjs → viewport-9JcVIXYF.cjs} +1 -1
- package/dist/{viewport-Dd85GUNO.cjs.map → viewport-9JcVIXYF.cjs.map} +1 -1
- package/dist/{viewport-Dzmt5QwK.js → viewport-GWTEBt2K.js} +1 -1
- package/dist/{viewport-Dzmt5QwK.js.map → viewport-GWTEBt2K.js.map} +1 -1
- package/dist/{web-vitals.attribution-CVCPiX-h.cjs → web-vitals.attribution-DAvBvdng.cjs} +1 -1
- package/dist/{web-vitals.attribution-CVCPiX-h.cjs.map → web-vitals.attribution-DAvBvdng.cjs.map} +1 -1
- package/dist/{web-vitals.attribution-xw9N5MKQ.js → web-vitals.attribution-DcoMtvlY.js} +1 -1
- package/dist/{web-vitals.attribution-xw9N5MKQ.js.map → web-vitals.attribution-DcoMtvlY.js.map} +1 -1
- package/dist/webSender-DA087xb5.cjs +2 -0
- package/dist/webSender-DA087xb5.cjs.map +1 -0
- package/dist/webSender-g4rs5TIg.js +44 -0
- package/dist/webSender-g4rs5TIg.js.map +1 -0
- package/dist/{webVitals.web-CNIpsKlA.js → webVitals.web-DRTDK6s5.js} +39 -24
- package/dist/webVitals.web-DRTDK6s5.js.map +1 -0
- package/dist/webVitals.web-DvScDIjX.cjs +2 -0
- package/dist/webVitals.web-DvScDIjX.cjs.map +1 -0
- package/dist/{xhrIntercept-BNiA41Mj.js → xhrIntercept-9uAkQh3N.js} +16 -14
- package/dist/xhrIntercept-9uAkQh3N.js.map +1 -0
- package/dist/xhrIntercept-xG1Yl5RI.cjs +2 -0
- package/dist/xhrIntercept-xG1Yl5RI.cjs.map +1 -0
- package/docs/migration-v4.md +1 -1
- package/docs/migration-v5.md +178 -0
- package/package.json +12 -4
- package/dist/appLifecycle-CECgRVu_.cjs +0 -2
- package/dist/appLifecycle-CECgRVu_.cjs.map +0 -1
- package/dist/appLifecycle-DQErzJIR.js.map +0 -1
- package/dist/batch-CwoO7noL.js +0 -56
- package/dist/batch-CwoO7noL.js.map +0 -1
- package/dist/batch-DNu8Xr9T.cjs +0 -2
- package/dist/batch-DNu8Xr9T.cjs.map +0 -1
- package/dist/crashCapture-BOJ8nSAZ.cjs +0 -4
- package/dist/crashCapture-BOJ8nSAZ.cjs.map +0 -1
- package/dist/crashCapture-BW8WuyaU.js +0 -70
- package/dist/crashCapture-BW8WuyaU.js.map +0 -1
- package/dist/crashHandler.web-8F_k2veo.js +0 -29
- package/dist/crashHandler.web-8F_k2veo.js.map +0 -1
- package/dist/crashHandler.web-CWmF56mJ.cjs +0 -2
- package/dist/crashHandler.web-CWmF56mJ.cjs.map +0 -1
- package/dist/crashHandlerNative.native-C2kSikDt.cjs +0 -2
- package/dist/crashHandlerNative.native-C2kSikDt.cjs.map +0 -1
- package/dist/crashHandlerNative.native-FupMnr1U.js.map +0 -1
- package/dist/deviceInfo.native-BJ-3Jj1T.js +0 -53
- package/dist/deviceInfo.native-BoeTZcD6.cjs +0 -2
- package/dist/frameTracker-CHG6sIx9.cjs +0 -2
- package/dist/frameTracker-CHG6sIx9.cjs.map +0 -1
- package/dist/frameTracker-DdB8W_kC.js.map +0 -1
- package/dist/index-BtLlV1HA.js +0 -57
- package/dist/index-BtLlV1HA.js.map +0 -1
- package/dist/index-C2XQ-EYw.js +0 -1122
- package/dist/index-C2XQ-EYw.js.map +0 -1
- package/dist/index-CXsVZY35.cjs +0 -2
- package/dist/index-CXsVZY35.cjs.map +0 -1
- package/dist/index-DLquF88M.cjs +0 -2
- package/dist/index-DLquF88M.cjs.map +0 -1
- package/dist/interactionWeb.web-Bl_cZlgh.cjs +0 -2
- package/dist/interceptFetchWeb.web-T88kO-bE.cjs +0 -2
- package/dist/interceptFetchWeb.web-T88kO-bE.cjs.map +0 -1
- package/dist/memoryNative.native-C42h9SjK.js.map +0 -1
- package/dist/memoryNative.native-CA-7w9w1.cjs +0 -2
- package/dist/memoryNative.native-CA-7w9w1.cjs.map +0 -1
- package/dist/memoryStore-BIGZmmfD.cjs +0 -2
- package/dist/memoryStore-BIGZmmfD.cjs.map +0 -1
- package/dist/memoryStore-F5I-GQKM.js +0 -193
- package/dist/memoryStore-F5I-GQKM.js.map +0 -1
- package/dist/nativeSender-CfQaRuDK.cjs +0 -2
- package/dist/nativeSender-CfQaRuDK.cjs.map +0 -1
- package/dist/nativeSender-pgVSIv-X.js +0 -59
- package/dist/nativeSender-pgVSIv-X.js.map +0 -1
- package/dist/navigationRef-BzYbs8cm.js +0 -28
- package/dist/navigationRef-BzYbs8cm.js.map +0 -1
- package/dist/navigationRef-C-_qhb43.cjs +0 -2
- package/dist/navigationRef-C-_qhb43.cjs.map +0 -1
- package/dist/navigationTracker-BmywA_Bg.js +0 -19
- package/dist/navigationTracker-BmywA_Bg.js.map +0 -1
- package/dist/navigationTracker-HkwVyywz.cjs +0 -2
- package/dist/navigationTracker-HkwVyywz.cjs.map +0 -1
- package/dist/navigationWeb.web-CW_z7Ca4.cjs +0 -2
- package/dist/navigationWeb.web-CW_z7Ca4.cjs.map +0 -1
- package/dist/navigationWeb.web-CcwgKuIZ.js +0 -55
- package/dist/navigationWeb.web-CcwgKuIZ.js.map +0 -1
- package/dist/networkChange-CUO1hRLj.cjs.map +0 -1
- package/dist/networkChange-D39hdSb0.js.map +0 -1
- package/dist/networkInfo.native-CGrx9cnH.js +0 -343
- package/dist/networkInfo.native-CGrx9cnH.js.map +0 -1
- package/dist/networkInfo.native-YVySdv3S.cjs +0 -2
- package/dist/networkInfo.native-YVySdv3S.cjs.map +0 -1
- package/dist/networkInfo.web-B2YlLNsI.js.map +0 -1
- package/dist/networkInfo.web-PltJTHsy.cjs.map +0 -1
- package/dist/runtimeReady.native-Bh7EcYmK.js +0 -14
- package/dist/runtimeReady.native-Bh7EcYmK.js.map +0 -1
- package/dist/runtimeReady.native-jUmuE1lV.cjs +0 -2
- package/dist/runtimeReady.native-jUmuE1lV.cjs.map +0 -1
- package/dist/seedRuntimeReady-BKwkBEAF.cjs +0 -2
- package/dist/src/adapters/navigationTracker.d.ts +0 -6
- package/dist/src/adapters/screenTiming.d.ts +0 -15
- package/dist/telemetry-ByDJIz_9.js +0 -1280
- package/dist/telemetry-ByDJIz_9.js.map +0 -1
- package/dist/telemetry-CrU7i1Jc.cjs +0 -2
- package/dist/telemetry-CrU7i1Jc.cjs.map +0 -1
- package/dist/uiInteraction-CdzvEI1p.cjs +0 -2
- package/dist/webSender-BIwslfpT.js +0 -63
- package/dist/webSender-BIwslfpT.js.map +0 -1
- package/dist/webSender-CVtE4sOF.cjs +0 -2
- package/dist/webSender-CVtE4sOF.cjs.map +0 -1
- package/dist/webVitals.web-CNIpsKlA.js.map +0 -1
- package/dist/webVitals.web-DpWJ-iYp.cjs +0 -2
- package/dist/webVitals.web-DpWJ-iYp.cjs.map +0 -1
- package/dist/xhrIntercept-BADex6Cq.cjs +0 -2
- package/dist/xhrIntercept-BADex6Cq.cjs.map +0 -1
- package/dist/xhrIntercept-BNiA41Mj.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NCG Africa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ sampling and session management all start on their own — there is nothing else
|
|
|
43
43
|
|
|
44
44
|
**How-to guides**
|
|
45
45
|
- [Send a custom event](#send-a-custom-event)
|
|
46
|
+
- [Time a journey](#time-a-journey)
|
|
46
47
|
- [Identify the signed-in user](#identify-the-signed-in-user)
|
|
47
48
|
- [Track screens](#track-screens)
|
|
48
49
|
- [Track taps](#track-taps)
|
|
@@ -50,6 +51,7 @@ sampling and session management all start on their own — there is nothing else
|
|
|
50
51
|
- [Make crash stacks readable](#make-crash-stacks-readable)
|
|
51
52
|
- [Strip PII before it leaves the device](#strip-pii-before-it-leaves-the-device)
|
|
52
53
|
- [Sample a percentage of sessions](#sample-a-percentage-of-sessions)
|
|
54
|
+
- [Respect a user's opt-out](#respect-a-users-opt-out)
|
|
53
55
|
- [Connect your traces to your backend](#connect-your-traces-to-your-backend)
|
|
54
56
|
|
|
55
57
|
**Reference**
|
|
@@ -167,8 +169,10 @@ Everything is passed to `createTelemetry()`. There are no runtime setters for th
|
|
|
167
169
|
| `debug` | `boolean` | `false` | Prints the SDK's internal diagnostics. Off means completely silent. |
|
|
168
170
|
| `buildId` | `string` | omitted | Your build's identifier, for [symbolicating crashes](#make-crash-stacks-readable). |
|
|
169
171
|
| `beforeSend` | `(event) => event \| null` | none | [Scrubbing hook](#strip-pii-before-it-leaves-the-device). Constructor-only. |
|
|
172
|
+
| `enabled` | `boolean` | `true` | `false` starts the SDK dark until [`enable()`](#respect-a-users-opt-out). |
|
|
170
173
|
| `sessionSampleRate` | `number` | `1` | [Fraction of sessions to keep](#sample-a-percentage-of-sessions), `0`–`1`. Constructor-only. |
|
|
171
174
|
| `traceHostAllowlist` | `string[]` | `[]` (empty) | [Hosts allowed to receive `traceparent`](#connect-your-traces-to-your-backend). Constructor-only. |
|
|
175
|
+
| `autoTrackTaps` | `boolean` | `false` | **Native only.** [Capture every `onPress` / `onLongPress`](#native--or-capture-every-press-automatically). Constructor-only. |
|
|
172
176
|
| `store` | `Store` | platform default | Replaces `localStorage` / `AsyncStorage`. Mostly for tests. |
|
|
173
177
|
| `sender` | `Sender` | platform default | Replaces the HTTP transport. Mostly for tests. |
|
|
174
178
|
|
|
@@ -218,6 +222,34 @@ JSON-stringified.
|
|
|
218
222
|
|
|
219
223
|
---
|
|
220
224
|
|
|
225
|
+
## Time a journey
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
const span = telemetry.startSpan("checkout", { cart_value: 42 });
|
|
229
|
+
// …
|
|
230
|
+
span.end(); // or span.end({ outcome: "failed" })
|
|
231
|
+
|
|
232
|
+
await telemetry.withSpan("sync_contacts", () => api.sync()); // throws → "failed", rethrown
|
|
233
|
+
|
|
234
|
+
telemetry.startSpan("onboarding"); // one screen…
|
|
235
|
+
telemetry.endSpan("onboarding", "completed"); // …closed from another, by name
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Each span sends **one** `task.complete` row when it ends: `task.name`, `task.outcome`
|
|
239
|
+
(`completed` | `failed` | `abandoned`) and `span.duration_ms`. The three span methods are
|
|
240
|
+
synchronous — call them without `await`.
|
|
241
|
+
|
|
242
|
+
- A span started during a tap or navigation joins that action (same `rum.action.id`); otherwise it
|
|
243
|
+
starts its own, `trace.root_type: "custom"`. Spans don't nest: a request inside one belongs to
|
|
244
|
+
the action, not the span.
|
|
245
|
+
- Starting a name that is already open replaces it. Ending an unknown name does nothing. At most
|
|
246
|
+
32 spans can be open; blank names and the 33rd are ignored.
|
|
247
|
+
- Open spans survive an app restart and can still be ended by name. A span still open when its
|
|
248
|
+
session ends is sent as `abandoned`.
|
|
249
|
+
- Your attributes cannot overwrite `task.*`, `span.*`, `trace.*`, `parent.*` or `rum.*` keys.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
221
253
|
## Identify the signed-in user
|
|
222
254
|
|
|
223
255
|
```typescript
|
|
@@ -265,36 +297,70 @@ with its name, dwell time, request count and load time.
|
|
|
265
297
|
|
|
266
298
|
```tsx
|
|
267
299
|
import { NavigationContainer, useNavigationContainerRef } from "@react-navigation/native";
|
|
300
|
+
import { useEffect } from "react";
|
|
268
301
|
import { telemetry } from "./telemetry";
|
|
269
302
|
|
|
270
303
|
export default function App() {
|
|
271
304
|
const navRef = useNavigationContainerRef();
|
|
305
|
+
useEffect(() => { telemetry.attachNavigation(navRef); }, [navRef]);
|
|
272
306
|
|
|
273
|
-
return
|
|
274
|
-
<NavigationContainer
|
|
275
|
-
ref={navRef}
|
|
276
|
-
onReady={() => { telemetry.attachNavigation(navRef); }}
|
|
277
|
-
>
|
|
278
|
-
{/* your screens */}
|
|
279
|
-
</NavigationContainer>
|
|
280
|
-
);
|
|
307
|
+
return <NavigationContainer ref={navRef}>{/* your screens */}</NavigationContainer>;
|
|
281
308
|
}
|
|
282
309
|
```
|
|
283
310
|
|
|
284
|
-
One call covers native **and** web
|
|
285
|
-
one
|
|
311
|
+
One call covers native **and** web. Attach whenever you like: a ready ref names the current
|
|
312
|
+
screen at once, and a not-yet-ready one names it on its `ready` event — the first screen is never
|
|
313
|
+
`unknown`.
|
|
314
|
+
|
|
315
|
+
`view.name` is the focused route names **joined root to leaf with `/`** (v5) — `HomeTab/Details`
|
|
316
|
+
and `SearchTab/Details` stay distinct. Names are never normalized and route params are never read.
|
|
317
|
+
|
|
318
|
+
### Expo Router
|
|
319
|
+
|
|
320
|
+
No extra dependency and no extra API — Expo Router is React Navigation underneath, and its route
|
|
321
|
+
names are the file paths, so `view.name` comes out as `(tabs)/settings/index`. In the root
|
|
322
|
+
`app/_layout.tsx`:
|
|
323
|
+
|
|
324
|
+
```tsx
|
|
325
|
+
import { Stack, useNavigationContainerRef } from "expo-router";
|
|
326
|
+
import { useEffect } from "react";
|
|
327
|
+
import { telemetry } from "../telemetry";
|
|
328
|
+
|
|
329
|
+
export default function RootLayout() {
|
|
330
|
+
const navRef = useNavigationContainerRef();
|
|
331
|
+
useEffect(() => { telemetry.attachNavigation(navRef); }, [navRef]);
|
|
332
|
+
return <Stack />;
|
|
333
|
+
}
|
|
334
|
+
```
|
|
286
335
|
|
|
287
336
|
### Naming screens manually
|
|
288
337
|
|
|
289
338
|
```typescript
|
|
290
|
-
await telemetry.screenStart("Checkout"); // native only
|
|
291
|
-
await telemetry.screenEnd("Checkout"); // native only
|
|
339
|
+
await telemetry.screenStart("Checkout"); // native only — names the current view
|
|
292
340
|
```
|
|
293
341
|
|
|
294
|
-
> **
|
|
295
|
-
>
|
|
296
|
-
>
|
|
297
|
-
>
|
|
342
|
+
> **Mixing `screenStart()` with `attachNavigation()` is fine (v5).** Screen names have ranks — an
|
|
343
|
+
> explicit name outranks a route name, which outranks a URL — but a route change always opens a
|
|
344
|
+
> new view, so a `screenStart()` name only renames the screen it was called on. Call it from that
|
|
345
|
+
> screen's own effect.
|
|
346
|
+
|
|
347
|
+
### Mark a screen ready
|
|
348
|
+
|
|
349
|
+
```tsx
|
|
350
|
+
import { useScreenReady } from "@nathanclaire/edge-telemetry-sdk";
|
|
351
|
+
|
|
352
|
+
function ProfileScreen() {
|
|
353
|
+
const { data } = useProfile();
|
|
354
|
+
useScreenReady(telemetry, !!data); // or call telemetry.markScreenReady() yourself
|
|
355
|
+
// …
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
The `view` row then carries `view.ready_time` (ms from opening the screen to the mark) and
|
|
360
|
+
`view.ready_outcome: "ready"`. The app's first screen is measured from **process start**, so its
|
|
361
|
+
`view.ready_time` is cold-start-to-usable. If the user leaves a screen you have marked before
|
|
362
|
+
without it becoming ready, the row says `"abandoned"`; screens you never mark carry neither key,
|
|
363
|
+
and leaving by backgrounding is never judged. The first mark per screen wins.
|
|
298
364
|
|
|
299
365
|
### Reading the results
|
|
300
366
|
|
|
@@ -385,6 +451,20 @@ The name ships uncapped and unnormalized, exactly as you wrote it.
|
|
|
385
451
|
**The tap's identity is captured at the tap, not at send.** A tap that navigates is still
|
|
386
452
|
attributed to the screen it happened on, not the one it opened.
|
|
387
453
|
|
|
454
|
+
### Native — or capture every press automatically
|
|
455
|
+
|
|
456
|
+
```typescript
|
|
457
|
+
const telemetry = createTelemetry({ apiKey, endpoint, autoTrackTaps: true }); // native only
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
Opt in and every `onPress` sends a `ui.interaction` (`ui.type: "tap"`), and every `onLongPress` a
|
|
461
|
+
`"long_press"` — no annotation needed. It fires when a press activates, never on a scroll.
|
|
462
|
+
|
|
463
|
+
Names come from **`testID` only** (normalized: `"Checkout Button!"` → `checkout_button`), never
|
|
464
|
+
from the button's text or accessibility label, which is where names and amounts live. A press with
|
|
465
|
+
no `testID` arrives as `unnamed` — add one to name it. A `trackTap()` call inside the handler
|
|
466
|
+
wins, and nested pressables produce one row.
|
|
467
|
+
|
|
388
468
|
---
|
|
389
469
|
|
|
390
470
|
## Report handled errors
|
|
@@ -402,6 +482,24 @@ try {
|
|
|
402
482
|
It takes `unknown` on purpose — real `catch` blocks receive strings and axios rejection objects,
|
|
403
483
|
and you shouldn't have to prove to TypeScript that it's an `Error` first.
|
|
404
484
|
|
|
485
|
+
### Render errors — `<EdgeErrorBoundary>`
|
|
486
|
+
|
|
487
|
+
```tsx
|
|
488
|
+
import { EdgeErrorBoundary } from "@nathanclaire/edge-telemetry-sdk";
|
|
489
|
+
|
|
490
|
+
<EdgeErrorBoundary
|
|
491
|
+
telemetry={telemetry}
|
|
492
|
+
fallback={({ error, resetError }) => <ErrorScreen onRetry={resetError} />} // or a plain element
|
|
493
|
+
onError={(error, info) => { /* runs after the SDK reports; a throw here is ignored */ }}
|
|
494
|
+
>
|
|
495
|
+
<App />
|
|
496
|
+
</EdgeErrorBoundary>
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
A caught render error is sent once, as `app.error` with `error.source: "boundary"` and
|
|
500
|
+
`error.component_stack`. React's own console report and the global error handlers skip it, so
|
|
501
|
+
turning on `captureConsole` does not double-count it.
|
|
502
|
+
|
|
405
503
|
### Two event names, and why it matters
|
|
406
504
|
|
|
407
505
|
| | `app.crash` | `app.error` |
|
|
@@ -532,6 +630,23 @@ a working scrubber from a broken one.
|
|
|
532
630
|
|
|
533
631
|
---
|
|
534
632
|
|
|
633
|
+
## Respect a user's opt-out
|
|
634
|
+
|
|
635
|
+
```typescript
|
|
636
|
+
telemetry.disable(); // takes effect immediately
|
|
637
|
+
telemetry.enable(); // resume
|
|
638
|
+
|
|
639
|
+
// No consent yet at launch? Start dark — nothing is collected until enable():
|
|
640
|
+
const telemetry = createTelemetry({ apiKey, endpoint, enabled: hasConsent() });
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
`disable()` drops everything queued and stored on the device, stops every timer, and leaves your
|
|
644
|
+
network requests untouched — no `traceparent` header is added while disabled. Nothing is sent or
|
|
645
|
+
written until `enable()`. The SDK does not remember the choice across launches: store it yourself
|
|
646
|
+
and pass `enabled` at startup. A launch that starts dark never sends `app.start`.
|
|
647
|
+
|
|
648
|
+
---
|
|
649
|
+
|
|
535
650
|
## Sample a percentage of sessions
|
|
536
651
|
|
|
537
652
|
```typescript
|
|
@@ -631,8 +746,8 @@ All of this starts in the constructor. You don't call anything to enable it.
|
|
|
631
746
|
| `ui.interaction` | Every click (web) / every `trackTap()` (native) | Both |
|
|
632
747
|
| `network_change` | Connectivity type changes | Both |
|
|
633
748
|
| `user.profile.update` | `identify()` | Both |
|
|
634
|
-
| `
|
|
635
|
-
| `
|
|
749
|
+
| `task.complete` | A [span](#time-a-journey) ends, or its session ends first | Both |
|
|
750
|
+
| `app.hang` | The JS thread froze for 2–60 s in the foreground (not in dev builds) | Both |
|
|
636
751
|
| `custom_event` | Any `log()` name not in this table | Both |
|
|
637
752
|
|
|
638
753
|
### Metrics
|
|
@@ -665,7 +780,7 @@ unreachable — `log("page_load")` now arrives as `custom_event`. Their jobs are
|
|
|
665
780
|
|
|
666
781
|
## API
|
|
667
782
|
|
|
668
|
-
Every method returns a Promise.
|
|
783
|
+
Every method returns a Promise, except the span methods, `markScreenReady()`, `disable()` and `enable()`, which are synchronous.
|
|
669
784
|
|
|
670
785
|
### Core — both platforms
|
|
671
786
|
|
|
@@ -678,6 +793,19 @@ attachNavigation(navigationRef: any): Promise<void>
|
|
|
678
793
|
trackErrors(options?: { captureConsole?: boolean }): Promise<void>
|
|
679
794
|
getDeviceInfo(): Promise<DeviceInfo>
|
|
680
795
|
getNetworkInfo(): Promise<NetworkInfo>
|
|
796
|
+
|
|
797
|
+
startSpan(name: string, attributes?: Record<string, unknown>): SpanHandle
|
|
798
|
+
// SpanHandle.end(opts?: { outcome?: "completed" | "failed" | "abandoned"; attributes? })
|
|
799
|
+
withSpan<T>(name: string, fn: () => T, attributes?: Record<string, unknown>): T
|
|
800
|
+
endSpan(name: string, outcome?: "completed" | "failed" | "abandoned", attributes?: Record<string, unknown>): void
|
|
801
|
+
markScreenReady(): void
|
|
802
|
+
|
|
803
|
+
recordMetric(name: string, value: number, attributes?: Record<string, any>, opts?: { unit?: string }): Promise<void>
|
|
804
|
+
// the SDK's own metric names are reserved; NaN / Infinity are dropped
|
|
805
|
+
addBreadcrumb(name: string, data?: Record<string, unknown>): Promise<void>
|
|
806
|
+
// into the trail of 20 on app.crash / app.hang — name ≤64 chars, ≤8 keys, values ≤255
|
|
807
|
+
startNewSession(): Promise<void> // session.reason: "manual"
|
|
808
|
+
disable(): void / enable(): void // consent; synchronous
|
|
681
809
|
```
|
|
682
810
|
|
|
683
811
|
### Identity — both platforms
|
|
@@ -705,7 +833,7 @@ setUserContact(email?: string, phone?: string): Promise<void>
|
|
|
705
833
|
```
|
|
706
834
|
|
|
707
835
|
> `fullName`, `firstName`, `lastName`, `avatar`, `createdAt` and `updatedAt` are `@deprecated` and
|
|
708
|
-
> go away in
|
|
836
|
+
> go away in v6. `fullName` still works — it's what `user.name` is built from. The other five
|
|
709
837
|
> reach no wire key at all.
|
|
710
838
|
|
|
711
839
|
### Native only
|
|
@@ -713,13 +841,12 @@ setUserContact(email?: string, phone?: string): Promise<void>
|
|
|
713
841
|
```typescript
|
|
714
842
|
trackTap(name: string): Promise<void> // → ui.interaction. Never rejects.
|
|
715
843
|
trackMemoryUsage(): Promise<void> // auto-started
|
|
716
|
-
screenStart(name: string): Promise<void> //
|
|
717
|
-
screenEnd(name: string): Promise<void> //
|
|
718
|
-
trackRoute(from: string, to: string): Promise<void> //
|
|
844
|
+
screenStart(name: string): Promise<void> // names the current view (explicit rung)
|
|
845
|
+
screenEnd(name: string): Promise<void> // @deprecated no-op since v5 — deleted in v6
|
|
846
|
+
trackRoute(from: string, to: string): Promise<void> // @deprecated no-op since v5 — deleted in v6
|
|
719
847
|
```
|
|
720
848
|
|
|
721
|
-
|
|
722
|
-
`navigation` and `screen.duration`, both superseded by the `view` event.
|
|
849
|
+
`navigation` and `screen.duration` are removed in v5 — the `view` event replaces both.
|
|
723
850
|
|
|
724
851
|
### Web only
|
|
725
852
|
|
|
@@ -741,14 +868,17 @@ import {
|
|
|
741
868
|
memoryStore, // an in-memory Store, for tests
|
|
742
869
|
type TelemetryOpts,
|
|
743
870
|
type BeforeSend,
|
|
871
|
+
type SpanHandle, type TaskOutcome,
|
|
872
|
+
EdgeErrorBoundary, // the render-error boundary
|
|
873
|
+
useScreenReady, // marks the current screen ready
|
|
874
|
+
type EdgeErrorBoundaryProps,
|
|
744
875
|
type Store, type SyncStore, type AsyncStore, type StoreRead, type StoreWrite,
|
|
745
876
|
type MemoryStoreOpts,
|
|
746
877
|
} from "@nathanclaire/edge-telemetry-sdk";
|
|
747
878
|
```
|
|
748
879
|
|
|
749
|
-
`TelemetryWeb` and `TelemetryNative` are
|
|
750
|
-
the only
|
|
751
|
-
directly skips both checks.
|
|
880
|
+
`TelemetryWeb` and `TelemetryNative` are exported **as types only** (v5): `createTelemetry()` is
|
|
881
|
+
the only way to construct one, so your `apiKey` and trace allowlist are always validated.
|
|
752
882
|
|
|
753
883
|
> `TelemetryEvent`, `DeviceInfo`, `NetworkInfo` and `UserProfile` are documented in this README as
|
|
754
884
|
> wire and return shapes, but are **not currently exported as types**. For a `beforeSend` hook,
|
|
@@ -783,6 +913,17 @@ key — but **not** the identity keys, which are stamped afterwards.
|
|
|
783
913
|
**Network and device state are read at log time**, not at init: a request that failed when the
|
|
784
914
|
Wi-Fi dropped is better described by the network at the moment it completed.
|
|
785
915
|
|
|
916
|
+
**Two small sets of device state ride outside the block**, on the rows that need them:
|
|
917
|
+
|
|
918
|
+
| Keys | On | Platform |
|
|
919
|
+
|---|---|---|
|
|
920
|
+
| `device.battery_level` (0–100), `device.battery_charging`, `device.power_save` | `app.crash`, `app.error`, `app.hang` | Native only (needs `react-native-device-info`) |
|
|
921
|
+
| `device.reduce_motion` | `session.started` | Both |
|
|
922
|
+
| `device.screen_reader`, `device.font_scale` | `session.started` | Native only |
|
|
923
|
+
|
|
924
|
+
Battery is a cached reading (refreshed every 60 s and on foreground), so reporting a crash never
|
|
925
|
+
waits on it. A reading the device can't give — a simulator's `-1`, say — is left out, not faked.
|
|
926
|
+
|
|
786
927
|
---
|
|
787
928
|
|
|
788
929
|
## Wire format
|
|
@@ -858,6 +999,9 @@ restore all resume the same session** if the gap is inside the idle window. A re
|
|
|
858
999
|
deliberately does *not* re-emit `session.started` — otherwise `COUNT(session.started)` would stop
|
|
859
1000
|
equalling your session count.
|
|
860
1001
|
|
|
1002
|
+
Call `startNewSession()` to end one yourself — on logout, say. Both session events then carry
|
|
1003
|
+
`session.reason: "manual"`.
|
|
1004
|
+
|
|
861
1005
|
---
|
|
862
1006
|
|
|
863
1007
|
## Delivery and reliability
|
|
@@ -918,8 +1062,8 @@ backend configuration question, not an SDK one.
|
|
|
918
1062
|
| No Core Web Vitals on native | Correct — they're web-only, by design. |
|
|
919
1063
|
| No `memory_usage` on web | Correct — it's native-only, by design. |
|
|
920
1064
|
| No dead-click data on native | Correct — no DOM, so no mutation signal. Filter dead-click rates to web. |
|
|
921
|
-
| `screen.duration`
|
|
922
|
-
|
|
|
1065
|
+
| `navigation` / `screen.duration` stopped arriving | Removed in v5. Use the `view` event — `view.time_spent` is the dwell. |
|
|
1066
|
+
| The *previous* screen got my `screenStart()` name | It ran before the route event. Call it from the new screen's own `useEffect`. |
|
|
923
1067
|
| `view.loading_time` is null | Read `view.loading_time_outcome` — it tells you which of the three reasons applies. |
|
|
924
1068
|
|
|
925
1069
|
### Requests the SDK can't see
|
|
@@ -932,6 +1076,17 @@ whose real wait is one of those reports `no_activity`.
|
|
|
932
1076
|
|
|
933
1077
|
## Upgrading
|
|
934
1078
|
|
|
1079
|
+
### To v5
|
|
1080
|
+
|
|
1081
|
+
**Read [`docs/migration-v5.md`](docs/migration-v5.md) before you deploy.** It ships inside the npm
|
|
1082
|
+
package.
|
|
1083
|
+
|
|
1084
|
+
Of v5's six breaking changes, **exactly one breaks a build**: `TelemetryWeb` / `TelemetryNative`
|
|
1085
|
+
are types only, so construct through `createTelemetry()`. The rest move a chart — `navigation` and
|
|
1086
|
+
`screen.duration` are gone (read `view`), nested `view.name`s are joined paths (`HomeTab/Details`),
|
|
1087
|
+
a route change always bounds a view, the native-module packages run from your install, and a 4xx
|
|
1088
|
+
drops its batch instead of persisting it.
|
|
1089
|
+
|
|
935
1090
|
### To v4
|
|
936
1091
|
|
|
937
1092
|
**Read [`docs/migration-v4.md`](docs/migration-v4.md) before you deploy.** It ships inside the npm
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class r{constructor(e){this.telemetry=e}async onState(e){this.telemetry.hangs?.setActive(e),e&&this.telemetry.deviceState?.refresh?.().catch(()=>{});const t=this.active;this.active=e,!(t===void 0||t===e)&&(await this.telemetry.log("app.lifecycle",{"lifecycle.state":e?"foreground":"background"}),e?this.telemetry.views.foreground():(await this.telemetry.views.background(),this.telemetry.trace.clear()))}}exports.AppLifecycleEmitter=r;
|
|
2
|
+
//# sourceMappingURL=appLifecycle-DS_fEclk.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appLifecycle-DS_fEclk.cjs","sources":["../src/adapters/appLifecycle.ts"],"sourcesContent":["import { Telemetry } from \"../core/telemetry\";\n\n/**\n * Shared foreground/background emitter — the single source of truth so the native\n * (RN AppState) and web (visibilitychange) lifecycle adapters stay in lockstep on the\n * `app.lifecycle` catalogue event (#30, #179).\n *\n * Feed it the current active state via `onState(isActive)`. It emits `app.lifecycle` only\n * on a transition, carrying the direction as `lifecycle.state` (foreground|background).\n */\nexport class AppLifecycleEmitter {\n private active?: boolean;\n\n constructor(private telemetry: Telemetry) {}\n\n /**\n * Returns once the transition's rows are enqueued — **await it before flushing**. The\n * background boundary's `view` row is the one most likely to be lost to an OS kill, and\n * the whole point of §4.5's background boundary is that it flushes while the app is still\n * reliably alive. A caller that fires the flush on the next line instead sends the batch\n * before the row exists.\n */\n async onState(isActive: boolean): Promise<void> {\n // Every call, the seed included and not only transitions: the stall detector must tick\n // from the first foreground, and stop the moment the app leaves it (#165).\n this.telemetry.hangs?.setActive(isActive);\n // #173: a foreground is a fresh chance the battery moved; the cache is never awaited.\n if (isActive) this.telemetry.deviceState?.refresh?.().catch(() => {});\n const previous = this.active;\n this.active = isActive;\n if (previous === undefined || previous === isActive) return;\n\n // Chained, not fired alongside, so the `app.lifecycle` row lands in the view it happened\n // in — awaited because a consumer-supplied double may return a plain value.\n await this.telemetry.log(\"app.lifecycle\", {\n \"lifecycle.state\": isActive ? \"foreground\" : \"background\",\n });\n // The view ends and emits, and the successor's clock starts paused so a night spent\n // backgrounded is not charged as dwell to the screen the user left open.\n if (isActive) this.telemetry.views.foreground();\n else {\n await this.telemetry.views.background();\n // Background clears the live root on both builds (§6.2), so a resumed app's first\n // fetch mints its own root rather than joining an action from before the user left.\n // *After* the view boundary, not before: the successor view is minted in there, and\n // clearing first would leave its freshly-minted `navigation` root as the carrier the\n // resumed app then joins.\n this.telemetry.trace.clear();\n }\n }\n}\n"],"names":["AppLifecycleEmitter","telemetry","isActive","previous"],"mappings":"gFAUO,MAAMA,CAAoB,CAG/B,YAAoBC,EAAsB,CAAtB,KAAA,UAAAA,CAAuB,CAS3C,MAAM,QAAQC,EAAkC,CAG9C,KAAK,UAAU,OAAO,UAAUA,CAAQ,EAEpCA,GAAU,KAAK,UAAU,aAAa,UAAA,EAAY,MAAM,IAAM,CAAC,CAAC,EACpE,MAAMC,EAAW,KAAK,OACtB,KAAK,OAASD,EACV,EAAAC,IAAa,QAAaA,IAAaD,KAI3C,MAAM,KAAK,UAAU,IAAI,gBAAiB,CACxC,kBAAmBA,EAAW,aAAe,YAAA,CAC9C,EAGGA,EAAU,KAAK,UAAU,MAAM,WAAA,GAEjC,MAAM,KAAK,UAAU,MAAM,WAAA,EAM3B,KAAK,UAAU,MAAM,MAAA,GAEzB,CACF"}
|
|
@@ -10,13 +10,15 @@ class a {
|
|
|
10
10
|
* before the row exists.
|
|
11
11
|
*/
|
|
12
12
|
async onState(e) {
|
|
13
|
+
this.telemetry.hangs?.setActive(e), e && this.telemetry.deviceState?.refresh?.().catch(() => {
|
|
14
|
+
});
|
|
13
15
|
const t = this.active;
|
|
14
|
-
this.active = e, !(t === void 0 || t === e) && (await this.telemetry.log("
|
|
15
|
-
"
|
|
16
|
+
this.active = e, !(t === void 0 || t === e) && (await this.telemetry.log("app.lifecycle", {
|
|
17
|
+
"lifecycle.state": e ? "foreground" : "background"
|
|
16
18
|
}), e ? this.telemetry.views.foreground() : (await this.telemetry.views.background(), this.telemetry.trace.clear()));
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
export {
|
|
20
22
|
a as AppLifecycleEmitter
|
|
21
23
|
};
|
|
22
|
-
//# sourceMappingURL=appLifecycle-
|
|
24
|
+
//# sourceMappingURL=appLifecycle-PffQ4vC1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appLifecycle-PffQ4vC1.js","sources":["../src/adapters/appLifecycle.ts"],"sourcesContent":["import { Telemetry } from \"../core/telemetry\";\n\n/**\n * Shared foreground/background emitter — the single source of truth so the native\n * (RN AppState) and web (visibilitychange) lifecycle adapters stay in lockstep on the\n * `app.lifecycle` catalogue event (#30, #179).\n *\n * Feed it the current active state via `onState(isActive)`. It emits `app.lifecycle` only\n * on a transition, carrying the direction as `lifecycle.state` (foreground|background).\n */\nexport class AppLifecycleEmitter {\n private active?: boolean;\n\n constructor(private telemetry: Telemetry) {}\n\n /**\n * Returns once the transition's rows are enqueued — **await it before flushing**. The\n * background boundary's `view` row is the one most likely to be lost to an OS kill, and\n * the whole point of §4.5's background boundary is that it flushes while the app is still\n * reliably alive. A caller that fires the flush on the next line instead sends the batch\n * before the row exists.\n */\n async onState(isActive: boolean): Promise<void> {\n // Every call, the seed included and not only transitions: the stall detector must tick\n // from the first foreground, and stop the moment the app leaves it (#165).\n this.telemetry.hangs?.setActive(isActive);\n // #173: a foreground is a fresh chance the battery moved; the cache is never awaited.\n if (isActive) this.telemetry.deviceState?.refresh?.().catch(() => {});\n const previous = this.active;\n this.active = isActive;\n if (previous === undefined || previous === isActive) return;\n\n // Chained, not fired alongside, so the `app.lifecycle` row lands in the view it happened\n // in — awaited because a consumer-supplied double may return a plain value.\n await this.telemetry.log(\"app.lifecycle\", {\n \"lifecycle.state\": isActive ? \"foreground\" : \"background\",\n });\n // The view ends and emits, and the successor's clock starts paused so a night spent\n // backgrounded is not charged as dwell to the screen the user left open.\n if (isActive) this.telemetry.views.foreground();\n else {\n await this.telemetry.views.background();\n // Background clears the live root on both builds (§6.2), so a resumed app's first\n // fetch mints its own root rather than joining an action from before the user left.\n // *After* the view boundary, not before: the successor view is minted in there, and\n // clearing first would leave its freshly-minted `navigation` root as the carrier the\n // resumed app then joins.\n this.telemetry.trace.clear();\n }\n }\n}\n"],"names":["AppLifecycleEmitter","telemetry","isActive","previous"],"mappings":"AAUO,MAAMA,EAAoB;AAAA,EAG/B,YAAoBC,GAAsB;AAAtB,SAAA,YAAAA;AAAA,EAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS3C,MAAM,QAAQC,GAAkC;AAG9C,SAAK,UAAU,OAAO,UAAUA,CAAQ,GAEpCA,KAAU,KAAK,UAAU,aAAa,UAAA,EAAY,MAAM,MAAM;AAAA,IAAC,CAAC;AACpE,UAAMC,IAAW,KAAK;AAEtB,IADA,KAAK,SAASD,GACV,EAAAC,MAAa,UAAaA,MAAaD,OAI3C,MAAM,KAAK,UAAU,IAAI,iBAAiB;AAAA,MACxC,mBAAmBA,IAAW,eAAe;AAAA,IAAA,CAC9C,GAGGA,IAAU,KAAK,UAAU,MAAM,WAAA,KAEjC,MAAM,KAAK,UAAU,MAAM,WAAA,GAM3B,KAAK,UAAU,MAAM,MAAA;AAAA,EAEzB;AACF;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./react-bqe7KPOf.cjs"),l={onPress:"tap",onLongPress:"long_press"},p=Symbol.for("edge-telemetry.autoTaps"),y=new WeakSet;let d;const m=new WeakMap;function f(t){if(!t||typeof t!="object")return t;let c=t;for(const r in l){const e=t[r];if(typeof e!="function")continue;let n=m.get(e);n||m.set(e,n=new Map);let a=n.get(t.testID);a||(a=g(e,l[r],t.testID),n.set(t.testID,a)),c===t&&(c={...t}),c[r]=a}return c}function g(t,c,r){return function(e){const n=d;if(!n)return t.apply(this,arguments);const a=e!==null&&typeof e=="object";if(a&&y.has(e))return t.apply(this,arguments);a&&y.add(e);let o,s=0;try{o=n.prepare(c,r),s=n.explicitCount()}catch(i){u.debug.warn("autoTrackTaps: prepare failed:",i)}try{return t.apply(this,arguments)}finally{if(o&&n.explicitCount()===s)try{o()}catch(i){u.debug.warn("autoTrackTaps: emit failed:",i)}}}}function h(t,c){d=c;for(const r of t)if(!(!r||r[p]))try{for(const n of["jsx","jsxs","jsxDEV"]){const a=r[n];typeof a=="function"&&(r[n]=function(o,s,...i){return a.call(this,o,f(s),...i)})}const e=r.createElement;typeof e=="function"&&(r.createElement=function(n,a,...o){return e.call(this,n,f(a),...o)}),r[p]=!0}catch(e){u.debug.warn("autoTrackTaps: could not patch a JSX factory:",e)}}exports.patchElementFactories=h;exports.wrapProps=f;
|
|
2
|
+
//# sourceMappingURL=autoTaps.native-By9I4Kr2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoTaps.native-By9I4Kr2.cjs","sources":["../src/adapters/native/autoTaps.native.ts"],"sourcesContent":["// `autoTrackTaps` (#174, decisions #150/#154) — opt-in, native-only automatic capture of every\n// `onPress` (`ui.type: tap`) and `onLongPress` (`long_press`). It patches the JSX runtime's\n// `jsx`/`jsxs`/`jsxDEV` and `React.createElement` at init: Babel's automatic runtime reads\n// `(0, _jsxRuntime.jsx)(…)` at call time, so patching the module's exports object reaches\n// modules that were already loaded.\n//\n// Actionability *is* the prop — so there is still no `surface` on native — and the wrapper\n// fires on Pressable **activation**, never on touch, so a scroll drag emits nothing.\n\nimport { debug } from \"../../core/debug\";\n\nexport type AutoTapKind = \"tap\" | \"long_press\";\n\n/** What the entry hands in: called synchronously at activation, *before* the host handler. */\nexport type AutoTapSink = {\n /** Snapshot identity and mint the root now; returns the emit to run after the handler, or nothing. */\n prepare(kind: AutoTapKind, testID: unknown): (() => void) | undefined;\n /** Increments on every explicit `trackTap()` — an explicit call inside the handler wins. */\n explicitCount(): number;\n};\n\nconst PROPS: Record<string, AutoTapKind> = { onPress: \"tap\", onLongPress: \"long_press\" };\nconst PATCHED = Symbol.for(\"edge-telemetry.autoTaps\");\n\n/**\n * One activation is one row however many wrapped handlers it passes through — `AppButton →\n * Pressable` nests two, and the innermost element's wrapper is the first one called, so it\n * claims the event and the outer ones pass straight through. Shared across both props.\n */\nconst claimed = new WeakSet<object>();\n\n/**\n * The instance the wrappers report to. Module-level because the factories are patched once per\n * process: a second opted-in `Telemetry` takes over rather than stacking a second wrapper.\n */\nlet sink: AutoTapSink | undefined;\nconst cache = new WeakMap<Function, Map<unknown, Function>>();\n\nexport function wrapProps(props: any): any {\n if (!props || typeof props !== \"object\") return props;\n let out = props;\n for (const prop in PROPS) {\n const handler = props[prop];\n if (typeof handler !== \"function\") continue;\n // Keyed on (handler, testID): `onPress` keeps its identity across renders (no\n // `React.memo` breakage), and a handler shared by list rows keeps each row's name.\n let byId = cache.get(handler);\n if (!byId) cache.set(handler, (byId = new Map()));\n let wrapped = byId.get(props.testID);\n if (!wrapped) {\n wrapped = wrap(handler, PROPS[prop], props.testID);\n byId.set(props.testID, wrapped);\n }\n if (out === props) out = { ...props };\n out[prop] = wrapped;\n }\n return out;\n}\n\nfunction wrap(handler: Function, kind: AutoTapKind, testID: unknown): Function {\n return function (this: unknown, event?: unknown) {\n const s = sink;\n if (!s) return handler.apply(this, arguments as any);\n const claimable = event !== null && typeof event === \"object\";\n if (claimable && claimed.has(event as object)) return handler.apply(this, arguments as any);\n if (claimable) claimed.add(event as object);\n let emit: (() => void) | undefined;\n let before = 0;\n try {\n // Before the handler — it navigates on its first line, and the requests it fires\n // must be children of this tap's root, not of whatever was live before.\n emit = s.prepare(kind, testID);\n before = s.explicitCount();\n } catch (err) { debug.warn(\"autoTrackTaps: prepare failed:\", err); }\n try {\n return handler.apply(this, arguments as any);\n } finally {\n if (emit && s.explicitCount() === before) {\n try { emit(); } catch (err) { debug.warn(\"autoTrackTaps: emit failed:\", err); }\n }\n }\n };\n}\n\n/**\n * Patch the element factories on the given module exports objects (`react/jsx-runtime`,\n * `react/jsx-dev-runtime`, `react`). Idempotent per module. Never throws: a frozen exports\n * object just stays unpatched.\n */\nexport function patchElementFactories(modules: unknown[], next: AutoTapSink): void {\n sink = next;\n for (const mod of modules as any[]) {\n if (!mod || mod[PATCHED]) continue;\n try {\n for (const fn of [\"jsx\", \"jsxs\", \"jsxDEV\"]) {\n const orig = mod[fn];\n if (typeof orig !== \"function\") continue;\n mod[fn] = function (type: unknown, props: unknown, ...rest: unknown[]) {\n return orig.call(this, type, wrapProps(props), ...rest);\n };\n }\n const create = mod.createElement;\n if (typeof create === \"function\") {\n mod.createElement = function (type: unknown, props: unknown, ...children: unknown[]) {\n return create.call(this, type, wrapProps(props), ...children);\n };\n }\n mod[PATCHED] = true;\n } catch (err) {\n debug.warn(\"autoTrackTaps: could not patch a JSX factory:\", err);\n }\n }\n}\n"],"names":["PROPS","PATCHED","claimed","sink","cache","wrapProps","props","out","prop","handler","byId","wrapped","wrap","kind","testID","event","s","claimable","emit","before","err","debug","patchElementFactories","modules","next","mod","fn","orig","type","rest","create","children"],"mappings":"wHAqBMA,EAAqC,CAAE,QAAS,MAAO,YAAa,YAAA,EACpEC,EAAU,OAAO,IAAI,yBAAyB,EAO9CC,MAAc,QAMpB,IAAIC,EACJ,MAAMC,MAAY,QAEX,SAASC,EAAUC,EAAiB,CACvC,GAAI,CAACA,GAAS,OAAOA,GAAU,SAAU,OAAOA,EAChD,IAAIC,EAAMD,EACV,UAAWE,KAAQR,EAAO,CACtB,MAAMS,EAAUH,EAAME,CAAI,EAC1B,GAAI,OAAOC,GAAY,WAAY,SAGnC,IAAIC,EAAON,EAAM,IAAIK,CAAO,EACvBC,GAAMN,EAAM,IAAIK,EAAUC,EAAO,IAAI,GAAM,EAChD,IAAIC,EAAUD,EAAK,IAAIJ,EAAM,MAAM,EAC9BK,IACDA,EAAUC,EAAKH,EAAST,EAAMQ,CAAI,EAAGF,EAAM,MAAM,EACjDI,EAAK,IAAIJ,EAAM,OAAQK,CAAO,GAE9BJ,IAAQD,IAAOC,EAAM,CAAE,GAAGD,CAAA,GAC9BC,EAAIC,CAAI,EAAIG,CAChB,CACA,OAAOJ,CACX,CAEA,SAASK,EAAKH,EAAmBI,EAAmBC,EAA2B,CAC3E,OAAO,SAAyBC,EAAiB,CAC7C,MAAMC,EAAIb,EACV,GAAI,CAACa,EAAG,OAAOP,EAAQ,MAAM,KAAM,SAAgB,EACnD,MAAMQ,EAAYF,IAAU,MAAQ,OAAOA,GAAU,SACrD,GAAIE,GAAaf,EAAQ,IAAIa,CAAe,EAAG,OAAON,EAAQ,MAAM,KAAM,SAAgB,EACtFQ,GAAWf,EAAQ,IAAIa,CAAe,EAC1C,IAAIG,EACAC,EAAS,EACb,GAAI,CAGAD,EAAOF,EAAE,QAAQH,EAAMC,CAAM,EAC7BK,EAASH,EAAE,cAAA,CACf,OAASI,EAAK,CAAEC,QAAM,KAAK,iCAAkCD,CAAG,CAAG,CACnE,GAAI,CACA,OAAOX,EAAQ,MAAM,KAAM,SAAgB,CAC/C,QAAA,CACI,GAAIS,GAAQF,EAAE,cAAA,IAAoBG,EAC9B,GAAI,CAAED,EAAA,CAAQ,OAASE,EAAK,CAAEC,QAAM,KAAK,8BAA+BD,CAAG,CAAG,CAEtF,CACJ,CACJ,CAOO,SAASE,EAAsBC,EAAoBC,EAAyB,CAC/ErB,EAAOqB,EACP,UAAWC,KAAOF,EACd,GAAI,GAACE,GAAOA,EAAIxB,CAAO,GACvB,GAAI,CACA,UAAWyB,IAAM,CAAC,MAAO,OAAQ,QAAQ,EAAG,CACxC,MAAMC,EAAOF,EAAIC,CAAE,EACf,OAAOC,GAAS,aACpBF,EAAIC,CAAE,EAAI,SAAUE,EAAetB,KAAmBuB,EAAiB,CACnE,OAAOF,EAAK,KAAK,KAAMC,EAAMvB,EAAUC,CAAK,EAAG,GAAGuB,CAAI,CAC1D,EACJ,CACA,MAAMC,EAASL,EAAI,cACf,OAAOK,GAAW,aAClBL,EAAI,cAAgB,SAAUG,EAAetB,KAAmByB,EAAqB,CACjF,OAAOD,EAAO,KAAK,KAAMF,EAAMvB,EAAUC,CAAK,EAAG,GAAGyB,CAAQ,CAChE,GAEJN,EAAIxB,CAAO,EAAI,EACnB,OAASmB,EAAK,CACVC,QAAM,KAAK,gDAAiDD,CAAG,CACnE,CAER"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { d as s } from "./react-urNtDGTL.js";
|
|
2
|
+
const u = { onPress: "tap", onLongPress: "long_press" }, l = /* @__PURE__ */ Symbol.for("edge-telemetry.autoTaps"), p = /* @__PURE__ */ new WeakSet();
|
|
3
|
+
let d;
|
|
4
|
+
const y = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
function m(t) {
|
|
6
|
+
if (!t || typeof t != "object") return t;
|
|
7
|
+
let o = t;
|
|
8
|
+
for (const r in u) {
|
|
9
|
+
const e = t[r];
|
|
10
|
+
if (typeof e != "function") continue;
|
|
11
|
+
let n = y.get(e);
|
|
12
|
+
n || y.set(e, n = /* @__PURE__ */ new Map());
|
|
13
|
+
let a = n.get(t.testID);
|
|
14
|
+
a || (a = h(e, u[r], t.testID), n.set(t.testID, a)), o === t && (o = { ...t }), o[r] = a;
|
|
15
|
+
}
|
|
16
|
+
return o;
|
|
17
|
+
}
|
|
18
|
+
function h(t, o, r) {
|
|
19
|
+
return function(e) {
|
|
20
|
+
const n = d;
|
|
21
|
+
if (!n) return t.apply(this, arguments);
|
|
22
|
+
const a = e !== null && typeof e == "object";
|
|
23
|
+
if (a && p.has(e)) return t.apply(this, arguments);
|
|
24
|
+
a && p.add(e);
|
|
25
|
+
let c, f = 0;
|
|
26
|
+
try {
|
|
27
|
+
c = n.prepare(o, r), f = n.explicitCount();
|
|
28
|
+
} catch (i) {
|
|
29
|
+
s.warn("autoTrackTaps: prepare failed:", i);
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
return t.apply(this, arguments);
|
|
33
|
+
} finally {
|
|
34
|
+
if (c && n.explicitCount() === f)
|
|
35
|
+
try {
|
|
36
|
+
c();
|
|
37
|
+
} catch (i) {
|
|
38
|
+
s.warn("autoTrackTaps: emit failed:", i);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function w(t, o) {
|
|
44
|
+
d = o;
|
|
45
|
+
for (const r of t)
|
|
46
|
+
if (!(!r || r[l]))
|
|
47
|
+
try {
|
|
48
|
+
for (const n of ["jsx", "jsxs", "jsxDEV"]) {
|
|
49
|
+
const a = r[n];
|
|
50
|
+
typeof a == "function" && (r[n] = function(c, f, ...i) {
|
|
51
|
+
return a.call(this, c, m(f), ...i);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const e = r.createElement;
|
|
55
|
+
typeof e == "function" && (r.createElement = function(n, a, ...c) {
|
|
56
|
+
return e.call(this, n, m(a), ...c);
|
|
57
|
+
}), r[l] = !0;
|
|
58
|
+
} catch (e) {
|
|
59
|
+
s.warn("autoTrackTaps: could not patch a JSX factory:", e);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
w as patchElementFactories,
|
|
64
|
+
m as wrapProps
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=autoTaps.native-DQCXevD7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoTaps.native-DQCXevD7.js","sources":["../src/adapters/native/autoTaps.native.ts"],"sourcesContent":["// `autoTrackTaps` (#174, decisions #150/#154) — opt-in, native-only automatic capture of every\n// `onPress` (`ui.type: tap`) and `onLongPress` (`long_press`). It patches the JSX runtime's\n// `jsx`/`jsxs`/`jsxDEV` and `React.createElement` at init: Babel's automatic runtime reads\n// `(0, _jsxRuntime.jsx)(…)` at call time, so patching the module's exports object reaches\n// modules that were already loaded.\n//\n// Actionability *is* the prop — so there is still no `surface` on native — and the wrapper\n// fires on Pressable **activation**, never on touch, so a scroll drag emits nothing.\n\nimport { debug } from \"../../core/debug\";\n\nexport type AutoTapKind = \"tap\" | \"long_press\";\n\n/** What the entry hands in: called synchronously at activation, *before* the host handler. */\nexport type AutoTapSink = {\n /** Snapshot identity and mint the root now; returns the emit to run after the handler, or nothing. */\n prepare(kind: AutoTapKind, testID: unknown): (() => void) | undefined;\n /** Increments on every explicit `trackTap()` — an explicit call inside the handler wins. */\n explicitCount(): number;\n};\n\nconst PROPS: Record<string, AutoTapKind> = { onPress: \"tap\", onLongPress: \"long_press\" };\nconst PATCHED = Symbol.for(\"edge-telemetry.autoTaps\");\n\n/**\n * One activation is one row however many wrapped handlers it passes through — `AppButton →\n * Pressable` nests two, and the innermost element's wrapper is the first one called, so it\n * claims the event and the outer ones pass straight through. Shared across both props.\n */\nconst claimed = new WeakSet<object>();\n\n/**\n * The instance the wrappers report to. Module-level because the factories are patched once per\n * process: a second opted-in `Telemetry` takes over rather than stacking a second wrapper.\n */\nlet sink: AutoTapSink | undefined;\nconst cache = new WeakMap<Function, Map<unknown, Function>>();\n\nexport function wrapProps(props: any): any {\n if (!props || typeof props !== \"object\") return props;\n let out = props;\n for (const prop in PROPS) {\n const handler = props[prop];\n if (typeof handler !== \"function\") continue;\n // Keyed on (handler, testID): `onPress` keeps its identity across renders (no\n // `React.memo` breakage), and a handler shared by list rows keeps each row's name.\n let byId = cache.get(handler);\n if (!byId) cache.set(handler, (byId = new Map()));\n let wrapped = byId.get(props.testID);\n if (!wrapped) {\n wrapped = wrap(handler, PROPS[prop], props.testID);\n byId.set(props.testID, wrapped);\n }\n if (out === props) out = { ...props };\n out[prop] = wrapped;\n }\n return out;\n}\n\nfunction wrap(handler: Function, kind: AutoTapKind, testID: unknown): Function {\n return function (this: unknown, event?: unknown) {\n const s = sink;\n if (!s) return handler.apply(this, arguments as any);\n const claimable = event !== null && typeof event === \"object\";\n if (claimable && claimed.has(event as object)) return handler.apply(this, arguments as any);\n if (claimable) claimed.add(event as object);\n let emit: (() => void) | undefined;\n let before = 0;\n try {\n // Before the handler — it navigates on its first line, and the requests it fires\n // must be children of this tap's root, not of whatever was live before.\n emit = s.prepare(kind, testID);\n before = s.explicitCount();\n } catch (err) { debug.warn(\"autoTrackTaps: prepare failed:\", err); }\n try {\n return handler.apply(this, arguments as any);\n } finally {\n if (emit && s.explicitCount() === before) {\n try { emit(); } catch (err) { debug.warn(\"autoTrackTaps: emit failed:\", err); }\n }\n }\n };\n}\n\n/**\n * Patch the element factories on the given module exports objects (`react/jsx-runtime`,\n * `react/jsx-dev-runtime`, `react`). Idempotent per module. Never throws: a frozen exports\n * object just stays unpatched.\n */\nexport function patchElementFactories(modules: unknown[], next: AutoTapSink): void {\n sink = next;\n for (const mod of modules as any[]) {\n if (!mod || mod[PATCHED]) continue;\n try {\n for (const fn of [\"jsx\", \"jsxs\", \"jsxDEV\"]) {\n const orig = mod[fn];\n if (typeof orig !== \"function\") continue;\n mod[fn] = function (type: unknown, props: unknown, ...rest: unknown[]) {\n return orig.call(this, type, wrapProps(props), ...rest);\n };\n }\n const create = mod.createElement;\n if (typeof create === \"function\") {\n mod.createElement = function (type: unknown, props: unknown, ...children: unknown[]) {\n return create.call(this, type, wrapProps(props), ...children);\n };\n }\n mod[PATCHED] = true;\n } catch (err) {\n debug.warn(\"autoTrackTaps: could not patch a JSX factory:\", err);\n }\n }\n}\n"],"names":["PROPS","PATCHED","claimed","sink","cache","wrapProps","props","out","prop","handler","byId","wrapped","wrap","kind","testID","event","s","claimable","emit","before","err","debug","patchElementFactories","modules","next","mod","fn","orig","type","rest","create","children"],"mappings":";AAqBA,MAAMA,IAAqC,EAAE,SAAS,OAAO,aAAa,aAAA,GACpEC,IAAU,uBAAO,IAAI,yBAAyB,GAO9CC,wBAAc,QAAA;AAMpB,IAAIC;AACJ,MAAMC,wBAAY,QAAA;AAEX,SAASC,EAAUC,GAAiB;AACvC,MAAI,CAACA,KAAS,OAAOA,KAAU,SAAU,QAAOA;AAChD,MAAIC,IAAMD;AACV,aAAWE,KAAQR,GAAO;AACtB,UAAMS,IAAUH,EAAME,CAAI;AAC1B,QAAI,OAAOC,KAAY,WAAY;AAGnC,QAAIC,IAAON,EAAM,IAAIK,CAAO;AAC5B,IAAKC,KAAMN,EAAM,IAAIK,GAAUC,IAAO,oBAAI,KAAM;AAChD,QAAIC,IAAUD,EAAK,IAAIJ,EAAM,MAAM;AACnC,IAAKK,MACDA,IAAUC,EAAKH,GAAST,EAAMQ,CAAI,GAAGF,EAAM,MAAM,GACjDI,EAAK,IAAIJ,EAAM,QAAQK,CAAO,IAE9BJ,MAAQD,MAAOC,IAAM,EAAE,GAAGD,EAAA,IAC9BC,EAAIC,CAAI,IAAIG;AAAA,EAChB;AACA,SAAOJ;AACX;AAEA,SAASK,EAAKH,GAAmBI,GAAmBC,GAA2B;AAC3E,SAAO,SAAyBC,GAAiB;AAC7C,UAAMC,IAAIb;AACV,QAAI,CAACa,EAAG,QAAOP,EAAQ,MAAM,MAAM,SAAgB;AACnD,UAAMQ,IAAYF,MAAU,QAAQ,OAAOA,KAAU;AACrD,QAAIE,KAAaf,EAAQ,IAAIa,CAAe,EAAG,QAAON,EAAQ,MAAM,MAAM,SAAgB;AAC1F,IAAIQ,KAAWf,EAAQ,IAAIa,CAAe;AAC1C,QAAIG,GACAC,IAAS;AACb,QAAI;AAGA,MAAAD,IAAOF,EAAE,QAAQH,GAAMC,CAAM,GAC7BK,IAASH,EAAE,cAAA;AAAA,IACf,SAASI,GAAK;AAAE,MAAAC,EAAM,KAAK,kCAAkCD,CAAG;AAAA,IAAG;AACnE,QAAI;AACA,aAAOX,EAAQ,MAAM,MAAM,SAAgB;AAAA,IAC/C,UAAA;AACI,UAAIS,KAAQF,EAAE,cAAA,MAAoBG;AAC9B,YAAI;AAAE,UAAAD,EAAA;AAAA,QAAQ,SAASE,GAAK;AAAE,UAAAC,EAAM,KAAK,+BAA+BD,CAAG;AAAA,QAAG;AAAA,IAEtF;AAAA,EACJ;AACJ;AAOO,SAASE,EAAsBC,GAAoBC,GAAyB;AAC/E,EAAArB,IAAOqB;AACP,aAAWC,KAAOF;AACd,QAAI,GAACE,KAAOA,EAAIxB,CAAO;AACvB,UAAI;AACA,mBAAWyB,KAAM,CAAC,OAAO,QAAQ,QAAQ,GAAG;AACxC,gBAAMC,IAAOF,EAAIC,CAAE;AACnB,UAAI,OAAOC,KAAS,eACpBF,EAAIC,CAAE,IAAI,SAAUE,GAAetB,MAAmBuB,GAAiB;AACnE,mBAAOF,EAAK,KAAK,MAAMC,GAAMvB,EAAUC,CAAK,GAAG,GAAGuB,CAAI;AAAA,UAC1D;AAAA,QACJ;AACA,cAAMC,IAASL,EAAI;AACnB,QAAI,OAAOK,KAAW,eAClBL,EAAI,gBAAgB,SAAUG,GAAetB,MAAmByB,GAAqB;AACjF,iBAAOD,EAAO,KAAK,MAAMF,GAAMvB,EAAUC,CAAK,GAAG,GAAGyB,CAAQ;AAAA,QAChE,IAEJN,EAAIxB,CAAO,IAAI;AAAA,MACnB,SAASmB,GAAK;AACV,QAAAC,EAAM,KAAK,iDAAiDD,CAAG;AAAA,MACnE;AAER;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./react-bqe7KPOf.cjs");class i{constructor(t){this.telemetry=t}attach(t={}){const{captureConsole:a=!1}=t;return new Promise((n,s)=>{try{window.onerror=(e,u,d,h,o)=>{if(r.isBoundaryCaught(o))return;const l=o?"global_handler":"cross_origin";this.telemetry.log("app.crash",r.buildErrorAttributes(l,o,{fallbackMessage:e}))},window.onunhandledrejection=e=>{r.isBoundaryCaught(e.reason)||this.telemetry.log("app.crash",r.buildErrorAttributes("unhandled_rejection",e.reason,{fallbackMessage:"Unhandled Promise Rejection"}))},a&&r.captureConsole(this.telemetry),n()}catch(e){s(e)}})}}exports.CrashHandler=i;
|
|
2
|
+
//# sourceMappingURL=crashHandler.web-6KvedEB-.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crashHandler.web-6KvedEB-.cjs","sources":["../src/adapters/web/crashHandler.web.ts"],"sourcesContent":["import { Telemetry } from \"../../core/telemetry\";\nimport { buildErrorAttributes, captureConsole, isBoundaryCaught } from \"../crashCapture\";\n\nexport type CrashHandlerOptions = { captureConsole?: boolean };\n\nexport class CrashHandler {\n constructor(private telemetry: Telemetry) { }\n\n // Lockstep with native: JS errors and unhandled rejections become `app.crash`;\n // console.error becomes `app.error` and console.warn a breadcrumb, both opt-in. §4.7, #100\n attach(options: CrashHandlerOptions = {}): Promise<void> {\n const { captureConsole: consoleEnabled = false } = options;\n return new Promise((resolve, reject) => {\n try {\n window.onerror = (msg, _url, _line, _col, error) => {\n // React's dev build rethrows a boundary-caught error here; it is already a row (#166).\n if (isBoundaryCaught(error)) return;\n // ⚠ `error === undefined` is the cross-origin instrumentation gap, not a\n // mystery Error: a bundle served from a CDN without CORS headers yields the\n // classic \"Script error.\" with no stack. Naming it beats collapsing it.\n const source = error ? \"global_handler\" : \"cross_origin\";\n // No `fatal` on web — nothing here is fatal, the page keeps running (§4.7).\n this.telemetry.log(\"app.crash\", buildErrorAttributes(source, error, { fallbackMessage: msg }));\n };\n\n window.onunhandledrejection = (event) => {\n if (isBoundaryCaught(event.reason)) return;\n this.telemetry.log(\"app.crash\", buildErrorAttributes(\"unhandled_rejection\", event.reason, {\n fallbackMessage: \"Unhandled Promise Rejection\",\n }));\n };\n\n if (consoleEnabled) captureConsole(this.telemetry);\n\n resolve();\n } catch (error) {\n reject(error);\n }\n });\n }\n}\n"],"names":["CrashHandler","telemetry","options","consoleEnabled","resolve","reject","msg","_url","_line","_col","error","isBoundaryCaught","source","buildErrorAttributes","event","captureConsole"],"mappings":"wHAKO,MAAMA,CAAa,CACtB,YAAoBC,EAAsB,CAAtB,KAAA,UAAAA,CAAwB,CAI5C,OAAOC,EAA+B,GAAmB,CACrD,KAAM,CAAE,eAAgBC,EAAiB,EAAA,EAAUD,EACnD,OAAO,IAAI,QAAQ,CAACE,EAASC,IAAW,CACpC,GAAI,CACA,OAAO,QAAU,CAACC,EAAKC,EAAMC,EAAOC,EAAMC,IAAU,CAEhD,GAAIC,EAAAA,iBAAiBD,CAAK,EAAG,OAI7B,MAAME,EAASF,EAAQ,iBAAmB,eAE1C,KAAK,UAAU,IAAI,YAAaG,EAAAA,qBAAqBD,EAAQF,EAAO,CAAE,gBAAiBJ,CAAA,CAAK,CAAC,CACjG,EAEA,OAAO,qBAAwBQ,GAAU,CACjCH,EAAAA,iBAAiBG,EAAM,MAAM,GACjC,KAAK,UAAU,IAAI,YAAaD,EAAAA,qBAAqB,sBAAuBC,EAAM,OAAQ,CACtF,gBAAiB,6BAAA,CACpB,CAAC,CACN,EAEIX,GAAgBY,EAAAA,eAAe,KAAK,SAAS,EAEjDX,EAAA,CACJ,OAASM,EAAO,CACZL,EAAOK,CAAK,CAChB,CACJ,CAAC,CACL,CACJ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { i as t, b as a, c as i } from "./react-urNtDGTL.js";
|
|
2
|
+
class b {
|
|
3
|
+
constructor(r) {
|
|
4
|
+
this.telemetry = r;
|
|
5
|
+
}
|
|
6
|
+
// Lockstep with native: JS errors and unhandled rejections become `app.crash`;
|
|
7
|
+
// console.error becomes `app.error` and console.warn a breadcrumb, both opt-in. §4.7, #100
|
|
8
|
+
attach(r = {}) {
|
|
9
|
+
const { captureConsole: s = !1 } = r;
|
|
10
|
+
return new Promise((n, l) => {
|
|
11
|
+
try {
|
|
12
|
+
window.onerror = (e, u, d, m, o) => {
|
|
13
|
+
if (t(o)) return;
|
|
14
|
+
const c = o ? "global_handler" : "cross_origin";
|
|
15
|
+
this.telemetry.log("app.crash", a(c, o, { fallbackMessage: e }));
|
|
16
|
+
}, window.onunhandledrejection = (e) => {
|
|
17
|
+
t(e.reason) || this.telemetry.log("app.crash", a("unhandled_rejection", e.reason, {
|
|
18
|
+
fallbackMessage: "Unhandled Promise Rejection"
|
|
19
|
+
}));
|
|
20
|
+
}, s && i(this.telemetry), n();
|
|
21
|
+
} catch (e) {
|
|
22
|
+
l(e);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
b as CrashHandler
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=crashHandler.web-BUlSXYoS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crashHandler.web-BUlSXYoS.js","sources":["../src/adapters/web/crashHandler.web.ts"],"sourcesContent":["import { Telemetry } from \"../../core/telemetry\";\nimport { buildErrorAttributes, captureConsole, isBoundaryCaught } from \"../crashCapture\";\n\nexport type CrashHandlerOptions = { captureConsole?: boolean };\n\nexport class CrashHandler {\n constructor(private telemetry: Telemetry) { }\n\n // Lockstep with native: JS errors and unhandled rejections become `app.crash`;\n // console.error becomes `app.error` and console.warn a breadcrumb, both opt-in. §4.7, #100\n attach(options: CrashHandlerOptions = {}): Promise<void> {\n const { captureConsole: consoleEnabled = false } = options;\n return new Promise((resolve, reject) => {\n try {\n window.onerror = (msg, _url, _line, _col, error) => {\n // React's dev build rethrows a boundary-caught error here; it is already a row (#166).\n if (isBoundaryCaught(error)) return;\n // ⚠ `error === undefined` is the cross-origin instrumentation gap, not a\n // mystery Error: a bundle served from a CDN without CORS headers yields the\n // classic \"Script error.\" with no stack. Naming it beats collapsing it.\n const source = error ? \"global_handler\" : \"cross_origin\";\n // No `fatal` on web — nothing here is fatal, the page keeps running (§4.7).\n this.telemetry.log(\"app.crash\", buildErrorAttributes(source, error, { fallbackMessage: msg }));\n };\n\n window.onunhandledrejection = (event) => {\n if (isBoundaryCaught(event.reason)) return;\n this.telemetry.log(\"app.crash\", buildErrorAttributes(\"unhandled_rejection\", event.reason, {\n fallbackMessage: \"Unhandled Promise Rejection\",\n }));\n };\n\n if (consoleEnabled) captureConsole(this.telemetry);\n\n resolve();\n } catch (error) {\n reject(error);\n }\n });\n }\n}\n"],"names":["CrashHandler","telemetry","options","consoleEnabled","resolve","reject","msg","_url","_line","_col","error","isBoundaryCaught","source","buildErrorAttributes","event","captureConsole"],"mappings":";AAKO,MAAMA,EAAa;AAAA,EACtB,YAAoBC,GAAsB;AAAtB,SAAA,YAAAA;AAAA,EAAwB;AAAA;AAAA;AAAA,EAI5C,OAAOC,IAA+B,IAAmB;AACrD,UAAM,EAAE,gBAAgBC,IAAiB,GAAA,IAAUD;AACnD,WAAO,IAAI,QAAQ,CAACE,GAASC,MAAW;AACpC,UAAI;AACA,eAAO,UAAU,CAACC,GAAKC,GAAMC,GAAOC,GAAMC,MAAU;AAEhD,cAAIC,EAAiBD,CAAK,EAAG;AAI7B,gBAAME,IAASF,IAAQ,mBAAmB;AAE1C,eAAK,UAAU,IAAI,aAAaG,EAAqBD,GAAQF,GAAO,EAAE,iBAAiBJ,EAAA,CAAK,CAAC;AAAA,QACjG,GAEA,OAAO,uBAAuB,CAACQ,MAAU;AACrC,UAAIH,EAAiBG,EAAM,MAAM,KACjC,KAAK,UAAU,IAAI,aAAaD,EAAqB,uBAAuBC,EAAM,QAAQ;AAAA,YACtF,iBAAiB;AAAA,UAAA,CACpB,CAAC;AAAA,QACN,GAEIX,KAAgBY,EAAe,KAAK,SAAS,GAEjDX,EAAA;AAAA,MACJ,SAASM,GAAO;AACZ,QAAAL,EAAOK,CAAK;AAAA,MAChB;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./react-bqe7KPOf.cjs");class d{constructor(n){this.telemetry=n}attach(n={}){const{captureConsole:o=!1}=n;return new Promise((s,i)=>{try{if(typeof ErrorUtils<"u"&&ErrorUtils.setGlobalHandler){const e=ErrorUtils.getGlobalHandler?.();ErrorUtils.setGlobalHandler((a,l)=>{t.isBoundaryCaught(a)||this.telemetry.log("app.crash",t.buildErrorAttributes("global_handler",a,{fatal:!!l})),e&&e(a,l)})}const r=e=>{t.isBoundaryCaught(e?.reason)||this.telemetry.log("app.crash",t.buildErrorAttributes("unhandled_rejection",e?.reason,{fallbackMessage:"Unhandled Promise Rejection",fatal:!1}))};globalThis.addEventListener?globalThis.addEventListener("unhandledrejection",r):require("promise/setimmediate/rejection-tracking").enable({allRejections:!0,onUnhandled:(a,l)=>r({reason:l})}),o&&t.captureConsole(this.telemetry),s()}catch(r){i(r)}})}}exports.CrashHandlerNative=d;
|
|
2
|
+
//# sourceMappingURL=crashHandlerNative.native-CFVQ5UcO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crashHandlerNative.native-CFVQ5UcO.cjs","sources":["../src/adapters/native/crashHandlerNative.native.ts"],"sourcesContent":["import { Telemetry } from \"../../core/telemetry\";\nimport { buildErrorAttributes, captureConsole, isBoundaryCaught } from \"../crashCapture\";\n\nexport type CrashHandlerOptions = { captureConsole?: boolean };\n\nexport class CrashHandlerNative {\n constructor(private telemetry: Telemetry) { }\n\n // JS errors and unhandled rejections become `app.crash`; console.error becomes\n // `app.error` and console.warn a breadcrumb, both opt-in (default off). §4.7, #100\n attach(options: CrashHandlerOptions = {}): Promise<void> {\n const { captureConsole: consoleEnabled = false } = options;\n return new Promise((resolve, reject) => {\n try {\n if (typeof ErrorUtils !== \"undefined\" && ErrorUtils.setGlobalHandler) {\n const defaultHandler = ErrorUtils.getGlobalHandler?.();\n ErrorUtils.setGlobalHandler((error: any, isFatal?: boolean) => {\n // `error.fatal` is native-only — the web build never passes it (§4.7).\n // A boundary-caught error is already a row (#166); RN's handler still runs.\n if (!isBoundaryCaught(error)) this.telemetry.log(\"app.crash\", buildErrorAttributes(\"global_handler\", error, {\n fatal: !!isFatal,\n }));\n if (defaultHandler) defaultHandler(error, isFatal); // keep RN red screen in dev\n });\n }\n\n const onRejection = (event: any) => {\n if (isBoundaryCaught(event?.reason)) return;\n this.telemetry.log(\"app.crash\", buildErrorAttributes(\"unhandled_rejection\", event?.reason, {\n fallbackMessage: \"Unhandled Promise Rejection\",\n fatal: false,\n }));\n };\n\n if (globalThis.addEventListener) {\n globalThis.addEventListener(\"unhandledrejection\", onRejection);\n } else {\n const tracking = require(\"promise/setimmediate/rejection-tracking\");\n tracking.enable({\n allRejections: true,\n onUnhandled: (_id: any, error: any) =>\n onRejection({ reason: error }),\n });\n }\n\n if (consoleEnabled) captureConsole(this.telemetry);\n\n resolve();\n } catch (error) {\n reject(error);\n }\n });\n }\n}\n"],"names":["CrashHandlerNative","telemetry","options","consoleEnabled","resolve","reject","defaultHandler","error","isFatal","isBoundaryCaught","buildErrorAttributes","onRejection","event","_id","captureConsole"],"mappings":"wHAKO,MAAMA,CAAmB,CAC5B,YAAoBC,EAAsB,CAAtB,KAAA,UAAAA,CAAwB,CAI5C,OAAOC,EAA+B,GAAmB,CACrD,KAAM,CAAE,eAAgBC,EAAiB,EAAA,EAAUD,EACnD,OAAO,IAAI,QAAQ,CAACE,EAASC,IAAW,CACpC,GAAI,CACA,GAAI,OAAO,WAAe,KAAe,WAAW,iBAAkB,CAClE,MAAMC,EAAiB,WAAW,mBAAA,EAClC,WAAW,iBAAiB,CAACC,EAAYC,IAAsB,CAGtDC,EAAAA,iBAAiBF,CAAK,GAAG,KAAK,UAAU,IAAI,YAAaG,EAAAA,qBAAqB,iBAAkBH,EAAO,CACxG,MAAO,CAAC,CAACC,CAAA,CACZ,CAAC,EACEF,GAAgBA,EAAeC,EAAOC,CAAO,CACrD,CAAC,CACL,CAEA,MAAMG,EAAeC,GAAe,CAC5BH,EAAAA,iBAAiBG,GAAO,MAAM,GAClC,KAAK,UAAU,IAAI,YAAaF,EAAAA,qBAAqB,sBAAuBE,GAAO,OAAQ,CACvF,gBAAiB,8BACjB,MAAO,EAAA,CACV,CAAC,CACN,EAEI,WAAW,iBACX,WAAW,iBAAiB,qBAAsBD,CAAW,EAE5C,QAAQ,yCAAyC,EACzD,OAAO,CACZ,cAAe,GACf,YAAa,CAACE,EAAUN,IACpBI,EAAY,CAAE,OAAQJ,EAAO,CAAA,CACpC,EAGDJ,GAAgBW,EAAAA,eAAe,KAAK,SAAS,EAEjDV,EAAA,CACJ,OAASG,EAAO,CACZF,EAAOE,CAAK,CAChB,CACJ,CAAC,CACL,CACJ"}
|