@multiplayer-app/session-recorder-react-native 1.3.37 → 2.0.17-alpha.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 (280) hide show
  1. package/package.json +4 -4
  2. package/src/NativeSessionRecorderModule.ts +4 -2
  3. package/src/NativeSessionRecorderModuleSpec.ts +4 -2
  4. package/src/NativeSessionRecorderNative.ts +1 -1
  5. package/src/index.ts +0 -1
  6. package/src/otel/instrumentations/index.ts +22 -22
  7. package/src/session-recorder.ts +4 -0
  8. package/src/types/configs.ts +1 -2
  9. package/lib/module/NativeSessionRecorderModule.js +0 -5
  10. package/lib/module/NativeSessionRecorderModule.js.map +0 -1
  11. package/lib/module/NativeSessionRecorderModuleSpec.js +0 -5
  12. package/lib/module/NativeSessionRecorderModuleSpec.js.map +0 -1
  13. package/lib/module/NativeSessionRecorderNative.js +0 -5
  14. package/lib/module/NativeSessionRecorderNative.js.map +0 -1
  15. package/lib/module/components/ErrorBoundary.js +0 -32
  16. package/lib/module/components/ErrorBoundary.js.map +0 -1
  17. package/lib/module/components/ScreenRecorderView/ScreenRecorderView.js +0 -23
  18. package/lib/module/components/ScreenRecorderView/ScreenRecorderView.js.map +0 -1
  19. package/lib/module/components/ScreenRecorderView/index.js +0 -4
  20. package/lib/module/components/ScreenRecorderView/index.js.map +0 -1
  21. package/lib/module/components/SessionRecorderWidget/ErrorBanner.js +0 -64
  22. package/lib/module/components/SessionRecorderWidget/ErrorBanner.js.map +0 -1
  23. package/lib/module/components/SessionRecorderWidget/FinalPopover.js +0 -74
  24. package/lib/module/components/SessionRecorderWidget/FinalPopover.js.map +0 -1
  25. package/lib/module/components/SessionRecorderWidget/FloatingButton.js +0 -191
  26. package/lib/module/components/SessionRecorderWidget/FloatingButton.js.map +0 -1
  27. package/lib/module/components/SessionRecorderWidget/InitialPopover.js +0 -138
  28. package/lib/module/components/SessionRecorderWidget/InitialPopover.js.map +0 -1
  29. package/lib/module/components/SessionRecorderWidget/ModalContainer.js +0 -177
  30. package/lib/module/components/SessionRecorderWidget/ModalContainer.js.map +0 -1
  31. package/lib/module/components/SessionRecorderWidget/ModalHeader.js +0 -27
  32. package/lib/module/components/SessionRecorderWidget/ModalHeader.js.map +0 -1
  33. package/lib/module/components/SessionRecorderWidget/SessionRecorderWidget.js +0 -133
  34. package/lib/module/components/SessionRecorderWidget/SessionRecorderWidget.js.map +0 -1
  35. package/lib/module/components/SessionRecorderWidget/icons.js +0 -93
  36. package/lib/module/components/SessionRecorderWidget/icons.js.map +0 -1
  37. package/lib/module/components/SessionRecorderWidget/index.js +0 -5
  38. package/lib/module/components/SessionRecorderWidget/index.js.map +0 -1
  39. package/lib/module/components/SessionRecorderWidget/styles.js +0 -173
  40. package/lib/module/components/SessionRecorderWidget/styles.js.map +0 -1
  41. package/lib/module/components/index.js +0 -6
  42. package/lib/module/components/index.js.map +0 -1
  43. package/lib/module/config/constants.js +0 -47
  44. package/lib/module/config/constants.js.map +0 -1
  45. package/lib/module/config/defaults.js +0 -87
  46. package/lib/module/config/defaults.js.map +0 -1
  47. package/lib/module/config/index.js +0 -9
  48. package/lib/module/config/index.js.map +0 -1
  49. package/lib/module/config/masking.js +0 -35
  50. package/lib/module/config/masking.js.map +0 -1
  51. package/lib/module/config/session-recorder.js +0 -50
  52. package/lib/module/config/session-recorder.js.map +0 -1
  53. package/lib/module/config/validators.js +0 -28
  54. package/lib/module/config/validators.js.map +0 -1
  55. package/lib/module/config/widget.js +0 -35
  56. package/lib/module/config/widget.js.map +0 -1
  57. package/lib/module/context/SessionRecorderContext.js +0 -100
  58. package/lib/module/context/SessionRecorderContext.js.map +0 -1
  59. package/lib/module/context/SessionRecorderStore.js +0 -12
  60. package/lib/module/context/SessionRecorderStore.js.map +0 -1
  61. package/lib/module/context/createStore.js +0 -27
  62. package/lib/module/context/createStore.js.map +0 -1
  63. package/lib/module/context/useSessionRecorderStore.js +0 -45
  64. package/lib/module/context/useSessionRecorderStore.js.map +0 -1
  65. package/lib/module/context/useStoreSelector.js +0 -27
  66. package/lib/module/context/useStoreSelector.js.map +0 -1
  67. package/lib/module/index.js +0 -14
  68. package/lib/module/index.js.map +0 -1
  69. package/lib/module/native/SessionRecorderNative.js +0 -76
  70. package/lib/module/native/SessionRecorderNative.js.map +0 -1
  71. package/lib/module/native/index.js +0 -4
  72. package/lib/module/native/index.js.map +0 -1
  73. package/lib/module/otel/CrashBufferSpanProcessor.js +0 -42
  74. package/lib/module/otel/CrashBufferSpanProcessor.js.map +0 -1
  75. package/lib/module/otel/helpers.js +0 -218
  76. package/lib/module/otel/helpers.js.map +0 -1
  77. package/lib/module/otel/index.js +0 -202
  78. package/lib/module/otel/index.js.map +0 -1
  79. package/lib/module/otel/instrumentations/index.js +0 -122
  80. package/lib/module/otel/instrumentations/index.js.map +0 -1
  81. package/lib/module/package.json +0 -1
  82. package/lib/module/patch/configs.js +0 -18
  83. package/lib/module/patch/configs.js.map +0 -1
  84. package/lib/module/patch/fetch.js +0 -222
  85. package/lib/module/patch/fetch.js.map +0 -1
  86. package/lib/module/patch/index.js +0 -6
  87. package/lib/module/patch/index.js.map +0 -1
  88. package/lib/module/patch/xhr.js +0 -100
  89. package/lib/module/patch/xhr.js.map +0 -1
  90. package/lib/module/recorder/gestureRecorder.js +0 -641
  91. package/lib/module/recorder/gestureRecorder.js.map +0 -1
  92. package/lib/module/recorder/index.js +0 -176
  93. package/lib/module/recorder/index.js.map +0 -1
  94. package/lib/module/recorder/navigationRecorder.js +0 -238
  95. package/lib/module/recorder/navigationRecorder.js.map +0 -1
  96. package/lib/module/recorder/screenRecorder.js +0 -527
  97. package/lib/module/recorder/screenRecorder.js.map +0 -1
  98. package/lib/module/services/api.service.js +0 -166
  99. package/lib/module/services/api.service.js.map +0 -1
  100. package/lib/module/services/crashBuffer.service.js +0 -280
  101. package/lib/module/services/crashBuffer.service.js.map +0 -1
  102. package/lib/module/services/network.service.js +0 -178
  103. package/lib/module/services/network.service.js.map +0 -1
  104. package/lib/module/services/screenRecordingService.js +0 -107
  105. package/lib/module/services/screenRecordingService.js.map +0 -1
  106. package/lib/module/services/socket.service.js +0 -186
  107. package/lib/module/services/socket.service.js.map +0 -1
  108. package/lib/module/services/storage.service.js +0 -178
  109. package/lib/module/services/storage.service.js.map +0 -1
  110. package/lib/module/session-recorder.js +0 -750
  111. package/lib/module/session-recorder.js.map +0 -1
  112. package/lib/module/types/configs.js +0 -4
  113. package/lib/module/types/configs.js.map +0 -1
  114. package/lib/module/types/expo-constants.d.js +0 -2
  115. package/lib/module/types/expo-constants.d.js.map +0 -1
  116. package/lib/module/types/index.js +0 -10
  117. package/lib/module/types/index.js.map +0 -1
  118. package/lib/module/types/session-recorder.js +0 -68
  119. package/lib/module/types/session-recorder.js.map +0 -1
  120. package/lib/module/utils/app-metadata.js +0 -28
  121. package/lib/module/utils/app-metadata.js.map +0 -1
  122. package/lib/module/utils/constants.optional.expo.js +0 -6
  123. package/lib/module/utils/constants.optional.expo.js.map +0 -1
  124. package/lib/module/utils/constants.optional.js +0 -8
  125. package/lib/module/utils/constants.optional.js.map +0 -1
  126. package/lib/module/utils/index.js +0 -11
  127. package/lib/module/utils/index.js.map +0 -1
  128. package/lib/module/utils/logger.js +0 -185
  129. package/lib/module/utils/logger.js.map +0 -1
  130. package/lib/module/utils/platform.js +0 -340
  131. package/lib/module/utils/platform.js.map +0 -1
  132. package/lib/module/utils/request-utils.js +0 -58
  133. package/lib/module/utils/request-utils.js.map +0 -1
  134. package/lib/module/utils/rrweb-events.js +0 -276
  135. package/lib/module/utils/rrweb-events.js.map +0 -1
  136. package/lib/module/utils/session.js +0 -21
  137. package/lib/module/utils/session.js.map +0 -1
  138. package/lib/module/utils/shallowEqual.js +0 -17
  139. package/lib/module/utils/shallowEqual.js.map +0 -1
  140. package/lib/module/utils/time.js +0 -17
  141. package/lib/module/utils/time.js.map +0 -1
  142. package/lib/module/utils/type-utils.js +0 -69
  143. package/lib/module/utils/type-utils.js.map +0 -1
  144. package/lib/module/version.js +0 -4
  145. package/lib/module/version.js.map +0 -1
  146. package/lib/typescript/package.json +0 -1
  147. package/lib/typescript/src/NativeSessionRecorderModule.d.ts +0 -25
  148. package/lib/typescript/src/NativeSessionRecorderModule.d.ts.map +0 -1
  149. package/lib/typescript/src/NativeSessionRecorderModuleSpec.d.ts +0 -25
  150. package/lib/typescript/src/NativeSessionRecorderModuleSpec.d.ts.map +0 -1
  151. package/lib/typescript/src/NativeSessionRecorderNative.d.ts +0 -25
  152. package/lib/typescript/src/NativeSessionRecorderNative.d.ts.map +0 -1
  153. package/lib/typescript/src/components/ErrorBoundary.d.ts +0 -16
  154. package/lib/typescript/src/components/ErrorBoundary.d.ts.map +0 -1
  155. package/lib/typescript/src/components/ScreenRecorderView/ScreenRecorderView.d.ts +0 -6
  156. package/lib/typescript/src/components/ScreenRecorderView/ScreenRecorderView.d.ts.map +0 -1
  157. package/lib/typescript/src/components/ScreenRecorderView/index.d.ts +0 -2
  158. package/lib/typescript/src/components/ScreenRecorderView/index.d.ts.map +0 -1
  159. package/lib/typescript/src/components/SessionRecorderWidget/ErrorBanner.d.ts +0 -8
  160. package/lib/typescript/src/components/SessionRecorderWidget/ErrorBanner.d.ts.map +0 -1
  161. package/lib/typescript/src/components/SessionRecorderWidget/FinalPopover.d.ts +0 -13
  162. package/lib/typescript/src/components/SessionRecorderWidget/FinalPopover.d.ts.map +0 -1
  163. package/lib/typescript/src/components/SessionRecorderWidget/FloatingButton.d.ts +0 -9
  164. package/lib/typescript/src/components/SessionRecorderWidget/FloatingButton.d.ts.map +0 -1
  165. package/lib/typescript/src/components/SessionRecorderWidget/InitialPopover.d.ts +0 -17
  166. package/lib/typescript/src/components/SessionRecorderWidget/InitialPopover.d.ts.map +0 -1
  167. package/lib/typescript/src/components/SessionRecorderWidget/ModalContainer.d.ts +0 -9
  168. package/lib/typescript/src/components/SessionRecorderWidget/ModalContainer.d.ts.map +0 -1
  169. package/lib/typescript/src/components/SessionRecorderWidget/ModalHeader.d.ts +0 -7
  170. package/lib/typescript/src/components/SessionRecorderWidget/ModalHeader.d.ts.map +0 -1
  171. package/lib/typescript/src/components/SessionRecorderWidget/SessionRecorderWidget.d.ts +0 -6
  172. package/lib/typescript/src/components/SessionRecorderWidget/SessionRecorderWidget.d.ts.map +0 -1
  173. package/lib/typescript/src/components/SessionRecorderWidget/icons.d.ts +0 -12
  174. package/lib/typescript/src/components/SessionRecorderWidget/icons.d.ts.map +0 -1
  175. package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts +0 -3
  176. package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts.map +0 -1
  177. package/lib/typescript/src/components/SessionRecorderWidget/styles.d.ts +0 -166
  178. package/lib/typescript/src/components/SessionRecorderWidget/styles.d.ts.map +0 -1
  179. package/lib/typescript/src/components/index.d.ts +0 -4
  180. package/lib/typescript/src/components/index.d.ts.map +0 -1
  181. package/lib/typescript/src/config/constants.d.ts +0 -22
  182. package/lib/typescript/src/config/constants.d.ts.map +0 -1
  183. package/lib/typescript/src/config/defaults.d.ts +0 -5
  184. package/lib/typescript/src/config/defaults.d.ts.map +0 -1
  185. package/lib/typescript/src/config/index.d.ts +0 -6
  186. package/lib/typescript/src/config/index.d.ts.map +0 -1
  187. package/lib/typescript/src/config/masking.d.ts +0 -3
  188. package/lib/typescript/src/config/masking.d.ts.map +0 -1
  189. package/lib/typescript/src/config/session-recorder.d.ts +0 -3
  190. package/lib/typescript/src/config/session-recorder.d.ts.map +0 -1
  191. package/lib/typescript/src/config/validators.d.ts +0 -11
  192. package/lib/typescript/src/config/validators.d.ts.map +0 -1
  193. package/lib/typescript/src/config/widget.d.ts +0 -10
  194. package/lib/typescript/src/config/widget.d.ts.map +0 -1
  195. package/lib/typescript/src/context/SessionRecorderContext.d.ts +0 -22
  196. package/lib/typescript/src/context/SessionRecorderContext.d.ts.map +0 -1
  197. package/lib/typescript/src/context/SessionRecorderStore.d.ts +0 -13
  198. package/lib/typescript/src/context/SessionRecorderStore.d.ts.map +0 -1
  199. package/lib/typescript/src/context/createStore.d.ts +0 -9
  200. package/lib/typescript/src/context/createStore.d.ts.map +0 -1
  201. package/lib/typescript/src/context/useSessionRecorderStore.d.ts +0 -29
  202. package/lib/typescript/src/context/useSessionRecorderStore.d.ts.map +0 -1
  203. package/lib/typescript/src/context/useStoreSelector.d.ts +0 -5
  204. package/lib/typescript/src/context/useStoreSelector.d.ts.map +0 -1
  205. package/lib/typescript/src/index.d.ts +0 -9
  206. package/lib/typescript/src/index.d.ts.map +0 -1
  207. package/lib/typescript/src/native/SessionRecorderNative.d.ts +0 -29
  208. package/lib/typescript/src/native/SessionRecorderNative.d.ts.map +0 -1
  209. package/lib/typescript/src/native/index.d.ts +0 -2
  210. package/lib/typescript/src/native/index.d.ts.map +0 -1
  211. package/lib/typescript/src/otel/CrashBufferSpanProcessor.d.ts +0 -17
  212. package/lib/typescript/src/otel/CrashBufferSpanProcessor.d.ts.map +0 -1
  213. package/lib/typescript/src/otel/helpers.d.ts +0 -46
  214. package/lib/typescript/src/otel/helpers.d.ts.map +0 -1
  215. package/lib/typescript/src/otel/index.d.ts +0 -33
  216. package/lib/typescript/src/otel/index.d.ts.map +0 -1
  217. package/lib/typescript/src/otel/instrumentations/index.d.ts +0 -5
  218. package/lib/typescript/src/otel/instrumentations/index.d.ts.map +0 -1
  219. package/lib/typescript/src/patch/configs.d.ts +0 -9
  220. package/lib/typescript/src/patch/configs.d.ts.map +0 -1
  221. package/lib/typescript/src/patch/fetch.d.ts +0 -2
  222. package/lib/typescript/src/patch/fetch.d.ts.map +0 -1
  223. package/lib/typescript/src/patch/index.d.ts +0 -4
  224. package/lib/typescript/src/patch/index.d.ts.map +0 -1
  225. package/lib/typescript/src/patch/xhr.d.ts +0 -2
  226. package/lib/typescript/src/patch/xhr.d.ts.map +0 -1
  227. package/lib/typescript/src/recorder/gestureRecorder.d.ts +0 -66
  228. package/lib/typescript/src/recorder/gestureRecorder.d.ts.map +0 -1
  229. package/lib/typescript/src/recorder/index.d.ts +0 -79
  230. package/lib/typescript/src/recorder/index.d.ts.map +0 -1
  231. package/lib/typescript/src/recorder/navigationRecorder.d.ts +0 -29
  232. package/lib/typescript/src/recorder/navigationRecorder.d.ts.map +0 -1
  233. package/lib/typescript/src/recorder/screenRecorder.d.ts +0 -127
  234. package/lib/typescript/src/recorder/screenRecorder.d.ts.map +0 -1
  235. package/lib/typescript/src/services/api.service.d.ts +0 -116
  236. package/lib/typescript/src/services/api.service.d.ts.map +0 -1
  237. package/lib/typescript/src/services/crashBuffer.service.d.ts +0 -27
  238. package/lib/typescript/src/services/crashBuffer.service.d.ts.map +0 -1
  239. package/lib/typescript/src/services/network.service.d.ts +0 -47
  240. package/lib/typescript/src/services/network.service.d.ts.map +0 -1
  241. package/lib/typescript/src/services/screenRecordingService.d.ts +0 -48
  242. package/lib/typescript/src/services/screenRecordingService.d.ts.map +0 -1
  243. package/lib/typescript/src/services/socket.service.d.ts +0 -44
  244. package/lib/typescript/src/services/socket.service.d.ts.map +0 -1
  245. package/lib/typescript/src/services/storage.service.d.ts +0 -47
  246. package/lib/typescript/src/services/storage.service.d.ts.map +0 -1
  247. package/lib/typescript/src/session-recorder.d.ts +0 -191
  248. package/lib/typescript/src/session-recorder.d.ts.map +0 -1
  249. package/lib/typescript/src/types/configs.d.ts +0 -92
  250. package/lib/typescript/src/types/configs.d.ts.map +0 -1
  251. package/lib/typescript/src/types/index.d.ts +0 -21
  252. package/lib/typescript/src/types/index.d.ts.map +0 -1
  253. package/lib/typescript/src/types/session-recorder.d.ts +0 -367
  254. package/lib/typescript/src/types/session-recorder.d.ts.map +0 -1
  255. package/lib/typescript/src/utils/app-metadata.d.ts +0 -17
  256. package/lib/typescript/src/utils/app-metadata.d.ts.map +0 -1
  257. package/lib/typescript/src/utils/constants.optional.d.ts +0 -22
  258. package/lib/typescript/src/utils/constants.optional.d.ts.map +0 -1
  259. package/lib/typescript/src/utils/constants.optional.expo.d.ts +0 -4
  260. package/lib/typescript/src/utils/constants.optional.expo.d.ts.map +0 -1
  261. package/lib/typescript/src/utils/index.d.ts +0 -8
  262. package/lib/typescript/src/utils/index.d.ts.map +0 -1
  263. package/lib/typescript/src/utils/logger.d.ts +0 -108
  264. package/lib/typescript/src/utils/logger.d.ts.map +0 -1
  265. package/lib/typescript/src/utils/platform.d.ts +0 -58
  266. package/lib/typescript/src/utils/platform.d.ts.map +0 -1
  267. package/lib/typescript/src/utils/request-utils.d.ts +0 -22
  268. package/lib/typescript/src/utils/request-utils.d.ts.map +0 -1
  269. package/lib/typescript/src/utils/rrweb-events.d.ts +0 -67
  270. package/lib/typescript/src/utils/rrweb-events.d.ts.map +0 -1
  271. package/lib/typescript/src/utils/session.d.ts +0 -7
  272. package/lib/typescript/src/utils/session.d.ts.map +0 -1
  273. package/lib/typescript/src/utils/shallowEqual.d.ts +0 -2
  274. package/lib/typescript/src/utils/shallowEqual.d.ts.map +0 -1
  275. package/lib/typescript/src/utils/time.d.ts +0 -5
  276. package/lib/typescript/src/utils/time.d.ts.map +0 -1
  277. package/lib/typescript/src/utils/type-utils.d.ts +0 -17
  278. package/lib/typescript/src/utils/type-utils.d.ts.map +0 -1
  279. package/lib/typescript/src/version.d.ts +0 -2
  280. package/lib/typescript/src/version.d.ts.map +0 -1
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- import { createStore } from "./createStore.js";
4
- export const sessionRecorderStore = createStore({
5
- isInitialized: false,
6
- sessionType: null,
7
- sessionState: null,
8
- isWidgetModalVisible: false,
9
- isOnline: true,
10
- error: null
11
- });
12
- //# sourceMappingURL=SessionRecorderStore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createStore","sessionRecorderStore","isInitialized","sessionType","sessionState","isWidgetModalVisible","isOnline","error"],"sourceRoot":"../../../src","sources":["context/SessionRecorderStore.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAoB,kBAAe;AAavD,OAAO,MAAMC,oBAAiD,GAC5DD,WAAW,CAAuB;EAChCE,aAAa,EAAE,KAAK;EACpBC,WAAW,EAAE,IAAI;EACjBC,YAAY,EAAE,IAAI;EAClBC,oBAAoB,EAAE,KAAK;EAC3BC,QAAQ,EAAE,IAAI;EACdC,KAAK,EAAE;AACT,CAAC,CAAC","ignoreList":[]}
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- export function createStore(initialState) {
4
- let state = initialState;
5
- const listeners = new Set();
6
- const getState = () => state;
7
- const setState = partial => {
8
- const prevState = state;
9
- const nextState = typeof partial === 'function' ? partial(prevState) : {
10
- ...prevState,
11
- ...partial
12
- };
13
- if (Object.is(nextState, prevState)) return;
14
- state = nextState;
15
- listeners.forEach(l => l(state, prevState));
16
- };
17
- const subscribe = listener => {
18
- listeners.add(listener);
19
- return () => listeners.delete(listener);
20
- };
21
- return {
22
- getState,
23
- setState,
24
- subscribe
25
- };
26
- }
27
- //# sourceMappingURL=createStore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createStore","initialState","state","listeners","Set","getState","setState","partial","prevState","nextState","Object","is","forEach","l","subscribe","listener","add","delete"],"sourceRoot":"../../../src","sources":["context/createStore.ts"],"mappings":";;AAQA,OAAO,SAASA,WAAWA,CAAmBC,YAAe,EAAY;EACvE,IAAIC,KAAQ,GAAGD,YAAY;EAC3B,MAAME,SAAS,GAAG,IAAIC,GAAG,CAAc,CAAC;EAExC,MAAMC,QAAQ,GAAGA,CAAA,KAAMH,KAAK;EAE5B,MAAMI,QAA8B,GAAIC,OAAO,IAAK;IAClD,MAAMC,SAAS,GAAGN,KAAK;IACvB,MAAMO,SAAS,GACb,OAAOF,OAAO,KAAK,UAAU,GACxBA,OAAO,CAAoBC,SAAS,CAAC,GACrC;MAAE,GAAGA,SAAS;MAAE,GAAGD;IAAQ,CAAO;IACzC,IAAIG,MAAM,CAACC,EAAE,CAACF,SAAS,EAAED,SAAS,CAAC,EAAE;IACrCN,KAAK,GAAGO,SAAS;IACjBN,SAAS,CAACS,OAAO,CAAEC,CAAC,IAAKA,CAAC,CAACX,KAAK,EAAEM,SAAS,CAAC,CAAC;EAC/C,CAAC;EAED,MAAMM,SAAgC,GAAIC,QAAQ,IAAK;IACrDZ,SAAS,CAACa,GAAG,CAACD,QAAQ,CAAC;IACvB,OAAO,MAAMZ,SAAS,CAACc,MAAM,CAACF,QAAQ,CAAC;EACzC,CAAC;EAED,OAAO;IAAEV,QAAQ;IAAEC,QAAQ;IAAEQ;EAAU,CAAC;AAC1C","ignoreList":[]}
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- import { useStoreSelector } from "./useStoreSelector.js";
4
- import { sessionRecorderStore } from "./SessionRecorderStore.js";
5
-
6
- /**
7
- * Select a derived slice from the shared Session Recorder store.
8
- * Works in both React (web) and React Native since the store shape is identical.
9
- *
10
- * @param selector - Function that maps the full store state to the slice you need
11
- * @param equalityFn - Optional comparator to avoid unnecessary re-renders
12
- * @returns The selected slice of state
13
- */
14
- export function useSessionRecorderStore(selector, equalityFn) {
15
- return useStoreSelector(sessionRecorderStore, selector, equalityFn);
16
- }
17
-
18
- /**
19
- * Read the current session recording state (started, paused, stopped).
20
- */
21
- export function useSessionRecordingState() {
22
- return useSessionRecorderStore(s => s.sessionState);
23
- }
24
-
25
- /**
26
- * Read the current session type (MANUAL/CONTINUOUS).
27
- */
28
- export function useSessionType() {
29
- return useSessionRecorderStore(s => s.sessionType);
30
- }
31
-
32
- /**
33
- * Check whether the Session Recorder has been initialized.
34
- */
35
- export function useIsInitialized() {
36
- return useSessionRecorderStore(s => s.isInitialized);
37
- }
38
-
39
- /**
40
- * Read the current widget modal visibility.
41
- */
42
- export function useWidgetModalVisible() {
43
- return useSessionRecorderStore(s => s.isWidgetModalVisible);
44
- }
45
- //# sourceMappingURL=useSessionRecorderStore.js.map
@@ -1 +0,0 @@
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,SAEEC,oBAAoB,QACf,2BAAwB;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,QAA6C,EAC7CC,UAA8C,EACtC;EACR,OAAOJ,gBAAgB,CACrBC,oBAAoB,EACpBE,QAAQ,EACRC,UACF,CAAC;AACH;;AAEA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CAAA,EAAG;EACzC,OAAOH,uBAAuB,CAAuBI,CAAC,IAAKA,CAAC,CAACC,YAAY,CAAC;AAC5E;;AAEA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B,OAAON,uBAAuB,CAAsBI,CAAC,IAAKA,CAAC,CAACG,WAAW,CAAC;AAC1E;;AAEA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAA,EAAG;EACjC,OAAOR,uBAAuB,CAAWI,CAAC,IAAKA,CAAC,CAACK,aAAa,CAAC;AACjE;;AAEA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAA,EAAG;EACtC,OAAOV,uBAAuB,CAAWI,CAAC,IAAKA,CAAC,CAACO,oBAAoB,CAAC;AACxE","ignoreList":[]}
@@ -1,27 +0,0 @@
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
@@ -1 +0,0 @@
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,MACzCQ,iBAAiB,CAACE,OAAO,CAACP,KAAK,CAACU,QAAQ,CAAC,CAAC,CAC5C,CAAC;EAEDf,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":[]}
@@ -1,14 +0,0 @@
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
- export { ErrorBoundary } from "./components/index.js";
9
-
10
- // Export the class for type checking
11
- export { SessionRecorder };
12
- // Export the instance as default
13
- export default SessionRecorder;
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["SessionRecorder","ErrorBoundary"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAO,kBAAS;AAChB,OAAOA,eAAe,MAAM,uBAAoB;AAChD,cAAc,0CAA0C;AACxD,cAAc,qCAAkC;AAChD,cAAc,sCAAmC;AACjD,SAASC,aAAa,QAAQ,uBAAc;;AAG5C;AACA,SAASD,eAAe;AACxB;AACA,eAAeA,eAAe","ignoreList":[]}
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- import { Platform, NativeEventEmitter } from 'react-native';
4
- import SessionRecorderNative from "../NativeSessionRecorderModule.js";
5
-
6
- // Check if we're on web platform
7
- const isWeb = Platform.OS === 'web';
8
-
9
- // Get the Turbo Module
10
- let eventEmitter = new NativeEventEmitter(SessionRecorderNative);
11
-
12
- // Validate that the native module is available
13
- if (!SessionRecorderNative && !isWeb) {
14
- console.warn('SessionRecorderNative Turbo Module is not available. Auto-linking may not have completed yet.');
15
- } else if (isWeb) {
16
- console.info('SessionRecorderNative: Running on web platform, native module disabled');
17
- }
18
-
19
- // Create a safe wrapper that handles web platform
20
- const SafeSessionRecorderNative = {
21
- async captureAndMask() {
22
- if (isWeb || !SessionRecorderNative) {
23
- throw new Error('SessionRecorderNative is not available on web platform');
24
- }
25
- return SessionRecorderNative.captureAndMask();
26
- },
27
- async captureAndMaskWithOptions(options) {
28
- if (isWeb || !SessionRecorderNative) {
29
- throw new Error('SessionRecorderNative is not available on web platform');
30
- }
31
- return SessionRecorderNative.captureAndMaskWithOptions(options);
32
- },
33
- async startGestureRecording() {
34
- if (isWeb || !SessionRecorderNative) {
35
- throw new Error('SessionRecorderNative is not available on web platform');
36
- }
37
- return SessionRecorderNative.startGestureRecording();
38
- },
39
- async stopGestureRecording() {
40
- if (isWeb || !SessionRecorderNative) {
41
- throw new Error('SessionRecorderNative is not available on web platform');
42
- }
43
- return SessionRecorderNative.stopGestureRecording();
44
- },
45
- async isGestureRecordingActive() {
46
- if (isWeb || !SessionRecorderNative) {
47
- throw new Error('SessionRecorderNative is not available on web platform');
48
- }
49
- return SessionRecorderNative.isGestureRecordingActive();
50
- },
51
- recordGesture(gestureType, x, y, target, metadata) {
52
- if (isWeb || !SessionRecorderNative) {
53
- throw new Error('SessionRecorderNative is not available on web platform');
54
- }
55
- SessionRecorderNative.recordGesture(gestureType, x, y, target, metadata);
56
- },
57
- addListener(_eventName) {
58
- // Required for RN event emitter contracts
59
- },
60
- removeListeners(_count) {
61
- // Required for RN event emitter contracts
62
- }
63
- };
64
- // Helper function to set gesture callback using event emitter pattern
65
- export function setGestureCallback(callback) {
66
- if (isWeb || !SessionRecorderNative) {
67
- throw new Error('SessionRecorderNative is not available on web platform');
68
- }
69
- eventEmitter?.removeAllListeners('onGestureDetected');
70
- eventEmitter?.addListener('onGestureDetected', callback);
71
- }
72
- export default SafeSessionRecorderNative;
73
-
74
- // Export event emitter for gesture events to maintain previous API
75
- export const gestureEventEmitter = eventEmitter;
76
- //# sourceMappingURL=SessionRecorderNative.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Platform","NativeEventEmitter","SessionRecorderNative","isWeb","OS","eventEmitter","console","warn","info","SafeSessionRecorderNative","captureAndMask","Error","captureAndMaskWithOptions","options","startGestureRecording","stopGestureRecording","isGestureRecordingActive","recordGesture","gestureType","x","y","target","metadata","addListener","_eventName","removeListeners","_count","setGestureCallback","callback","removeAllListeners","gestureEventEmitter"],"sourceRoot":"../../../src","sources":["native/SessionRecorderNative.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,kBAAkB,QAAQ,cAAc;AAC3D,OAAOC,qBAAqB,MAGrB,mCAAgC;;AAEvC;AACA,MAAMC,KAAK,GAAGH,QAAQ,CAACI,EAAE,KAAK,KAAK;;AAEnC;AACA,IAAIC,YAAY,GAAG,IAAIJ,kBAAkB,CAACC,qBAA4B,CAAC;;AAEvE;AACA,IAAI,CAACA,qBAAqB,IAAI,CAACC,KAAK,EAAE;EACpCG,OAAO,CAACC,IAAI,CACV,+FACF,CAAC;AACH,CAAC,MAAM,IAAIJ,KAAK,EAAE;EAChBG,OAAO,CAACE,IAAI,CACV,wEACF,CAAC;AACH;;AAEA;AACA,MAAMC,yBAA+B,GAAG;EACtC,MAAMC,cAAcA,CAAA,EAAoB;IACtC,IAAIP,KAAK,IAAI,CAACD,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,IAAIV,KAAK,IAAI,CAACD,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,IAAIX,KAAK,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OAAO,MAAMqB,mBAAmB,GAAGzB,YAAY","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export { default as SessionRecorderNative, gestureEventEmitter } from "./SessionRecorderNative.js";
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["default","SessionRecorderNative","gestureEventEmitter"],"sourceRoot":"../../../src","sources":["native/index.ts"],"mappings":";;AAAA,SACEA,OAAO,IAAIC,qBAAqB,EAChCC,mBAAmB,QAEd,4BAAyB","ignoreList":[]}
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- import { MULTIPLAYER_TRACE_SESSION_CACHE_PREFIX } from '@multiplayer-app/session-recorder-common';
4
- /**
5
- * Implementation of the {@link SpanProcessor} that batches spans exported by
6
- * the SDK then pushes them to the exporter pipeline.
7
- */
8
- export class CrashBufferSpanProcessor {
9
- constructor(_crashBuffer, _serializeSpan) {
10
- this._crashBuffer = _crashBuffer;
11
- this._serializeSpan = _serializeSpan;
12
- }
13
- forceFlush() {
14
- return Promise.resolve();
15
- }
16
- onStart(_span, _parentContext) {
17
- return;
18
- }
19
- onEnd(span) {
20
- const _spanContext = span.spanContext();
21
- const traceId = _spanContext.traceId;
22
-
23
- // // Never buffer/export unsampled spans.
24
- // if ((_spanContext.traceFlags & TraceFlags.SAMPLED) === 0) {
25
- // return
26
- // }
27
-
28
- if (traceId.startsWith(MULTIPLAYER_TRACE_SESSION_CACHE_PREFIX)) {
29
- if (this._crashBuffer) {
30
- this._crashBuffer.appendSpans([{
31
- ts: span.startTime[0] * 1000 + span.startTime[1] / 1000000,
32
- span: this._serializeSpan(span)
33
- }]);
34
- }
35
- return;
36
- }
37
- }
38
- shutdown() {
39
- return Promise.resolve();
40
- }
41
- }
42
- //# sourceMappingURL=CrashBufferSpanProcessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["MULTIPLAYER_TRACE_SESSION_CACHE_PREFIX","CrashBufferSpanProcessor","constructor","_crashBuffer","_serializeSpan","forceFlush","Promise","resolve","onStart","_span","_parentContext","onEnd","span","_spanContext","spanContext","traceId","startsWith","appendSpans","ts","startTime","shutdown"],"sourceRoot":"../../../src","sources":["otel/CrashBufferSpanProcessor.ts"],"mappings":";;AAMA,SAASA,sCAAsC,QAAQ,0CAA0C;AAGjG;AACA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,CAA0B;EAC7DC,WAAWA,CACQC,YAAqC,EACrCC,cAA2C,EAC5D;IAAA,KAFiBD,YAAqC,GAArCA,YAAqC;IAAA,KACrCC,cAA2C,GAA3CA,cAA2C;EAC3D;EAEHC,UAAUA,CAAA,EAAkB;IAC1B,OAAOC,OAAO,CAACC,OAAO,CAAC,CAAC;EAC1B;EAEAC,OAAOA,CAACC,KAAW,EAAEC,cAAuB,EAAQ;IAClD;EACF;EAEAC,KAAKA,CAACC,IAAkB,EAAQ;IAC9B,MAAMC,YAAY,GAAGD,IAAI,CAACE,WAAW,CAAC,CAAC;IAEvC,MAAMC,OAAO,GAAGF,YAAY,CAACE,OAAO;;IAEpC;IACA;IACA;IACA;;IAEA,IAAIA,OAAO,CAACC,UAAU,CAAChB,sCAAsC,CAAC,EAAE;MAC9D,IAAI,IAAI,CAACG,YAAY,EAAE;QACrB,IAAI,CAACA,YAAY,CAACc,WAAW,CAAC,CAC5B;UACEC,EAAE,EAAEN,IAAI,CAACO,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAGP,IAAI,CAACO,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO;UAC1DP,IAAI,EAAE,IAAI,CAACR,cAAc,CAACQ,IAAI;QAChC,CAAC,CACF,CAAC;MACJ;MACA;IACF;EACF;EAEAQ,QAAQA,CAAA,EAAkB;IACxB,OAAOd,OAAO,CAACC,OAAO,CAAC,CAAC;EAC1B;AACF","ignoreList":[]}
@@ -1,218 +0,0 @@
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
-
199
- logger.warn('MULTIPLAYER_SESSION_RECORDER', '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
@@ -1 +0,0 @@
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,QA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