@multiplayer-app/session-recorder-react-native 0.0.1-alpha.9 → 0.0.1-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/SessionRecorderNative.podspec +29 -0
  2. package/android/build.gradle +32 -0
  3. package/app.plugin.js +42 -0
  4. package/copy-react-native-dist.sh +4 -10
  5. package/dist/components/GestureCaptureWrapper/GestureCaptureWrapper.js +1 -0
  6. package/dist/components/GestureCaptureWrapper/GestureCaptureWrapper.js.map +1 -0
  7. package/dist/components/GestureCaptureWrapper/index.d.ts +1 -0
  8. package/dist/components/GestureCaptureWrapper/index.js +1 -0
  9. package/dist/components/GestureCaptureWrapper/index.js.map +1 -0
  10. package/dist/components/MaskableComponent.d.ts +22 -0
  11. package/dist/components/MaskableComponent.js +1 -0
  12. package/dist/components/MaskableComponent.js.map +1 -0
  13. package/dist/components/MaskableTextInput.d.ts +14 -0
  14. package/dist/components/MaskableTextInput.js +1 -0
  15. package/dist/components/MaskableTextInput.js.map +1 -0
  16. package/dist/components/ScreenRecorderView/ScreenRecorderView.d.ts +5 -0
  17. package/dist/components/ScreenRecorderView/ScreenRecorderView.js +1 -0
  18. package/dist/components/ScreenRecorderView/ScreenRecorderView.js.map +1 -0
  19. package/dist/components/ScreenRecorderView/index.d.ts +1 -0
  20. package/dist/components/ScreenRecorderView/index.js +1 -0
  21. package/dist/components/ScreenRecorderView/index.js.map +1 -0
  22. package/dist/components/SessionRecorderWidget/FinalPopover.d.ts +11 -0
  23. package/dist/components/SessionRecorderWidget/FinalPopover.js +1 -0
  24. package/dist/components/SessionRecorderWidget/FinalPopover.js.map +1 -0
  25. package/dist/components/SessionRecorderWidget/FloatingButton.d.ts +8 -0
  26. package/dist/components/SessionRecorderWidget/FloatingButton.js +1 -0
  27. package/dist/components/SessionRecorderWidget/FloatingButton.js.map +1 -0
  28. package/dist/components/SessionRecorderWidget/InitialPopover.d.ts +13 -0
  29. package/dist/components/SessionRecorderWidget/InitialPopover.js +1 -0
  30. package/dist/components/SessionRecorderWidget/InitialPopover.js.map +1 -0
  31. package/dist/components/SessionRecorderWidget/ModalContainer.d.ts +8 -0
  32. package/dist/components/SessionRecorderWidget/ModalContainer.js +1 -0
  33. package/dist/components/SessionRecorderWidget/ModalContainer.js.map +1 -0
  34. package/dist/components/SessionRecorderWidget/ModalHeader.d.ts +6 -0
  35. package/dist/components/SessionRecorderWidget/ModalHeader.js +1 -0
  36. package/dist/components/SessionRecorderWidget/ModalHeader.js.map +1 -0
  37. package/dist/components/SessionRecorderWidget/SessionRecorderWidget.d.ts +5 -0
  38. package/dist/components/SessionRecorderWidget/SessionRecorderWidget.js +1 -0
  39. package/dist/components/SessionRecorderWidget/SessionRecorderWidget.js.map +1 -0
  40. package/dist/components/SessionRecorderWidget/icons.d.ts +11 -0
  41. package/dist/components/SessionRecorderWidget/icons.js +1 -0
  42. package/dist/components/SessionRecorderWidget/icons.js.map +1 -0
  43. package/dist/components/SessionRecorderWidget/index.d.ts +2 -0
  44. package/dist/components/SessionRecorderWidget/index.js +1 -0
  45. package/dist/components/SessionRecorderWidget/index.js.map +1 -0
  46. package/dist/components/SessionRecorderWidget/styles.d.ts +145 -0
  47. package/dist/components/SessionRecorderWidget/styles.js +1 -0
  48. package/dist/components/SessionRecorderWidget/styles.js.map +1 -0
  49. package/dist/components/index.d.ts +3 -0
  50. package/dist/components/index.js +1 -0
  51. package/dist/components/index.js.map +1 -0
  52. package/dist/config/defaults.js +1 -1
  53. package/dist/config/defaults.js.map +1 -1
  54. package/dist/config/masking.js +1 -1
  55. package/dist/config/masking.js.map +1 -1
  56. package/dist/context/SessionRecorderContext.d.ts +5 -3
  57. package/dist/context/SessionRecorderContext.js +1 -1
  58. package/dist/context/SessionRecorderContext.js.map +1 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/native/ScreenMasking.d.ts +21 -0
  61. package/dist/native/ScreenMasking.js +1 -0
  62. package/dist/native/ScreenMasking.js.map +1 -0
  63. package/dist/native/SessionRecorderNative.d.ts +21 -0
  64. package/dist/native/SessionRecorderNative.js +1 -0
  65. package/dist/native/SessionRecorderNative.js.map +1 -0
  66. package/dist/otel/index.d.ts +0 -2
  67. package/dist/otel/index.js.map +1 -1
  68. package/dist/otel/instrumentations/index.d.ts +0 -3
  69. package/dist/otel/instrumentations/index.js +1 -1
  70. package/dist/otel/instrumentations/index.js.map +1 -1
  71. package/dist/patch/xhr.js +1 -1
  72. package/dist/patch/xhr.js.map +1 -1
  73. package/dist/recorder/gestureRecorder.d.ts +0 -9
  74. package/dist/recorder/gestureRecorder.js +1 -1
  75. package/dist/recorder/gestureRecorder.js.map +1 -1
  76. package/dist/recorder/index.d.ts +4 -3
  77. package/dist/recorder/index.js.map +1 -1
  78. package/dist/recorder/screenRecorder.d.ts +2 -6
  79. package/dist/recorder/screenRecorder.js +1 -1
  80. package/dist/recorder/screenRecorder.js.map +1 -1
  81. package/dist/recorder/screenshotManager.d.ts +10 -0
  82. package/dist/recorder/screenshotManager.js +1 -0
  83. package/dist/recorder/screenshotManager.js.map +1 -0
  84. package/dist/services/screenMaskingService.d.ts +39 -0
  85. package/dist/services/screenMaskingService.js +1 -0
  86. package/dist/services/screenMaskingService.js.map +1 -0
  87. package/dist/services/storage.service.d.ts +18 -2
  88. package/dist/services/storage.service.js +1 -1
  89. package/dist/services/storage.service.js.map +1 -1
  90. package/dist/session-recorder.d.ts +4 -2
  91. package/dist/session-recorder.js +1 -1
  92. package/dist/session-recorder.js.map +1 -1
  93. package/dist/types/index.d.ts +2 -16
  94. package/dist/types/index.js +1 -1
  95. package/dist/types/index.js.map +1 -1
  96. package/dist/types/session-recorder.d.ts +6 -0
  97. package/dist/types/session-recorder.js.map +1 -1
  98. package/dist/utils/app-metadata.d.ts +16 -0
  99. package/dist/utils/app-metadata.js +1 -0
  100. package/dist/utils/app-metadata.js.map +1 -0
  101. package/dist/utils/componentRegistry.d.ts +64 -0
  102. package/dist/utils/componentRegistry.js +1 -0
  103. package/dist/utils/componentRegistry.js.map +1 -0
  104. package/dist/utils/nativeModuleTest.d.ts +8 -0
  105. package/dist/utils/nativeModuleTest.js +1 -0
  106. package/dist/utils/nativeModuleTest.js.map +1 -0
  107. package/dist/utils/platform.d.ts +35 -0
  108. package/dist/utils/platform.js +1 -1
  109. package/dist/utils/platform.js.map +1 -1
  110. package/dist/utils/reactNativeHierarchyExtractor.d.ts +38 -0
  111. package/dist/utils/reactNativeHierarchyExtractor.js +1 -0
  112. package/dist/utils/reactNativeHierarchyExtractor.js.map +1 -0
  113. package/dist/utils/rrweb-events.d.ts +1 -1
  114. package/dist/utils/rrweb-events.js +1 -1
  115. package/dist/utils/rrweb-events.js.map +1 -1
  116. package/dist/utils/screenshotMasker.d.ts +96 -0
  117. package/dist/utils/screenshotMasker.js +1 -0
  118. package/dist/utils/screenshotMasker.js.map +1 -0
  119. package/dist/utils/viewHierarchyTracker.d.ts +89 -0
  120. package/dist/utils/viewHierarchyTracker.js +1 -0
  121. package/dist/utils/viewHierarchyTracker.js.map +1 -0
  122. package/dist/version.d.ts +1 -1
  123. package/dist/version.js +1 -1
  124. package/dist/version.js.map +1 -1
  125. package/docs/NATIVE_MODULE_SETUP.md +177 -0
  126. package/ios/SessionRecorderNative.m +17 -0
  127. package/ios/SessionRecorderNative.podspec +26 -0
  128. package/ios/SessionRecorderNative.swift +205 -0
  129. package/package.json +25 -14
  130. package/plugin/package.json +20 -0
  131. package/plugin/src/index.js +42 -0
  132. package/react-native.config.js +15 -0
  133. package/RRWEB_INTEGRATION.md +0 -336
  134. package/VIEWSHOT_INTEGRATION_TEST.md +0 -123
  135. package/babel.config.js +0 -13
  136. package/dist/components/GestureCaptureWrapper.js +0 -1
  137. package/dist/components/GestureCaptureWrapper.js.map +0 -1
  138. package/dist/expo.d.ts +0 -7
  139. package/dist/expo.js +0 -1
  140. package/dist/expo.js.map +0 -1
  141. package/dist/otel/instrumentations/gestureInstrumentation.d.ts +0 -15
  142. package/dist/otel/instrumentations/gestureInstrumentation.js +0 -1
  143. package/dist/otel/instrumentations/gestureInstrumentation.js.map +0 -1
  144. package/dist/otel/instrumentations/reactNativeInstrumentation.d.ts +0 -8
  145. package/dist/otel/instrumentations/reactNativeInstrumentation.js +0 -1
  146. package/dist/otel/instrumentations/reactNativeInstrumentation.js.map +0 -1
  147. package/dist/otel/instrumentations/reactNavigationInstrumentation.d.ts +0 -13
  148. package/dist/otel/instrumentations/reactNavigationInstrumentation.js +0 -1
  149. package/dist/otel/instrumentations/reactNavigationInstrumentation.js.map +0 -1
  150. package/dist/recorder/gestureHandlerRecorder.d.ts +0 -19
  151. package/dist/recorder/gestureHandlerRecorder.js +0 -1
  152. package/dist/recorder/gestureHandlerRecorder.js.map +0 -1
  153. package/dist/types/rrweb.d.ts +0 -118
  154. package/dist/types/rrweb.js +0 -1
  155. package/dist/types/rrweb.js.map +0 -1
  156. package/src/components/GestureCaptureWrapper.tsx +0 -110
  157. package/src/config/constants.ts +0 -60
  158. package/src/config/defaults.ts +0 -82
  159. package/src/config/index.ts +0 -6
  160. package/src/config/masking.ts +0 -27
  161. package/src/config/session-recorder.ts +0 -55
  162. package/src/config/validators.ts +0 -31
  163. package/src/context/SessionRecorderContext.tsx +0 -143
  164. package/src/expo.ts +0 -11
  165. package/src/index.ts +0 -9
  166. package/src/otel/helpers.ts +0 -275
  167. package/src/otel/index.ts +0 -149
  168. package/src/otel/instrumentations/gestureInstrumentation.ts +0 -141
  169. package/src/otel/instrumentations/index.ts +0 -120
  170. package/src/otel/instrumentations/reactNativeInstrumentation.ts +0 -77
  171. package/src/otel/instrumentations/reactNavigationInstrumentation.ts +0 -119
  172. package/src/patch/index.ts +0 -1
  173. package/src/patch/xhr.ts +0 -142
  174. package/src/recorder/eventExporter.ts +0 -141
  175. package/src/recorder/gestureHandlerRecorder.ts +0 -157
  176. package/src/recorder/gestureRecorder.ts +0 -622
  177. package/src/recorder/index.ts +0 -178
  178. package/src/recorder/navigationTracker.ts +0 -449
  179. package/src/recorder/screenRecorder.ts +0 -506
  180. package/src/services/api.service.ts +0 -203
  181. package/src/services/storage.service.ts +0 -158
  182. package/src/session-recorder.ts +0 -601
  183. package/src/types/expo.d.ts +0 -23
  184. package/src/types/index.ts +0 -46
  185. package/src/types/session-recorder.ts +0 -423
  186. package/src/types/session.ts +0 -65
  187. package/src/utils/index.ts +0 -8
  188. package/src/utils/logger.ts +0 -225
  189. package/src/utils/platform.ts +0 -87
  190. package/src/utils/request-utils.ts +0 -61
  191. package/src/utils/rrweb-events.ts +0 -311
  192. package/src/utils/session.ts +0 -18
  193. package/src/utils/time.ts +0 -17
  194. package/src/utils/type-utils.ts +0 -75
  195. package/src/version.ts +0 -1
  196. package/tsconfig.json +0 -24
  197. /package/dist/components/{GestureCaptureWrapper.d.ts → GestureCaptureWrapper/GestureCaptureWrapper.d.ts} +0 -0
