@nathanclaire/edge-telemetry-sdk 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/README.md +831 -186
  2. package/dist/appLifecycle-CECgRVu_.cjs +2 -0
  3. package/dist/appLifecycle-CECgRVu_.cjs.map +1 -0
  4. package/dist/appLifecycle-DQErzJIR.js +22 -0
  5. package/dist/appLifecycle-DQErzJIR.js.map +1 -0
  6. package/dist/batch-CwoO7noL.js +56 -0
  7. package/dist/batch-CwoO7noL.js.map +1 -0
  8. package/dist/batch-DNu8Xr9T.cjs +2 -0
  9. package/dist/batch-DNu8Xr9T.cjs.map +1 -0
  10. package/dist/crashCapture-BOJ8nSAZ.cjs +4 -0
  11. package/dist/crashCapture-BOJ8nSAZ.cjs.map +1 -0
  12. package/dist/crashCapture-BW8WuyaU.js +70 -0
  13. package/dist/crashCapture-BW8WuyaU.js.map +1 -0
  14. package/dist/crashHandler.web-8F_k2veo.js +29 -0
  15. package/dist/crashHandler.web-8F_k2veo.js.map +1 -0
  16. package/dist/crashHandler.web-CWmF56mJ.cjs +2 -0
  17. package/dist/crashHandler.web-CWmF56mJ.cjs.map +1 -0
  18. package/dist/crashHandlerNative.native-C2kSikDt.cjs +2 -0
  19. package/dist/crashHandlerNative.native-C2kSikDt.cjs.map +1 -0
  20. package/dist/crashHandlerNative.native-FupMnr1U.js +39 -0
  21. package/dist/crashHandlerNative.native-FupMnr1U.js.map +1 -0
  22. package/dist/deviceInfo.native-BJ-3Jj1T.js +53 -0
  23. package/dist/deviceInfo.native-BJ-3Jj1T.js.map +1 -0
  24. package/dist/deviceInfo.native-BoeTZcD6.cjs +2 -0
  25. package/dist/deviceInfo.native-BoeTZcD6.cjs.map +1 -0
  26. package/dist/deviceInfo.web-3L3IDQQA.cjs +2 -0
  27. package/dist/deviceInfo.web-3L3IDQQA.cjs.map +1 -0
  28. package/dist/deviceInfo.web-BFB1-pcA.js +41 -0
  29. package/dist/deviceInfo.web-BFB1-pcA.js.map +1 -0
  30. package/dist/frameTracker-CHG6sIx9.cjs +2 -0
  31. package/dist/frameTracker-CHG6sIx9.cjs.map +1 -0
  32. package/dist/frameTracker-DdB8W_kC.js +54 -0
  33. package/dist/frameTracker-DdB8W_kC.js.map +1 -0
  34. package/dist/httpAttributes-BrrtM8zh.js +70 -0
  35. package/dist/httpAttributes-BrrtM8zh.js.map +1 -0
  36. package/dist/httpAttributes-D0m6UID7.cjs +2 -0
  37. package/dist/httpAttributes-D0m6UID7.cjs.map +1 -0
  38. package/dist/index-BtLlV1HA.js +57 -0
  39. package/dist/index-BtLlV1HA.js.map +1 -0
  40. package/dist/{deviceInfo.native-D2k0LDhI.js → index-C2XQ-EYw.js} +362 -411
  41. package/dist/index-C2XQ-EYw.js.map +1 -0
  42. package/dist/index-CXsVZY35.cjs +2 -0
  43. package/dist/index-CXsVZY35.cjs.map +1 -0
  44. package/dist/index-DLquF88M.cjs +2 -0
  45. package/dist/index-DLquF88M.cjs.map +1 -0
  46. package/dist/index.native.cjs +1 -1
  47. package/dist/index.native.cjs.map +1 -1
  48. package/dist/index.native.js +94 -59
  49. package/dist/index.native.js.map +1 -1
  50. package/dist/index.web.cjs +1 -1
  51. package/dist/index.web.cjs.map +1 -1
  52. package/dist/index.web.js +88 -33
  53. package/dist/index.web.js.map +1 -1
  54. package/dist/interactionWeb.web-Bl_cZlgh.cjs +2 -0
  55. package/dist/interactionWeb.web-Bl_cZlgh.cjs.map +1 -0
  56. package/dist/interactionWeb.web-CJAviVQ7.js +109 -0
  57. package/dist/interactionWeb.web-CJAviVQ7.js.map +1 -0
  58. package/dist/interceptFetchWeb.web-T88kO-bE.cjs +2 -0
  59. package/dist/interceptFetchWeb.web-T88kO-bE.cjs.map +1 -0
  60. package/dist/interceptFetchWeb.web-UXC2Lb6X.js +61 -0
  61. package/dist/interceptFetchWeb.web-UXC2Lb6X.js.map +1 -0
  62. package/dist/interceptHttpNative.native-BVpFuoNB.cjs +2 -0
  63. package/dist/interceptHttpNative.native-BVpFuoNB.cjs.map +1 -0
  64. package/dist/interceptHttpNative.native-rX-lPNST.js +18 -0
  65. package/dist/interceptHttpNative.native-rX-lPNST.js.map +1 -0
  66. package/dist/loadingTime-Bhomd9qq.cjs +2 -0
  67. package/dist/loadingTime-Bhomd9qq.cjs.map +1 -0
  68. package/dist/loadingTime-ZkYvFijA.js +70 -0
  69. package/dist/loadingTime-ZkYvFijA.js.map +1 -0
  70. package/dist/memoryNative.native-C42h9SjK.js +54 -0
  71. package/dist/memoryNative.native-C42h9SjK.js.map +1 -0
  72. package/dist/memoryNative.native-CA-7w9w1.cjs +2 -0
  73. package/dist/memoryNative.native-CA-7w9w1.cjs.map +1 -0
  74. package/dist/memoryStore-BIGZmmfD.cjs +2 -0
  75. package/dist/memoryStore-BIGZmmfD.cjs.map +1 -0
  76. package/dist/memoryStore-F5I-GQKM.js +193 -0
  77. package/dist/memoryStore-F5I-GQKM.js.map +1 -0
  78. package/dist/nativeSender-CfQaRuDK.cjs +2 -0
  79. package/dist/nativeSender-CfQaRuDK.cjs.map +1 -0
  80. package/dist/nativeSender-pgVSIv-X.js +59 -0
  81. package/dist/nativeSender-pgVSIv-X.js.map +1 -0
  82. package/dist/navigationRef-BzYbs8cm.js +28 -0
  83. package/dist/navigationRef-BzYbs8cm.js.map +1 -0
  84. package/dist/navigationRef-C-_qhb43.cjs +2 -0
  85. package/dist/navigationRef-C-_qhb43.cjs.map +1 -0
  86. package/dist/{navigationTracker-Cts68dgG.js → navigationTracker-BmywA_Bg.js} +4 -4
  87. package/dist/navigationTracker-BmywA_Bg.js.map +1 -0
  88. package/dist/navigationTracker-HkwVyywz.cjs +2 -0
  89. package/dist/navigationTracker-HkwVyywz.cjs.map +1 -0
  90. package/dist/navigationWeb.web-CW_z7Ca4.cjs +2 -0
  91. package/dist/navigationWeb.web-CW_z7Ca4.cjs.map +1 -0
  92. package/dist/navigationWeb.web-CcwgKuIZ.js +55 -0
  93. package/dist/navigationWeb.web-CcwgKuIZ.js.map +1 -0
  94. package/dist/{networkInfo.native-BK5fpAOL.js → networkInfo.native-CGrx9cnH.js} +15 -15
  95. package/dist/{networkInfo.native-BK5fpAOL.js.map → networkInfo.native-CGrx9cnH.js.map} +1 -1
  96. package/dist/{networkInfo.native-cxuw93Uy.cjs → networkInfo.native-YVySdv3S.cjs} +2 -2
  97. package/dist/{networkInfo.native-cxuw93Uy.cjs.map → networkInfo.native-YVySdv3S.cjs.map} +1 -1
  98. package/dist/{networkInfo.web-twcNn_hc.js → networkInfo.web-B2YlLNsI.js} +3 -3
  99. package/dist/networkInfo.web-B2YlLNsI.js.map +1 -0
  100. package/dist/networkInfo.web-PltJTHsy.cjs +2 -0
  101. package/dist/networkInfo.web-PltJTHsy.cjs.map +1 -0
  102. package/dist/runtimeReady.native-Bh7EcYmK.js +14 -0
  103. package/dist/runtimeReady.native-Bh7EcYmK.js.map +1 -0
  104. package/dist/runtimeReady.native-jUmuE1lV.cjs +2 -0
  105. package/dist/runtimeReady.native-jUmuE1lV.cjs.map +1 -0
  106. package/dist/runtimeReady.web-C8fdIbVR.js +25 -0
  107. package/dist/runtimeReady.web-C8fdIbVR.js.map +1 -0
  108. package/dist/runtimeReady.web-DHW682RN.cjs +2 -0
  109. package/dist/runtimeReady.web-DHW682RN.cjs.map +1 -0
  110. package/dist/seedRuntimeReady-BKwkBEAF.cjs +2 -0
  111. package/dist/seedRuntimeReady-BKwkBEAF.cjs.map +1 -0
  112. package/dist/seedRuntimeReady-Cz8nOKoo.js +10 -0
  113. package/dist/seedRuntimeReady-Cz8nOKoo.js.map +1 -0
  114. package/dist/src/adapters/appLifecycle.d.ts +8 -1
  115. package/dist/src/adapters/batch.d.ts +2 -0
  116. package/dist/src/adapters/crashCapture.d.ts +38 -9
  117. package/dist/src/adapters/failedEvents.d.ts +43 -0
  118. package/dist/src/adapters/frameAggregate.d.ts +8 -3
  119. package/dist/src/adapters/frameTracker.d.ts +30 -0
  120. package/dist/src/adapters/httpAttributes.d.ts +18 -0
  121. package/dist/src/adapters/loadingTime.d.ts +67 -0
  122. package/dist/src/adapters/native/interceptHttpNative.native.d.ts +18 -0
  123. package/dist/src/adapters/native/memoryNative.native.d.ts +15 -11
  124. package/dist/src/adapters/native/runtimeReady.native.d.ts +1 -0
  125. package/dist/src/adapters/native/store.native.d.ts +10 -0
  126. package/dist/src/adapters/nativeSender.d.ts +2 -2
  127. package/dist/src/adapters/navigationRef.d.ts +21 -0
  128. package/dist/src/adapters/navigationTracker.d.ts +1 -1
  129. package/dist/src/adapters/screenTiming.d.ts +8 -2
  130. package/dist/src/adapters/seedRuntimeReady.d.ts +8 -0
  131. package/dist/src/adapters/traceHeader.d.ts +33 -0
  132. package/dist/src/adapters/traceManager.d.ts +131 -0
  133. package/dist/src/adapters/uiInteraction.d.ts +111 -0
  134. package/dist/src/adapters/viewManager.d.ts +161 -0
  135. package/dist/src/adapters/viewport.d.ts +15 -0
  136. package/dist/src/adapters/web/interactionWeb.web.d.ts +36 -0
  137. package/dist/src/adapters/web/interceptFetchWeb.web.d.ts +3 -11
  138. package/dist/src/adapters/web/navigationWeb.web.d.ts +10 -0
  139. package/dist/src/adapters/web/runtimeReady.web.d.ts +5 -0
  140. package/dist/src/adapters/web/store.web.d.ts +12 -0
  141. package/dist/src/adapters/web/webVitals.web.d.ts +49 -0
  142. package/dist/src/adapters/webSender.d.ts +2 -2
  143. package/dist/src/adapters/webVitals.d.ts +25 -0
  144. package/dist/src/adapters/xhrIntercept.d.ts +53 -0
  145. package/dist/src/core/beforeSend.d.ts +20 -0
  146. package/dist/src/core/debug.d.ts +7 -0
  147. package/dist/src/core/memoryStore.d.ts +23 -0
  148. package/dist/src/core/store.d.ts +41 -0
  149. package/dist/src/core/telemetry.d.ts +305 -35
  150. package/dist/src/core/userProfile.d.ts +12 -0
  151. package/dist/src/core/utils/json.d.ts +7 -0
  152. package/dist/src/core/utils/uuid.d.ts +10 -1
  153. package/dist/src/createTelemetry.native.d.ts +7 -0
  154. package/dist/src/createTelemetry.web.d.ts +7 -0
  155. package/dist/src/index.base.d.ts +17 -1
  156. package/dist/src/index.native.d.ts +46 -9
  157. package/dist/src/index.web.d.ts +33 -2
  158. package/dist/store.native-BYBJcy6o.js +32 -0
  159. package/dist/store.native-BYBJcy6o.js.map +1 -0
  160. package/dist/store.native-TPqXngmF.cjs +2 -0
  161. package/dist/store.native-TPqXngmF.cjs.map +1 -0
  162. package/dist/store.web-CvqqN-_Z.cjs +2 -0
  163. package/dist/store.web-CvqqN-_Z.cjs.map +1 -0
  164. package/dist/store.web-DJAlN0nc.js +31 -0
  165. package/dist/store.web-DJAlN0nc.js.map +1 -0
  166. package/dist/telemetry-ByDJIz_9.js +1280 -0
  167. package/dist/telemetry-ByDJIz_9.js.map +1 -0
  168. package/dist/telemetry-CrU7i1Jc.cjs +2 -0
  169. package/dist/telemetry-CrU7i1Jc.cjs.map +1 -0
  170. package/dist/uiInteraction-CdzvEI1p.cjs +2 -0
  171. package/dist/uiInteraction-CdzvEI1p.cjs.map +1 -0
  172. package/dist/uiInteraction-DAqxxz0q.js +104 -0
  173. package/dist/uiInteraction-DAqxxz0q.js.map +1 -0
  174. package/dist/viewport-Dd85GUNO.cjs +2 -0
  175. package/dist/viewport-Dd85GUNO.cjs.map +1 -0
  176. package/dist/viewport-Dzmt5QwK.js +15 -0
  177. package/dist/viewport-Dzmt5QwK.js.map +1 -0
  178. package/dist/web-vitals.attribution-CVCPiX-h.cjs +2 -0
  179. package/dist/web-vitals.attribution-CVCPiX-h.cjs.map +1 -0
  180. package/dist/web-vitals.attribution-xw9N5MKQ.js +488 -0
  181. package/dist/web-vitals.attribution-xw9N5MKQ.js.map +1 -0
  182. package/dist/webSender-BIwslfpT.js +63 -0
  183. package/dist/webSender-BIwslfpT.js.map +1 -0
  184. package/dist/webSender-CVtE4sOF.cjs +2 -0
  185. package/dist/webSender-CVtE4sOF.cjs.map +1 -0
  186. package/dist/webVitals.web-CNIpsKlA.js +85 -0
  187. package/dist/webVitals.web-CNIpsKlA.js.map +1 -0
  188. package/dist/webVitals.web-DpWJ-iYp.cjs +2 -0
  189. package/dist/webVitals.web-DpWJ-iYp.cjs.map +1 -0
  190. package/dist/xhrIntercept-BADex6Cq.cjs +2 -0
  191. package/dist/xhrIntercept-BADex6Cq.cjs.map +1 -0
  192. package/dist/xhrIntercept-BNiA41Mj.js +53 -0
  193. package/dist/xhrIntercept-BNiA41Mj.js.map +1 -0
  194. package/docs/migration-v4.md +190 -0
  195. package/package.json +12 -4
  196. package/dist/appLifecycle-Cynw0kAv.js +0 -14
  197. package/dist/appLifecycle-Cynw0kAv.js.map +0 -1
  198. package/dist/appLifecycle-DvJIt7ym.cjs +0 -2
  199. package/dist/appLifecycle-DvJIt7ym.cjs.map +0 -1
  200. package/dist/batch-CLBFgYPC.cjs +0 -2
  201. package/dist/batch-CLBFgYPC.cjs.map +0 -1
  202. package/dist/batch-DLG_gtOm.js +0 -12
  203. package/dist/batch-DLG_gtOm.js.map +0 -1
  204. package/dist/crashCapture-BYTM4FLC.cjs +0 -2
  205. package/dist/crashCapture-BYTM4FLC.cjs.map +0 -1
  206. package/dist/crashCapture-D_rkkBVa.js +0 -31
  207. package/dist/crashCapture-D_rkkBVa.js.map +0 -1
  208. package/dist/crashHandler.web-BSxDpFTo.cjs +0 -2
  209. package/dist/crashHandler.web-BSxDpFTo.cjs.map +0 -1
  210. package/dist/crashHandler.web-D59bmhg9.js +0 -32
  211. package/dist/crashHandler.web-D59bmhg9.js.map +0 -1
  212. package/dist/crashHandlerNative.native-DeAFze4E.cjs +0 -2
  213. package/dist/crashHandlerNative.native-DeAFze4E.cjs.map +0 -1
  214. package/dist/crashHandlerNative.native-d7qJkzA6.js +0 -41
  215. package/dist/crashHandlerNative.native-d7qJkzA6.js.map +0 -1
  216. package/dist/debug-DsvQ9y3W.js +0 -68
  217. package/dist/debug-DsvQ9y3W.js.map +0 -1
  218. package/dist/debug-rnOOxFpN.cjs +0 -2
  219. package/dist/debug-rnOOxFpN.cjs.map +0 -1
  220. package/dist/deviceInfo.native-7hbRYixR.cjs +0 -2
  221. package/dist/deviceInfo.native-7hbRYixR.cjs.map +0 -1
  222. package/dist/deviceInfo.native-D2k0LDhI.js.map +0 -1
  223. package/dist/deviceInfo.web-ByNAlEJh.cjs +0 -2
  224. package/dist/deviceInfo.web-ByNAlEJh.cjs.map +0 -1
  225. package/dist/deviceInfo.web-DzQyEku6.js +0 -40
  226. package/dist/deviceInfo.web-DzQyEku6.js.map +0 -1
  227. package/dist/frameAggregate-C_HoVFcK.cjs +0 -2
  228. package/dist/frameAggregate-C_HoVFcK.cjs.map +0 -1
  229. package/dist/frameAggregate-Cwh1juw1.js +0 -17
  230. package/dist/frameAggregate-Cwh1juw1.js.map +0 -1
  231. package/dist/frameDropsNative.native-CP7zrXDf.js +0 -23
  232. package/dist/frameDropsNative.native-CP7zrXDf.js.map +0 -1
  233. package/dist/frameDropsNative.native-DKqEDqip.cjs +0 -2
  234. package/dist/frameDropsNative.native-DKqEDqip.cjs.map +0 -1
  235. package/dist/frameDropsWeb.web-C9Lt3Fuj.js +0 -22
  236. package/dist/frameDropsWeb.web-C9Lt3Fuj.js.map +0 -1
  237. package/dist/frameDropsWeb.web-azpwQCUz.cjs +0 -2
  238. package/dist/frameDropsWeb.web-azpwQCUz.cjs.map +0 -1
  239. package/dist/httpAttributes-BV50UKQU.js +0 -19
  240. package/dist/httpAttributes-BV50UKQU.js.map +0 -1
  241. package/dist/httpAttributes-xXOD9trQ.cjs +0 -2
  242. package/dist/httpAttributes-xXOD9trQ.cjs.map +0 -1
  243. package/dist/interaction-CH8yoY5-.js +0 -23
  244. package/dist/interaction-CH8yoY5-.js.map +0 -1
  245. package/dist/interaction-DcNFBW7a.cjs +0 -2
  246. package/dist/interaction-DcNFBW7a.cjs.map +0 -1
  247. package/dist/interceptFetchNative.native-VlhtMG-U.js +0 -49
  248. package/dist/interceptFetchNative.native-VlhtMG-U.js.map +0 -1
  249. package/dist/interceptFetchNative.native-jEAldH14.cjs +0 -2
  250. package/dist/interceptFetchNative.native-jEAldH14.cjs.map +0 -1
  251. package/dist/interceptFetchWeb.web-DFzZliik.cjs +0 -2
  252. package/dist/interceptFetchWeb.web-DFzZliik.cjs.map +0 -1
  253. package/dist/interceptFetchWeb.web-DfsMfoRP.js +0 -77
  254. package/dist/interceptFetchWeb.web-DfsMfoRP.js.map +0 -1
  255. package/dist/memoryNative.native-BWLh2S9L.js +0 -48
  256. package/dist/memoryNative.native-BWLh2S9L.js.map +0 -1
  257. package/dist/memoryNative.native-DCXSOd4Q.cjs +0 -2
  258. package/dist/memoryNative.native-DCXSOd4Q.cjs.map +0 -1
  259. package/dist/memoryWeb.web-B3YuV-cB.js +0 -48
  260. package/dist/memoryWeb.web-B3YuV-cB.js.map +0 -1
  261. package/dist/memoryWeb.web-CheXAcJn.cjs +0 -2
  262. package/dist/memoryWeb.web-CheXAcJn.cjs.map +0 -1
  263. package/dist/nativeSender-BE_mzw_S.js +0 -70
  264. package/dist/nativeSender-BE_mzw_S.js.map +0 -1
  265. package/dist/nativeSender-DyAUGY7c.cjs +0 -2
  266. package/dist/nativeSender-DyAUGY7c.cjs.map +0 -1
  267. package/dist/navigationNative.native-3tO5JxSd.cjs +0 -2
  268. package/dist/navigationNative.native-3tO5JxSd.cjs.map +0 -1
  269. package/dist/navigationNative.native-BUCGPQX2.js +0 -25
  270. package/dist/navigationNative.native-BUCGPQX2.js.map +0 -1
  271. package/dist/navigationTracker-B2GMwyKk.cjs +0 -2
  272. package/dist/navigationTracker-B2GMwyKk.cjs.map +0 -1
  273. package/dist/navigationTracker-Cts68dgG.js.map +0 -1
  274. package/dist/navigationWeb.web-B0necr5j.cjs +0 -2
  275. package/dist/navigationWeb.web-B0necr5j.cjs.map +0 -1
  276. package/dist/navigationWeb.web-CORzE_Id.js +0 -46
  277. package/dist/navigationWeb.web-CORzE_Id.js.map +0 -1
  278. package/dist/networkInfo.web-DJmw1sNK.cjs +0 -2
  279. package/dist/networkInfo.web-DJmw1sNK.cjs.map +0 -1
  280. package/dist/networkInfo.web-twcNn_hc.js.map +0 -1
  281. package/dist/src/adapters/interaction.d.ts +0 -17
  282. package/dist/src/adapters/native/frameDropsNative.native.d.ts +0 -16
  283. package/dist/src/adapters/native/interceptFetchNative.native.d.ts +0 -23
  284. package/dist/src/adapters/native/navigationNative.native.d.ts +0 -12
  285. package/dist/src/adapters/web/frameDropsWeb.web.d.ts +0 -16
  286. package/dist/src/adapters/web/memoryWeb.web.d.ts +0 -26
  287. package/dist/telemetry-Co4MYdwa.cjs +0 -2
  288. package/dist/telemetry-Co4MYdwa.cjs.map +0 -1
  289. package/dist/telemetry-KI0x4gzC.js +0 -389
  290. package/dist/telemetry-KI0x4gzC.js.map +0 -1
  291. package/dist/v4-BysszJq8.js +0 -31
  292. package/dist/v4-BysszJq8.js.map +0 -1
  293. package/dist/v4-CqdK_b8Y.cjs +0 -2
  294. package/dist/v4-CqdK_b8Y.cjs.map +0 -1
  295. package/dist/webSender-B27tmT1w.js +0 -42
  296. package/dist/webSender-B27tmT1w.js.map +0 -1
  297. package/dist/webSender-BWi4x1df.cjs +0 -2
  298. package/dist/webSender-BWi4x1df.cjs.map +0 -1
