@multiplayer-app/session-recorder-react-native 1.0.1-beta.3 → 1.0.1-beta.4

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 (465) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +216 -155
  3. package/SessionRecorderNative.podspec +9 -14
  4. package/android/build.gradle +21 -44
  5. package/android/gradle.properties +4 -4
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/com/multiplayer/sessionrecordernative/SessionRecorderNativeConfig.kt +52 -0
  8. package/android/src/main/java/com/multiplayer/sessionrecordernative/SessionRecorderNativeModule.kt +860 -0
  9. package/android/src/main/java/com/multiplayer/sessionrecordernative/SessionRecorderNativeModuleSpec.kt +51 -0
  10. package/android/src/main/java/com/multiplayer/sessionrecordernative/SessionRecorderNativePackage.kt +33 -0
  11. package/android/src/main/java/com/multiplayer/sessionrecordernative/model/TargetInfo.kt +9 -0
  12. package/android/src/main/java/com/multiplayer/sessionrecordernative/util/ViewUtils.kt +72 -0
  13. package/android/src/main/java/com/xxx/XxxModule.kt +23 -0
  14. package/ios/SessionRecorderNative.podspec +4 -2
  15. package/ios/SessionRecorderNative.swift +1 -1
  16. package/ios/SessionRecorderNativeSpec.swift +3 -3
  17. package/ios/Xxx.h +5 -0
  18. package/ios/Xxx.mm +21 -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 +13 -0
  68. package/lib/module/index.js.map +1 -0
  69. package/lib/module/native/SessionRecorderNative.js +74 -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 +193 -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/lib/typescript/src/components/ScreenRecorderView/ScreenRecorderView.d.ts +6 -0
  144. package/lib/typescript/src/components/ScreenRecorderView/ScreenRecorderView.d.ts.map +1 -0
  145. package/lib/typescript/src/components/ScreenRecorderView/index.d.ts +2 -0
  146. package/lib/typescript/src/components/ScreenRecorderView/index.d.ts.map +1 -0
  147. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/ErrorBanner.d.ts +1 -0
  148. package/lib/typescript/src/components/SessionRecorderWidget/ErrorBanner.d.ts.map +1 -0
  149. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/FinalPopover.d.ts +2 -1
  150. package/lib/typescript/src/components/SessionRecorderWidget/FinalPopover.d.ts.map +1 -0
  151. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/FloatingButton.d.ts +1 -0
  152. package/lib/typescript/src/components/SessionRecorderWidget/FloatingButton.d.ts.map +1 -0
  153. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/InitialPopover.d.ts +2 -1
  154. package/lib/typescript/src/components/SessionRecorderWidget/InitialPopover.d.ts.map +1 -0
  155. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/ModalContainer.d.ts +1 -0
  156. package/lib/typescript/src/components/SessionRecorderWidget/ModalContainer.d.ts.map +1 -0
  157. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/ModalHeader.d.ts +1 -0
  158. package/lib/typescript/src/components/SessionRecorderWidget/ModalHeader.d.ts.map +1 -0
  159. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/SessionRecorderWidget.d.ts +1 -0
  160. package/lib/typescript/src/components/SessionRecorderWidget/SessionRecorderWidget.d.ts.map +1 -0
  161. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/icons.d.ts +1 -0
  162. package/lib/typescript/src/components/SessionRecorderWidget/icons.d.ts.map +1 -0
  163. package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts +3 -0
  164. package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts.map +1 -0
  165. package/{dist → lib/typescript/src}/components/SessionRecorderWidget/styles.d.ts +4 -3
  166. package/lib/typescript/src/components/SessionRecorderWidget/styles.d.ts.map +1 -0
  167. package/{dist → lib/typescript/src}/components/index.d.ts +1 -0
  168. package/lib/typescript/src/components/index.d.ts.map +1 -0
  169. package/{dist → lib/typescript/src}/config/constants.d.ts +1 -0
  170. package/lib/typescript/src/config/constants.d.ts.map +1 -0
  171. package/{dist → lib/typescript/src}/config/defaults.d.ts +2 -1
  172. package/lib/typescript/src/config/defaults.d.ts.map +1 -0
  173. package/{dist → lib/typescript/src}/config/index.d.ts +1 -0
  174. package/lib/typescript/src/config/index.d.ts.map +1 -0
  175. package/lib/typescript/src/config/masking.d.ts +3 -0
  176. package/lib/typescript/src/config/masking.d.ts.map +1 -0
  177. package/lib/typescript/src/config/session-recorder.d.ts +3 -0
  178. package/lib/typescript/src/config/session-recorder.d.ts.map +1 -0
  179. package/{dist → lib/typescript/src}/config/validators.d.ts +1 -0
  180. package/lib/typescript/src/config/validators.d.ts.map +1 -0
  181. package/{dist → lib/typescript/src}/config/widget.d.ts +2 -1
  182. package/lib/typescript/src/config/widget.d.ts.map +1 -0
  183. package/{dist → lib/typescript/src}/context/SessionRecorderContext.d.ts +3 -2
  184. package/lib/typescript/src/context/SessionRecorderContext.d.ts.map +1 -0
  185. package/{dist → lib/typescript/src}/context/SessionRecorderStore.d.ts +2 -1
  186. package/lib/typescript/src/context/SessionRecorderStore.d.ts.map +1 -0
  187. package/{dist → lib/typescript/src}/context/useSessionRecorderStore.d.ts +2 -1
  188. package/lib/typescript/src/context/useSessionRecorderStore.d.ts.map +1 -0
  189. package/{dist → lib/typescript/src}/context/useStoreSelector.d.ts +2 -1
  190. package/lib/typescript/src/context/useStoreSelector.d.ts.map +1 -0
  191. package/{dist → lib/typescript/src}/index.d.ts +1 -0
  192. package/lib/typescript/src/index.d.ts.map +1 -0
  193. package/{dist → lib/typescript/src}/native/SessionRecorderNative.d.ts +21 -3
  194. package/lib/typescript/src/native/SessionRecorderNative.d.ts.map +1 -0
  195. package/{dist → lib/typescript/src}/native/index.d.ts +1 -0
  196. package/lib/typescript/src/native/index.d.ts.map +1 -0
  197. package/{dist → lib/typescript/src}/otel/helpers.d.ts +3 -2
  198. package/lib/typescript/src/otel/helpers.d.ts.map +1 -0
  199. package/{dist → lib/typescript/src}/otel/index.d.ts +2 -2
  200. package/lib/typescript/src/otel/index.d.ts.map +1 -0
  201. package/{dist → lib/typescript/src}/otel/instrumentations/index.d.ts +2 -1
  202. package/lib/typescript/src/otel/instrumentations/index.d.ts.map +1 -0
  203. package/lib/typescript/src/patch/index.d.ts +2 -0
  204. package/lib/typescript/src/patch/index.d.ts.map +1 -0
  205. package/{dist → lib/typescript/src}/patch/xhr.d.ts +1 -0
  206. package/lib/typescript/src/patch/xhr.d.ts.map +1 -0
  207. package/{dist → lib/typescript/src}/recorder/eventExporter.d.ts +2 -1
  208. package/lib/typescript/src/recorder/eventExporter.d.ts.map +1 -0
  209. package/{dist → lib/typescript/src}/recorder/gestureRecorder.d.ts +3 -2
  210. package/lib/typescript/src/recorder/gestureRecorder.d.ts.map +1 -0
  211. package/{dist → lib/typescript/src}/recorder/index.d.ts +3 -2
  212. package/lib/typescript/src/recorder/index.d.ts.map +1 -0
  213. package/{dist → lib/typescript/src}/recorder/navigationTracker.d.ts +2 -1
  214. package/lib/typescript/src/recorder/navigationTracker.d.ts.map +1 -0
  215. package/{dist → lib/typescript/src}/recorder/screenRecorder.d.ts +4 -4
  216. package/lib/typescript/src/recorder/screenRecorder.d.ts.map +1 -0
  217. package/{dist → lib/typescript/src}/services/api.service.d.ts +2 -1
  218. package/lib/typescript/src/services/api.service.d.ts.map +1 -0
  219. package/{dist → lib/typescript/src}/services/network.service.d.ts +1 -0
  220. package/lib/typescript/src/services/network.service.d.ts.map +1 -0
  221. package/{dist → lib/typescript/src}/services/screenMaskingService.d.ts +2 -1
  222. package/lib/typescript/src/services/screenMaskingService.d.ts.map +1 -0
  223. package/{dist → lib/typescript/src}/services/storage.service.d.ts +2 -1
  224. package/lib/typescript/src/services/storage.service.d.ts.map +1 -0
  225. package/{dist → lib/typescript/src}/session-recorder.d.ts +3 -2
  226. package/lib/typescript/src/session-recorder.d.ts.map +1 -0
  227. package/{dist → lib/typescript/src}/types/configs.d.ts +3 -2
  228. package/lib/typescript/src/types/configs.d.ts.map +1 -0
  229. package/{dist → lib/typescript/src}/types/index.d.ts +1 -0
  230. package/lib/typescript/src/types/index.d.ts.map +1 -0
  231. package/{dist → lib/typescript/src}/types/session-recorder.d.ts +3 -2
  232. package/lib/typescript/src/types/session-recorder.d.ts.map +1 -0
  233. package/{dist → lib/typescript/src}/types/session.d.ts +1 -0
  234. package/lib/typescript/src/types/session.d.ts.map +1 -0
  235. package/{dist → lib/typescript/src}/utils/app-metadata.d.ts +1 -0
  236. package/lib/typescript/src/utils/app-metadata.d.ts.map +1 -0
  237. package/{dist → lib/typescript/src}/utils/constants.optional.d.ts +1 -0
  238. package/lib/typescript/src/utils/constants.optional.d.ts.map +1 -0
  239. package/{dist → lib/typescript/src}/utils/constants.optional.expo.d.ts +1 -0
  240. package/lib/typescript/src/utils/constants.optional.expo.d.ts.map +1 -0
  241. package/{dist → lib/typescript/src}/utils/createStore.d.ts +1 -0
  242. package/lib/typescript/src/utils/createStore.d.ts.map +1 -0
  243. package/{dist → lib/typescript/src}/utils/index.d.ts +1 -0
  244. package/lib/typescript/src/utils/index.d.ts.map +1 -0
  245. package/{dist → lib/typescript/src}/utils/logger.d.ts +1 -0
  246. package/lib/typescript/src/utils/logger.d.ts.map +1 -0
  247. package/{dist → lib/typescript/src}/utils/platform.d.ts +2 -1
  248. package/lib/typescript/src/utils/platform.d.ts.map +1 -0
  249. package/{dist → lib/typescript/src}/utils/request-utils.d.ts +1 -0
  250. package/lib/typescript/src/utils/request-utils.d.ts.map +1 -0
  251. package/{dist → lib/typescript/src}/utils/rrweb-events.d.ts +2 -1
  252. package/lib/typescript/src/utils/rrweb-events.d.ts.map +1 -0
  253. package/{dist → lib/typescript/src}/utils/session.d.ts +1 -0
  254. package/lib/typescript/src/utils/session.d.ts.map +1 -0
  255. package/{dist → lib/typescript/src}/utils/shallowEqual.d.ts +1 -0
  256. package/lib/typescript/src/utils/shallowEqual.d.ts.map +1 -0
  257. package/{dist → lib/typescript/src}/utils/time.d.ts +1 -0
  258. package/lib/typescript/src/utils/time.d.ts.map +1 -0
  259. package/{dist → lib/typescript/src}/utils/type-utils.d.ts +1 -0
  260. package/lib/typescript/src/utils/type-utils.d.ts.map +1 -0
  261. package/{dist → lib/typescript/src}/version.d.ts +1 -0
  262. package/lib/typescript/src/version.d.ts.map +1 -0
  263. package/package.json +133 -44
  264. package/src/components/ScreenRecorderView/ScreenRecorderView.tsx +20 -0
  265. package/src/components/SessionRecorderWidget/ErrorBanner.tsx +58 -0
  266. package/src/components/SessionRecorderWidget/FinalPopover.tsx +96 -0
  267. package/src/components/SessionRecorderWidget/FloatingButton.tsx +176 -0
  268. package/src/components/SessionRecorderWidget/InitialPopover.tsx +167 -0
  269. package/src/components/SessionRecorderWidget/ModalContainer.tsx +189 -0
  270. package/src/components/SessionRecorderWidget/ModalHeader.tsx +24 -0
  271. package/src/components/SessionRecorderWidget/SessionRecorderWidget.tsx +136 -0
  272. package/src/components/SessionRecorderWidget/icons.tsx +52 -0
  273. package/{dist/components/SessionRecorderWidget/index.d.ts → src/components/SessionRecorderWidget/index.ts} +1 -0
  274. package/src/components/SessionRecorderWidget/styles.ts +169 -0
  275. package/src/components/index.ts +2 -0
  276. package/src/config/constants.ts +68 -0
  277. package/src/config/defaults.ts +101 -0
  278. package/src/config/index.ts +6 -0
  279. package/src/config/masking.ts +34 -0
  280. package/src/config/session-recorder.ts +59 -0
  281. package/src/config/validators.ts +31 -0
  282. package/src/config/widget.ts +38 -0
  283. package/src/context/SessionRecorderContext.tsx +138 -0
  284. package/src/context/SessionRecorderStore.ts +21 -0
  285. package/src/context/useSessionRecorderStore.ts +27 -0
  286. package/src/context/useStoreSelector.ts +34 -0
  287. package/src/index.ts +10 -0
  288. package/src/native/SessionRecorderNative.ts +164 -0
  289. package/src/native/index.ts +1 -0
  290. package/src/otel/helpers.ts +274 -0
  291. package/src/otel/index.ts +135 -0
  292. package/src/otel/instrumentations/index.ts +115 -0
  293. package/src/patch/index.ts +1 -0
  294. package/src/patch/xhr.ts +149 -0
  295. package/src/recorder/eventExporter.ts +155 -0
  296. package/src/recorder/gestureRecorder.ts +681 -0
  297. package/src/recorder/index.ts +190 -0
  298. package/src/recorder/navigationTracker.ts +245 -0
  299. package/src/recorder/screenRecorder.ts +549 -0
  300. package/src/services/api.service.ts +215 -0
  301. package/src/services/network.service.ts +182 -0
  302. package/src/services/screenMaskingService.ts +122 -0
  303. package/src/services/storage.service.ts +219 -0
  304. package/src/session-recorder.ts +591 -0
  305. package/src/types/configs.ts +96 -0
  306. package/src/types/expo-constants.d.ts +7 -0
  307. package/src/types/index.ts +29 -0
  308. package/src/types/session-recorder.ts +386 -0
  309. package/src/types/session.ts +65 -0
  310. package/src/utils/app-metadata.ts +31 -0
  311. package/src/utils/constants.optional.expo.ts +5 -0
  312. package/src/utils/constants.optional.ts +16 -0
  313. package/src/utils/createStore.ts +29 -0
  314. package/src/utils/index.ts +8 -0
  315. package/src/utils/logger.ts +216 -0
  316. package/src/utils/platform.ts +370 -0
  317. package/src/utils/request-utils.ts +61 -0
  318. package/src/utils/rrweb-events.ts +316 -0
  319. package/src/utils/session.ts +19 -0
  320. package/src/utils/shallowEqual.ts +14 -0
  321. package/src/utils/time.ts +17 -0
  322. package/src/utils/type-utils.ts +75 -0
  323. package/src/version.ts +1 -0
  324. package/REACT_NATIVE_SETUP.md +0 -91
  325. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  326. package/android/gradle/wrapper/gradle-wrapper.properties +0 -7
  327. package/android/gradlew +0 -249
  328. package/android/gradlew.bat +0 -92
  329. package/copy-react-native-dist.sh +0 -56
  330. package/dist/components/ScreenRecorderView/ScreenRecorderView.d.ts +0 -5
  331. package/dist/components/ScreenRecorderView/ScreenRecorderView.js +0 -1
  332. package/dist/components/ScreenRecorderView/ScreenRecorderView.js.map +0 -1
  333. package/dist/components/ScreenRecorderView/index.js +0 -1
  334. package/dist/components/ScreenRecorderView/index.js.map +0 -1
  335. package/dist/components/SessionRecorderWidget/ErrorBanner.js +0 -1
  336. package/dist/components/SessionRecorderWidget/ErrorBanner.js.map +0 -1
  337. package/dist/components/SessionRecorderWidget/FinalPopover.js +0 -1
  338. package/dist/components/SessionRecorderWidget/FinalPopover.js.map +0 -1
  339. package/dist/components/SessionRecorderWidget/FloatingButton.js +0 -1
  340. package/dist/components/SessionRecorderWidget/FloatingButton.js.map +0 -1
  341. package/dist/components/SessionRecorderWidget/InitialPopover.js +0 -1
  342. package/dist/components/SessionRecorderWidget/InitialPopover.js.map +0 -1
  343. package/dist/components/SessionRecorderWidget/ModalContainer.js +0 -1
  344. package/dist/components/SessionRecorderWidget/ModalContainer.js.map +0 -1
  345. package/dist/components/SessionRecorderWidget/ModalHeader.js +0 -1
  346. package/dist/components/SessionRecorderWidget/ModalHeader.js.map +0 -1
  347. package/dist/components/SessionRecorderWidget/SessionRecorderWidget.js +0 -1
  348. package/dist/components/SessionRecorderWidget/SessionRecorderWidget.js.map +0 -1
  349. package/dist/components/SessionRecorderWidget/icons.js +0 -1
  350. package/dist/components/SessionRecorderWidget/icons.js.map +0 -1
  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/GestureRecorderNativeTurboSpec.d.ts +0 -31
  387. package/dist/native/GestureRecorderNativeTurboSpec.js +0 -1
  388. package/dist/native/GestureRecorderNativeTurboSpec.js.map +0 -1
  389. package/dist/native/SessionRecorderNative.js +0 -1
  390. package/dist/native/SessionRecorderNative.js.map +0 -1
  391. package/dist/native/SessionRecorderNativeTurboSpec.d.ts +0 -17
  392. package/dist/native/SessionRecorderNativeTurboSpec.js +0 -1
  393. package/dist/native/SessionRecorderNativeTurboSpec.js.map +0 -1
  394. package/dist/native/index.js +0 -1
  395. package/dist/native/index.js.map +0 -1
  396. package/dist/otel/helpers.js +0 -1
  397. package/dist/otel/helpers.js.map +0 -1
  398. package/dist/otel/index.js +0 -1
  399. package/dist/otel/index.js.map +0 -1
  400. package/dist/otel/instrumentations/index.js +0 -1
  401. package/dist/otel/instrumentations/index.js.map +0 -1
  402. package/dist/patch/index.d.ts +0 -1
  403. package/dist/patch/index.js +0 -1
  404. package/dist/patch/index.js.map +0 -1
  405. package/dist/patch/xhr.js +0 -1
  406. package/dist/patch/xhr.js.map +0 -1
  407. package/dist/recorder/eventExporter.js +0 -1
  408. package/dist/recorder/eventExporter.js.map +0 -1
  409. package/dist/recorder/gestureRecorder.js +0 -1
  410. package/dist/recorder/gestureRecorder.js.map +0 -1
  411. package/dist/recorder/index.js +0 -1
  412. package/dist/recorder/index.js.map +0 -1
  413. package/dist/recorder/navigationTracker.js +0 -1
  414. package/dist/recorder/navigationTracker.js.map +0 -1
  415. package/dist/recorder/screenRecorder.js +0 -1
  416. package/dist/recorder/screenRecorder.js.map +0 -1
  417. package/dist/services/api.service.js +0 -1
  418. package/dist/services/api.service.js.map +0 -1
  419. package/dist/services/network.service.js +0 -1
  420. package/dist/services/network.service.js.map +0 -1
  421. package/dist/services/screenMaskingService.js +0 -1
  422. package/dist/services/screenMaskingService.js.map +0 -1
  423. package/dist/services/storage.service.js +0 -1
  424. package/dist/services/storage.service.js.map +0 -1
  425. package/dist/session-recorder.js +0 -1
  426. package/dist/session-recorder.js.map +0 -1
  427. package/dist/types/configs.js +0 -1
  428. package/dist/types/configs.js.map +0 -1
  429. package/dist/types/index.js +0 -1
  430. package/dist/types/index.js.map +0 -1
  431. package/dist/types/session-recorder.js +0 -1
  432. package/dist/types/session-recorder.js.map +0 -1
  433. package/dist/types/session.js +0 -1
  434. package/dist/types/session.js.map +0 -1
  435. package/dist/utils/app-metadata.js +0 -1
  436. package/dist/utils/app-metadata.js.map +0 -1
  437. package/dist/utils/constants.optional.expo.js +0 -1
  438. package/dist/utils/constants.optional.expo.js.map +0 -1
  439. package/dist/utils/constants.optional.js +0 -1
  440. package/dist/utils/constants.optional.js.map +0 -1
  441. package/dist/utils/createStore.js +0 -1
  442. package/dist/utils/createStore.js.map +0 -1
  443. package/dist/utils/index.js +0 -1
  444. package/dist/utils/index.js.map +0 -1
  445. package/dist/utils/logger.js +0 -1
  446. package/dist/utils/logger.js.map +0 -1
  447. package/dist/utils/platform.js +0 -1
  448. package/dist/utils/platform.js.map +0 -1
  449. package/dist/utils/request-utils.js +0 -1
  450. package/dist/utils/request-utils.js.map +0 -1
  451. package/dist/utils/rrweb-events.js +0 -1
  452. package/dist/utils/rrweb-events.js.map +0 -1
  453. package/dist/utils/session.js +0 -1
  454. package/dist/utils/session.js.map +0 -1
  455. package/dist/utils/shallowEqual.js +0 -1
  456. package/dist/utils/shallowEqual.js.map +0 -1
  457. package/dist/utils/time.js +0 -1
  458. package/dist/utils/time.js.map +0 -1
  459. package/dist/utils/type-utils.js +0 -1
  460. package/dist/utils/type-utils.js.map +0 -1
  461. package/dist/version.js +0 -1
  462. package/dist/version.js.map +0 -1
  463. package/docs/AUTO_METADATA_DETECTION.md +0 -108
  464. package/react-native.config.js +0 -13
  465. /package/{dist/components/ScreenRecorderView/index.d.ts → src/components/ScreenRecorderView/index.ts} +0 -0
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ import { useStoreSelector } from "./useStoreSelector.js";
4
+ import { sessionRecorderStore } from "./SessionRecorderStore.js";
5
+ export function useSessionRecorderStore(selector, equalityFn) {
6
+ return useStoreSelector(sessionRecorderStore, selector, equalityFn);
7
+ }
8
+ export function useSessionRecordingState() {
9
+ return useSessionRecorderStore(s => s.sessionState);
10
+ }
11
+ export function useSessionType() {
12
+ return useSessionRecorderStore(s => s.sessionType);
13
+ }
14
+ export function useIsInitialized() {
15
+ return useSessionRecorderStore(s => s.isInitialized);
16
+ }
17
+ export function useWidgetModalVisible() {
18
+ return useSessionRecorderStore(s => s.isWidgetModalVisible);
19
+ }
20
+ //# sourceMappingURL=useSessionRecorderStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useStoreSelector","sessionRecorderStore","useSessionRecorderStore","selector","equalityFn","useSessionRecordingState","s","sessionState","useSessionType","sessionType","useIsInitialized","isInitialized","useWidgetModalVisible","isWidgetModalVisible"],"sourceRoot":"../../../src","sources":["context/useSessionRecorderStore.ts"],"mappings":";;AAEA,SAASA,gBAAgB,QAAQ,uBAAoB;AACrD,SAAoCC,oBAAoB,QAAQ,2BAAwB;AAExF,OAAO,SAASC,uBAAuBA,CACrCC,QAA6C,EAC7CC,UAA8C,EACtC;EACR,OAAOJ,gBAAgB,CAA+BC,oBAAoB,EAAEE,QAAQ,EAAEC,UAAU,CAAC;AACnG;AAEA,OAAO,SAASC,wBAAwBA,CAAA,EAAG;EACzC,OAAOH,uBAAuB,CAAuBI,CAAC,IAAKA,CAAC,CAACC,YAAY,CAAC;AAC5E;AAEA,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B,OAAON,uBAAuB,CAAsBI,CAAC,IAAKA,CAAC,CAACG,WAAW,CAAC;AAC1E;AAEA,OAAO,SAASC,gBAAgBA,CAAA,EAAG;EACjC,OAAOR,uBAAuB,CAAWI,CAAC,IAAKA,CAAC,CAACK,aAAa,CAAC;AACjE;AAEA,OAAO,SAASC,qBAAqBA,CAAA,EAAG;EACtC,OAAOV,uBAAuB,CAAWI,CAAC,IAAKA,CAAC,CAACO,oBAAoB,CAAC;AACxE","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ import { useEffect, useRef, useState } from 'react';
4
+ import { shallowEqual } from "../utils/shallowEqual.js";
5
+ export function useStoreSelector(store, selector, equalityFn = Object.is) {
6
+ const latestSelectorRef = useRef(selector);
7
+ const latestEqualityRef = useRef(equalityFn);
8
+ latestSelectorRef.current = selector;
9
+ latestEqualityRef.current = equalityFn;
10
+ const [slice, setSlice] = useState(() => latestSelectorRef.current(store.getState()));
11
+ useEffect(() => {
12
+ function handleChange(nextState, prevState) {
13
+ const nextSlice = latestSelectorRef.current(nextState);
14
+ const prevSlice = latestSelectorRef.current(prevState);
15
+ if (!latestEqualityRef.current(nextSlice, prevSlice)) {
16
+ setSlice(nextSlice);
17
+ }
18
+ }
19
+ const unsubscribe = store.subscribe(handleChange);
20
+ // Sync once in case changed between render and effect
21
+ handleChange(store.getState(), store.getState());
22
+ return unsubscribe;
23
+ }, [store]);
24
+ return slice;
25
+ }
26
+ export const shallow = shallowEqual;
27
+ //# sourceMappingURL=useStoreSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRef","useState","shallowEqual","useStoreSelector","store","selector","equalityFn","Object","is","latestSelectorRef","latestEqualityRef","current","slice","setSlice","getState","handleChange","nextState","prevState","nextSlice","prevSlice","unsubscribe","subscribe","shallow"],"sourceRoot":"../../../src","sources":["context/useStoreSelector.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEnD,SAASC,YAAY,QAAQ,0BAAuB;AAEpD,OAAO,SAASC,gBAAgBA,CAC9BC,KAAoB,EACpBC,QAAmC,EACnCC,UAA6C,GAAGC,MAAM,CAACC,EAAE,EACjD;EACR,MAAMC,iBAAiB,GAAGT,MAAM,CAACK,QAAQ,CAAC;EAC1C,MAAMK,iBAAiB,GAAGV,MAAM,CAACM,UAAU,CAAC;EAC5CG,iBAAiB,CAACE,OAAO,GAAGN,QAAQ;EACpCK,iBAAiB,CAACC,OAAO,GAAGL,UAAU;EAEtC,MAAM,CAACM,KAAK,EAAEC,QAAQ,CAAC,GAAGZ,QAAQ,CAAS,MAAMQ,iBAAiB,CAACE,OAAO,CAACP,KAAK,CAACU,QAAQ,CAAC,CAAC,CAAC,CAAC;EAE7Ff,SAAS,CAAC,MAAM;IACd,SAASgB,YAAYA,CAACC,SAAiB,EAAEC,SAAiB,EAAE;MAC1D,MAAMC,SAAS,GAAGT,iBAAiB,CAACE,OAAO,CAACK,SAAS,CAAC;MACtD,MAAMG,SAAS,GAAGV,iBAAiB,CAACE,OAAO,CAACM,SAAS,CAAC;MACtD,IAAI,CAACP,iBAAiB,CAACC,OAAO,CAACO,SAAS,EAAEC,SAAS,CAAC,EAAE;QACpDN,QAAQ,CAACK,SAAS,CAAC;MACrB;IACF;IACA,MAAME,WAAW,GAAGhB,KAAK,CAACiB,SAAS,CAACN,YAAY,CAAC;IACjD;IACAA,YAAY,CAACX,KAAK,CAACU,QAAQ,CAAC,CAAC,EAAEV,KAAK,CAACU,QAAQ,CAAC,CAAC,CAAC;IAChD,OAAOM,WAAW;EACpB,CAAC,EAAE,CAAChB,KAAK,CAAC,CAAC;EAEX,OAAOQ,KAAK;AACd;AAEA,OAAO,MAAMU,OAAO,GAAGpB,YAAY","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ import "./patch/index.js";
4
+ import SessionRecorder from "./session-recorder.js";
5
+ export * from '@multiplayer-app/session-recorder-common';
6
+ export * from "./context/SessionRecorderContext.js";
7
+ export * from "./context/useSessionRecorderStore.js";
8
+
9
+ // Export the class for type checking
10
+ export { SessionRecorder };
11
+ // Export the instance as default
12
+ export default SessionRecorder;
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SessionRecorder"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAO,kBAAS;AAChB,OAAOA,eAAe,MAAM,uBAAoB;AAChD,cAAc,0CAA0C;AACxD,cAAc,qCAAkC;AAChD,cAAc,sCAAmC;;AAEjD;AACA,SAASA,eAAe;AACxB;AACA,eAAeA,eAAe","ignoreList":[]}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ import { NativeEventEmitter, Platform, TurboModuleRegistry } from 'react-native';
4
+ // Check if we're on web platform
5
+ const isWeb = Platform.OS === 'web';
6
+
7
+ // Get the Turbo Module
8
+ let SessionRecorderNative = null;
9
+ let eventEmitter = null;
10
+ if (!isWeb) {
11
+ try {
12
+ SessionRecorderNative = TurboModuleRegistry.getEnforcing('SessionRecorderNative');
13
+ eventEmitter = new NativeEventEmitter(SessionRecorderNative);
14
+ } catch (error) {
15
+ console.warn('Failed to access SessionRecorderNative Turbo Module:', error);
16
+ }
17
+ }
18
+
19
+ // Validate that the native module is available
20
+ if (!SessionRecorderNative && !isWeb) {
21
+ console.warn('SessionRecorderNative Turbo Module is not available. Auto-linking may not have completed yet.');
22
+ } else if (isWeb) {
23
+ console.info('SessionRecorderNative: Running on web platform, native module disabled');
24
+ }
25
+
26
+ // Create a safe wrapper that handles web platform
27
+ const SafeSessionRecorderNative = {
28
+ async captureAndMask() {
29
+ if (isWeb || !SessionRecorderNative) {
30
+ throw new Error('SessionRecorderNative is not available on web platform');
31
+ }
32
+ return SessionRecorderNative.captureAndMask();
33
+ },
34
+ async captureAndMaskWithOptions(options) {
35
+ if (isWeb || !SessionRecorderNative) {
36
+ throw new Error('SessionRecorderNative is not available on web platform');
37
+ }
38
+ return SessionRecorderNative.captureAndMaskWithOptions(options);
39
+ },
40
+ async startGestureRecording() {
41
+ if (isWeb || !SessionRecorderNative) {
42
+ throw new Error('SessionRecorderNative is not available on web platform');
43
+ }
44
+ return SessionRecorderNative.startGestureRecording();
45
+ },
46
+ async stopGestureRecording() {
47
+ if (isWeb || !SessionRecorderNative) {
48
+ throw new Error('SessionRecorderNative is not available on web platform');
49
+ }
50
+ return SessionRecorderNative.stopGestureRecording();
51
+ },
52
+ async isGestureRecordingActive() {
53
+ if (isWeb || !SessionRecorderNative) {
54
+ throw new Error('SessionRecorderNative is not available on web platform');
55
+ }
56
+ return SessionRecorderNative.isGestureRecordingActive();
57
+ },
58
+ setGestureCallback(callback) {
59
+ if (isWeb || !SessionRecorderNative) {
60
+ throw new Error('SessionRecorderNative is not available on web platform');
61
+ }
62
+ // Native side will also invoke callback if provided; also subscribe to events here
63
+ try {
64
+ SessionRecorderNative.setGestureCallback(callback);
65
+ } catch {}
66
+ eventEmitter?.removeAllListeners('onGestureDetected');
67
+ eventEmitter?.addListener('onGestureDetected', callback);
68
+ }
69
+ };
70
+ export default SafeSessionRecorderNative;
71
+
72
+ // Export event emitter for gesture events to maintain previous API
73
+ export const gestureEventEmitter = eventEmitter;
74
+ //# sourceMappingURL=SessionRecorderNative.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeEventEmitter","Platform","TurboModuleRegistry","isWeb","OS","SessionRecorderNative","eventEmitter","getEnforcing","error","console","warn","info","SafeSessionRecorderNative","captureAndMask","Error","captureAndMaskWithOptions","options","startGestureRecording","stopGestureRecording","isGestureRecordingActive","setGestureCallback","callback","removeAllListeners","addListener","gestureEventEmitter"],"sourceRoot":"../../../src","sources":["native/SessionRecorderNative.ts"],"mappings":";;AACA,SAASA,kBAAkB,EAAEC,QAAQ,EAAEC,mBAAmB,QAA0B,cAAc;AAgElG;AACA,MAAMC,KAAK,GAAGF,QAAQ,CAACG,EAAE,KAAK,KAAK;;AAEnC;AACA,IAAIC,qBAAkC,GAAG,IAAI;AAC7C,IAAIC,YAAuC,GAAG,IAAI;AAElD,IAAI,CAACH,KAAK,EAAE;EACV,IAAI;IACFE,qBAAqB,GAAGH,mBAAmB,CAACK,YAAY,CAAO,uBAAuB,CAAC;IACvFD,YAAY,GAAG,IAAIN,kBAAkB,CAACK,qBAA4B,CAAC;EACrE,CAAC,CAAC,OAAOG,KAAK,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,sDAAsD,EAAEF,KAAK,CAAC;EAC7E;AACF;;AAEA;AACA,IAAI,CAACH,qBAAqB,IAAI,CAACF,KAAK,EAAE;EACpCM,OAAO,CAACC,IAAI,CAAC,+FAA+F,CAAC;AAC/G,CAAC,MAAM,IAAIP,KAAK,EAAE;EAChBM,OAAO,CAACE,IAAI,CAAC,wEAAwE,CAAC;AACxF;;AAEA;AACA,MAAMC,yBAA+B,GAAG;EACtC,MAAMC,cAAcA,CAAA,EAAoB;IACtC,IAAIV,KAAK,IAAI,CAACE,qBAAqB,EAAE;MACnC,MAAM,IAAIS,KAAK,CAAC,wDAAwD,CAAC;IAC3E;IACA,OAAOT,qBAAqB,CAACQ,cAAc,CAAC,CAAC;EAC/C,CAAC;EAED,MAAME,yBAAyBA,CAACC,OAAuB,EAAmB;IACxE,IAAIb,KAAK,IAAI,CAACE,qBAAqB,EAAE;MACnC,MAAM,IAAIS,KAAK,CAAC,wDAAwD,CAAC;IAC3E;IACA,OAAOT,qBAAqB,CAACU,yBAAyB,CAACC,OAAO,CAAC;EACjE,CAAC;EAED,MAAMC,qBAAqBA,CAAA,EAAkB;IAC3C,IAAId,KAAK,IAAI,CAACE,qBAAqB,EAAE;MACnC,MAAM,IAAIS,KAAK,CAAC,wDAAwD,CAAC;IAC3E;IACA,OAAOT,qBAAqB,CAACY,qBAAqB,CAAC,CAAC;EACtD,CAAC;EAED,MAAMC,oBAAoBA,CAAA,EAAkB;IAC1C,IAAIf,KAAK,IAAI,CAACE,qBAAqB,EAAE;MACnC,MAAM,IAAIS,KAAK,CAAC,wDAAwD,CAAC;IAC3E;IACA,OAAOT,qBAAqB,CAACa,oBAAoB,CAAC,CAAC;EACrD,CAAC;EAED,MAAMC,wBAAwBA,CAAA,EAAqB;IACjD,IAAIhB,KAAK,IAAI,CAACE,qBAAqB,EAAE;MACnC,MAAM,IAAIS,KAAK,CAAC,wDAAwD,CAAC;IAC3E;IACA,OAAOT,qBAAqB,CAACc,wBAAwB,CAAC,CAAC;EACzD,CAAC;EAEDC,kBAAkBA,CAACC,QAA8B,EAAQ;IACvD,IAAIlB,KAAK,IAAI,CAACE,qBAAqB,EAAE;MACnC,MAAM,IAAIS,KAAK,CAAC,wDAAwD,CAAC;IAC3E;IACA;IACA,IAAI;MACFT,qBAAqB,CAACe,kBAAkB,CAACC,QAAe,CAAC;IAC3D,CAAC,CAAC,MAAM,CAAE;IACVf,YAAY,EAAEgB,kBAAkB,CAAC,mBAAmB,CAAC;IACrDhB,YAAY,EAAEiB,WAAW,CAAC,mBAAmB,EAAEF,QAAQ,CAAC;EAC1D;AACF,CAAC;AAwBD,eAAeT,yBAAyB;;AAExC;AACA,OAAO,MAAMY,mBAAmB,GAAGlB,YAAY","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { default as SessionRecorderNative, gestureEventEmitter } from "./SessionRecorderNative.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default","SessionRecorderNative","gestureEventEmitter"],"sourceRoot":"../../../src","sources":["native/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,qBAAqB,EAAEC,mBAAmB,QAAiC,4BAAyB","ignoreList":[]}
@@ -0,0 +1,218 @@
1
+ "use strict";
2
+
3
+ import { MULTIPLAYER_TRACE_DEBUG_PREFIX, MULTIPLAYER_TRACE_CONTINUOUS_DEBUG_PREFIX, ATTR_MULTIPLAYER_HTTP_REQUEST_BODY, ATTR_MULTIPLAYER_HTTP_REQUEST_HEADERS, ATTR_MULTIPLAYER_HTTP_RESPONSE_BODY, ATTR_MULTIPLAYER_HTTP_RESPONSE_HEADERS } from '@multiplayer-app/session-recorder-common';
4
+ import { logger } from "../utils/index.js";
5
+ /**
6
+ * Checks if the trace should be processed based on trace ID prefixes
7
+ */
8
+ export function shouldProcessTrace(traceId) {
9
+ return traceId.startsWith(MULTIPLAYER_TRACE_DEBUG_PREFIX) || traceId.startsWith(MULTIPLAYER_TRACE_CONTINUOUS_DEBUG_PREFIX);
10
+ }
11
+
12
+ /**
13
+ * Processes request and response body based on trace type and configuration
14
+ */
15
+ export function processBody(payload, config, span) {
16
+ const {
17
+ captureBody,
18
+ masking
19
+ } = config;
20
+ const traceId = span.spanContext().traceId;
21
+ if (!captureBody) {
22
+ return {};
23
+ }
24
+ let {
25
+ requestBody,
26
+ responseBody
27
+ } = payload;
28
+ if (requestBody !== undefined && requestBody !== null) {
29
+ requestBody = JSON.parse(JSON.stringify(requestBody));
30
+ }
31
+ if (responseBody !== undefined && responseBody !== null) {
32
+ responseBody = JSON.parse(JSON.stringify(responseBody));
33
+ }
34
+
35
+ // Apply masking for debug traces
36
+ if (traceId.startsWith(MULTIPLAYER_TRACE_DEBUG_PREFIX) || traceId.startsWith(MULTIPLAYER_TRACE_CONTINUOUS_DEBUG_PREFIX)) {
37
+ if (masking.isContentMaskingEnabled) {
38
+ requestBody = requestBody && masking.maskBody?.(requestBody, span);
39
+ responseBody = responseBody && masking.maskBody?.(responseBody, span);
40
+ }
41
+ }
42
+
43
+ // Convert to string if needed
44
+ if (typeof requestBody !== 'string') {
45
+ requestBody = JSON.stringify(requestBody);
46
+ }
47
+ if (typeof responseBody !== 'string') {
48
+ responseBody = JSON.stringify(responseBody);
49
+ }
50
+ return {
51
+ requestBody: requestBody?.length ? requestBody : undefined,
52
+ responseBody: responseBody?.length ? responseBody : undefined
53
+ };
54
+ }
55
+
56
+ /**
57
+ * Processes request and response headers based on configuration
58
+ */
59
+ export function processHeaders(payload, config, span) {
60
+ const {
61
+ captureHeaders,
62
+ masking
63
+ } = config;
64
+ if (!captureHeaders) {
65
+ return {};
66
+ }
67
+ let {
68
+ requestHeaders = {},
69
+ responseHeaders = {}
70
+ } = payload;
71
+
72
+ // Handle header filtering
73
+ if (!masking.headersToInclude?.length && !masking.headersToExclude?.length) {
74
+ // Add null checks to prevent JSON.parse error when headers is undefined
75
+ if (requestHeaders !== undefined && requestHeaders !== null) {
76
+ requestHeaders = JSON.parse(JSON.stringify(requestHeaders));
77
+ }
78
+ if (responseHeaders !== undefined && responseHeaders !== null) {
79
+ responseHeaders = JSON.parse(JSON.stringify(responseHeaders));
80
+ }
81
+ } else {
82
+ if (masking.headersToInclude) {
83
+ const _requestHeaders = {};
84
+ const _responseHeaders = {};
85
+ for (const headerName of masking.headersToInclude) {
86
+ if (requestHeaders[headerName]) {
87
+ _requestHeaders[headerName] = requestHeaders[headerName];
88
+ }
89
+ if (responseHeaders[headerName]) {
90
+ _responseHeaders[headerName] = responseHeaders[headerName];
91
+ }
92
+ }
93
+ requestHeaders = _requestHeaders;
94
+ responseHeaders = _responseHeaders;
95
+ }
96
+ if (masking.headersToExclude?.length) {
97
+ for (const headerName of masking.headersToExclude) {
98
+ delete requestHeaders[headerName];
99
+ delete responseHeaders[headerName];
100
+ }
101
+ }
102
+ }
103
+
104
+ // Apply masking
105
+ const maskedRequestHeaders = masking.maskHeaders?.(requestHeaders, span) || requestHeaders;
106
+ const maskedResponseHeaders = masking.maskHeaders?.(responseHeaders, span) || responseHeaders;
107
+
108
+ // Convert to string
109
+ const requestHeadersStr = typeof maskedRequestHeaders === 'string' ? maskedRequestHeaders : JSON.stringify(maskedRequestHeaders);
110
+ const responseHeadersStr = typeof maskedResponseHeaders === 'string' ? maskedResponseHeaders : JSON.stringify(maskedResponseHeaders);
111
+ return {
112
+ requestHeaders: requestHeadersStr?.length ? requestHeadersStr : undefined,
113
+ responseHeaders: responseHeadersStr?.length ? responseHeadersStr : undefined
114
+ };
115
+ }
116
+
117
+ /**
118
+ * Processes HTTP payload (body and headers) and sets span attributes
119
+ */
120
+ export function processHttpPayload(payload, config, span) {
121
+ const traceId = span.spanContext().traceId;
122
+ if (!shouldProcessTrace(traceId)) {
123
+ return;
124
+ }
125
+ const {
126
+ requestBody,
127
+ responseBody
128
+ } = processBody(payload, config, span);
129
+ const {
130
+ requestHeaders,
131
+ responseHeaders
132
+ } = processHeaders(payload, config, span);
133
+
134
+ // Set span attributes
135
+ if (requestBody) {
136
+ span.setAttribute(ATTR_MULTIPLAYER_HTTP_REQUEST_BODY, requestBody);
137
+ }
138
+ if (responseBody) {
139
+ span.setAttribute(ATTR_MULTIPLAYER_HTTP_RESPONSE_BODY, responseBody);
140
+ }
141
+ if (requestHeaders) {
142
+ span.setAttribute(ATTR_MULTIPLAYER_HTTP_REQUEST_HEADERS, requestHeaders);
143
+ }
144
+ if (responseHeaders) {
145
+ span.setAttribute(ATTR_MULTIPLAYER_HTTP_RESPONSE_HEADERS, responseHeaders);
146
+ }
147
+ }
148
+
149
+ /**
150
+ * Converts Headers object to plain object
151
+ */
152
+ export function headersToObject(headers) {
153
+ const result = {};
154
+ if (!headers) {
155
+ return result;
156
+ }
157
+ if (headers instanceof Headers) {
158
+ headers.forEach((value, key) => {
159
+ result[key] = value;
160
+ });
161
+ } else if (Array.isArray(headers)) {
162
+ // Handle array of [key, value] pairs
163
+ for (const [key, value] of headers) {
164
+ if (typeof key === 'string' && typeof value === 'string') {
165
+ result[key] = value;
166
+ }
167
+ }
168
+ } else if (typeof headers === 'object' && !Array.isArray(headers)) {
169
+ for (const [key, value] of Object.entries(headers)) {
170
+ if (typeof key === 'string' && typeof value === 'string') {
171
+ result[key] = value;
172
+ }
173
+ }
174
+ }
175
+ return result;
176
+ }
177
+
178
+ /**
179
+ * Extracts response body as string from Response object
180
+ */
181
+ export async function extractResponseBody(response) {
182
+ if (!response.body) {
183
+ return null;
184
+ }
185
+ try {
186
+ if (response.body instanceof ReadableStream) {
187
+ // Check if response body is already consumed
188
+ if (response.bodyUsed) {
189
+ return null;
190
+ }
191
+ const responseClone = response.clone();
192
+ return responseClone.text();
193
+ } else {
194
+ return JSON.stringify(response.body);
195
+ }
196
+ } catch (error) {
197
+ // If cloning fails (body already consumed), return null
198
+ // eslint-disable-next-line no-console
199
+ logger.warn('DEBUGGER_LIB', 'Failed to extract response body', error);
200
+ return null;
201
+ }
202
+ }
203
+ export const getExporterEndpoint = exporterEndpoint => {
204
+ const hasPath = exporterEndpoint && (() => {
205
+ try {
206
+ const url = new URL(exporterEndpoint);
207
+ return url.pathname !== '/' && url.pathname !== '';
208
+ } catch {
209
+ return false;
210
+ }
211
+ })();
212
+ if (hasPath) {
213
+ return exporterEndpoint;
214
+ }
215
+ const trimmedExporterEndpoint = new URL(exporterEndpoint).origin;
216
+ return `${trimmedExporterEndpoint}/v1/traces`;
217
+ };
218
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MULTIPLAYER_TRACE_DEBUG_PREFIX","MULTIPLAYER_TRACE_CONTINUOUS_DEBUG_PREFIX","ATTR_MULTIPLAYER_HTTP_REQUEST_BODY","ATTR_MULTIPLAYER_HTTP_REQUEST_HEADERS","ATTR_MULTIPLAYER_HTTP_RESPONSE_BODY","ATTR_MULTIPLAYER_HTTP_RESPONSE_HEADERS","logger","shouldProcessTrace","traceId","startsWith","processBody","payload","config","span","captureBody","masking","spanContext","requestBody","responseBody","undefined","JSON","parse","stringify","isContentMaskingEnabled","maskBody","length","processHeaders","captureHeaders","requestHeaders","responseHeaders","headersToInclude","headersToExclude","_requestHeaders","_responseHeaders","headerName","maskedRequestHeaders","maskHeaders","maskedResponseHeaders","requestHeadersStr","responseHeadersStr","processHttpPayload","setAttribute","headersToObject","headers","result","Headers","forEach","value","key","Array","isArray","Object","entries","extractResponseBody","response","body","ReadableStream","bodyUsed","responseClone","clone","text","error","warn","getExporterEndpoint","exporterEndpoint","hasPath","url","URL","pathname","trimmedExporterEndpoint","origin"],"sourceRoot":"../../../src","sources":["otel/helpers.ts"],"mappings":";;AACA,SACEA,8BAA8B,EAC9BC,yCAAyC,EACzCC,kCAAkC,EAClCC,qCAAqC,EACrCC,mCAAmC,EACnCC,sCAAsC,QACjC,0CAA0C;AACjD,SAASC,MAAM,QAAQ,mBAAU;AAmBjC;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,OAAe,EAAW;EAC3D,OACEA,OAAO,CAACC,UAAU,CAACT,8BAA8B,CAAC,IAClDQ,OAAO,CAACC,UAAU,CAACR,yCAAyC,CAAC;AAEjE;;AAEA;AACA;AACA;AACA,OAAO,SAASS,WAAWA,CACzBC,OAAwB,EACxBC,MAA+B,EAC/BC,IAAU,EACuC;EACjD,MAAM;IAAEC,WAAW;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EACvC,MAAMJ,OAAO,GAAGK,IAAI,CAACG,WAAW,CAAC,CAAC,CAACR,OAAO;EAE1C,IAAI,CAACM,WAAW,EAAE;IAChB,OAAO,CAAC,CAAC;EACX;EAEA,IAAI;IAAEG,WAAW;IAAEC;EAAa,CAAC,GAAGP,OAAO;EAE3C,IAAIM,WAAW,KAAKE,SAAS,IAAIF,WAAW,KAAK,IAAI,EAAE;IACrDA,WAAW,GAAGG,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,SAAS,CAACL,WAAW,CAAC,CAAC;E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,EAAE;QACrB,OAAO,IAAI;MACb;MAEA,MAAMC,aAAa,GAAGJ,QAAQ,CAACK,KAAK,CAAC,CAAC;MACtC,OAAOD,aAAa,CAACE,IAAI,CAAC,CAAC;IAC7B,CAAC,MAAM;MACL,OAAOxC,IAAI,CAACE,SAAS,CAACgC,QAAQ,CAACC,IAAI,CAAC;IACtC;EACF,CAAC,CAAC,OAAOM,KAAK,EAAE;IACd;IACA;IACAvD,MAAM,CAACwD,IAAI,CAAC,cAAc,EAAE,iCAAiC,EAAED,KAAK,CAAC;IACrE,OAAO,IAAI;EACb;AACF;AAEA,OAAO,MAAME,mBAAmB,GAAIC,gBAAwB,IAAa;EACvE,MAAMC,OAAO,GAAGD,gBAAgB,IAAI,CAAC,MAAM;IACzC,IAAI;MACF,MAAME,GAAG,GAAG,IAAIC,GAAG,CAACH,gBAAgB,CAAC;MACrC,OAAOE,GAAG,CAACE,QAAQ,KAAK,GAAG,IAAIF,GAAG,CAACE,QAAQ,KAAK,EAAE;IACpD,CAAC,CAAC,MAAM;MACN,OAAO,KAAK;IACd;EACF,CAAC,EAAE,CAAC;EAEJ,IAAIH,OAAO,EAAE;IACX,OAAOD,gBAAgB;EACzB;EAEA,MAAMK,uBAAuB,GAAG,IAAIF,GAAG,CAACH,gBAAgB,CAAC,CAACM,MAAM;EAEhE,OAAO,GAAGD,uBAAuB,YAAY;AAC/C,CAAC","ignoreList":[]}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ import { resourceFromAttributes } from '@opentelemetry/resources';
4
+ import { W3CTraceContextPropagator } from '@opentelemetry/core';
5
+ import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
6
+ import * as SemanticAttributes from '@opentelemetry/semantic-conventions';
7
+ import { registerInstrumentations } from '@opentelemetry/instrumentation';
8
+ import { SessionType, ATTR_MULTIPLAYER_SESSION_ID, SessionRecorderIdGenerator, SessionRecorderTraceIdRatioBasedSampler, SessionRecorderBrowserTraceExporter } from '@multiplayer-app/session-recorder-common';
9
+ import { getInstrumentations } from "./instrumentations/index.js";
10
+ import { getExporterEndpoint } from "./helpers.js";
11
+ import { getPlatformAttributes } from "../utils/platform.js";
12
+ import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
13
+ export class TracerReactNativeSDK {
14
+ sessionId = '';
15
+ constructor() {}
16
+ _setSessionId(sessionId, sessionType = SessionType.PLAIN) {
17
+ this.sessionId = sessionId;
18
+ this.idGenerator?.setSessionId(sessionId, sessionType);
19
+ }
20
+ init(options) {
21
+ this.config = options;
22
+ const {
23
+ application,
24
+ version,
25
+ environment
26
+ } = this.config;
27
+ this.idGenerator = new SessionRecorderIdGenerator();
28
+ this.exporter = new SessionRecorderBrowserTraceExporter({
29
+ apiKey: options.apiKey,
30
+ url: getExporterEndpoint(options.exporterEndpoint)
31
+ });
32
+ this.tracerProvider = new WebTracerProvider({
33
+ resource: resourceFromAttributes({
34
+ [SemanticAttributes.SEMRESATTRS_SERVICE_NAME]: application,
35
+ [SemanticAttributes.SEMRESATTRS_SERVICE_VERSION]: version,
36
+ [SemanticAttributes.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: environment,
37
+ ...getPlatformAttributes()
38
+ }),
39
+ idGenerator: this.idGenerator,
40
+ sampler: new SessionRecorderTraceIdRatioBasedSampler(this.config.sampleTraceRatio || 0.15),
41
+ spanProcessors: [this._getSpanSessionIdProcessor(), new BatchSpanProcessor(this.exporter)]
42
+ });
43
+ this.tracerProvider.register({
44
+ propagator: new W3CTraceContextPropagator()
45
+ });
46
+
47
+ // Register instrumentations
48
+ registerInstrumentations({
49
+ tracerProvider: this.tracerProvider,
50
+ instrumentations: getInstrumentations(this.config)
51
+ });
52
+ }
53
+ _getSpanSessionIdProcessor() {
54
+ return {
55
+ onStart: span => {
56
+ if (this.sessionId) {
57
+ span.setAttribute(ATTR_MULTIPLAYER_SESSION_ID, this.sessionId);
58
+ }
59
+ // Add React Native specific attributes
60
+ span.setAttribute('platform', 'react-native');
61
+ span.setAttribute('timestamp', Date.now());
62
+ },
63
+ onEnd: () => {},
64
+ shutdown: () => Promise.resolve(),
65
+ forceFlush: () => Promise.resolve()
66
+ };
67
+ }
68
+ start(sessionId, sessionType) {
69
+ if (!this.tracerProvider) {
70
+ throw new Error('Configuration not initialized. Call init() before start().');
71
+ }
72
+ this._setSessionId(sessionId, sessionType);
73
+ }
74
+ stop() {
75
+ if (!this.tracerProvider) {
76
+ throw new Error('Configuration not initialized. Call init() before start().');
77
+ }
78
+ this._setSessionId('');
79
+ }
80
+ setApiKey(apiKey) {
81
+ if (!this.exporter) {
82
+ throw new Error('Configuration not initialized. Call init() before setApiKey().');
83
+ }
84
+ this.exporter.setApiKey?.(apiKey);
85
+ }
86
+ setSessionId(sessionId, sessionType) {
87
+ this._setSessionId(sessionId, sessionType);
88
+ }
89
+
90
+ // Shutdown (React Native specific)
91
+ shutdown() {
92
+ return Promise.resolve();
93
+ }
94
+ }
95
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["resourceFromAttributes","W3CTraceContextPropagator","BatchSpanProcessor","SemanticAttributes","registerInstrumentations","SessionType","ATTR_MULTIPLAYER_SESSION_ID","SessionRecorderIdGenerator","SessionRecorderTraceIdRatioBasedSampler","SessionRecorderBrowserTraceExporter","getInstrumentations","getExporterEndpoint","getPlatformAttributes","WebTracerProvider","TracerReactNativeSDK","sessionId","constructor","_setSessionId","sessionType","PLAIN","idGenerator","setSessionId","init","options","config","application","version","environment","exporter","apiKey","url","exporterEndpoint","tracerProvider","resource","SEMRESATTRS_SERVICE_NAME","SEMRESATTRS_SERVICE_VERSION","SEMRESATTRS_DEPLOYMENT_ENVIRONMENT","sampler","sampleTraceRatio","spanProcessors","_getSpanSessionIdProcessor","register","propagator","instrumentations","onStart","span","setAttribute","Date","now","onEnd","shutdown","Promise","resolve","forceFlush","start","Error","stop","setApiKey"],"sourceRoot":"../../../src","sources":["otel/index.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,0BA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IAAI,CAAC,IAAI,CAACc,cAAc,EAAE;MACxB,MAAM,IAAIuB,KAAK,CACb,4DACF,CAAC;IACH;IAEA,IAAI,CAACtC,aAAa,CAACF,SAAS,EAAEG,WAAW,CAAC;EAC5C;EAEAsC,IAAIA,CAAA,EAAS;IACX,IAAI,CAAC,IAAI,CAACxB,cAAc,EAAE;MACxB,MAAM,IAAIuB,KAAK,CACb,4DACF,CAAC;IACH;IAEA,IAAI,CAACtC,aAAa,CAAC,EAAE,CAAC;EACxB;EAEAwC,SAASA,CAAC5B,MAAc,EAAQ;IAC9B,IAAI,CAAC,IAAI,CAACD,QAAQ,EAAE;MAClB,MAAM,IAAI2B,KAAK,CACb,gEACF,CAAC;IACH;IAEA,IAAI,CAAC3B,QAAQ,CAAC6B,SAAS,GAAG5B,MAAM,CAAC;EACnC;EAEAR,YAAYA,CAACN,SAAiB,EAAEG,WAAwB,EAAQ;IAC9D,IAAI,CAACD,aAAa,CAACF,SAAS,EAAEG,WAAW,CAAC;EAC5C;;EAEA;EACAgC,QAAQA,CAAA,EAAkB;IACxB,OAAOC,OAAO,CAACC,OAAO,CAAC,CAAC;EAC1B;AACF","ignoreList":[]}
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ import { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';
4
+ import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
5
+ import { logger } from "../../utils/index.js";
6
+ import { OTEL_IGNORE_URLS } from "../../config/index.js";
7
+ import { extractResponseBody, headersToObject, processHttpPayload } from "../helpers.js";
8
+ export function getInstrumentations(config) {
9
+ const instrumentations = [];
10
+
11
+ // Fetch instrumentation
12
+ try {
13
+ instrumentations.push(new FetchInstrumentation({
14
+ clearTimingResources: false,
15
+ ignoreUrls: [...OTEL_IGNORE_URLS, ...(config.ignoreUrls || [])],
16
+ propagateTraceHeaderCorsUrls: config.propagateTraceHeaderCorsUrls,
17
+ applyCustomAttributesOnSpan: async (span, request, response) => {
18
+ if (!config) return;
19
+ const {
20
+ captureBody,
21
+ captureHeaders
22
+ } = config;
23
+ try {
24
+ if (!captureBody && !captureHeaders) {
25
+ return;
26
+ }
27
+ const requestBody = request.body;
28
+ const requestHeaders = headersToObject(request.headers);
29
+ const responseHeaders = headersToObject(response instanceof Response ? response.headers : undefined);
30
+ let responseBody = null;
31
+ if (response instanceof Response && response.body) {
32
+ responseBody = await extractResponseBody(response);
33
+ }
34
+ const payload = {
35
+ requestBody,
36
+ responseBody,
37
+ requestHeaders,
38
+ responseHeaders
39
+ };
40
+ processHttpPayload(payload, config, span);
41
+ } catch (error) {
42
+ // eslint-disable-next-line
43
+ logger.error('DEBUGGER_LIB', 'Failed to capture fetch payload', error);
44
+ }
45
+ }
46
+ }));
47
+ } catch (error) {
48
+ logger.warn('DEBUGGER_LIB', 'Fetch instrumentation not available', error);
49
+ }
50
+
51
+ // XMLHttpRequest instrumentation
52
+ try {
53
+ instrumentations.push(new XMLHttpRequestInstrumentation({
54
+ clearTimingResources: false,
55
+ ignoreUrls: [...OTEL_IGNORE_URLS, ...(config.ignoreUrls || [])],
56
+ propagateTraceHeaderCorsUrls: config.propagateTraceHeaderCorsUrls,
57
+ applyCustomAttributesOnSpan: (span, xhr) => {
58
+ if (!config) return;
59
+ const {
60
+ captureBody,
61
+ captureHeaders
62
+ } = config;
63
+ try {
64
+ if (!captureBody && !captureHeaders) {
65
+ return;
66
+ }
67
+
68
+ // @ts-ignore
69
+ const requestBody = xhr.networkRequest.requestBody;
70
+ // @ts-ignore
71
+ const responseBody = xhr.networkRequest.responseBody;
72
+ // @ts-ignore
73
+ const requestHeaders = xhr.networkRequest.requestHeaders || {};
74
+ // @ts-ignore
75
+ const responseHeaders = xhr.networkRequest.responseHeaders || {};
76
+ const payload = {
77
+ requestBody,
78
+ responseBody,
79
+ requestHeaders,
80
+ responseHeaders
81
+ };
82
+ processHttpPayload(payload, config, span);
83
+ } catch (error) {
84
+ // eslint-disable-next-line
85
+ logger.error('DEBUGGER_LIB', 'Failed to capture xml-http payload', error);
86
+ }
87
+ }
88
+ }));
89
+ } catch (error) {
90
+ logger.warn('DEBUGGER_LIB', 'XMLHttpRequest instrumentation not available', error);
91
+ }
92
+
93
+ // Custom React Native instrumentations
94
+ // try {
95
+ // instrumentations.push(new ReactNativeInstrumentation())
96
+ // } catch (error) {
97
+ // console.warn('React Native instrumentation not available:', error)
98
+ // }
99
+
100
+ return instrumentations;
101
+ }
102
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FetchInstrumentation","XMLHttpRequestInstrumentation","logger","OTEL_IGNORE_URLS","extractResponseBody","headersToObject","processHttpPayload","getInstrumentations","config","instrumentations","push","clearTimingResources","ignoreUrls","propagateTraceHeaderCorsUrls","applyCustomAttributesOnSpan","span","request","response","captureBody","captureHeaders","requestBody","body","requestHeaders","headers","responseHeaders","Response","undefined","responseBody","payload","error","warn","xhr","networkRequest"],"sourceRoot":"../../../../src","sources":["otel/instrumentations/index.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,sCAAsC;AAC3E,SAASC,6BAA6B,QAAQ,iDAAiD;AAE/F,SAASC,MAAM,QAAQ,sBAAa;AACpC,SAASC,gBAAgB,QAAQ,uBAAc;AAE/C,SAASC,mBAAmB,EAAEC,eAAe,EAAEC,kBAAkB,QAAQ,eAAY;AAErF,OAAO,SAASC,mBAAmBA,CAACC,MAA+B,EAAE;EAEnE,MAAMC,gBAAgB,GAAG,EAAE;;EAE3B;EACA,IAAI;IACFA,gBAAgB,CAACC,IAAI,CACnB,IAAIV,oBAAoB,CAAC;MACvBW,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE,CACV,GAAGT,gBAAgB,EACnB,IAAIK,MAAM,CAACI,UAAU,IAAI,EAAE,CAAC,CAC7B;MACDC,4BAA4B,EAAEL,MAAM,CAACK,4BAA4B;MACjEC,2BAA2B,EAAE,MAAAA,CAAOC,IAAI,EAAEC,OAAO,EAAEC,QAAQ,KAA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,GAAG,KAAK;QAC1C,IAAI,CAACvB,MAAM,EAAE;QAEb,MAAM;UAAEU,WAAW;UAAEC;QAAe,CAAC,GAAGX,MAAM;QAE9C,IAAI;UACF,IAAI,CAACU,WAAW,IAAI,CAACC,cAAc,EAAE;YACnC;UACF;;UAEA;UACA,MAAMC,WAAW,GAAGW,GAAG,CAACC,cAAc,CAACZ,WAAW;UAClD;UACA,MAAMO,YAAY,GAAGI,GAAG,CAACC,cAAc,CAACL,YAAY;UACpD;UACA,MAAML,cAAc,GAAGS,GAAG,CAACC,cAAc,CAACV,cAAc,IAAI,CAAC,CAAC;UAC9D;UACA,MAAME,eAAe,GAAGO,GAAG,CAACC,cAAc,CAACR,eAAe,IAAI,CAAC,CAAC;UAEhE,MAAMI,OAAO,GAAG;YACdR,WAAW;YACXO,YAAY;YACZL,cAAc;YACdE;UACF,CAAC;UACDlB,kBAAkB,CAACsB,OAAO,EAAEpB,MAAM,EAAEO,IAAI,CAAC;QAC3C,CAAC,CAAC,OAAOc,KAAK,EAAE;UACd;UACA3B,MAAM,CAAC2B,KAAK,CAAC,cAAc,EAAE,oCAAoC,EAAEA,KAAK,CAAC;QAC3E;MACF;IACF,CAAC,CACH,CAAC;EACH,CAAC,CAAC,OAAOA,KAAK,EAAE;IACd3B,MAAM,CAAC4B,IAAI,CAAC,cAAc,EAAE,8CAA8C,EAAED,KAAK,CAAC;EACpF;;EAEA;EACA;EACA;EACA;EACA;EACA;;EAEA,OAAOpB,gBAAgB;AACzB","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ import "./xhr.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["patch/index.ts"],"mappings":";;AAAA,OAAO,UAAO","ignoreList":[]}