@@ -1,141 +0,0 @@
1
- import io, { Socket } from 'socket.io-client'
2
-
3
- import { ISession } from '../types'
4
- import { logger } from '../utils'
5
-
6
- import {
7
- SESSION_ADD_EVENT,
8
- SESSION_AUTO_CREATED,
9
- SESSION_STOPPED_EVENT,
10
- SESSION_SUBSCRIBE_EVENT,
11
- SESSION_UNSUBSCRIBE_EVENT,
12
- } from '../config'
13
-
14
- const MAX_RECONNECTION_ATTEMPTS = 2
15
-
16
- export class EventExporter {
17
- private socket: Socket | null = null
18
- private queue: any[] = []
19
- private isConnecting: boolean = false
20
- private isConnected: boolean = false
21
- private attempts: number = 0
22
- private sessionId: string | null = null
23
-
24
- constructor(private options: { socketUrl: string, apiKey: string }) { }
25
-
26
- private init(): void {
27
- if (this.isConnecting || this.isConnected) return
28
- this.attempts++
29
- this.isConnecting = true
30
- this.socket = io(this.options.socketUrl, {
31
- path: '/v0/radar/ws',
32
- auth: {
33
- 'x-api-key': this.options.apiKey,
34
- },
35
- reconnectionAttempts: 2,
36
- transports: ['websocket'],
37
- })
38
-
39
- // this.socket.on('connect', () => {
40
- // this.isConnecting = false
41
- // this.isConnected = true
42
- // this.usePostMessage = false
43
- // this.flushQueue()
44
- // })
45
-
46
- this.socket.on('ready', () => {
47
- this.isConnecting = false
48
- this.isConnected = true
49
- logger.info('EventExporter', 'Connected to server')
50
- this.flushQueue()
51
- })
52
-
53
- this.socket.on('disconnect', (err: any) => {
54
- this.isConnecting = false
55
- this.isConnected = false
56
- logger.info('EventExporter', 'Disconnected from server')
57
- })
58
-
59
- this.socket.on('connect_error', (err: any) => {
60
- this.isConnecting = false
61
- this.isConnected = false
62
- this.checkReconnectionAttempts()
63
- logger.error('EventExporter', 'Error connecting to server', err)
64
- })
65
-
66
- this.socket.on(SESSION_STOPPED_EVENT, (data: any) => {
67
-
68
- this.unsubscribeFromSession()
69
- })
70
-
71
- this.socket.on(SESSION_AUTO_CREATED, (data: any) => {
72
-
73
- })
74
- }
75
-
76
- private checkReconnectionAttempts(): void {
77
- if (this.attempts >= MAX_RECONNECTION_ATTEMPTS) {
78
-
79
- this.flushQueue()
80
- }
81
- }
82
-
83
-
84
- private flushQueue(): void {
85
- while (this.queue.length > 0 && (this.socket?.connected)) {
86
- const event = this.queue.shift()
87
- if (!event) continue
88
-
89
- if (this.socket?.connected) {
90
- this.socket.emit(event.name, event.data)
91
- }
92
- }
93
- }
94
-
95
- private unsubscribeFromSession() {
96
- const payload = {
97
- debugSessionId: this.sessionId,
98
- }
99
- if (this.socket?.connected) {
100
- this.socket.emit(SESSION_UNSUBSCRIBE_EVENT, payload)
101
- }
102
- }
103
-
104
- public send(event: any): void {
105
- if (this.socket?.connected) {
106
- this.socket.emit(SESSION_ADD_EVENT, event)
107
- } else {
108
- this.queue.push({ data: event, name: SESSION_ADD_EVENT })
109
- this.init()
110
- }
111
- }
112
-
113
- public subscribeToSession(session: ISession): void {
114
- this.sessionId = session.shortId || session._id
115
- const payload = {
116
- projectId: session.project,
117
- workspaceId: session.workspace,
118
- debugSessionId: this.sessionId,
119
- sessionType: session.creationType,
120
- }
121
- if (this.socket?.connected) {
122
- this.socket.emit(SESSION_SUBSCRIBE_EVENT, payload)
123
- } else {
124
- this.queue.push({ data: payload, name: SESSION_SUBSCRIBE_EVENT })
125
- this.init()
126
- }
127
- }
128
-
129
- public close(): void {
130
- if (this.socket?.connected) {
131
- setTimeout(() => {
132
- this.unsubscribeFromSession()
133
- this.attempts = 0
134
- this.isConnected = false
135
- this.isConnecting = false
136
- this.socket?.disconnect()
137
- this.socket = null
138
- }, 500)
139
- }
140
- }
141
- }
@@ -1,157 +0,0 @@
1
- import { Gesture } from 'react-native-gesture-handler'
2
- import { ReactNode } from 'react'
3
- import { SessionState } from '../types'
4
- import { GestureInstrumentation } from '../otel/instrumentations/gestureInstrumentation'
5
-
6
- export interface GestureHandlerRecorderProps {
7
- children: ReactNode
8
- sessionState: SessionState | null
9
- onGestureRecord: (gestureType: string, data: any) => void
10
- }
11
-
12
- export class GestureHandlerRecorder {
13
- private gestureInstrumentation: GestureInstrumentation
14
- private onGestureRecord?: (gestureType: string, data: any) => void
15
-
16
- constructor() {
17
- this.gestureInstrumentation = new GestureInstrumentation()
18
- this.gestureInstrumentation.enable()
19
- }
20
-
21
- setGestureCallback(callback: (gestureType: string, data: any) => void) {
22
- this.onGestureRecord = callback
23
- }
24
-
25
- // Create tap gesture
26
- createTapGesture() {
27
- return Gesture.Tap()
28
- .onStart((event) => {
29
- this.recordGesture('tap', {
30
- x: event.x,
31
- y: event.y,
32
- timestamp: Date.now(),
33
- })
34
- })
35
- }
36
-
37
- // Create pan gesture (for swipes and drags)
38
- createPanGesture() {
39
- return Gesture.Pan()
40
- .onStart((event) => {
41
- this.recordGesture('pan_start', {
42
- x: event.x,
43
- y: event.y,
44
- timestamp: Date.now(),
45
- })
46
- })
47
- .onUpdate((event) => {
48
- this.recordGesture('pan_update', {
49
- x: event.x,
50
- y: event.y,
51
- translationX: event.translationX,
52
- translationY: event.translationY,
53
- velocityX: event.velocityX,
54
- velocityY: event.velocityY,
55
- timestamp: Date.now(),
56
- })
57
- })
58
- .onEnd((event) => {
59
- this.recordGesture('pan_end', {
60
- x: event.x,
61
- y: event.y,
62
- translationX: event.translationX,
63
- translationY: event.translationY,
64
- velocityX: event.velocityX,
65
- velocityY: event.velocityY,
66
- timestamp: Date.now(),
67
- })
68
- })
69
- }
70
-
71
- // Create pinch gesture
72
- createPinchGesture() {
73
- return Gesture.Pinch()
74
- .onStart((event) => {
75
- this.recordGesture('pinch_start', {
76
- scale: event.scale,
77
- focalX: event.focalX,
78
- focalY: event.focalY,
79
- timestamp: Date.now(),
80
- })
81
- })
82
- .onUpdate((event) => {
83
- this.recordGesture('pinch_update', {
84
- scale: event.scale,
85
- focalX: event.focalX,
86
- focalY: event.focalY,
87
- timestamp: Date.now(),
88
- })
89
- })
90
- .onEnd((event) => {
91
- this.recordGesture('pinch_end', {
92
- scale: event.scale,
93
- focalX: event.focalX,
94
- focalY: event.focalY,
95
- timestamp: Date.now(),
96
- })
97
- })
98
- }
99
-
100
- // Create long press gesture
101
- createLongPressGesture() {
102
- return Gesture.LongPress()
103
- .minDuration(500)
104
- .onStart((event) => {
105
- this.recordGesture('long_press', {
106
- x: event.x,
107
- y: event.y,
108
- duration: 500,
109
- timestamp: Date.now(),
110
- })
111
- })
112
- }
113
-
114
- private recordGesture(gestureType: string, data: any) {
115
- // Record with OpenTelemetry
116
- switch (gestureType) {
117
- case 'tap':
118
- this.gestureInstrumentation.recordTap(data.x, data.y)
119
- break
120
- case 'pan_start':
121
- case 'pan_update':
122
- case 'pan_end':
123
- this.gestureInstrumentation.recordPan(data.translationX || 0, data.translationY || 0)
124
- break
125
- case 'pinch_start':
126
- case 'pinch_update':
127
- case 'pinch_end':
128
- this.gestureInstrumentation.recordPinch(data.scale, undefined)
129
- break
130
- case 'long_press':
131
- this.gestureInstrumentation.recordLongPress(data.duration, undefined)
132
- break
133
- }
134
-
135
- // Record with session recorder
136
- if (this.onGestureRecord) {
137
- this.onGestureRecord(gestureType, data)
138
- }
139
- }
140
-
141
- // Create a gesture detector component
142
- createGestureDetector(children: ReactNode, sessionState: SessionState | null): ReactNode {
143
- if (sessionState !== SessionState.started) {
144
- return children
145
- }
146
-
147
- const tapGesture = this.createTapGesture()
148
- const panGesture = this.createPanGesture()
149
- const pinchGesture = this.createPinchGesture()
150
- const longPressGesture = this.createLongPressGesture()
151
-
152
- // Note: This would need to be implemented as a proper React component
153
- // For now, return children directly - the gesture detection would be handled
154
- // at the app level by wrapping the entire app with GestureHandlerRootView
155
- return children
156
- }
157
- }