@@ -0,0 +1,28 @@
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
@@ -0,0 +1 @@
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;"}
@@ -0,0 +1,2 @@
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
@@ -0,0 +1 @@
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,11 +1,11 @@
1
- class n {
1
+ class a {
2
2
  constructor(e) {
3
3
  this.telemetry = e;
4
4
  }
5
5
  // Route change → v3 `navigation`. Baseline keys follow the reference/Angular shape;
6
6
  // iOS (screen/previous_screen/type/kind) reconciliation is OPEN (see additions ledger).
7
7
  recordRouteChange(e, t) {
8
- this.telemetry.log("navigation", {
8
+ return this.telemetry.log("navigation", {
9
9
  "navigation.from_screen": e,
10
10
  "navigation.to_screen": t,
11
11
  "navigation.method": "push",
@@ -14,6 +14,6 @@ class n {
14
14
  }
15
15
  }
16
16
  export {
17
- n as N
17
+ a as N
18
18
  };
19
- //# sourceMappingURL=navigationTracker-Cts68dgG.js.map
19
+ //# sourceMappingURL=navigationTracker-BmywA_Bg.js.map
@@ -0,0 +1 @@
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;"}
@@ -0,0 +1,2 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,55 @@
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
@@ -0,0 +1 @@
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,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,EACrF;AACJ;"}
@@ -178,7 +178,7 @@ class z {
178
178
  signal: n.signal
179
179
  });
180
180
  let d;
181
- const c = new Promise((h, m) => {
181
+ const o = new Promise((h, m) => {
182
182
  d = setTimeout(() => m("timedout"), this._configuration.reachabilityRequestTimeout);
183
183
  });
184
184
  let b = () => {
@@ -187,7 +187,7 @@ class z {
187
187
  b = () => m("canceled");
188
188
  });
189
189
  return {
190
- promise: Promise.race([s, c, w]).then((h) => this._configuration.reachabilityTest(h)).then((h) => {
190
+ promise: Promise.race([s, o, w]).then((h) => this._configuration.reachabilityTest(h)).then((h) => {
191
191
  this._setIsInternetReachable(h);
192
192
  const m = this._isInternetReachable ? this._configuration.reachabilityLongTimeout : this._configuration.reachabilityShortTimeout;
193
193
  this._currentTimeoutHandle = setTimeout(this._checkInternetReachability, m);
@@ -207,16 +207,16 @@ class z {
207
207
  }), this._configuration = i, this._listener = e;
208
208
  }
209
209
  }
210
- function o(t, i, e) {
210
+ function c(t, i, e) {
211
211
  return i in t ? Object.defineProperty(t, i, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : t[i] = e, t;
212
212
  }
213
213
  class P {
214
214
  constructor(i) {
215
- o(this, "_nativeEventSubscription", null), o(this, "_subscriptions", /* @__PURE__ */ new Set()), o(this, "_latestState", null), o(this, "_internetReachability", void 0), o(this, "_handleNativeStateUpdate", (e) => {
215
+ c(this, "_nativeEventSubscription", null), c(this, "_subscriptions", /* @__PURE__ */ new Set()), c(this, "_latestState", null), c(this, "_internetReachability", void 0), c(this, "_handleNativeStateUpdate", (e) => {
216
216
  this._internetReachability.update(e);
217
217
  const n = this._convertState(e);
218
218
  this._latestState = n, this._subscriptions.forEach((s) => s(n));
219
- }), o(this, "_handleInternetReachabilityUpdate", (e) => {
219
+ }), c(this, "_handleInternetReachabilityUpdate", (e) => {
220
220
  if (!this._latestState)
221
221
  return;
222
222
  const n = {
@@ -224,19 +224,19 @@ class P {
224
224
  isInternetReachable: e
225
225
  };
226
226
  this._latestState = n, this._subscriptions.forEach((s) => s(n));
227
- }), o(this, "_fetchCurrentState", async (e) => {
227
+ }), c(this, "_fetchCurrentState", async (e) => {
228
228
  const n = await C.getCurrentState(e);
229
229
  this._internetReachability.update(n);
230
230
  const s = this._convertState(n);
231
231
  return e || (this._latestState = s, this._subscriptions.forEach((d) => d(s))), s;
232
- }), o(this, "_convertState", (e) => typeof e.isInternetReachable == "boolean" ? e : {
232
+ }), c(this, "_convertState", (e) => typeof e.isInternetReachable == "boolean" ? e : {
233
233
  ...e,
234
234
  isInternetReachable: this._internetReachability.currentState()
235
- }), o(this, "latest", (e) => e ? this._fetchCurrentState(e) : this._latestState ? Promise.resolve(this._latestState) : this._fetchCurrentState()), o(this, "add", (e) => {
235
+ }), c(this, "latest", (e) => e ? this._fetchCurrentState(e) : this._latestState ? Promise.resolve(this._latestState) : this._fetchCurrentState()), c(this, "add", (e) => {
236
236
  this._subscriptions.add(e), this._latestState ? e(this._latestState) : this.latest().then(e);
237
- }), o(this, "remove", (e) => {
237
+ }), c(this, "remove", (e) => {
238
238
  this._subscriptions.delete(e);
239
- }), o(this, "tearDown", () => {
239
+ }), c(this, "tearDown", () => {
240
240
  this._internetReachability && this._internetReachability.tearDown(), this._nativeEventSubscription && this._nativeEventSubscription.remove(), this._subscriptions.clear();
241
241
  }), this._internetReachability = new z(i, this._handleInternetReachabilityUpdate), this._nativeEventSubscription = C.eventEmitter.addListener(p, this._handleNativeStateUpdate), this._fetchCurrentState();
242
242
  }
@@ -294,14 +294,14 @@ function Y(t = !1, i) {
294
294
  }, w = new P(b);
295
295
  return n(w), w.add(d), w.tearDown;
296
296
  }, [t, i]);
297
- const c = U(() => {
297
+ const o = U(() => {
298
298
  e && !_ && (_ = !0, e._fetchCurrentState().finally(() => {
299
299
  _ = !1;
300
300
  }));
301
301
  }, [e]);
302
302
  return {
303
303
  netInfo: s,
304
- refresh: c
304
+ refresh: o
305
305
  };
306
306
  }
307
307
  const T = {
@@ -320,10 +320,10 @@ class X {
320
320
  const i = await T.fetch();
321
321
  return {
322
322
  type: i.type,
323
- isConnected: i.isConnected ?? void 0
323
+ is_connected: i.isConnected ?? void 0
324
324
  };
325
325
  } catch {
326
- return { type: "unknown", isConnected: void 0 };
326
+ return { type: "unknown", is_connected: void 0 };
327
327
  }
328
328
  }
329
329
  /**
@@ -340,4 +340,4 @@ class X {
340
340
  export {
341
341
  X as NetworkInfoTrackerNative
342
342
  };
343
- //# sourceMappingURL=networkInfo.native-BK5fpAOL.js.map
343
+ //# sourceMappingURL=networkInfo.native-CGrx9cnH.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"networkInfo.native-BK5fpAOL.js","sources":["../node_modules/@react-native-community/netinfo/lib/module/internal/defaultConfiguration.web.js","../node_modules/@react-native-community/netinfo/lib/module/internal/privateTypes.js","../node_modules/@react-native-community/netinfo/lib/module/internal/types.js","../node_modules/@react-native-community/netinfo/lib/module/internal/nativeModule.web.js","../node_modules/@react-native-community/netinfo/lib/module/internal/nativeInterface.web.js","../node_modules/@react-native-community/netinfo/lib/module/internal/internetReachability.js","../node_modules/@react-native-community/netinfo/lib/module/internal/state.js","../node_modules/@react-native-community/netinfo/lib/module/index.js","../src/adapters/native/networkInfo.native.ts"],"sourcesContent":["const DEFAULT_CONFIGURATION = {\n reachabilityUrl: '/',\n reachabilityMethod: \"HEAD\",\n reachabilityHeaders: {},\n reachabilityTest: response => Promise.resolve(response.status === 200),\n reachabilityShortTimeout: 5 * 1000,\n // 5s\n reachabilityLongTimeout: 60 * 1000,\n // 60s\n reachabilityRequestTimeout: 15 * 1000,\n // 15s\n reachabilityShouldRun: () => true,\n shouldFetchWiFiSSID: true,\n useNativeReachability: true\n};\nexport default DEFAULT_CONFIGURATION;\n//# sourceMappingURL=defaultConfiguration.web.js.map","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nexport const DEVICE_CONNECTIVITY_EVENT = 'netInfo.networkStatusDidChange'; // Certain properties are optional when sent by the native module and are handled by the JS code\n//# sourceMappingURL=privateTypes.js.map","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nexport let NetInfoStateType;\n\n(function (NetInfoStateType) {\n NetInfoStateType[\"unknown\"] = \"unknown\";\n NetInfoStateType[\"none\"] = \"none\";\n NetInfoStateType[\"cellular\"] = \"cellular\";\n NetInfoStateType[\"wifi\"] = \"wifi\";\n NetInfoStateType[\"bluetooth\"] = \"bluetooth\";\n NetInfoStateType[\"ethernet\"] = \"ethernet\";\n NetInfoStateType[\"wimax\"] = \"wimax\";\n NetInfoStateType[\"vpn\"] = \"vpn\";\n NetInfoStateType[\"other\"] = \"other\";\n})(NetInfoStateType || (NetInfoStateType = {}));\n\nexport let NetInfoCellularGeneration;\n\n(function (NetInfoCellularGeneration) {\n NetInfoCellularGeneration[\"2g\"] = \"2g\";\n NetInfoCellularGeneration[\"3g\"] = \"3g\";\n NetInfoCellularGeneration[\"4g\"] = \"4g\";\n NetInfoCellularGeneration[\"5g\"] = \"5g\";\n})(NetInfoCellularGeneration || (NetInfoCellularGeneration = {}));\n//# sourceMappingURL=types.js.map","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nimport { DEVICE_CONNECTIVITY_EVENT } from './privateTypes';\nimport { NetInfoCellularGeneration, NetInfoStateType } from './types'; // See https://wicg.github.io/netinfo/#dom-connectiontype\n\n// Use a constant test of this form because in SSR on next.js, optional chaining is not sufficient,\n// but this test correctly detects that window is not available and allows for conditionals before access\nconst isWindowPresent = typeof window !== 'undefined'; // Check if window exists and if the browser supports the connection API\n\nconst connection = isWindowPresent && !window.hasOwnProperty('tizen') && !window.hasOwnProperty('webOS') ? window.navigator.connection || window.navigator.mozConnection || window.navigator.webkitConnection : undefined; // Map browser types to native types\n\nconst typeMapping = {\n bluetooth: NetInfoStateType.bluetooth,\n cellular: NetInfoStateType.cellular,\n ethernet: NetInfoStateType.ethernet,\n none: NetInfoStateType.none,\n other: NetInfoStateType.other,\n unknown: NetInfoStateType.unknown,\n wifi: NetInfoStateType.wifi,\n wimax: NetInfoStateType.wimax,\n mixed: NetInfoStateType.other\n};\nconst effectiveTypeMapping = {\n '2g': NetInfoCellularGeneration['2g'],\n '3g': NetInfoCellularGeneration['3g'],\n '4g': NetInfoCellularGeneration['4g'],\n 'slow-2g': NetInfoCellularGeneration['2g']\n}; // Determine current state of connection\n\nconst getCurrentState = _requestedInterface => {\n const isConnected = isWindowPresent ? navigator.onLine : false;\n const baseState = {\n isInternetReachable: null\n }; // If we don't have a connection object, we return minimal information\n\n if (!connection) {\n if (isConnected) {\n const state = { ...baseState,\n isConnected: true,\n type: NetInfoStateType.other,\n details: {\n isConnectionExpensive: false\n }\n };\n return state;\n }\n\n const state = { ...baseState,\n isConnected: false,\n isInternetReachable: false,\n type: NetInfoStateType.none,\n details: null\n };\n return state;\n } // Otherwise try to return detailed information\n\n\n const isConnectionExpensive = connection.saveData;\n const type = connection.type ? typeMapping[connection.type] : isConnected ? NetInfoStateType.other : NetInfoStateType.unknown;\n\n if (type === NetInfoStateType.bluetooth) {\n const state = { ...baseState,\n isConnected: true,\n type,\n details: {\n isConnectionExpensive\n }\n };\n return state;\n } else if (type === NetInfoStateType.cellular) {\n const state = { ...baseState,\n isConnected: true,\n type,\n details: {\n isConnectionExpensive,\n cellularGeneration: effectiveTypeMapping[connection.effectiveType] || null,\n carrier: null\n }\n };\n return state;\n } else if (type === NetInfoStateType.ethernet) {\n const state = { ...baseState,\n isConnected: true,\n type,\n details: {\n isConnectionExpensive,\n ipAddress: null,\n subnet: null\n }\n };\n return state;\n } else if (type === NetInfoStateType.wifi) {\n const state = { ...baseState,\n isConnected: true,\n type,\n details: {\n isConnectionExpensive,\n ssid: null,\n bssid: null,\n strength: null,\n ipAddress: null,\n subnet: null,\n frequency: null,\n linkSpeed: null,\n rxLinkSpeed: null,\n txLinkSpeed: null\n }\n };\n return state;\n } else if (type === NetInfoStateType.wimax) {\n const state = { ...baseState,\n isConnected: true,\n type,\n details: {\n isConnectionExpensive\n }\n };\n return state;\n } else if (type === NetInfoStateType.none) {\n const state = { ...baseState,\n isConnected: false,\n isInternetReachable: false,\n type,\n details: null\n };\n return state;\n } else if (type === NetInfoStateType.unknown) {\n const state = { ...baseState,\n isConnected,\n isInternetReachable: null,\n type,\n details: null\n };\n return state;\n }\n\n const state = { ...baseState,\n isConnected: true,\n type: NetInfoStateType.other,\n details: {\n isConnectionExpensive\n }\n };\n return state;\n};\n\nconst handlers = [];\nconst nativeHandlers = [];\nconst RNCNetInfo = {\n addListener(type, handler) {\n switch (type) {\n case DEVICE_CONNECTIVITY_EVENT:\n {\n const nativeHandler = () => {\n handler(getCurrentState());\n };\n\n if (connection) {\n connection.addEventListener('change', nativeHandler);\n } else {\n if (isWindowPresent) {\n window.addEventListener('online', nativeHandler, false);\n window.addEventListener('offline', nativeHandler, false);\n }\n } // Remember handlers\n\n\n handlers.push(handler);\n nativeHandlers.push(nativeHandler);\n break;\n }\n }\n },\n\n removeListeners(type, handler) {\n switch (type) {\n case DEVICE_CONNECTIVITY_EVENT:\n {\n // Get native handler\n const index = handlers.indexOf(handler);\n const nativeHandler = nativeHandlers[index];\n\n if (connection) {\n connection.removeEventListener('change', nativeHandler);\n } else {\n if (isWindowPresent) {\n window.removeEventListener('online', nativeHandler);\n window.removeEventListener('offline', nativeHandler);\n }\n } // Remove handlers\n\n\n handlers.splice(index, 1);\n nativeHandlers.splice(index, 1);\n break;\n }\n }\n },\n\n async getCurrentState(requestedInterface) {\n return getCurrentState(requestedInterface);\n },\n\n configure() {\n return;\n }\n\n};\nexport default RNCNetInfo;\n//# sourceMappingURL=nativeModule.web.js.map","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nimport { NativeEventEmitter } from 'react-native';\nimport RNCNetInfo from './nativeModule';\nimport { DEVICE_CONNECTIVITY_EVENT } from './privateTypes';\nconst nativeEventEmitter = new NativeEventEmitter(); // Listen to connectivity events\n\nRNCNetInfo.addListener(DEVICE_CONNECTIVITY_EVENT, event => {\n nativeEventEmitter.emit(DEVICE_CONNECTIVITY_EVENT, event);\n});\nexport default { ...RNCNetInfo,\n eventEmitter: nativeEventEmitter\n};\n//# sourceMappingURL=nativeInterface.web.js.map","function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nexport default class InternetReachability {\n constructor(configuration, listener) {\n _defineProperty(this, \"_configuration\", void 0);\n\n _defineProperty(this, \"_listener\", void 0);\n\n _defineProperty(this, \"_isInternetReachable\", undefined);\n\n _defineProperty(this, \"_currentInternetReachabilityCheckHandler\", null);\n\n _defineProperty(this, \"_currentTimeoutHandle\", null);\n\n _defineProperty(this, \"_setIsInternetReachable\", isInternetReachable => {\n if (this._isInternetReachable === isInternetReachable) {\n return;\n }\n\n this._isInternetReachable = isInternetReachable;\n\n this._listener(this._isInternetReachable);\n });\n\n _defineProperty(this, \"_setExpectsConnection\", expectsConnection => {\n // Cancel any pending check\n if (this._currentInternetReachabilityCheckHandler !== null) {\n this._currentInternetReachabilityCheckHandler.cancel();\n\n this._currentInternetReachabilityCheckHandler = null;\n } // Cancel any pending timeout\n\n\n if (this._currentTimeoutHandle !== null) {\n clearTimeout(this._currentTimeoutHandle);\n this._currentTimeoutHandle = null;\n }\n\n if (expectsConnection && this._configuration.reachabilityShouldRun()) {\n // If we expect a connection, start the process for finding if we have one\n // Set the state to \"null\" if it was previously false\n if (!this._isInternetReachable) {\n this._setIsInternetReachable(null);\n } // Start a network request to check for internet\n\n\n this._currentInternetReachabilityCheckHandler = this._checkInternetReachability();\n } else {\n // If we don't expect a connection or don't run reachability check, just change the state to \"false\"\n this._setIsInternetReachable(false);\n }\n });\n\n _defineProperty(this, \"_checkInternetReachability\", () => {\n const controller = new AbortController();\n const responsePromise = fetch(this._configuration.reachabilityUrl, {\n headers: this._configuration.reachabilityHeaders,\n method: this._configuration.reachabilityMethod,\n cache: 'no-cache',\n signal: controller.signal\n }); // Create promise that will reject after the request timeout has been reached\n\n let timeoutHandle;\n const timeoutPromise = new Promise((_, reject) => {\n timeoutHandle = setTimeout(() => reject('timedout'), this._configuration.reachabilityRequestTimeout);\n }); // Create promise that makes it possible to cancel a pending request through a reject\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n\n let cancel = () => {};\n\n const cancelPromise = new Promise((_, reject) => {\n cancel = () => reject('canceled');\n });\n const promise = Promise.race([responsePromise, timeoutPromise, cancelPromise]).then(response => {\n return this._configuration.reachabilityTest(response);\n }).then(result => {\n this._setIsInternetReachable(result);\n\n const nextTimeoutInterval = this._isInternetReachable ? this._configuration.reachabilityLongTimeout : this._configuration.reachabilityShortTimeout;\n this._currentTimeoutHandle = setTimeout(this._checkInternetReachability, nextTimeoutInterval);\n }).catch(error => {\n if ('canceled' === error) {\n controller.abort();\n } else {\n if ('timedout' === error) {\n controller.abort();\n }\n\n this._setIsInternetReachable(false);\n\n this._currentTimeoutHandle = setTimeout(this._checkInternetReachability, this._configuration.reachabilityShortTimeout);\n }\n }) // Clear request timeout and propagate any errors\n .then(() => {\n clearTimeout(timeoutHandle);\n }, error => {\n clearTimeout(timeoutHandle);\n throw error;\n });\n return {\n promise,\n cancel\n };\n });\n\n _defineProperty(this, \"update\", state => {\n if (typeof state.isInternetReachable === 'boolean' && this._configuration.useNativeReachability) {\n this._setIsInternetReachable(state.isInternetReachable);\n } else {\n this._setExpectsConnection(state.isConnected);\n }\n });\n\n _defineProperty(this, \"currentState\", () => {\n return this._isInternetReachable;\n });\n\n _defineProperty(this, \"tearDown\", () => {\n // Cancel any pending check\n if (this._currentInternetReachabilityCheckHandler !== null) {\n this._currentInternetReachabilityCheckHandler.cancel();\n\n this._currentInternetReachabilityCheckHandler = null;\n } // Cancel any pending timeout\n\n\n if (this._currentTimeoutHandle !== null) {\n clearTimeout(this._currentTimeoutHandle);\n this._currentTimeoutHandle = null;\n }\n });\n\n this._configuration = configuration;\n this._listener = listener;\n }\n\n}\n//# sourceMappingURL=internetReachability.js.map","function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nimport NativeInterface from './nativeInterface';\nimport InternetReachability from './internetReachability';\nimport * as PrivateTypes from './privateTypes';\nexport default class State {\n constructor(configuration) {\n _defineProperty(this, \"_nativeEventSubscription\", null);\n\n _defineProperty(this, \"_subscriptions\", new Set());\n\n _defineProperty(this, \"_latestState\", null);\n\n _defineProperty(this, \"_internetReachability\", void 0);\n\n _defineProperty(this, \"_handleNativeStateUpdate\", state => {\n // Update the internet reachability module\n this._internetReachability.update(state); // Convert the state from native to JS shape\n\n\n const convertedState = this._convertState(state); // Update the listeners\n\n\n this._latestState = convertedState;\n\n this._subscriptions.forEach(handler => handler(convertedState));\n });\n\n _defineProperty(this, \"_handleInternetReachabilityUpdate\", isInternetReachable => {\n if (!this._latestState) {\n return;\n }\n\n const nextState = { ...this._latestState,\n isInternetReachable\n };\n this._latestState = nextState;\n\n this._subscriptions.forEach(handler => handler(nextState));\n });\n\n _defineProperty(this, \"_fetchCurrentState\", async requestedInterface => {\n const state = await NativeInterface.getCurrentState(requestedInterface); // Update the internet reachability module\n\n this._internetReachability.update(state); // Convert and store the new state\n\n\n const convertedState = this._convertState(state);\n\n if (!requestedInterface) {\n this._latestState = convertedState;\n\n this._subscriptions.forEach(handler => handler(convertedState));\n }\n\n return convertedState;\n });\n\n _defineProperty(this, \"_convertState\", input => {\n if (typeof input.isInternetReachable === 'boolean') {\n return input;\n } else {\n return { ...input,\n isInternetReachable: this._internetReachability.currentState()\n };\n }\n });\n\n _defineProperty(this, \"latest\", requestedInterface => {\n if (requestedInterface) {\n return this._fetchCurrentState(requestedInterface);\n } else if (this._latestState) {\n return Promise.resolve(this._latestState);\n } else {\n return this._fetchCurrentState();\n }\n });\n\n _defineProperty(this, \"add\", handler => {\n // Add the subscription handler to our set\n this._subscriptions.add(handler); // Send it the latest data we have\n\n\n if (this._latestState) {\n handler(this._latestState);\n } else {\n this.latest().then(handler);\n }\n });\n\n _defineProperty(this, \"remove\", handler => {\n this._subscriptions.delete(handler);\n });\n\n _defineProperty(this, \"tearDown\", () => {\n if (this._internetReachability) {\n this._internetReachability.tearDown();\n }\n\n if (this._nativeEventSubscription) {\n this._nativeEventSubscription.remove();\n }\n\n this._subscriptions.clear();\n });\n\n // Add the listener to the internet connectivity events\n this._internetReachability = new InternetReachability(configuration, this._handleInternetReachabilityUpdate); // Add the subscription to the native events\n\n this._nativeEventSubscription = NativeInterface.eventEmitter.addListener(PrivateTypes.DEVICE_CONNECTIVITY_EVENT, this._handleNativeStateUpdate); // Fetch the current state from the native module\n\n this._fetchCurrentState();\n }\n\n}\n//# sourceMappingURL=state.js.map","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nimport { useState, useEffect, useCallback } from 'react';\nimport { Platform } from 'react-native';\nimport DEFAULT_CONFIGURATION from './internal/defaultConfiguration';\nimport NativeInterface from './internal/nativeInterface';\nimport State from './internal/state';\nimport * as Types from './internal/types'; // Stores the currently used configuration\n\nlet _configuration = DEFAULT_CONFIGURATION; // Stores the singleton reference to the state manager\n\nlet _state = null;\n\nconst createState = () => {\n return new State(_configuration);\n}; // Track ongoing requests\n\n\nlet isRequestInProgress = false;\nlet requestQueue = [];\n/**\n * Configures the library with the given configuration. Note that calling this will stop all\n * previously added listeners from being called again. It is best to call this right when your\n * application is started to avoid issues. The configuration sets up a global singleton instance.\n *\n * @param configuration The new configuration to set.\n */\n\nexport function configure(configuration) {\n _configuration = { ...DEFAULT_CONFIGURATION,\n ...configuration\n };\n\n if (_state) {\n _state.tearDown();\n\n _state = createState();\n }\n\n if (Platform.OS === 'ios') {\n NativeInterface.configure(configuration);\n }\n}\n/**\n * Returns a `Promise` that resolves to a `NetInfoState` object.\n * This function operates on the global singleton instance configured using `configure()`\n *\n * @param [requestedInterface] interface from which to obtain the information\n *\n * @returns A Promise which contains the current connection state.\n */\n\nexport function fetch(requestedInterface) {\n if (!_state) {\n _state = createState();\n }\n\n return _state.latest(requestedInterface);\n}\n/**\n * Force-refreshes the internal state of the global singleton managed by this library.\n *\n * @returns A Promise which contains the updated connection state.\n */\n\nexport function refresh() {\n if (!_state) {\n _state = createState();\n } // If a request is already in progress, return a promise that will resolve when the current request finishes\n\n\n if (isRequestInProgress) {\n return new Promise(resolve => {\n requestQueue.push(resolve);\n });\n }\n\n isRequestInProgress = true;\n return _state._fetchCurrentState().then(result => {\n requestQueue.forEach(resolve => resolve(result));\n requestQueue = [];\n return result;\n }).finally(() => {\n isRequestInProgress = false;\n });\n}\n/**\n * Subscribe to the global singleton's connection information. The callback is called with a parameter of type\n * [`NetInfoState`](README.md#netinfostate) whenever the connection state changes. Your listener\n * will be called with the latest information soon after you subscribe and then with any\n * subsequent changes afterwards. You should not assume that the listener is called in the same\n * way across devices or platforms.\n *\n * @param listener The listener which is called when the network state changes.\n *\n * @returns A function which can be called to unsubscribe.\n */\n\nexport function addEventListener(listener) {\n if (!_state) {\n _state = createState();\n }\n\n _state.add(listener);\n\n return () => {\n _state && _state.remove(listener);\n };\n}\n/**\n * A React Hook into this library's singleton which updates when the connection state changes.\n *\n * @param {Partial<Types.NetInfoConfiguration>} configuration - Configure the isolated network checker managed by this hook\n *\n * @returns The connection state.\n */\n\nexport function useNetInfo(configuration) {\n if (configuration) {\n configure(configuration);\n }\n\n const [netInfo, setNetInfo] = useState({\n type: Types.NetInfoStateType.unknown,\n isConnected: null,\n isInternetReachable: null,\n details: null\n });\n useEffect(() => {\n const unsubscribe = addEventListener(setNetInfo);\n return () => unsubscribe();\n }, []);\n return netInfo;\n}\n/**\n * A React Hook which manages an isolated instance of the network info manager.\n * This is not a hook into a singleton shared state. NetInfo.configure, NetInfo.addEventListener,\n * NetInfo.fetch, NetInfo.refresh are performed on a global singleton and have no affect on this hook.\n * @param {boolean} isPaused - Pause the internal network checks.\n * @param {Partial<Types.NetInfoConfiguration>} configuration - Configure the isolated network checker managed by this hook\n *\n * @returns the netInfo state and a refresh function\n */\n\nexport function useNetInfoInstance(isPaused = false, configuration) {\n const [networkInfoManager, setNetworkInfoManager] = useState();\n const [netInfo, setNetInfo] = useState({\n type: Types.NetInfoStateType.unknown,\n isConnected: null,\n isInternetReachable: null,\n details: null\n });\n useEffect(() => {\n if (isPaused) {\n return;\n }\n\n const config = { ...DEFAULT_CONFIGURATION,\n ...configuration\n };\n const state = new State(config);\n setNetworkInfoManager(state);\n state.add(setNetInfo);\n return state.tearDown;\n }, [isPaused, configuration]);\n const refresh = useCallback(() => {\n if (networkInfoManager && !isRequestInProgress) {\n isRequestInProgress = true;\n\n networkInfoManager._fetchCurrentState().finally(() => {\n isRequestInProgress = false;\n });\n }\n }, [networkInfoManager]);\n return {\n netInfo,\n refresh\n };\n}\nexport * from './internal/types';\nexport default {\n configure,\n fetch,\n refresh,\n addEventListener,\n useNetInfo,\n useNetInfoInstance\n};\n//# sourceMappingURL=index.js.map","// adapters/native/networkInfoNative.native.ts\nimport NetInfo from \"@react-native-community/netinfo\";\nimport { NetworkInfo, Telemetry } from \"../../core/telemetry\";\nimport { NetworkChangeEmitter } from \"../networkChange\";\n\n\nexport class NetworkInfoTrackerNative {\n private telemetry?: Telemetry;\n\n constructor() {\n\n }\n\n async collect(): Promise<NetworkInfo> {\n try {\n const netState = await NetInfo.fetch();\n return {\n type: netState.type,\n isConnected: netState.isConnected ?? undefined,\n };\n } catch {\n return { type: \"unknown\", isConnected: undefined };\n }\n }\n\n /**\n * collect() feeds the steady-state Context block on every event (no standalone\n * network_info event, ADR-0002). A connectivity *transition* is still its own\n * v3 `network_change` event, emitted via the shared NetworkChangeEmitter.\n */\n async start(telemetry: Telemetry): Promise<NetworkInfo> {\n this.telemetry = telemetry;\n const changes = new NetworkChangeEmitter(telemetry);\n const info = await this.collect();\n changes.onSample(info.type); // seed baseline so the first real transition emits\n NetInfo.addEventListener(state => changes.onSample(state.type));\n return info;\n }\n}\n"],"names":["DEFAULT_CONFIGURATION","response","DEVICE_CONNECTIVITY_EVENT","NetInfoStateType","NetInfoCellularGeneration","isWindowPresent","connection","typeMapping","effectiveTypeMapping","getCurrentState","_requestedInterface","isConnected","baseState","isConnectionExpensive","type","handlers","nativeHandlers","RNCNetInfo","handler","nativeHandler","index","requestedInterface","nativeEventEmitter","NativeEventEmitter","event","NativeInterface","_defineProperty","obj","key","value","InternetReachability","configuration","listener","isInternetReachable","expectsConnection","controller","responsePromise","timeoutHandle","timeoutPromise","_","reject","cancel","cancelPromise","result","nextTimeoutInterval","error","state","State","convertedState","nextState","input","PrivateTypes.DEVICE_CONNECTIVITY_EVENT","_configuration","_state","createState","isRequestInProgress","requestQueue","configure","Platform","fetch","refresh","resolve","addEventListener","useNetInfo","netInfo","setNetInfo","useState","Types.NetInfoStateType","useEffect","unsubscribe","useNetInfoInstance","isPaused","networkInfoManager","setNetworkInfoManager","config","useCallback","NetInfo","NetworkInfoTrackerNative","netState","telemetry","changes","NetworkChangeEmitter","info"],"mappings":";;;AAAA,MAAMA,IAAwB;AAAA,EAC5B,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,qBAAqB,CAAA;AAAA,EACrB,kBAAkB,CAAAC,MAAY,QAAQ,QAAQA,EAAS,WAAW,GAAG;AAAA,EACrE,0BAA0B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AyB;AAAA,EAGlC,cAAc;AAAA,EAEd;AAAA,EAEA,MAAM,UAAgC;AAClC,QAAI;AACA,YAAMC,IAAW,MAAMF,EAAQ,MAAA;AAC/B,aAAO;AAAA,QACH,MAAME,EAAS;AAAA,QACf,aAAaA,EAAS,eAAe;AAAA,MAAA;AAAA,IAE7C,QAAQ;AACJ,aAAO,EAAE,MAAM,WAAW,aAAa,OAAA;AAAA,IAC3C;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,MAAMC,GAA4C;AACpD,SAAK,YAAYA;AACjB,UAAMC,IAAU,IAAIC,EAAqBF,CAAS,GAC5CG,IAAO,MAAM,KAAK,QAAA;AACxB,WAAAF,EAAQ,SAASE,EAAK,IAAI,GAC1BN,EAAQ,iBAAiB,CAAA9B,MAASkC,EAAQ,SAASlC,EAAM,IAAI,CAAC,GACvDoC;AAAA,EACX;AACJ;","x_google_ignoreList":[0,1,2,3,4,5,6,7]}
1
+ {"version":3,"file":"networkInfo.native-CGrx9cnH.js","sources":["../node_modules/@react-native-community/netinfo/lib/module/internal/defaultConfiguration.web.js","../node_modules/@react-native-community/netinfo/lib/module/internal/privateTypes.js","../node_modules/@react-native-community/netinfo/lib/module/internal/types.js","../node_modules/@react-native-community/netinfo/lib/module/internal/nativeModule.web.js","../node_modules/@react-native-community/netinfo/lib/module/internal/nativeInterface.web.js","../node_modules/@react-native-community/netinfo/lib/module/internal/internetReachability.js","../node_modules/@react-native-community/netinfo/lib/module/internal/state.js","../node_modules/@react-native-community/netinfo/lib/module/index.js","../src/adapters/native/networkInfo.native.ts"],"sourcesContent":["const DEFAULT_CONFIGURATION = {\n reachabilityUrl: '/',\n reachabilityMethod: \"HEAD\",\n reachabilityHeaders: {},\n reachabilityTest: response => Promise.resolve(response.status === 200),\n reachabilityShortTimeout: 5 * 1000,\n // 5s\n reachabilityLongTimeout: 60 * 1000,\n // 60s\n reachabilityRequestTimeout: 15 * 1000,\n // 15s\n reachabilityShouldRun: () => true,\n shouldFetchWiFiSSID: true,\n useNativeReachability: true\n};\nexport default DEFAULT_CONFIGURATION;\n//# sourceMappingURL=defaultConfiguration.web.js.map","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nexport const DEVICE_CONNECTIVITY_EVENT = 'netInfo.networkStatusDidChange'; // Certain properties are optional when sent by the native module and are handled by the JS code\n//# sourceMappingURL=privateTypes.js.map","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nexport let NetInfoStateType;\n\n(function (NetInfoStateType) {\n NetInfoStateType[\"unknown\"] = \"unknown\";\n NetInfoStateType[\"none\"] = \"none\";\n NetInfoStateType[\"cellular\"] = \"cellular\";\n NetInfoStateType[\"wifi\"] = \"wifi\";\n NetInfoStateType[\"bluetooth\"] = \"bluetooth\";\n NetInfoStateType[\"ethernet\"] = \"ethernet\";\n NetInfoStateType[\"wimax\"] = \"wimax\";\n NetInfoStateType[\"vpn\"] = \"vpn\";\n NetInfoStateType[\"other\"] = \"other\";\n})(NetInfoStateType || (NetInfoStateType = {}));\n\nexport let NetInfoCellularGeneration;\n\n(function (NetInfoCellularGeneration) {\n NetInfoCellularGeneration[\"2g\"] = \"2g\";\n NetInfoCellularGeneration[\"3g\"] = \"3g\";\n NetInfoCellularGeneration[\"4g\"] = \"4g\";\n NetInfoCellularGeneration[\"5g\"] = \"5g\";\n})(NetInfoCellularGeneration || (NetInfoCellularGeneration = {}));\n//# sourceMappingURL=types.js.map","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nimport { DEVICE_CONNECTIVITY_EVENT } from './privateTypes';\nimport { NetInfoCellularGeneration, NetInfoStateType } from './types'; // See https://wicg.github.io/netinfo/#dom-connectiontype\n\n// Use a constant test of this form because in SSR on next.js, optional chaining is not sufficient,\n// but this test correctly detects that window is not available and allows for conditionals before access\nconst isWindowPresent = typeof window !== 'undefined'; // Check if window exists and if the browser supports the connection API\n\nconst connection = isWindowPresent && !window.hasOwnProperty('tizen') && !window.hasOwnProperty('webOS') ? window.navigator.connection || window.navigator.mozConnection || window.navigator.webkitConnection : undefined; // Map browser types to native types\n\nconst typeMapping = {\n bluetooth: NetInfoStateType.bluetooth,\n cellular: NetInfoStateType.cellular,\n ethernet: NetInfoStateType.ethernet,\n none: NetInfoStateType.none,\n other: NetInfoStateType.other,\n unknown: NetInfoStateType.unknown,\n wifi: NetInfoStateType.wifi,\n wimax: NetInfoStateType.wimax,\n mixed: NetInfoStateType.other\n};\nconst effectiveTypeMapping = {\n '2g': NetInfoCellularGeneration['2g'],\n '3g': NetInfoCellularGeneration['3g'],\n '4g': NetInfoCellularGeneration['4g'],\n 'slow-2g': NetInfoCellularGeneration['2g']\n}; // Determine current state of connection\n\nconst getCurrentState = _requestedInterface => {\n const isConnected = isWindowPresent ? navigator.onLine : false;\n const baseState = {\n isInternetReachable: null\n }; // If we don't have a connection object, we return minimal information\n\n if (!connection) {\n if (isConnected) {\n const state = { ...baseState,\n isConnected: true,\n type: NetInfoStateType.other,\n details: {\n isConnectionExpensive: false\n }\n };\n return state;\n }\n\n const state = { ...baseState,\n isConnected: false,\n isInternetReachable: false,\n type: NetInfoStateType.none,\n details: null\n };\n return state;\n } // Otherwise try to return detailed information\n\n\n const isConnectionExpensive = connection.saveData;\n const type = connection.type ? typeMapping[connection.type] : isConnected ? NetInfoStateType.other : NetInfoStateType.unknown;\n\n if (type === NetInfoStateType.bluetooth) {\n const state = { ...baseState,\n isConnected: true,\n type,\n details: {\n isConnectionExpensive\n }\n };\n return state;\n } else if (type === NetInfoStateType.cellular) {\n const state = { ...baseState,\n isConnected: true,\n type,\n details: {\n isConnectionExpensive,\n cellularGeneration: effectiveTypeMapping[connection.effectiveType] || null,\n carrier: null\n }\n };\n return state;\n } else if (type === NetInfoStateType.ethernet) {\n const state = { ...baseState,\n isConnected: true,\n type,\n details: {\n isConnectionExpensive,\n ipAddress: null,\n subnet: null\n }\n };\n return state;\n } else if (type === NetInfoStateType.wifi) {\n const state = { ...baseState,\n isConnected: true,\n type,\n details: {\n isConnectionExpensive,\n ssid: null,\n bssid: null,\n strength: null,\n ipAddress: null,\n subnet: null,\n frequency: null,\n linkSpeed: null,\n rxLinkSpeed: null,\n txLinkSpeed: null\n }\n };\n return state;\n } else if (type === NetInfoStateType.wimax) {\n const state = { ...baseState,\n isConnected: true,\n type,\n details: {\n isConnectionExpensive\n }\n };\n return state;\n } else if (type === NetInfoStateType.none) {\n const state = { ...baseState,\n isConnected: false,\n isInternetReachable: false,\n type,\n details: null\n };\n return state;\n } else if (type === NetInfoStateType.unknown) {\n const state = { ...baseState,\n isConnected,\n isInternetReachable: null,\n type,\n details: null\n };\n return state;\n }\n\n const state = { ...baseState,\n isConnected: true,\n type: NetInfoStateType.other,\n details: {\n isConnectionExpensive\n }\n };\n return state;\n};\n\nconst handlers = [];\nconst nativeHandlers = [];\nconst RNCNetInfo = {\n addListener(type, handler) {\n switch (type) {\n case DEVICE_CONNECTIVITY_EVENT:\n {\n const nativeHandler = () => {\n handler(getCurrentState());\n };\n\n if (connection) {\n connection.addEventListener('change', nativeHandler);\n } else {\n if (isWindowPresent) {\n window.addEventListener('online', nativeHandler, false);\n window.addEventListener('offline', nativeHandler, false);\n }\n } // Remember handlers\n\n\n handlers.push(handler);\n nativeHandlers.push(nativeHandler);\n break;\n }\n }\n },\n\n removeListeners(type, handler) {\n switch (type) {\n case DEVICE_CONNECTIVITY_EVENT:\n {\n // Get native handler\n const index = handlers.indexOf(handler);\n const nativeHandler = nativeHandlers[index];\n\n if (connection) {\n connection.removeEventListener('change', nativeHandler);\n } else {\n if (isWindowPresent) {\n window.removeEventListener('online', nativeHandler);\n window.removeEventListener('offline', nativeHandler);\n }\n } // Remove handlers\n\n\n handlers.splice(index, 1);\n nativeHandlers.splice(index, 1);\n break;\n }\n }\n },\n\n async getCurrentState(requestedInterface) {\n return getCurrentState(requestedInterface);\n },\n\n configure() {\n return;\n }\n\n};\nexport default RNCNetInfo;\n//# sourceMappingURL=nativeModule.web.js.map","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nimport { NativeEventEmitter } from 'react-native';\nimport RNCNetInfo from './nativeModule';\nimport { DEVICE_CONNECTIVITY_EVENT } from './privateTypes';\nconst nativeEventEmitter = new NativeEventEmitter(); // Listen to connectivity events\n\nRNCNetInfo.addListener(DEVICE_CONNECTIVITY_EVENT, event => {\n nativeEventEmitter.emit(DEVICE_CONNECTIVITY_EVENT, event);\n});\nexport default { ...RNCNetInfo,\n eventEmitter: nativeEventEmitter\n};\n//# sourceMappingURL=nativeInterface.web.js.map","function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nexport default class InternetReachability {\n constructor(configuration, listener) {\n _defineProperty(this, \"_configuration\", void 0);\n\n _defineProperty(this, \"_listener\", void 0);\n\n _defineProperty(this, \"_isInternetReachable\", undefined);\n\n _defineProperty(this, \"_currentInternetReachabilityCheckHandler\", null);\n\n _defineProperty(this, \"_currentTimeoutHandle\", null);\n\n _defineProperty(this, \"_setIsInternetReachable\", isInternetReachable => {\n if (this._isInternetReachable === isInternetReachable) {\n return;\n }\n\n this._isInternetReachable = isInternetReachable;\n\n this._listener(this._isInternetReachable);\n });\n\n _defineProperty(this, \"_setExpectsConnection\", expectsConnection => {\n // Cancel any pending check\n if (this._currentInternetReachabilityCheckHandler !== null) {\n this._currentInternetReachabilityCheckHandler.cancel();\n\n this._currentInternetReachabilityCheckHandler = null;\n } // Cancel any pending timeout\n\n\n if (this._currentTimeoutHandle !== null) {\n clearTimeout(this._currentTimeoutHandle);\n this._currentTimeoutHandle = null;\n }\n\n if (expectsConnection && this._configuration.reachabilityShouldRun()) {\n // If we expect a connection, start the process for finding if we have one\n // Set the state to \"null\" if it was previously false\n if (!this._isInternetReachable) {\n this._setIsInternetReachable(null);\n } // Start a network request to check for internet\n\n\n this._currentInternetReachabilityCheckHandler = this._checkInternetReachability();\n } else {\n // If we don't expect a connection or don't run reachability check, just change the state to \"false\"\n this._setIsInternetReachable(false);\n }\n });\n\n _defineProperty(this, \"_checkInternetReachability\", () => {\n const controller = new AbortController();\n const responsePromise = fetch(this._configuration.reachabilityUrl, {\n headers: this._configuration.reachabilityHeaders,\n method: this._configuration.reachabilityMethod,\n cache: 'no-cache',\n signal: controller.signal\n }); // Create promise that will reject after the request timeout has been reached\n\n let timeoutHandle;\n const timeoutPromise = new Promise((_, reject) => {\n timeoutHandle = setTimeout(() => reject('timedout'), this._configuration.reachabilityRequestTimeout);\n }); // Create promise that makes it possible to cancel a pending request through a reject\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n\n let cancel = () => {};\n\n const cancelPromise = new Promise((_, reject) => {\n cancel = () => reject('canceled');\n });\n const promise = Promise.race([responsePromise, timeoutPromise, cancelPromise]).then(response => {\n return this._configuration.reachabilityTest(response);\n }).then(result => {\n this._setIsInternetReachable(result);\n\n const nextTimeoutInterval = this._isInternetReachable ? this._configuration.reachabilityLongTimeout : this._configuration.reachabilityShortTimeout;\n this._currentTimeoutHandle = setTimeout(this._checkInternetReachability, nextTimeoutInterval);\n }).catch(error => {\n if ('canceled' === error) {\n controller.abort();\n } else {\n if ('timedout' === error) {\n controller.abort();\n }\n\n this._setIsInternetReachable(false);\n\n this._currentTimeoutHandle = setTimeout(this._checkInternetReachability, this._configuration.reachabilityShortTimeout);\n }\n }) // Clear request timeout and propagate any errors\n .then(() => {\n clearTimeout(timeoutHandle);\n }, error => {\n clearTimeout(timeoutHandle);\n throw error;\n });\n return {\n promise,\n cancel\n };\n });\n\n _defineProperty(this, \"update\", state => {\n if (typeof state.isInternetReachable === 'boolean' && this._configuration.useNativeReachability) {\n this._setIsInternetReachable(state.isInternetReachable);\n } else {\n this._setExpectsConnection(state.isConnected);\n }\n });\n\n _defineProperty(this, \"currentState\", () => {\n return this._isInternetReachable;\n });\n\n _defineProperty(this, \"tearDown\", () => {\n // Cancel any pending check\n if (this._currentInternetReachabilityCheckHandler !== null) {\n this._currentInternetReachabilityCheckHandler.cancel();\n\n this._currentInternetReachabilityCheckHandler = null;\n } // Cancel any pending timeout\n\n\n if (this._currentTimeoutHandle !== null) {\n clearTimeout(this._currentTimeoutHandle);\n this._currentTimeoutHandle = null;\n }\n });\n\n this._configuration = configuration;\n this._listener = listener;\n }\n\n}\n//# sourceMappingURL=internetReachability.js.map","function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nimport NativeInterface from './nativeInterface';\nimport InternetReachability from './internetReachability';\nimport * as PrivateTypes from './privateTypes';\nexport default class State {\n constructor(configuration) {\n _defineProperty(this, \"_nativeEventSubscription\", null);\n\n _defineProperty(this, \"_subscriptions\", new Set());\n\n _defineProperty(this, \"_latestState\", null);\n\n _defineProperty(this, \"_internetReachability\", void 0);\n\n _defineProperty(this, \"_handleNativeStateUpdate\", state => {\n // Update the internet reachability module\n this._internetReachability.update(state); // Convert the state from native to JS shape\n\n\n const convertedState = this._convertState(state); // Update the listeners\n\n\n this._latestState = convertedState;\n\n this._subscriptions.forEach(handler => handler(convertedState));\n });\n\n _defineProperty(this, \"_handleInternetReachabilityUpdate\", isInternetReachable => {\n if (!this._latestState) {\n return;\n }\n\n const nextState = { ...this._latestState,\n isInternetReachable\n };\n this._latestState = nextState;\n\n this._subscriptions.forEach(handler => handler(nextState));\n });\n\n _defineProperty(this, \"_fetchCurrentState\", async requestedInterface => {\n const state = await NativeInterface.getCurrentState(requestedInterface); // Update the internet reachability module\n\n this._internetReachability.update(state); // Convert and store the new state\n\n\n const convertedState = this._convertState(state);\n\n if (!requestedInterface) {\n this._latestState = convertedState;\n\n this._subscriptions.forEach(handler => handler(convertedState));\n }\n\n return convertedState;\n });\n\n _defineProperty(this, \"_convertState\", input => {\n if (typeof input.isInternetReachable === 'boolean') {\n return input;\n } else {\n return { ...input,\n isInternetReachable: this._internetReachability.currentState()\n };\n }\n });\n\n _defineProperty(this, \"latest\", requestedInterface => {\n if (requestedInterface) {\n return this._fetchCurrentState(requestedInterface);\n } else if (this._latestState) {\n return Promise.resolve(this._latestState);\n } else {\n return this._fetchCurrentState();\n }\n });\n\n _defineProperty(this, \"add\", handler => {\n // Add the subscription handler to our set\n this._subscriptions.add(handler); // Send it the latest data we have\n\n\n if (this._latestState) {\n handler(this._latestState);\n } else {\n this.latest().then(handler);\n }\n });\n\n _defineProperty(this, \"remove\", handler => {\n this._subscriptions.delete(handler);\n });\n\n _defineProperty(this, \"tearDown\", () => {\n if (this._internetReachability) {\n this._internetReachability.tearDown();\n }\n\n if (this._nativeEventSubscription) {\n this._nativeEventSubscription.remove();\n }\n\n this._subscriptions.clear();\n });\n\n // Add the listener to the internet connectivity events\n this._internetReachability = new InternetReachability(configuration, this._handleInternetReachabilityUpdate); // Add the subscription to the native events\n\n this._nativeEventSubscription = NativeInterface.eventEmitter.addListener(PrivateTypes.DEVICE_CONNECTIVITY_EVENT, this._handleNativeStateUpdate); // Fetch the current state from the native module\n\n this._fetchCurrentState();\n }\n\n}\n//# sourceMappingURL=state.js.map","/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\nimport { useState, useEffect, useCallback } from 'react';\nimport { Platform } from 'react-native';\nimport DEFAULT_CONFIGURATION from './internal/defaultConfiguration';\nimport NativeInterface from './internal/nativeInterface';\nimport State from './internal/state';\nimport * as Types from './internal/types'; // Stores the currently used configuration\n\nlet _configuration = DEFAULT_CONFIGURATION; // Stores the singleton reference to the state manager\n\nlet _state = null;\n\nconst createState = () => {\n return new State(_configuration);\n}; // Track ongoing requests\n\n\nlet isRequestInProgress = false;\nlet requestQueue = [];\n/**\n * Configures the library with the given configuration. Note that calling this will stop all\n * previously added listeners from being called again. It is best to call this right when your\n * application is started to avoid issues. The configuration sets up a global singleton instance.\n *\n * @param configuration The new configuration to set.\n */\n\nexport function configure(configuration) {\n _configuration = { ...DEFAULT_CONFIGURATION,\n ...configuration\n };\n\n if (_state) {\n _state.tearDown();\n\n _state = createState();\n }\n\n if (Platform.OS === 'ios') {\n NativeInterface.configure(configuration);\n }\n}\n/**\n * Returns a `Promise` that resolves to a `NetInfoState` object.\n * This function operates on the global singleton instance configured using `configure()`\n *\n * @param [requestedInterface] interface from which to obtain the information\n *\n * @returns A Promise which contains the current connection state.\n */\n\nexport function fetch(requestedInterface) {\n if (!_state) {\n _state = createState();\n }\n\n return _state.latest(requestedInterface);\n}\n/**\n * Force-refreshes the internal state of the global singleton managed by this library.\n *\n * @returns A Promise which contains the updated connection state.\n */\n\nexport function refresh() {\n if (!_state) {\n _state = createState();\n } // If a request is already in progress, return a promise that will resolve when the current request finishes\n\n\n if (isRequestInProgress) {\n return new Promise(resolve => {\n requestQueue.push(resolve);\n });\n }\n\n isRequestInProgress = true;\n return _state._fetchCurrentState().then(result => {\n requestQueue.forEach(resolve => resolve(result));\n requestQueue = [];\n return result;\n }).finally(() => {\n isRequestInProgress = false;\n });\n}\n/**\n * Subscribe to the global singleton's connection information. The callback is called with a parameter of type\n * [`NetInfoState`](README.md#netinfostate) whenever the connection state changes. Your listener\n * will be called with the latest information soon after you subscribe and then with any\n * subsequent changes afterwards. You should not assume that the listener is called in the same\n * way across devices or platforms.\n *\n * @param listener The listener which is called when the network state changes.\n *\n * @returns A function which can be called to unsubscribe.\n */\n\nexport function addEventListener(listener) {\n if (!_state) {\n _state = createState();\n }\n\n _state.add(listener);\n\n return () => {\n _state && _state.remove(listener);\n };\n}\n/**\n * A React Hook into this library's singleton which updates when the connection state changes.\n *\n * @param {Partial<Types.NetInfoConfiguration>} configuration - Configure the isolated network checker managed by this hook\n *\n * @returns The connection state.\n */\n\nexport function useNetInfo(configuration) {\n if (configuration) {\n configure(configuration);\n }\n\n const [netInfo, setNetInfo] = useState({\n type: Types.NetInfoStateType.unknown,\n isConnected: null,\n isInternetReachable: null,\n details: null\n });\n useEffect(() => {\n const unsubscribe = addEventListener(setNetInfo);\n return () => unsubscribe();\n }, []);\n return netInfo;\n}\n/**\n * A React Hook which manages an isolated instance of the network info manager.\n * This is not a hook into a singleton shared state. NetInfo.configure, NetInfo.addEventListener,\n * NetInfo.fetch, NetInfo.refresh are performed on a global singleton and have no affect on this hook.\n * @param {boolean} isPaused - Pause the internal network checks.\n * @param {Partial<Types.NetInfoConfiguration>} configuration - Configure the isolated network checker managed by this hook\n *\n * @returns the netInfo state and a refresh function\n */\n\nexport function useNetInfoInstance(isPaused = false, configuration) {\n const [networkInfoManager, setNetworkInfoManager] = useState();\n const [netInfo, setNetInfo] = useState({\n type: Types.NetInfoStateType.unknown,\n isConnected: null,\n isInternetReachable: null,\n details: null\n });\n useEffect(() => {\n if (isPaused) {\n return;\n }\n\n const config = { ...DEFAULT_CONFIGURATION,\n ...configuration\n };\n const state = new State(config);\n setNetworkInfoManager(state);\n state.add(setNetInfo);\n return state.tearDown;\n }, [isPaused, configuration]);\n const refresh = useCallback(() => {\n if (networkInfoManager && !isRequestInProgress) {\n isRequestInProgress = true;\n\n networkInfoManager._fetchCurrentState().finally(() => {\n isRequestInProgress = false;\n });\n }\n }, [networkInfoManager]);\n return {\n netInfo,\n refresh\n };\n}\nexport * from './internal/types';\nexport default {\n configure,\n fetch,\n refresh,\n addEventListener,\n useNetInfo,\n useNetInfoInstance\n};\n//# sourceMappingURL=index.js.map","// adapters/native/networkInfoNative.native.ts\nimport NetInfo from \"@react-native-community/netinfo\";\nimport { NetworkInfo, Telemetry } from \"../../core/telemetry\";\nimport { NetworkChangeEmitter } from \"../networkChange\";\n\n\nexport class NetworkInfoTrackerNative {\n private telemetry?: Telemetry;\n\n constructor() {\n\n }\n\n async collect(): Promise<NetworkInfo> {\n try {\n const netState = await NetInfo.fetch();\n return {\n type: netState.type,\n is_connected: netState.isConnected ?? undefined,\n };\n } catch {\n return { type: \"unknown\", is_connected: undefined };\n }\n }\n\n /**\n * collect() feeds the steady-state Context block on every event (no standalone\n * network_info event, ADR-0002). A connectivity *transition* is still its own\n * v3 `network_change` event, emitted via the shared NetworkChangeEmitter.\n */\n async start(telemetry: Telemetry): Promise<NetworkInfo> {\n this.telemetry = telemetry;\n const changes = new NetworkChangeEmitter(telemetry);\n const info = await this.collect();\n changes.onSample(info.type); // seed baseline so the first real transition emits\n NetInfo.addEventListener(state => changes.onSample(state.type));\n return info;\n }\n}\n"],"names":["DEFAULT_CONFIGURATION","response","DEVICE_CONNECTIVITY_EVENT","NetInfoStateType","NetInfoCellularGeneration","isWindowPresent","connection","typeMapping","effectiveTypeMapping","getCurrentState","_requestedInterface","isConnected","baseState","isConnectionExpensive","type","handlers","nativeHandlers","RNCNetInfo","handler","nativeHandler","index","requestedInterface","nativeEventEmitter","NativeEventEmitter","event","NativeInterface","_defineProperty","obj","key","value","InternetReachability","configuration","listener","isInternetReachable","expectsConnection","controller","responsePromise","timeoutHandle","timeoutPromise","_","reject","cancel","cancelPromise","result","nextTimeoutInterval","error","state","State","convertedState","nextState","input","PrivateTypes.DEVICE_CONNECTIVITY_EVENT","_configuration","_state","createState","isRequestInProgress","requestQueue","configure","Platform","fetch","refresh","resolve","addEventListener","useNetInfo","netInfo","setNetInfo","useState","Types.NetInfoStateType","useEffect","unsubscribe","useNetInfoInstance","isPaused","networkInfoManager","setNetworkInfoManager","config","use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G,CAACiB,CAAkB,CAAC;AACvB,SAAO;AAAA,IACL,SAAAR;AAAA,IACA,SAAAJ;AAAA,EACJ;AACA;AAEA,MAAAgB,IAAe;AAAA,EACb,WAAAnB;AAAA,EACF,OAAEE;AAAAA,EACA,SAAAC;AAAA,EACA,kBAAAE;AAAA,EACA,YAAAC;AAAA,EACA,oBAAAO;AACF;AC3LO,MAAMO,EAAyB;AAAA,EAGlC,cAAc;AAAA,EAEd;AAAA,EAEA,MAAM,UAAgC;AAClC,QAAI;AACA,YAAMC,IAAW,MAAMF,EAAQ,MAAA;AAC/B,aAAO;AAAA,QACH,MAAME,EAAS;AAAA,QACf,cAAcA,EAAS,eAAe;AAAA,MAAA;AAAA,IAE9C,QAAQ;AACJ,aAAO,EAAE,MAAM,WAAW,cAAc,OAAA;AAAA,IAC5C;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,MAAMC,GAA4C;AACpD,SAAK,YAAYA;AACjB,UAAMC,IAAU,IAAIC,EAAqBF,CAAS,GAC5CG,IAAO,MAAM,KAAK,QAAA;AACxB,WAAAF,EAAQ,SAASE,EAAK,IAAI,GAC1BN,EAAQ,iBAAiB,CAAA9B,MAASkC,EAAQ,SAASlC,EAAM,IAAI,CAAC,GACvDoC;AAAA,EACX;AACJ;","x_google_ignoreList":[0,1,2,3,4,5,6,7]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),H=require("react-native"),q=require("./networkChange-CUO1hRLj.cjs"),E={reachabilityUrl:"/",reachabilityMethod:"HEAD",reachabilityHeaders:{},reachabilityTest:t=>Promise.resolve(t.status===200),reachabilityShortTimeout:5*1e3,reachabilityLongTimeout:60*1e3,reachabilityRequestTimeout:15*1e3,reachabilityShouldRun:()=>!0,shouldFetchWiFiSSID:!0,useNativeReachability:!0},y="netInfo.networkStatusDidChange";let r;(function(t){t.unknown="unknown",t.none="none",t.cellular="cellular",t.wifi="wifi",t.bluetooth="bluetooth",t.ethernet="ethernet",t.wimax="wimax",t.vpn="vpn",t.other="other"})(r||(r={}));let _;(function(t){t["2g"]="2g",t["3g"]="3g",t["4g"]="4g",t["5g"]="5g"})(_||(_={}));const p=typeof window<"u",h=p&&!window.hasOwnProperty("tizen")&&!window.hasOwnProperty("webOS")?window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection:void 0,U={bluetooth:r.bluetooth,cellular:r.cellular,ethernet:r.ethernet,none:r.none,other:r.other,unknown:r.unknown,wifi:r.wifi,wimax:r.wimax,mixed:r.other},M={"2g":_["2g"],"3g":_["3g"],"4g":_["4g"],"slow-2g":_["2g"]},k=t=>{const i=p?navigator.onLine:!1,e={isInternetReachable:null};if(!h)return i?{...e,isConnected:!0,type:r.other,details:{isConnectionExpensive:!1}}:{...e,isConnected:!1,isInternetReachable:!1,type:r.none,details:null};const n=h.saveData,s=h.type?U[h.type]:i?r.other:r.unknown;return s===r.bluetooth?{...e,isConnected:!0,type:s,details:{isConnectionExpensive:n}}:s===r.cellular?{...e,isConnected:!0,type:s,details:{isConnectionExpensive:n,cellularGeneration:M[h.effectiveType]||null,carrier:null}}:s===r.ethernet?{...e,isConnected:!0,type:s,details:{isConnectionExpensive:n,ipAddress:null,subnet:null}}:s===r.wifi?{...e,isConnected:!0,type:s,details:{isConnectionExpensive:n,ssid:null,bssid:null,strength:null,ipAddress:null,subnet:null,frequency:null,linkSpeed:null,rxLinkSpeed:null,txLinkSpeed:null}}:s===r.wimax?{...e,isConnected:!0,type:s,details:{isConnectionExpensive:n}}:s===r.none?{...e,isConnected:!1,isInternetReachable:!1,type:s,details:null}:s===r.unknown?{...e,isConnected:i,isInternetReachable:null,type:s,details:null}:{...e,isConnected:!0,type:r.other,details:{isConnectionExpensive:n}}},I=[],R=[],L={addListener(t,i){switch(t){case y:{const e=()=>{i(k())};h?h.addEventListener("change",e):p&&(window.addEventListener("online",e,!1),window.addEventListener("offline",e,!1)),I.push(i),R.push(e);break}}},removeListeners(t,i){switch(t){case y:{const e=I.indexOf(i),n=R[e];h?h.removeEventListener("change",n):p&&(window.removeEventListener("online",n),window.removeEventListener("offline",n)),I.splice(e,1),R.splice(e,1);break}}},async getCurrentState(t){return k()},configure(){}},P=new H.NativeEventEmitter;L.addListener(y,t=>{P.emit(y,t)});const C={...L,eventEmitter:P};function l(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}class A{constructor(i,e){l(this,"_configuration",void 0),l(this,"_listener",void 0),l(this,"_isInternetReachable",void 0),l(this,"_currentInternetReachabilityCheckHandler",null),l(this,"_currentTimeoutHandle",null),l(this,"_setIsInternetReachable",n=>{this._isInternetReachable!==n&&(this._isInternetReachable=n,this._listener(this._isInternetReachable))}),l(this,"_setExpectsConnection",n=>{this._currentInternetReachabilityCheckHandler!==null&&(this._currentInternetReachabilityCheckHandler.cancel(),this._currentInternetReachabilityCheckHandler=null),this._currentTimeoutHandle!==null&&(clearTimeout(this._currentTimeoutHandle),this._currentTimeoutHandle=null),n&&this._configuration.reachabilityShouldRun()?(this._isInternetReachable||this._setIsInternetReachable(null),this._currentInternetReachabilityCheckHandler=this._checkInternetReachability()):this._setIsInternetReachable(!1)}),l(this,"_checkInternetReachability",()=>{const n=new AbortController,s=fetch(this._configuration.reachabilityUrl,{headers:this._configuration.reachabilityHeaders,method:this._configuration.reachabilityMethod,cache:"no-cache",signal:n.signal});let d;const o=new Promise((u,v)=>{d=setTimeout(()=>v("timedout"),this._configuration.reachabilityRequestTimeout)});let w=()=>{};const m=new Promise((u,v)=>{w=()=>v("canceled")});return{promise:Promise.race([s,o,m]).then(u=>this._configuration.reachabilityTest(u)).then(u=>{this._setIsInternetReachable(u);const v=this._isInternetReachable?this._configuration.reachabilityLongTimeout:this._configuration.reachabilityShortTimeout;this._currentTimeoutHandle=setTimeout(this._checkInternetReachability,v)}).catch(u=>{u==="canceled"?n.abort():(u==="timedout"&&n.abort(),this._setIsInternetReachable(!1),this._currentTimeoutHandle=setTimeout(this._checkInternetReachability,this._configuration.reachabilityShortTimeout))}).then(()=>{clearTimeout(d)},u=>{throw clearTimeout(d),u}),cancel:w}}),l(this,"update",n=>{typeof n.isInternetReachable=="boolean"&&this._configuration.useNativeReachability?this._setIsInternetReachable(n.isInternetReachable):this._setExpectsConnection(n.isConnected)}),l(this,"currentState",()=>this._isInternetReachable),l(this,"tearDown",()=>{this._currentInternetReachabilityCheckHandler!==null&&(this._currentInternetReachabilityCheckHandler.cancel(),this._currentInternetReachabilityCheckHandler=null),this._currentTimeoutHandle!==null&&(clearTimeout(this._currentTimeoutHandle),this._currentTimeoutHandle=null)}),this._configuration=i,this._listener=e}}function c(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}class x{constructor(i){c(this,"_nativeEventSubscription",null),c(this,"_subscriptions",new Set),c(this,"_latestState",null),c(this,"_internetReachability",void 0),c(this,"_handleNativeStateUpdate",e=>{this._internetReachability.update(e);const n=this._convertState(e);this._latestState=n,this._subscriptions.forEach(s=>s(n))}),c(this,"_handleInternetReachabilityUpdate",e=>{if(!this._latestState)return;const n={...this._latestState,isInternetReachable:e};this._latestState=n,this._subscriptions.forEach(s=>s(n))}),c(this,"_fetchCurrentState",async e=>{const n=await C.getCurrentState(e);this._internetReachability.update(n);const s=this._convertState(n);return e||(this._latestState=s,this._subscriptions.forEach(d=>d(s))),s}),c(this,"_convertState",e=>typeof e.isInternetReachable=="boolean"?e:{...e,isInternetReachable:this._internetReachability.currentState()}),c(this,"latest",e=>e?this._fetchCurrentState(e):this._latestState?Promise.resolve(this._latestState):this._fetchCurrentState()),c(this,"add",e=>{this._subscriptions.add(e),this._latestState?e(this._latestState):this.latest().then(e)}),c(this,"remove",e=>{this._subscriptions.delete(e)}),c(this,"tearDown",()=>{this._internetReachability&&this._internetReachability.tearDown(),this._nativeEventSubscription&&this._nativeEventSubscription.remove(),this._subscriptions.clear()}),this._internetReachability=new A(i,this._handleInternetReachabilityUpdate),this._nativeEventSubscription=C.eventEmitter.addListener(y,this._handleNativeStateUpdate),this._fetchCurrentState()}}let N=E,a=null;const g=()=>new x(N);let b=!1,S=[];function D(t){N={...E,...t},a&&(a.tearDown(),a=g()),H.Platform.OS==="ios"&&C.configure(t)}function F(t){return a||(a=g()),a.latest(t)}function V(){return a||(a=g()),b?new Promise(t=>{S.push(t)}):(b=!0,a._fetchCurrentState().then(t=>(S.forEach(i=>i(t)),S=[],t)).finally(()=>{b=!1}))}function O(t){return a||(a=g()),a.add(t),()=>{a&&a.remove(t)}}function z(t){t&&D(t);const[i,e]=f.useState({type:r.unknown,isConnected:null,isInternetReachable:null,details:null});return f.useEffect(()=>{const n=O(e);return()=>n()},[]),i}function W(t=!1,i){const[e,n]=f.useState(),[s,d]=f.useState({type:r.unknown,isConnected:null,isInternetReachable:null,details:null});f.useEffect(()=>{if(t)return;const w={...E,...i},m=new x(w);return n(m),m.add(d),m.tearDown},[t,i]);const o=f.useCallback(()=>{e&&!b&&(b=!0,e._fetchCurrentState().finally(()=>{b=!1}))},[e]);return{netInfo:s,refresh:o}}const T={configure:D,fetch:F,refresh:V,addEventListener:O,useNetInfo:z,useNetInfoInstance:W};class ${constructor(){}async collect(){try{const i=await T.fetch();return{type:i.type,isConnected:i.isConnected??void 0}}catch{return{type:"unknown",isConnected:void 0}}}async start(i){this.telemetry=i;const e=new q.NetworkChangeEmitter(i),n=await this.collect();return e.onSample(n.type),T.addEventListener(s=>e.onSample(s.type)),n}}exports.NetworkInfoTrackerNative=$;
2
- //# sourceMappingURL=networkInfo.native-cxuw93Uy.cjs.map
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),H=require("react-native"),q=require("./networkChange-CUO1hRLj.cjs"),E={reachabilityUrl:"/",reachabilityMethod:"HEAD",reachabilityHeaders:{},reachabilityTest:t=>Promise.resolve(t.status===200),reachabilityShortTimeout:5*1e3,reachabilityLongTimeout:60*1e3,reachabilityRequestTimeout:15*1e3,reachabilityShouldRun:()=>!0,shouldFetchWiFiSSID:!0,useNativeReachability:!0},v="netInfo.networkStatusDidChange";let r;(function(t){t.unknown="unknown",t.none="none",t.cellular="cellular",t.wifi="wifi",t.bluetooth="bluetooth",t.ethernet="ethernet",t.wimax="wimax",t.vpn="vpn",t.other="other"})(r||(r={}));let _;(function(t){t["2g"]="2g",t["3g"]="3g",t["4g"]="4g",t["5g"]="5g"})(_||(_={}));const p=typeof window<"u",h=p&&!window.hasOwnProperty("tizen")&&!window.hasOwnProperty("webOS")?window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection:void 0,U={bluetooth:r.bluetooth,cellular:r.cellular,ethernet:r.ethernet,none:r.none,other:r.other,unknown:r.unknown,wifi:r.wifi,wimax:r.wimax,mixed:r.other},M={"2g":_["2g"],"3g":_["3g"],"4g":_["4g"],"slow-2g":_["2g"]},k=t=>{const i=p?navigator.onLine:!1,e={isInternetReachable:null};if(!h)return i?{...e,isConnected:!0,type:r.other,details:{isConnectionExpensive:!1}}:{...e,isConnected:!1,isInternetReachable:!1,type:r.none,details:null};const n=h.saveData,s=h.type?U[h.type]:i?r.other:r.unknown;return s===r.bluetooth?{...e,isConnected:!0,type:s,details:{isConnectionExpensive:n}}:s===r.cellular?{...e,isConnected:!0,type:s,details:{isConnectionExpensive:n,cellularGeneration:M[h.effectiveType]||null,carrier:null}}:s===r.ethernet?{...e,isConnected:!0,type:s,details:{isConnectionExpensive:n,ipAddress:null,subnet:null}}:s===r.wifi?{...e,isConnected:!0,type:s,details:{isConnectionExpensive:n,ssid:null,bssid:null,strength:null,ipAddress:null,subnet:null,frequency:null,linkSpeed:null,rxLinkSpeed:null,txLinkSpeed:null}}:s===r.wimax?{...e,isConnected:!0,type:s,details:{isConnectionExpensive:n}}:s===r.none?{...e,isConnected:!1,isInternetReachable:!1,type:s,details:null}:s===r.unknown?{...e,isConnected:i,isInternetReachable:null,type:s,details:null}:{...e,isConnected:!0,type:r.other,details:{isConnectionExpensive:n}}},I=[],R=[],L={addListener(t,i){switch(t){case v:{const e=()=>{i(k())};h?h.addEventListener("change",e):p&&(window.addEventListener("online",e,!1),window.addEventListener("offline",e,!1)),I.push(i),R.push(e);break}}},removeListeners(t,i){switch(t){case v:{const e=I.indexOf(i),n=R[e];h?h.removeEventListener("change",n):p&&(window.removeEventListener("online",n),window.removeEventListener("offline",n)),I.splice(e,1),R.splice(e,1);break}}},async getCurrentState(t){return k()},configure(){}},P=new H.NativeEventEmitter;L.addListener(v,t=>{P.emit(v,t)});const C={...L,eventEmitter:P};function l(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}class A{constructor(i,e){l(this,"_configuration",void 0),l(this,"_listener",void 0),l(this,"_isInternetReachable",void 0),l(this,"_currentInternetReachabilityCheckHandler",null),l(this,"_currentTimeoutHandle",null),l(this,"_setIsInternetReachable",n=>{this._isInternetReachable!==n&&(this._isInternetReachable=n,this._listener(this._isInternetReachable))}),l(this,"_setExpectsConnection",n=>{this._currentInternetReachabilityCheckHandler!==null&&(this._currentInternetReachabilityCheckHandler.cancel(),this._currentInternetReachabilityCheckHandler=null),this._currentTimeoutHandle!==null&&(clearTimeout(this._currentTimeoutHandle),this._currentTimeoutHandle=null),n&&this._configuration.reachabilityShouldRun()?(this._isInternetReachable||this._setIsInternetReachable(null),this._currentInternetReachabilityCheckHandler=this._checkInternetReachability()):this._setIsInternetReachable(!1)}),l(this,"_checkInternetReachability",()=>{const n=new AbortController,s=fetch(this._configuration.reachabilityUrl,{headers:this._configuration.reachabilityHeaders,method:this._configuration.reachabilityMethod,cache:"no-cache",signal:n.signal});let d;const o=new Promise((u,y)=>{d=setTimeout(()=>y("timedout"),this._configuration.reachabilityRequestTimeout)});let w=()=>{};const m=new Promise((u,y)=>{w=()=>y("canceled")});return{promise:Promise.race([s,o,m]).then(u=>this._configuration.reachabilityTest(u)).then(u=>{this._setIsInternetReachable(u);const y=this._isInternetReachable?this._configuration.reachabilityLongTimeout:this._configuration.reachabilityShortTimeout;this._currentTimeoutHandle=setTimeout(this._checkInternetReachability,y)}).catch(u=>{u==="canceled"?n.abort():(u==="timedout"&&n.abort(),this._setIsInternetReachable(!1),this._currentTimeoutHandle=setTimeout(this._checkInternetReachability,this._configuration.reachabilityShortTimeout))}).then(()=>{clearTimeout(d)},u=>{throw clearTimeout(d),u}),cancel:w}}),l(this,"update",n=>{typeof n.isInternetReachable=="boolean"&&this._configuration.useNativeReachability?this._setIsInternetReachable(n.isInternetReachable):this._setExpectsConnection(n.isConnected)}),l(this,"currentState",()=>this._isInternetReachable),l(this,"tearDown",()=>{this._currentInternetReachabilityCheckHandler!==null&&(this._currentInternetReachabilityCheckHandler.cancel(),this._currentInternetReachabilityCheckHandler=null),this._currentTimeoutHandle!==null&&(clearTimeout(this._currentTimeoutHandle),this._currentTimeoutHandle=null)}),this._configuration=i,this._listener=e}}function c(t,i,e){return i in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}class x{constructor(i){c(this,"_nativeEventSubscription",null),c(this,"_subscriptions",new Set),c(this,"_latestState",null),c(this,"_internetReachability",void 0),c(this,"_handleNativeStateUpdate",e=>{this._internetReachability.update(e);const n=this._convertState(e);this._latestState=n,this._subscriptions.forEach(s=>s(n))}),c(this,"_handleInternetReachabilityUpdate",e=>{if(!this._latestState)return;const n={...this._latestState,isInternetReachable:e};this._latestState=n,this._subscriptions.forEach(s=>s(n))}),c(this,"_fetchCurrentState",async e=>{const n=await C.getCurrentState(e);this._internetReachability.update(n);const s=this._convertState(n);return e||(this._latestState=s,this._subscriptions.forEach(d=>d(s))),s}),c(this,"_convertState",e=>typeof e.isInternetReachable=="boolean"?e:{...e,isInternetReachable:this._internetReachability.currentState()}),c(this,"latest",e=>e?this._fetchCurrentState(e):this._latestState?Promise.resolve(this._latestState):this._fetchCurrentState()),c(this,"add",e=>{this._subscriptions.add(e),this._latestState?e(this._latestState):this.latest().then(e)}),c(this,"remove",e=>{this._subscriptions.delete(e)}),c(this,"tearDown",()=>{this._internetReachability&&this._internetReachability.tearDown(),this._nativeEventSubscription&&this._nativeEventSubscription.remove(),this._subscriptions.clear()}),this._internetReachability=new A(i,this._handleInternetReachabilityUpdate),this._nativeEventSubscription=C.eventEmitter.addListener(v,this._handleNativeStateUpdate),this._fetchCurrentState()}}let N=E,a=null;const g=()=>new x(N);let b=!1,S=[];function D(t){N={...E,...t},a&&(a.tearDown(),a=g()),H.Platform.OS==="ios"&&C.configure(t)}function F(t){return a||(a=g()),a.latest(t)}function $(){return a||(a=g()),b?new Promise(t=>{S.push(t)}):(b=!0,a._fetchCurrentState().then(t=>(S.forEach(i=>i(t)),S=[],t)).finally(()=>{b=!1}))}function O(t){return a||(a=g()),a.add(t),()=>{a&&a.remove(t)}}function V(t){t&&D(t);const[i,e]=f.useState({type:r.unknown,isConnected:null,isInternetReachable:null,details:null});return f.useEffect(()=>{const n=O(e);return()=>n()},[]),i}function z(t=!1,i){const[e,n]=f.useState(),[s,d]=f.useState({type:r.unknown,isConnected:null,isInternetReachable:null,details:null});f.useEffect(()=>{if(t)return;const w={...E,...i},m=new x(w);return n(m),m.add(d),m.tearDown},[t,i]);const o=f.useCallback(()=>{e&&!b&&(b=!0,e._fetchCurrentState().finally(()=>{b=!1}))},[e]);return{netInfo:s,refresh:o}}const T={configure:D,fetch:F,refresh:$,addEventListener:O,useNetInfo:V,useNetInfoInstance:z};class W{constructor(){}async collect(){try{const i=await T.fetch();return{type:i.type,is_connected:i.isConnected??void 0}}catch{return{type:"unknown",is_connected:void 0}}}async start(i){this.telemetry=i;const e=new q.NetworkChangeEmitter(i),n=await this.collect();return e.onSample(n.type),T.addEventListener(s=>e.onSample(s.type)),n}}exports.NetworkInfoTrackerNative=W;
2
+ //# sourceMappingURL=networkInfo.native-YVySdv3S.cjs.map