@multiplayer-app/session-recorder-react-native 1.0.0 → 1.0.1-beta.10

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 (463) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +216 -155
  3. package/SessionRecorderNative.podspec +35 -14
  4. package/android/build.gradle +65 -22
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/com/sessionrecordernative/SessionRecorderNativeConfig.kt +52 -0
  8. package/android/src/main/java/com/sessionrecordernative/SessionRecorderNativeModule.kt +861 -0
  9. package/android/src/main/java/com/sessionrecordernative/SessionRecorderNativePackage.kt +33 -0
  10. package/android/src/main/java/com/sessionrecordernative/SessionRecorderNativeSpec.kt +79 -0
  11. package/android/src/main/java/com/sessionrecordernative/model/TargetInfo.kt +9 -0
  12. package/android/src/main/java/com/sessionrecordernative/util/ViewUtils.kt +72 -0
  13. package/ios/GestureTargetFinder.swift +50 -0
  14. package/ios/SessionRecorderNative-Bridging-Header.h +2 -0
  15. package/ios/{GestureRecorderNative.m → SessionRecorderNative.mm} +17 -6
  16. package/ios/SessionRecorderNative.swift +256 -4
  17. package/lib/module/SessionRecorderNativeSpec.js +5 -0
  18. package/lib/module/SessionRecorderNativeSpec.js.map +1 -0
  19. package/lib/module/components/ScreenRecorderView/ScreenRecorderView.js +23 -0
  20. package/lib/module/components/ScreenRecorderView/ScreenRecorderView.js.map +1 -0
  21. package/lib/module/components/ScreenRecorderView/index.js +4 -0
  22. package/lib/module/components/ScreenRecorderView/index.js.map +1 -0
  23. package/lib/module/components/SessionRecorderWidget/ErrorBanner.js +64 -0
  24. package/lib/module/components/SessionRecorderWidget/ErrorBanner.js.map +1 -0
  25. package/lib/module/components/SessionRecorderWidget/FinalPopover.js +74 -0
  26. package/lib/module/components/SessionRecorderWidget/FinalPopover.js.map +1 -0
  27. package/lib/module/components/SessionRecorderWidget/FloatingButton.js +191 -0
  28. package/lib/module/components/SessionRecorderWidget/FloatingButton.js.map +1 -0
  29. package/lib/module/components/SessionRecorderWidget/InitialPopover.js +138 -0
  30. package/lib/module/components/SessionRecorderWidget/InitialPopover.js.map +1 -0
  31. package/lib/module/components/SessionRecorderWidget/ModalContainer.js +177 -0
  32. package/lib/module/components/SessionRecorderWidget/ModalContainer.js.map +1 -0
  33. package/lib/module/components/SessionRecorderWidget/ModalHeader.js +27 -0
  34. package/lib/module/components/SessionRecorderWidget/ModalHeader.js.map +1 -0
  35. package/lib/module/components/SessionRecorderWidget/SessionRecorderWidget.js +133 -0
  36. package/lib/module/components/SessionRecorderWidget/SessionRecorderWidget.js.map +1 -0
  37. package/lib/module/components/SessionRecorderWidget/icons.js +93 -0
  38. package/lib/module/components/SessionRecorderWidget/icons.js.map +1 -0
  39. package/lib/module/components/SessionRecorderWidget/index.js +5 -0
  40. package/lib/module/components/SessionRecorderWidget/index.js.map +1 -0
  41. package/lib/module/components/SessionRecorderWidget/styles.js +173 -0
  42. package/lib/module/components/SessionRecorderWidget/styles.js.map +1 -0
  43. package/lib/module/components/index.js +5 -0
  44. package/lib/module/components/index.js.map +1 -0
  45. package/lib/module/config/constants.js +42 -0
  46. package/lib/module/config/constants.js.map +1 -0
  47. package/lib/module/config/defaults.js +81 -0
  48. package/lib/module/config/defaults.js.map +1 -0
  49. package/lib/module/config/index.js +9 -0
  50. package/lib/module/config/index.js.map +1 -0
  51. package/lib/module/config/masking.js +35 -0
  52. package/lib/module/config/masking.js.map +1 -0
  53. package/lib/module/config/session-recorder.js +44 -0
  54. package/lib/module/config/session-recorder.js.map +1 -0
  55. package/lib/module/config/validators.js +28 -0
  56. package/lib/module/config/validators.js.map +1 -0
  57. package/lib/module/config/widget.js +35 -0
  58. package/lib/module/config/widget.js.map +1 -0
  59. package/lib/module/context/SessionRecorderContext.js +93 -0
  60. package/lib/module/context/SessionRecorderContext.js.map +1 -0
  61. package/lib/module/context/SessionRecorderStore.js +12 -0
  62. package/lib/module/context/SessionRecorderStore.js.map +1 -0
  63. package/lib/module/context/useSessionRecorderStore.js +20 -0
  64. package/lib/module/context/useSessionRecorderStore.js.map +1 -0
  65. package/lib/module/context/useStoreSelector.js +27 -0
  66. package/lib/module/context/useStoreSelector.js.map +1 -0
  67. package/lib/module/index.js +16 -0
  68. package/lib/module/index.js.map +1 -0
  69. package/lib/module/native/SessionRecorderNative.js +79 -0
  70. package/lib/module/native/SessionRecorderNative.js.map +1 -0
  71. package/lib/module/native/index.js +4 -0
  72. package/lib/module/native/index.js.map +1 -0
  73. package/lib/module/otel/helpers.js +218 -0
  74. package/lib/module/otel/helpers.js.map +1 -0
  75. package/lib/module/otel/index.js +95 -0
  76. package/lib/module/otel/index.js.map +1 -0
  77. package/lib/module/otel/instrumentations/index.js +102 -0
  78. package/lib/module/otel/instrumentations/index.js.map +1 -0
  79. package/lib/module/package.json +1 -0
  80. package/lib/module/patch/index.js +4 -0
  81. package/lib/module/patch/index.js.map +1 -0
  82. package/lib/module/patch/xhr.js +116 -0
  83. package/lib/module/patch/xhr.js.map +1 -0
  84. package/lib/module/recorder/eventExporter.js +130 -0
  85. package/lib/module/recorder/eventExporter.js.map +1 -0
  86. package/lib/module/recorder/gestureRecorder.js +641 -0
  87. package/lib/module/recorder/gestureRecorder.js.map +1 -0
  88. package/lib/module/recorder/index.js +168 -0
  89. package/lib/module/recorder/index.js.map +1 -0
  90. package/lib/module/recorder/navigationTracker.js +228 -0
  91. package/lib/module/recorder/navigationTracker.js.map +1 -0
  92. package/lib/module/recorder/screenRecorder.js +495 -0
  93. package/lib/module/recorder/screenRecorder.js.map +1 -0
  94. package/lib/module/services/api.service.js +149 -0
  95. package/lib/module/services/api.service.js.map +1 -0
  96. package/lib/module/services/network.service.js +178 -0
  97. package/lib/module/services/network.service.js.map +1 -0
  98. package/lib/module/services/screenMaskingService.js +107 -0
  99. package/lib/module/services/screenMaskingService.js.map +1 -0
  100. package/lib/module/services/storage.service.js +179 -0
  101. package/lib/module/services/storage.service.js.map +1 -0
  102. package/lib/module/session-recorder.js +541 -0
  103. package/lib/module/session-recorder.js.map +1 -0
  104. package/lib/module/types/configs.js +4 -0
  105. package/lib/module/types/configs.js.map +1 -0
  106. package/lib/module/types/expo-constants.d.js +2 -0
  107. package/lib/module/types/expo-constants.d.js.map +1 -0
  108. package/lib/module/types/index.js +11 -0
  109. package/lib/module/types/index.js.map +1 -0
  110. package/lib/module/types/session-recorder.js +68 -0
  111. package/lib/module/types/session-recorder.js.map +1 -0
  112. package/lib/module/types/session.js +9 -0
  113. package/lib/module/types/session.js.map +1 -0
  114. package/lib/module/utils/app-metadata.js +28 -0
  115. package/lib/module/utils/app-metadata.js.map +1 -0
  116. package/lib/module/utils/constants.optional.expo.js +6 -0
  117. package/lib/module/utils/constants.optional.expo.js.map +1 -0
  118. package/lib/module/utils/constants.optional.js +8 -0
  119. package/lib/module/utils/constants.optional.js.map +1 -0
  120. package/lib/module/utils/createStore.js +27 -0
  121. package/lib/module/utils/createStore.js.map +1 -0
  122. package/lib/module/utils/index.js +11 -0
  123. package/lib/module/utils/index.js.map +1 -0
  124. package/lib/module/utils/logger.js +185 -0
  125. package/lib/module/utils/logger.js.map +1 -0
  126. package/lib/module/utils/platform.js +340 -0
  127. package/lib/module/utils/platform.js.map +1 -0
  128. package/lib/module/utils/request-utils.js +58 -0
  129. package/lib/module/utils/request-utils.js.map +1 -0
  130. package/lib/module/utils/rrweb-events.js +276 -0
  131. package/lib/module/utils/rrweb-events.js.map +1 -0
  132. package/lib/module/utils/session.js +21 -0
  133. package/lib/module/utils/session.js.map +1 -0
  134. package/lib/module/utils/shallowEqual.js +17 -0
  135. package/lib/module/utils/shallowEqual.js.map +1 -0
  136. package/lib/module/utils/time.js +17 -0
  137. package/lib/module/utils/time.js.map +1 -0
  138. package/lib/module/utils/type-utils.js +69 -0
  139. package/lib/module/utils/type-utils.js.map +1 -0
  140. package/lib/module/version.js +4 -0
  141. package/lib/module/version.js.map +1 -0
  142. package/lib/typescript/package.json +1 -0
  143. package/{dist/native/SessionRecorderNative.d.ts → lib/typescript/src/SessionRecorderNativeSpec.d.ts} +23 -15
  144. package/lib/typescript/src/SessionRecorderNativeSpec.d.ts.map +1 -0
  145. package/lib/typescript/src/components/ScreenRecorderView/ScreenRecorderView.d.ts +6 -0
  146. package/lib/typescript/src/components/ScreenRecorderView/ScreenRecorderView.d.ts.map +1 -0
  147. package/lib/typescript/src/components/ScreenRecorderView/index.d.ts +2 -0
  148. package/lib/typescript/src/components/ScreenRecorderView/index.d.ts.map +1 -0
  149. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/ErrorBanner.d.ts +1 -0
  150. package/lib/typescript/src/components/SessionRecorderWidget/ErrorBanner.d.ts.map +1 -0
  151. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/FinalPopover.d.ts +2 -1
  152. package/lib/typescript/src/components/SessionRecorderWidget/FinalPopover.d.ts.map +1 -0
  153. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/FloatingButton.d.ts +1 -0
  154. package/lib/typescript/src/components/SessionRecorderWidget/FloatingButton.d.ts.map +1 -0
  155. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/InitialPopover.d.ts +2 -1
  156. package/lib/typescript/src/components/SessionRecorderWidget/InitialPopover.d.ts.map +1 -0
  157. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/ModalContainer.d.ts +1 -0
  158. package/lib/typescript/src/components/SessionRecorderWidget/ModalContainer.d.ts.map +1 -0
  159. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/ModalHeader.d.ts +1 -0
  160. package/lib/typescript/src/components/SessionRecorderWidget/ModalHeader.d.ts.map +1 -0
  161. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/SessionRecorderWidget.d.ts +1 -0
  162. package/lib/typescript/src/components/SessionRecorderWidget/SessionRecorderWidget.d.ts.map +1 -0
  163. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/icons.d.ts +1 -0
  164. package/lib/typescript/src/components/SessionRecorderWidget/icons.d.ts.map +1 -0
  165. package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts +3 -0
  166. package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts.map +1 -0
  167. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/styles.d.ts +4 -3
  168. package/lib/typescript/src/components/SessionRecorderWidget/styles.d.ts.map +1 -0
  169. package/lib/typescript/src/components/index.d.ts +3 -0
  170. package/lib/typescript/src/components/index.d.ts.map +1 -0
  171. package/{dist → lib/typescript/src}/config/constants.d.ts +1 -0
  172. package/lib/typescript/src/config/constants.d.ts.map +1 -0
  173. package/{dist → lib/typescript/src}/config/defaults.d.ts +2 -1
  174. package/lib/typescript/src/config/defaults.d.ts.map +1 -0
  175. package/{dist → lib/typescript/src}/config/index.d.ts +1 -0
  176. package/lib/typescript/src/config/index.d.ts.map +1 -0
  177. package/lib/typescript/src/config/masking.d.ts +3 -0
  178. package/lib/typescript/src/config/masking.d.ts.map +1 -0
  179. package/lib/typescript/src/config/session-recorder.d.ts +3 -0
  180. package/lib/typescript/src/config/session-recorder.d.ts.map +1 -0
  181. package/{dist → lib/typescript/src}/config/validators.d.ts +1 -0
  182. package/lib/typescript/src/config/validators.d.ts.map +1 -0
  183. package/{dist → lib/typescript/src}/config/widget.d.ts +2 -1
  184. package/lib/typescript/src/config/widget.d.ts.map +1 -0
  185. package/{dist → lib/typescript/src}/context/SessionRecorderContext.d.ts +3 -2
  186. package/lib/typescript/src/context/SessionRecorderContext.d.ts.map +1 -0
  187. package/{dist → lib/typescript/src}/context/SessionRecorderStore.d.ts +2 -1
  188. package/lib/typescript/src/context/SessionRecorderStore.d.ts.map +1 -0
  189. package/{dist → lib/typescript/src}/context/useSessionRecorderStore.d.ts +4 -3
  190. package/lib/typescript/src/context/useSessionRecorderStore.d.ts.map +1 -0
  191. package/{dist → lib/typescript/src}/context/useStoreSelector.d.ts +2 -1
  192. package/lib/typescript/src/context/useStoreSelector.d.ts.map +1 -0
  193. package/{dist → lib/typescript/src}/index.d.ts +2 -0
  194. package/lib/typescript/src/index.d.ts.map +1 -0
  195. package/lib/typescript/src/native/SessionRecorderNative.d.ts +27 -0
  196. package/lib/typescript/src/native/SessionRecorderNative.d.ts.map +1 -0
  197. package/lib/typescript/src/native/index.d.ts +2 -0
  198. package/lib/typescript/src/native/index.d.ts.map +1 -0
  199. package/{dist → lib/typescript/src}/otel/helpers.d.ts +3 -2
  200. package/lib/typescript/src/otel/helpers.d.ts.map +1 -0
  201. package/{dist → lib/typescript/src}/otel/index.d.ts +2 -2
  202. package/lib/typescript/src/otel/index.d.ts.map +1 -0
  203. package/{dist → lib/typescript/src}/otel/instrumentations/index.d.ts +2 -1
  204. package/lib/typescript/src/otel/instrumentations/index.d.ts.map +1 -0
  205. package/lib/typescript/src/patch/index.d.ts +2 -0
  206. package/lib/typescript/src/patch/index.d.ts.map +1 -0
  207. package/{dist → lib/typescript/src}/patch/xhr.d.ts +1 -0
  208. package/lib/typescript/src/patch/xhr.d.ts.map +1 -0
  209. package/{dist → lib/typescript/src}/recorder/eventExporter.d.ts +2 -1
  210. package/lib/typescript/src/recorder/eventExporter.d.ts.map +1 -0
  211. package/{dist → lib/typescript/src}/recorder/gestureRecorder.d.ts +3 -2
  212. package/lib/typescript/src/recorder/gestureRecorder.d.ts.map +1 -0
  213. package/{dist → lib/typescript/src}/recorder/index.d.ts +3 -2
  214. package/lib/typescript/src/recorder/index.d.ts.map +1 -0
  215. package/{dist → lib/typescript/src}/recorder/navigationTracker.d.ts +2 -1
  216. package/lib/typescript/src/recorder/navigationTracker.d.ts.map +1 -0
  217. package/{dist → lib/typescript/src}/recorder/screenRecorder.d.ts +4 -4
  218. package/lib/typescript/src/recorder/screenRecorder.d.ts.map +1 -0
  219. package/{dist → lib/typescript/src}/services/api.service.d.ts +2 -1
  220. package/lib/typescript/src/services/api.service.d.ts.map +1 -0
  221. package/{dist → lib/typescript/src}/services/network.service.d.ts +1 -0
  222. package/lib/typescript/src/services/network.service.d.ts.map +1 -0
  223. package/{dist → lib/typescript/src}/services/screenMaskingService.d.ts +2 -1
  224. package/lib/typescript/src/services/screenMaskingService.d.ts.map +1 -0
  225. package/{dist → lib/typescript/src}/services/storage.service.d.ts +2 -1
  226. package/lib/typescript/src/services/storage.service.d.ts.map +1 -0
  227. package/{dist → lib/typescript/src}/session-recorder.d.ts +3 -2
  228. package/lib/typescript/src/session-recorder.d.ts.map +1 -0
  229. package/{dist → lib/typescript/src}/types/configs.d.ts +3 -2
  230. package/lib/typescript/src/types/configs.d.ts.map +1 -0
  231. package/{dist → lib/typescript/src}/types/index.d.ts +1 -0
  232. package/lib/typescript/src/types/index.d.ts.map +1 -0
  233. package/{dist → lib/typescript/src}/types/session-recorder.d.ts +7 -6
  234. package/lib/typescript/src/types/session-recorder.d.ts.map +1 -0
  235. package/{dist → lib/typescript/src}/types/session.d.ts +1 -0
  236. package/lib/typescript/src/types/session.d.ts.map +1 -0
  237. package/{dist → lib/typescript/src}/utils/app-metadata.d.ts +1 -0
  238. package/lib/typescript/src/utils/app-metadata.d.ts.map +1 -0
  239. package/{dist → lib/typescript/src}/utils/constants.optional.d.ts +1 -0
  240. package/lib/typescript/src/utils/constants.optional.d.ts.map +1 -0
  241. package/{dist → lib/typescript/src}/utils/constants.optional.expo.d.ts +1 -0
  242. package/lib/typescript/src/utils/constants.optional.expo.d.ts.map +1 -0
  243. package/{dist → lib/typescript/src}/utils/createStore.d.ts +1 -0
  244. package/lib/typescript/src/utils/createStore.d.ts.map +1 -0
  245. package/lib/typescript/src/utils/index.d.ts +8 -0
  246. package/lib/typescript/src/utils/index.d.ts.map +1 -0
  247. package/{dist → lib/typescript/src}/utils/logger.d.ts +2 -1
  248. package/lib/typescript/src/utils/logger.d.ts.map +1 -0
  249. package/{dist → lib/typescript/src}/utils/platform.d.ts +2 -1
  250. package/lib/typescript/src/utils/platform.d.ts.map +1 -0
  251. package/{dist → lib/typescript/src}/utils/request-utils.d.ts +1 -0
  252. package/lib/typescript/src/utils/request-utils.d.ts.map +1 -0
  253. package/{dist → lib/typescript/src}/utils/rrweb-events.d.ts +2 -1
  254. package/lib/typescript/src/utils/rrweb-events.d.ts.map +1 -0
  255. package/{dist → lib/typescript/src}/utils/session.d.ts +1 -0
  256. package/lib/typescript/src/utils/session.d.ts.map +1 -0
  257. package/{dist → lib/typescript/src}/utils/shallowEqual.d.ts +1 -0
  258. package/lib/typescript/src/utils/shallowEqual.d.ts.map +1 -0
  259. package/{dist → lib/typescript/src}/utils/time.d.ts +1 -0
  260. package/lib/typescript/src/utils/time.d.ts.map +1 -0
  261. package/{dist → lib/typescript/src}/utils/type-utils.d.ts +1 -0
  262. package/lib/typescript/src/utils/type-utils.d.ts.map +1 -0
  263. package/lib/typescript/src/version.d.ts +2 -0
  264. package/lib/typescript/src/version.d.ts.map +1 -0
  265. package/package.json +157 -39
  266. package/react-native.config.js +8 -6
  267. package/src/SessionRecorderNativeSpec.ts +52 -0
  268. package/src/components/ScreenRecorderView/ScreenRecorderView.tsx +20 -0
  269. package/src/components/ScreenRecorderView/index.ts +1 -0
  270. package/src/components/SessionRecorderWidget/ErrorBanner.tsx +58 -0
  271. package/src/components/SessionRecorderWidget/FinalPopover.tsx +96 -0
  272. package/src/components/SessionRecorderWidget/FloatingButton.tsx +176 -0
  273. package/src/components/SessionRecorderWidget/InitialPopover.tsx +167 -0
  274. package/src/components/SessionRecorderWidget/ModalContainer.tsx +189 -0
  275. package/src/components/SessionRecorderWidget/ModalHeader.tsx +26 -0
  276. package/src/components/SessionRecorderWidget/SessionRecorderWidget.tsx +150 -0
  277. package/src/components/SessionRecorderWidget/icons.tsx +80 -0
  278. package/src/components/SessionRecorderWidget/index.ts +3 -0
  279. package/src/components/SessionRecorderWidget/styles.ts +168 -0
  280. package/src/config/constants.ts +67 -0
  281. package/src/config/defaults.ts +105 -0
  282. package/src/config/index.ts +6 -0
  283. package/src/config/masking.ts +60 -0
  284. package/src/config/session-recorder.ts +87 -0
  285. package/src/config/validators.ts +54 -0
  286. package/src/config/widget.ts +47 -0
  287. package/src/context/SessionRecorderContext.tsx +138 -0
  288. package/src/context/SessionRecorderStore.ts +22 -0
  289. package/src/context/useSessionRecorderStore.ts +34 -0
  290. package/src/context/useStoreSelector.ts +36 -0
  291. package/src/index.ts +13 -0
  292. package/src/native/SessionRecorderNative.ts +120 -0
  293. package/src/native/index.ts +5 -0
  294. package/src/otel/helpers.ts +290 -0
  295. package/src/otel/index.ts +132 -0
  296. package/src/otel/instrumentations/index.ts +118 -0
  297. package/src/patch/xhr.ts +148 -0
  298. package/src/recorder/eventExporter.ts +150 -0
  299. package/src/recorder/gestureRecorder.ts +828 -0
  300. package/src/recorder/index.ts +203 -0
  301. package/src/recorder/navigationTracker.ts +268 -0
  302. package/src/recorder/screenRecorder.ts +600 -0
  303. package/src/services/api.service.ts +216 -0
  304. package/src/services/network.service.ts +191 -0
  305. package/src/services/screenMaskingService.ts +153 -0
  306. package/src/services/storage.service.ts +248 -0
  307. package/src/session-recorder.ts +647 -0
  308. package/src/types/configs.ts +118 -0
  309. package/src/types/expo-constants.d.ts +7 -0
  310. package/src/types/index.ts +27 -0
  311. package/src/types/session-recorder.ts +381 -0
  312. package/src/types/session.ts +65 -0
  313. package/src/utils/app-metadata.ts +31 -0
  314. package/src/utils/constants.optional.expo.ts +5 -0
  315. package/src/utils/constants.optional.ts +18 -0
  316. package/src/utils/createStore.ts +32 -0
  317. package/{dist/utils/index.d.ts → src/utils/index.ts} +1 -0
  318. package/src/utils/logger.ts +245 -0
  319. package/src/utils/platform.ts +401 -0
  320. package/src/utils/request-utils.ts +61 -0
  321. package/src/utils/rrweb-events.ts +329 -0
  322. package/src/utils/session.ts +22 -0
  323. package/src/utils/shallowEqual.ts +20 -0
  324. package/src/utils/time.ts +20 -0
  325. package/src/utils/type-utils.ts +75 -0
  326. package/src/version.ts +1 -0
  327. package/copy-react-native-dist.sh +0 -56
  328. package/dist/components/ScreenRecorderView/ScreenRecorderView.d.ts +0 -5
  329. package/dist/components/ScreenRecorderView/ScreenRecorderView.js +0 -1
  330. package/dist/components/ScreenRecorderView/ScreenRecorderView.js.map +0 -1
  331. package/dist/components/ScreenRecorderView/index.d.ts +0 -1
  332. package/dist/components/ScreenRecorderView/index.js +0 -1
  333. package/dist/components/ScreenRecorderView/index.js.map +0 -1
  334. package/dist/components/SessionRecorderWidget/ErrorBanner.js +0 -1
  335. package/dist/components/SessionRecorderWidget/ErrorBanner.js.map +0 -1
  336. package/dist/components/SessionRecorderWidget/FinalPopover.js +0 -1
  337. package/dist/components/SessionRecorderWidget/FinalPopover.js.map +0 -1
  338. package/dist/components/SessionRecorderWidget/FloatingButton.js +0 -1
  339. package/dist/components/SessionRecorderWidget/FloatingButton.js.map +0 -1
  340. package/dist/components/SessionRecorderWidget/InitialPopover.js +0 -1
  341. package/dist/components/SessionRecorderWidget/InitialPopover.js.map +0 -1
  342. package/dist/components/SessionRecorderWidget/ModalContainer.js +0 -1
  343. package/dist/components/SessionRecorderWidget/ModalContainer.js.map +0 -1
  344. package/dist/components/SessionRecorderWidget/ModalHeader.js +0 -1
  345. package/dist/components/SessionRecorderWidget/ModalHeader.js.map +0 -1
  346. package/dist/components/SessionRecorderWidget/SessionRecorderWidget.js +0 -1
  347. package/dist/components/SessionRecorderWidget/SessionRecorderWidget.js.map +0 -1
  348. package/dist/components/SessionRecorderWidget/icons.js +0 -1
  349. package/dist/components/SessionRecorderWidget/icons.js.map +0 -1
  350. package/dist/components/SessionRecorderWidget/index.d.ts +0 -2
  351. package/dist/components/SessionRecorderWidget/index.js +0 -1
  352. package/dist/components/SessionRecorderWidget/index.js.map +0 -1
  353. package/dist/components/SessionRecorderWidget/styles.js +0 -1
  354. package/dist/components/SessionRecorderWidget/styles.js.map +0 -1
  355. package/dist/components/index.js +0 -1
  356. package/dist/components/index.js.map +0 -1
  357. package/dist/config/constants.js +0 -1
  358. package/dist/config/constants.js.map +0 -1
  359. package/dist/config/defaults.js +0 -1
  360. package/dist/config/defaults.js.map +0 -1
  361. package/dist/config/index.js +0 -1
  362. package/dist/config/index.js.map +0 -1
  363. package/dist/config/masking.d.ts +0 -2
  364. package/dist/config/masking.js +0 -1
  365. package/dist/config/masking.js.map +0 -1
  366. package/dist/config/session-recorder.d.ts +0 -2
  367. package/dist/config/session-recorder.js +0 -1
  368. package/dist/config/session-recorder.js.map +0 -1
  369. package/dist/config/validators.js +0 -1
  370. package/dist/config/validators.js.map +0 -1
  371. package/dist/config/widget.js +0 -1
  372. package/dist/config/widget.js.map +0 -1
  373. package/dist/context/SessionRecorderContext.js +0 -1
  374. package/dist/context/SessionRecorderContext.js.map +0 -1
  375. package/dist/context/SessionRecorderStore.js +0 -1
  376. package/dist/context/SessionRecorderStore.js.map +0 -1
  377. package/dist/context/useSessionRecorderStore.js +0 -1
  378. package/dist/context/useSessionRecorderStore.js.map +0 -1
  379. package/dist/context/useStoreSelector.js +0 -1
  380. package/dist/context/useStoreSelector.js.map +0 -1
  381. package/dist/index.js +0 -1
  382. package/dist/index.js.map +0 -1
  383. package/dist/native/GestureRecorderNative.d.ts +0 -57
  384. package/dist/native/GestureRecorderNative.js +0 -1
  385. package/dist/native/GestureRecorderNative.js.map +0 -1
  386. package/dist/native/SessionRecorderNative.js +0 -1
  387. package/dist/native/SessionRecorderNative.js.map +0 -1
  388. package/dist/native/index.d.ts +0 -2
  389. package/dist/native/index.js +0 -1
  390. package/dist/native/index.js.map +0 -1
  391. package/dist/otel/helpers.js +0 -1
  392. package/dist/otel/helpers.js.map +0 -1
  393. package/dist/otel/index.js +0 -1
  394. package/dist/otel/index.js.map +0 -1
  395. package/dist/otel/instrumentations/index.js +0 -1
  396. package/dist/otel/instrumentations/index.js.map +0 -1
  397. package/dist/patch/index.js +0 -1
  398. package/dist/patch/index.js.map +0 -1
  399. package/dist/patch/xhr.js +0 -1
  400. package/dist/patch/xhr.js.map +0 -1
  401. package/dist/recorder/eventExporter.js +0 -1
  402. package/dist/recorder/eventExporter.js.map +0 -1
  403. package/dist/recorder/gestureRecorder.js +0 -1
  404. package/dist/recorder/gestureRecorder.js.map +0 -1
  405. package/dist/recorder/index.js +0 -1
  406. package/dist/recorder/index.js.map +0 -1
  407. package/dist/recorder/navigationTracker.js +0 -1
  408. package/dist/recorder/navigationTracker.js.map +0 -1
  409. package/dist/recorder/screenRecorder.js +0 -1
  410. package/dist/recorder/screenRecorder.js.map +0 -1
  411. package/dist/services/api.service.js +0 -1
  412. package/dist/services/api.service.js.map +0 -1
  413. package/dist/services/network.service.js +0 -1
  414. package/dist/services/network.service.js.map +0 -1
  415. package/dist/services/screenMaskingService.js +0 -1
  416. package/dist/services/screenMaskingService.js.map +0 -1
  417. package/dist/services/storage.service.js +0 -1
  418. package/dist/services/storage.service.js.map +0 -1
  419. package/dist/session-recorder.js +0 -1
  420. package/dist/session-recorder.js.map +0 -1
  421. package/dist/types/configs.js +0 -1
  422. package/dist/types/configs.js.map +0 -1
  423. package/dist/types/index.js +0 -1
  424. package/dist/types/index.js.map +0 -1
  425. package/dist/types/session-recorder.js +0 -1
  426. package/dist/types/session-recorder.js.map +0 -1
  427. package/dist/types/session.js +0 -1
  428. package/dist/types/session.js.map +0 -1
  429. package/dist/utils/app-metadata.js +0 -1
  430. package/dist/utils/app-metadata.js.map +0 -1
  431. package/dist/utils/constants.optional.expo.js +0 -1
  432. package/dist/utils/constants.optional.expo.js.map +0 -1
  433. package/dist/utils/constants.optional.js +0 -1
  434. package/dist/utils/constants.optional.js.map +0 -1
  435. package/dist/utils/createStore.js +0 -1
  436. package/dist/utils/createStore.js.map +0 -1
  437. package/dist/utils/index.js +0 -1
  438. package/dist/utils/index.js.map +0 -1
  439. package/dist/utils/logger.js +0 -1
  440. package/dist/utils/logger.js.map +0 -1
  441. package/dist/utils/platform.js +0 -1
  442. package/dist/utils/platform.js.map +0 -1
  443. package/dist/utils/request-utils.js +0 -1
  444. package/dist/utils/request-utils.js.map +0 -1
  445. package/dist/utils/rrweb-events.js +0 -1
  446. package/dist/utils/rrweb-events.js.map +0 -1
  447. package/dist/utils/session.js +0 -1
  448. package/dist/utils/session.js.map +0 -1
  449. package/dist/utils/shallowEqual.js +0 -1
  450. package/dist/utils/shallowEqual.js.map +0 -1
  451. package/dist/utils/time.js +0 -1
  452. package/dist/utils/time.js.map +0 -1
  453. package/dist/utils/type-utils.js +0 -1
  454. package/dist/utils/type-utils.js.map +0 -1
  455. package/dist/version.d.ts +0 -1
  456. package/dist/version.js +0 -1
  457. package/dist/version.js.map +0 -1
  458. package/docs/AUTO_METADATA_DETECTION.md +0 -108
  459. package/ios/GestureRecorderNative.swift +0 -316
  460. package/ios/SessionRecorderNative.m +0 -17
  461. package/ios/SessionRecorderNative.podspec +0 -26
  462. /package/{dist/components/index.d.ts → src/components/index.ts} +0 -0
  463. /package/{dist/patch/index.d.ts → src/patch/index.ts} +0 -0
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+
3
+ import { SessionType } from '@multiplayer-app/session-recorder-common';
4
+ // import { pack } from '@rrweb/packer' // Removed to avoid blob creation issues in Hermes
5
+ import { EventExporter } from "./eventExporter.js";
6
+ import { logger } from "../utils/index.js";
7
+ import { ScreenRecorder } from "./screenRecorder.js";
8
+ import { GestureRecorder } from "./gestureRecorder.js";
9
+ import { NavigationTracker } from "./navigationTracker.js";
10
+ export class RecorderReactNativeSDK {
11
+ isRecording = false;
12
+ recordedEvents = [];
13
+ sessionId = null;
14
+ sessionType = SessionType.PLAIN;
15
+ constructor() {
16
+ this.screenRecorder = new ScreenRecorder();
17
+ this.gestureRecorder = new GestureRecorder();
18
+ this.navigationTracker = new NavigationTracker();
19
+ this.exporter = new EventExporter({
20
+ socketUrl: '',
21
+ apiKey: ''
22
+ });
23
+ }
24
+ init(config) {
25
+ this.config = config;
26
+ this.screenRecorder.init(config, this);
27
+ this.navigationTracker.init(config, this.screenRecorder);
28
+ this.gestureRecorder.init(config, this, this.screenRecorder);
29
+ this.exporter.setApiKey(config.apiKey);
30
+ this.exporter.setSocketUrl(config.apiBaseUrl);
31
+ }
32
+ setApiKey(apiKey) {
33
+ this.exporter.setApiKey(apiKey);
34
+ }
35
+ setSocketUrl(socketUrl) {
36
+ this.exporter.setSocketUrl(socketUrl);
37
+ }
38
+ start(sessionId, sessionType) {
39
+ if (!this.config) {
40
+ throw new Error('Configuration not initialized. Call init() before start().');
41
+ }
42
+ this.sessionId = sessionId;
43
+ this.sessionType = sessionType;
44
+ this.isRecording = true;
45
+
46
+ // Emit recording started meta event
47
+
48
+ if (this.config.recordScreen) {
49
+ this.screenRecorder.start();
50
+ }
51
+ if (this.config.recordGestures) {
52
+ this.gestureRecorder.start();
53
+ }
54
+ if (this.config.recordNavigation) {
55
+ this.navigationTracker.start();
56
+ }
57
+ }
58
+ stop() {
59
+ this.isRecording = false;
60
+ this.gestureRecorder.stop();
61
+ this.navigationTracker.stop();
62
+ this.screenRecorder.stop();
63
+ this.exporter?.close();
64
+ }
65
+ setNavigationRef(ref) {
66
+ this.navigationTracker.setNavigationRef(ref);
67
+ }
68
+
69
+ /**
70
+ * Set the viewshot ref for screen capture
71
+ * @param ref - React Native View ref for screen capture
72
+ */
73
+ setViewShotRef(ref) {
74
+ this.screenRecorder.setViewShotRef(ref);
75
+ }
76
+
77
+ /**
78
+ * Record an rrweb event
79
+ * @param event - The rrweb event to record
80
+ */
81
+ recordEvent(event) {
82
+ if (!this.isRecording) {
83
+ return;
84
+ }
85
+ if (this.exporter) {
86
+ logger.debug('RecorderReactNativeSDK', 'Sending to exporter', event);
87
+ // Skip packing to avoid blob creation issues in Hermes
88
+ // const packedEvent = pack(event)
89
+ this.exporter.send({
90
+ event: event,
91
+ // Send raw event instead of packed
92
+ eventType: event.type,
93
+ timestamp: event.timestamp,
94
+ debugSessionId: this.sessionId,
95
+ debugSessionType: this.sessionType
96
+ });
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Record touch start event
102
+ * @param x - X coordinate
103
+ * @param y - Y coordinate
104
+ * @param target - Target element identifier
105
+ * @param pressure - Touch pressure
106
+ */
107
+ recordTouchStart(x, y, target, pressure) {
108
+ if (!this.isRecording) {
109
+ return;
110
+ }
111
+ this.gestureRecorder.recordTouchStart(x, y, target, pressure);
112
+ }
113
+
114
+ /**
115
+ * Record touch move event
116
+ * @param x - X coordinate
117
+ * @param y - Y coordinate
118
+ * @param target - Target element identifier
119
+ * @param pressure - Touch pressure
120
+ */
121
+ recordTouchMove(x, y, target, pressure) {
122
+ if (!this.isRecording) {
123
+ return;
124
+ }
125
+ this.gestureRecorder.recordTouchMove(x, y, target, pressure);
126
+ }
127
+
128
+ /**
129
+ * Record touch end event
130
+ * @param x - X coordinate
131
+ * @param y - Y coordinate
132
+ * @param target - Target element identifier
133
+ * @param pressure - Touch pressure
134
+ */
135
+ recordTouchEnd(x, y, target, pressure) {
136
+ if (!this.isRecording) {
137
+ return;
138
+ }
139
+ this.gestureRecorder.recordTouchEnd(x, y, target, pressure);
140
+ }
141
+
142
+ /**
143
+ * Get all recorded events
144
+ * @returns Array of recorded rrweb events
145
+ */
146
+ getRecordedEvents() {
147
+ return [...this.recordedEvents];
148
+ }
149
+
150
+ /**
151
+ * Clear all recorded events
152
+ */
153
+ clearRecordedEvents() {
154
+ this.recordedEvents = [];
155
+ }
156
+
157
+ /**
158
+ * Get recording statistics
159
+ * @returns Recording statistics
160
+ */
161
+ getRecordingStats() {
162
+ return {
163
+ totalEvents: this.recordedEvents.length,
164
+ isRecording: this.isRecording
165
+ };
166
+ }
167
+ }
168
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SessionType","EventExporter","logger","ScreenRecorder","GestureRecorder","NavigationTracker","RecorderReactNativeSDK","isRecording","recordedEvents","sessionId","sessionType","PLAIN","constructor","screenRecorder","gestureRecorder","navigationTracker","exporter","socketUrl","apiKey","init","config","setApiKey","setSocketUrl","apiBaseUrl","start","Error","recordScreen","recordGestures","recordNavigation","stop","close","setNavigationRef","ref","setViewShotRef","recordEvent","event","debug","send","eventType","type","timestamp","debugSessionId","debugSessionType","recordTouchStart","x","y","target","pressure","recordTouchMove","recordTouchEnd","getRecordedEvents","clearRecordedEvents","getRecordingStats","totalEvents","length"],"sourceRoot":"../../../src","sources":["recorder/index.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,0CAA0C;AACtE;AACA,SAASC,aAAa,QAAQ,oBAAiB;AAC/C,SAASC,MAAM,QAAQ,mBAAU;AACjC,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,iBAAiB,QAAQ,wBAAqB;AAGvD,OAAO,MAAMC,sBAAsB,CAA0B;EACnDC,WAAW,GAAG,KAAK;EAKnBC,cAAc,GAAoB,EAAE;EAEpCC,SAAS,GAAkB,IAAI;EAC/BC,WAAW,GAAgBV,WAAW,CAACW,KAAK;EAEpDC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,cAAc,GAAG,IAAIV,cAAc,CAAC,CAAC;IAC1C,IAAI,CAACW,eAAe,GAAG,IAAIV,eAAe,CAAC,CAAC;IAC5C,IAAI,CAACW,iBAAiB,GAAG,IAAIV,iBAAiB,CAAC,CAAC;IAChD,IAAI,CAACW,QAAQ,GAAG,IAAIf,aAAa,CAAC;MAChCgB,SAAS,EAAE,EAAE;MACbC,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;EAEAC,IAAIA,CAACC,MAAsB,EAAQ;IACjC,IAAI,CAACA,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACP,cAAc,CAACM,IAAI,CAACC,MAAM,EAAE,IAAI,CAAC;IACtC,IAAI,CAACL,iBAAiB,CAACI,IAAI,CAACC,MAAM,EAAE,IAAI,CAACP,cAAc,CAAC;IACxD,IAAI,CAACC,eAAe,CAACK,IAAI,CAACC,MAAM,EAAE,IAAI,EAAE,IAAI,CAACP,cAAc,CAAC;IAE5D,IAAI,CAACG,QAAQ,CAACK,SAAS,CAACD,MAAM,CAACF,MAAM,CAAC;IACtC,IAAI,CAACF,QAAQ,CAACM,YAAY,CAACF,MAAM,CAACG,UAAU,CAAC;EAC/C;E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,CAACO,eAAe,CAACmC,cAAc,CAACL,CAAC,EAAEC,CAAC,EAAEC,MAAM,EAAEC,QAAQ,CAAC;EAC7D;;EAEA;AACF;AACA;AACA;EACEG,iBAAiBA,CAAA,EAAoB;IACnC,OAAO,CAAC,GAAG,IAAI,CAAC1C,cAAc,CAAC;EACjC;;EAEA;AACF;AACA;EACE2C,mBAAmBA,CAAA,EAAS;IAC1B,IAAI,CAAC3C,cAAc,GAAG,EAAE;EAC1B;;EAEA;AACF;AACA;AACA;EACE4C,iBAAiBA,CAAA,EAAkD;IACjE,OAAO;MACLC,WAAW,EAAE,IAAI,CAAC7C,cAAc,CAAC8C,MAAM;MACvC/C,WAAW,EAAE,IAAI,CAACA;IACpB,CAAC;EACH;AACF","ignoreList":[]}
@@ -0,0 +1,228 @@
1
+ "use strict";
2
+
3
+ import { trace, SpanStatusCode } from '@opentelemetry/api';
4
+ import { logger } from "../utils/index.js";
5
+ export class NavigationTracker {
6
+ isRecording = false;
7
+ navigationRef = null;
8
+ navigationListeners = new Map();
9
+ currentRoute = null;
10
+ navigationStack = [];
11
+ navigationStartTime = 0;
12
+ // Reference to screen recorder for force capture
13
+
14
+ init(config, screenRecorder) {
15
+ this.config = config;
16
+ this.screenRecorder = screenRecorder;
17
+ logger.info('NavigationTracker', 'Navigation tracker initialized', {
18
+ config: this.config,
19
+ screenRecorder: this.screenRecorder
20
+ });
21
+ }
22
+ setNavigationRef(ref) {
23
+ this.navigationRef = ref;
24
+ if (this.isRecording) {
25
+ this._setupNavigationListener();
26
+ }
27
+ }
28
+ start() {
29
+ logger.info('NavigationTracker', 'Navigation tracking started');
30
+ this.isRecording = true;
31
+ this.navigationStack = [];
32
+ this.navigationStartTime = Date.now();
33
+ this._setupNavigationListener();
34
+ // Navigation tracking started
35
+ }
36
+ stop() {
37
+ this.isRecording = false;
38
+ this._removeNavigationListener();
39
+ // Navigation tracking stopped
40
+ }
41
+ pause() {
42
+ this.isRecording = false;
43
+ }
44
+ resume() {
45
+ this.isRecording = true;
46
+ this._setupNavigationListener();
47
+ }
48
+ _setupNavigationListener() {
49
+ if (!this.navigationRef) {
50
+ // Navigation ref not set - silently continue
51
+ return;
52
+ }
53
+ try {
54
+ // Listen to navigation state changes
55
+ const stateListener = this.navigationRef.addListener('state', e => {
56
+ this._recordNavigationEvent('state_change', e.data);
57
+ });
58
+
59
+ // Listen to focus events
60
+ const focusListener = this.navigationRef.addListener('focus', e => {
61
+ this._recordNavigationEvent('focus', e.data);
62
+ });
63
+
64
+ // Listen to blur events
65
+ const blurListener = this.navigationRef.addListener('blur', e => {
66
+ this._recordNavigationEvent('blur', e.data);
67
+ });
68
+
69
+ // Listen to beforeRemove events
70
+ const beforeRemoveListener = this.navigationRef.addListener('beforeRemove', e => {
71
+ this._recordNavigationEvent('beforeRemove', e.data);
72
+ });
73
+
74
+ // Store listeners for cleanup
75
+ this.navigationListeners.set('state', stateListener);
76
+ this.navigationListeners.set('focus', focusListener);
77
+ this.navigationListeners.set('blur', blurListener);
78
+ this.navigationListeners.set('beforeRemove', beforeRemoveListener);
79
+
80
+ // Navigation listeners setup complete
81
+ } catch (error) {
82
+ // Failed to setup navigation listeners - silently continue
83
+ }
84
+ }
85
+ _removeNavigationListener() {
86
+ try {
87
+ // Remove all listeners
88
+ this.navigationListeners.forEach((listener, _) => {
89
+ if (listener && typeof listener.remove === 'function') {
90
+ listener.remove();
91
+ }
92
+ });
93
+ this.navigationListeners.clear();
94
+ // Navigation listeners removed
95
+ } catch (error) {
96
+ // Failed to remove navigation listeners - silently continue
97
+ }
98
+ }
99
+ _getFriendlyRouteTitle() {
100
+ try {
101
+ const current = this.navigationRef?.getCurrentRoute?.();
102
+ if (!current) return null;
103
+ // Prefer a title set via navigation.setOptions({ title }) if present in params
104
+ const titleFromParams = current.params && current.params.title;
105
+ if (titleFromParams && typeof titleFromParams === 'string') {
106
+ return titleFromParams;
107
+ }
108
+
109
+ // Fallback to a prettified route name (handles Expo Router style names like 'user-posts/[id]')
110
+ if (current.name && typeof current.name === 'string') {
111
+ const raw = current.name;
112
+ // Remove group segments like "(tabs)/" at the beginning
113
+ const withoutGroups = raw.replace(/^\([^)]*\)\//, '');
114
+ // Take last path segment (e.g., 'user-posts/[id]' -> '[id]' is removed later, 'post/[id]' -> 'post')
115
+ const lastSegment = withoutGroups.split('/').filter(Boolean).slice(-2).join(' ');
116
+ // Remove dynamic segments like '[id]'
117
+ const withoutParams = lastSegment.replace(/\[[^\]]+\]/g, '').trim();
118
+ // Replace dashes/underscores with spaces and collapse spaces
119
+ const spaced = withoutParams.replace(/[-_]+/g, ' ').replace(/\s+/g, ' ').trim();
120
+ // Title case
121
+ const titleCase = spaced.split(' ').map(w => w ? w.charAt(0).toUpperCase() + w.slice(1) : w).join(' ');
122
+ return titleCase || raw;
123
+ }
124
+ return null;
125
+ } catch {
126
+ return null;
127
+ }
128
+ }
129
+ _recordNavigationEvent(eventType, data) {
130
+ if (!this.isRecording) return;
131
+ const event = {
132
+ type: 'navigate',
133
+ timestamp: Date.now(),
134
+ metadata: {
135
+ eventType,
136
+ navigationDuration: Date.now() - this.navigationStartTime,
137
+ stackDepth: this.navigationStack.length
138
+ }
139
+ };
140
+ const currentRoute = this.navigationRef?.getCurrentRoute?.() || {};
141
+ const friendlyTitle = this._getFriendlyRouteTitle();
142
+ const routeName = data?.routeName || currentRoute?.name;
143
+ const params = data?.params || currentRoute?.params;
144
+ const key = data?.key || currentRoute?.key;
145
+ if (routeName) {
146
+ event.routeName = routeName;
147
+ this._updateNavigationStack(routeName, eventType);
148
+ }
149
+ if (params) {
150
+ event.params = params;
151
+ }
152
+ if (key) {
153
+ event.metadata.routeKey = key;
154
+ }
155
+ if (friendlyTitle) {
156
+ event.metadata.friendlyRouteName = friendlyTitle;
157
+ }
158
+ this._recordOpenTelemetrySpan(event);
159
+
160
+ // Force screen capture on navigation events
161
+ // this.screenRecorder?.forceCapture(event.timestamp)
162
+ }
163
+ _updateNavigationStack(routeName, eventType) {
164
+ if (eventType === 'focus' || eventType === 'state_change') {
165
+ if (this.currentRoute !== routeName) {
166
+ this.currentRoute = routeName;
167
+ this.navigationStack.push(routeName);
168
+ }
169
+ } else if (eventType === 'blur' || eventType === 'beforeRemove') {
170
+ const index = this.navigationStack.indexOf(routeName);
171
+ if (index > -1) {
172
+ this.navigationStack.splice(index, 1);
173
+ }
174
+ }
175
+ }
176
+ _recordOpenTelemetrySpan(event) {
177
+ try {
178
+ const span = trace.getTracer('navigation').startSpan(`Navigation.${event.type}`, {
179
+ attributes: {
180
+ 'navigation.system': 'ReactNavigation',
181
+ 'navigation.operation': event.type,
182
+ 'navigation.type': event.type,
183
+ 'navigation.timestamp': event.timestamp,
184
+ 'navigation.platform': 'react-native'
185
+ }
186
+ });
187
+ if (event.routeName) {
188
+ span.setAttribute('navigation.route_name', event.routeName);
189
+ }
190
+ if (event.params) {
191
+ span.setAttribute('navigation.params', JSON.stringify(event.params));
192
+ }
193
+ if (event.metadata) {
194
+ Object.entries(event.metadata).forEach(([key, value]) => {
195
+ span.setAttribute(`navigation.metadata.${key}`, String(value));
196
+ });
197
+ }
198
+ span.setStatus({
199
+ code: SpanStatusCode.OK
200
+ });
201
+ span.end();
202
+ } catch (error) {
203
+ // Failed to record OpenTelemetry span for navigation - silently continue
204
+ }
205
+ }
206
+
207
+ // Get current navigation state
208
+ getCurrentRoute() {
209
+ return this.currentRoute;
210
+ }
211
+ getNavigationStack() {
212
+ return [...this.navigationStack];
213
+ }
214
+ getNavigationDepth() {
215
+ return this.navigationStack.length;
216
+ }
217
+
218
+ // Get recording status
219
+ isRecordingEnabled() {
220
+ return this.isRecording;
221
+ }
222
+
223
+ // Get navigation duration
224
+ getNavigationDuration() {
225
+ return Date.now() - this.navigationStartTime;
226
+ }
227
+ }
228
+ //# sourceMappingURL=navigationTracker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["trace","SpanStatusCode","logger","NavigationTracker","isRecording","navigationRef","navigationListeners","Map","currentRoute","navigationStack","navigationStartTime","init","config","screenRecorder","info","setNavigationRef","ref","_setupNavigationListener","start","Date","now","stop","_removeNavigationListener","pause","resume","stateListener","addListener","e","_recordNavigationEvent","data","focusListener","blurListener","beforeRemoveListener","set","error","forEach","listener","_","remove","clear","_getFriendlyRouteTitle","current","getCurrentRoute","titleFromParams","params","title","name","raw","withoutGroups","replace","lastSegment","split","filter","Boolean","slice","join","withoutParams","trim","spaced","titleCase","map","w","charAt","toUpperCase","eventType","event","type","timestamp","metadata","navigationDuration","stackDepth","length","friendlyTitle","routeName","key","_updateNavigationStack","routeKey","friendlyRouteName","_recordOpenTelemetrySpan","push","index","indexOf","splice","span","getTracer","startSpan","attributes","setAttribute","JSON","stringify","Object","entries","value","String","setStatus","code","OK","end","getNavigationStack","getNavigationDepth","isRecordingEnabled","getNavigationDuration"],"sourceRoot":"../../../src","sources":["recorder/navigationTracker.ts"],"mappings":";;AACA,SAASA,KAAK,EAAEC,cAAc,QAAQ,oBAAoB;AAC1D,SAASC,MAAM,QAAQ,mBAAU;AAEjC,OAAO,MAAMC,iBAAiB,CAAC;EAErBC,WAAW,GAAG,KAAK;EACnBC,aAAa,GAAQ,IAAI;EACzBC,mBAAmB,GAAqB,IAAIC,GAAG,CAAC,CAAC;EACjDC,YAAY,GAAkB,IAAI;EAClCC,eAAe,GAAa,EAAE;EAC9BC,mBAAmB,GAAW,CAAC;EACT;;EAE9BC,IAAIA,CAACC,MAAsB,EAAEC,cAAoB,EAAQ;IACvD,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,cAAc,GAAGA,cAAc;IACpCX,MAAM,CAACY,IAAI,CAAC,mBAAmB,EAAE,gCAAgC,EAAE;MACjEF,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,cAAc,EAAE,IAAI,CAACA;IACvB,CAAC,CAAC;EACJ;EAEAE,gBAAgBA,CAACC,GAAQ,EAAQ;IAC/B,IAAI,CAACX,aAAa,GAAGW,GAAG;IACxB,IAAI,IAAI,CAACZ,WAAW,EAAE;MACpB,I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