@multiplayer-app/session-recorder-react-native 1.0.1-beta.4 → 1.0.1-beta.5
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.
- package/android/src/main/java/com/multiplayer/sessionrecordernative/SessionRecorderNativeModule.kt +2 -2
- package/lib/module/components/SessionRecorderWidget/ErrorBanner.js.map +1 -1
- package/lib/module/components/SessionRecorderWidget/ModalHeader.js.map +1 -1
- package/lib/module/components/SessionRecorderWidget/SessionRecorderWidget.js.map +1 -1
- package/lib/module/components/SessionRecorderWidget/icons.js.map +1 -1
- package/lib/module/components/SessionRecorderWidget/styles.js.map +1 -1
- package/lib/module/config/constants.js.map +1 -1
- package/lib/module/config/defaults.js.map +1 -1
- package/lib/module/config/masking.js.map +1 -1
- package/lib/module/config/session-recorder.js.map +1 -1
- package/lib/module/config/validators.js.map +1 -1
- package/lib/module/config/widget.js.map +1 -1
- package/lib/module/context/SessionRecorderStore.js.map +1 -1
- package/lib/module/context/useSessionRecorderStore.js.map +1 -1
- package/lib/module/context/useStoreSelector.js.map +1 -1
- package/lib/module/native/SessionRecorderNative.js.map +1 -1
- package/lib/module/native/index.js.map +1 -1
- package/lib/module/otel/helpers.js +1 -1
- package/lib/module/otel/helpers.js.map +1 -1
- package/lib/module/otel/index.js.map +1 -1
- package/lib/module/otel/instrumentations/index.js.map +1 -1
- package/lib/module/patch/xhr.js.map +1 -1
- package/lib/module/recorder/eventExporter.js.map +1 -1
- package/lib/module/recorder/gestureRecorder.js.map +1 -1
- package/lib/module/recorder/index.js.map +1 -1
- package/lib/module/recorder/navigationTracker.js.map +1 -1
- package/lib/module/recorder/screenRecorder.js.map +1 -1
- package/lib/module/services/api.service.js.map +1 -1
- package/lib/module/services/network.service.js.map +1 -1
- package/lib/module/services/screenMaskingService.js.map +1 -1
- package/lib/module/services/storage.service.js.map +1 -1
- package/lib/module/session-recorder.js.map +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/session-recorder.js.map +1 -1
- package/lib/module/utils/app-metadata.js +2 -2
- package/lib/module/utils/constants.optional.js.map +1 -1
- package/lib/module/utils/createStore.js.map +1 -1
- package/lib/module/utils/logger.js +0 -8
- package/lib/module/utils/logger.js.map +1 -1
- package/lib/module/utils/platform.js +1 -1
- package/lib/module/utils/platform.js.map +1 -1
- package/lib/module/utils/rrweb-events.js.map +1 -1
- package/lib/module/utils/session.js.map +1 -1
- package/lib/module/utils/shallowEqual.js.map +1 -1
- package/lib/module/utils/time.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/components/ScreenRecorderView/index.d.ts +1 -1
- package/lib/typescript/src/components/SessionRecorderWidget/ErrorBanner.d.ts.map +1 -1
- package/lib/typescript/src/components/SessionRecorderWidget/ModalHeader.d.ts.map +1 -1
- package/lib/typescript/src/components/SessionRecorderWidget/SessionRecorderWidget.d.ts.map +1 -1
- package/lib/typescript/src/components/SessionRecorderWidget/icons.d.ts.map +1 -1
- package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts +1 -1
- package/lib/typescript/src/components/SessionRecorderWidget/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/config/constants.d.ts.map +1 -1
- package/lib/typescript/src/config/defaults.d.ts.map +1 -1
- package/lib/typescript/src/config/index.d.ts.map +1 -1
- package/lib/typescript/src/config/masking.d.ts.map +1 -1
- package/lib/typescript/src/config/session-recorder.d.ts.map +1 -1
- package/lib/typescript/src/config/validators.d.ts.map +1 -1
- package/lib/typescript/src/config/widget.d.ts +1 -1
- package/lib/typescript/src/config/widget.d.ts.map +1 -1
- package/lib/typescript/src/context/SessionRecorderStore.d.ts.map +1 -1
- package/lib/typescript/src/context/useSessionRecorderStore.d.ts +3 -3
- package/lib/typescript/src/context/useSessionRecorderStore.d.ts.map +1 -1
- package/lib/typescript/src/context/useStoreSelector.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/SessionRecorderNative.d.ts.map +1 -1
- package/lib/typescript/src/native/index.d.ts +1 -1
- package/lib/typescript/src/native/index.d.ts.map +1 -1
- package/lib/typescript/src/otel/helpers.d.ts.map +1 -1
- package/lib/typescript/src/otel/index.d.ts.map +1 -1
- package/lib/typescript/src/otel/instrumentations/index.d.ts.map +1 -1
- package/lib/typescript/src/patch/index.d.ts.map +1 -1
- package/lib/typescript/src/patch/xhr.d.ts.map +1 -1
- package/lib/typescript/src/recorder/eventExporter.d.ts.map +1 -1
- package/lib/typescript/src/recorder/gestureRecorder.d.ts.map +1 -1
- package/lib/typescript/src/recorder/index.d.ts.map +1 -1
- package/lib/typescript/src/recorder/navigationTracker.d.ts.map +1 -1
- package/lib/typescript/src/recorder/screenRecorder.d.ts.map +1 -1
- package/lib/typescript/src/services/api.service.d.ts.map +1 -1
- package/lib/typescript/src/services/network.service.d.ts.map +1 -1
- package/lib/typescript/src/services/screenMaskingService.d.ts.map +1 -1
- package/lib/typescript/src/services/storage.service.d.ts.map +1 -1
- package/lib/typescript/src/session-recorder.d.ts.map +1 -1
- package/lib/typescript/src/types/configs.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/session-recorder.d.ts +4 -4
- package/lib/typescript/src/types/session-recorder.d.ts.map +1 -1
- package/lib/typescript/src/types/session.d.ts.map +1 -1
- package/lib/typescript/src/utils/app-metadata.d.ts.map +1 -1
- package/lib/typescript/src/utils/constants.optional.d.ts.map +1 -1
- package/lib/typescript/src/utils/constants.optional.expo.d.ts.map +1 -1
- package/lib/typescript/src/utils/createStore.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/logger.d.ts +1 -1
- package/lib/typescript/src/utils/logger.d.ts.map +1 -1
- package/lib/typescript/src/utils/platform.d.ts.map +1 -1
- package/lib/typescript/src/utils/request-utils.d.ts.map +1 -1
- package/lib/typescript/src/utils/rrweb-events.d.ts.map +1 -1
- package/lib/typescript/src/utils/session.d.ts.map +1 -1
- package/lib/typescript/src/utils/shallowEqual.d.ts.map +1 -1
- package/lib/typescript/src/utils/time.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-utils.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/ScreenRecorderView/index.ts +1 -1
- package/src/components/SessionRecorderWidget/ErrorBanner.tsx +14 -14
- package/src/components/SessionRecorderWidget/ModalHeader.tsx +11 -9
- package/src/components/SessionRecorderWidget/SessionRecorderWidget.tsx +70 -56
- package/src/components/SessionRecorderWidget/icons.tsx +58 -30
- package/src/components/SessionRecorderWidget/index.ts +1 -1
- package/src/components/SessionRecorderWidget/styles.ts +17 -18
- package/src/components/index.ts +2 -2
- package/src/config/constants.ts +19 -20
- package/src/config/defaults.ts +35 -31
- package/src/config/index.ts +5 -5
- package/src/config/masking.ts +44 -18
- package/src/config/session-recorder.ts +54 -26
- package/src/config/validators.ts +43 -20
- package/src/config/widget.ts +24 -15
- package/src/context/SessionRecorderStore.ts +19 -18
- package/src/context/useSessionRecorderStore.ts +17 -10
- package/src/context/useStoreSelector.ts +20 -18
- package/src/index.ts +7 -7
- package/src/native/SessionRecorderNative.ts +83 -67
- package/src/native/index.ts +5 -1
- package/src/otel/helpers.ts +109 -93
- package/src/otel/index.ts +46 -49
- package/src/otel/instrumentations/index.ts +44 -41
- package/src/patch/index.ts +1 -1
- package/src/patch/xhr.ts +77 -78
- package/src/recorder/eventExporter.ts +63 -68
- package/src/recorder/gestureRecorder.ts +359 -212
- package/src/recorder/index.ts +75 -62
- package/src/recorder/navigationTracker.ts +120 -97
- package/src/recorder/screenRecorder.ts +214 -163
- package/src/services/api.service.ts +49 -48
- package/src/services/network.service.ts +67 -58
- package/src/services/screenMaskingService.ts +81 -50
- package/src/services/storage.service.ts +99 -70
- package/src/session-recorder.ts +270 -214
- package/src/types/configs.ts +53 -31
- package/src/types/expo-constants.d.ts +2 -2
- package/src/types/index.ts +16 -18
- package/src/types/session-recorder.ts +106 -111
- package/src/types/session.ts +45 -45
- package/src/utils/app-metadata.ts +9 -9
- package/src/utils/constants.optional.expo.ts +3 -3
- package/src/utils/constants.optional.ts +14 -12
- package/src/utils/createStore.ts +23 -20
- package/src/utils/index.ts +7 -7
- package/src/utils/logger.ts +87 -58
- package/src/utils/platform.ts +149 -118
- package/src/utils/request-utils.ts +15 -15
- package/src/utils/rrweb-events.ts +47 -34
- package/src/utils/session.ts +15 -12
- package/src/utils/shallowEqual.ts +16 -10
- package/src/utils/time.ts +7 -4
- package/src/utils/type-utils.ts +36 -36
- package/src/version.ts +1 -1
- package/android/src/main/java/com/multiplayer/sessionrecordernative/SessionRecorderNativeModuleSpec.kt +0 -51
- package/android/src/main/java/com/xxx/XxxModule.kt +0 -23
- package/ios/Xxx.h +0 -5
- package/ios/Xxx.mm +0 -21
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import io, { Socket } from 'socket.io-client'
|
|
1
|
+
import io, { Socket } from 'socket.io-client';
|
|
2
2
|
|
|
3
|
-
import { type ISession } from '../types'
|
|
4
|
-
import { logger } from '../utils'
|
|
3
|
+
import { type ISession } from '../types';
|
|
4
|
+
import { logger } from '../utils';
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
SESSION_ADD_EVENT,
|
|
@@ -9,30 +9,30 @@ import {
|
|
|
9
9
|
SESSION_STOPPED_EVENT,
|
|
10
10
|
SESSION_SUBSCRIBE_EVENT,
|
|
11
11
|
SESSION_UNSUBSCRIBE_EVENT,
|
|
12
|
-
} from '../config'
|
|
12
|
+
} from '../config';
|
|
13
13
|
|
|
14
|
-
const MAX_RECONNECTION_ATTEMPTS = 2
|
|
14
|
+
const MAX_RECONNECTION_ATTEMPTS = 2;
|
|
15
15
|
|
|
16
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
|
-
private socketUrl: string
|
|
25
|
-
private apiKey: string
|
|
26
|
-
|
|
27
|
-
constructor(options: { socketUrl: string
|
|
28
|
-
this.socketUrl = options.socketUrl
|
|
29
|
-
this.apiKey = options.apiKey
|
|
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
|
+
private socketUrl: string;
|
|
25
|
+
private apiKey: string;
|
|
26
|
+
|
|
27
|
+
constructor(options: { socketUrl: string; apiKey: string }) {
|
|
28
|
+
this.socketUrl = options.socketUrl;
|
|
29
|
+
this.apiKey = options.apiKey;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
private init(): void {
|
|
33
|
-
if (this.isConnecting || this.isConnected) return
|
|
34
|
-
this.attempts
|
|
35
|
-
this.isConnecting = true
|
|
33
|
+
if (this.isConnecting || this.isConnected) return;
|
|
34
|
+
this.attempts++;
|
|
35
|
+
this.isConnecting = true;
|
|
36
36
|
this.socket = io(this.socketUrl, {
|
|
37
37
|
path: '/v0/radar/ws',
|
|
38
38
|
auth: {
|
|
@@ -40,7 +40,7 @@ export class EventExporter {
|
|
|
40
40
|
},
|
|
41
41
|
reconnectionAttempts: 2,
|
|
42
42
|
transports: ['websocket'],
|
|
43
|
-
})
|
|
43
|
+
});
|
|
44
44
|
|
|
45
45
|
// this.socket.on('connect', () => {
|
|
46
46
|
// this.isConnecting = false
|
|
@@ -50,58 +50,53 @@ export class EventExporter {
|
|
|
50
50
|
// })
|
|
51
51
|
|
|
52
52
|
this.socket.on('ready', () => {
|
|
53
|
-
this.isConnecting = false
|
|
54
|
-
this.isConnected = true
|
|
55
|
-
logger.info('EventExporter', 'Connected to server')
|
|
56
|
-
this.flushQueue()
|
|
57
|
-
})
|
|
53
|
+
this.isConnecting = false;
|
|
54
|
+
this.isConnected = true;
|
|
55
|
+
logger.info('EventExporter', 'Connected to server');
|
|
56
|
+
this.flushQueue();
|
|
57
|
+
});
|
|
58
58
|
|
|
59
59
|
this.socket.on('disconnect', (_err: any) => {
|
|
60
|
-
this.isConnecting = false
|
|
61
|
-
this.isConnected = false
|
|
62
|
-
logger.info('EventExporter', 'Disconnected from server')
|
|
63
|
-
})
|
|
60
|
+
this.isConnecting = false;
|
|
61
|
+
this.isConnected = false;
|
|
62
|
+
logger.info('EventExporter', 'Disconnected from server');
|
|
63
|
+
});
|
|
64
64
|
|
|
65
65
|
this.socket.on('connect_error', (err: any) => {
|
|
66
|
-
this.isConnecting = false
|
|
67
|
-
this.isConnected = false
|
|
68
|
-
this.checkReconnectionAttempts()
|
|
69
|
-
logger.error('EventExporter', 'Error connecting to server', err)
|
|
70
|
-
})
|
|
66
|
+
this.isConnecting = false;
|
|
67
|
+
this.isConnected = false;
|
|
68
|
+
this.checkReconnectionAttempts();
|
|
69
|
+
logger.error('EventExporter', 'Error connecting to server', err);
|
|
70
|
+
});
|
|
71
71
|
|
|
72
72
|
this.socket.on(SESSION_STOPPED_EVENT, (_: any) => {
|
|
73
|
+
this.unsubscribeFromSession();
|
|
74
|
+
});
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
this.socket.on(SESSION_AUTO_CREATED, (_: any) => {
|
|
78
|
-
|
|
79
|
-
})
|
|
76
|
+
this.socket.on(SESSION_AUTO_CREATED, (_: any) => {});
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
setApiKey(apiKey: string): void {
|
|
83
|
-
this.apiKey = apiKey
|
|
80
|
+
this.apiKey = apiKey;
|
|
84
81
|
}
|
|
85
82
|
|
|
86
83
|
setSocketUrl(socketUrl: string): void {
|
|
87
|
-
this.socketUrl = socketUrl
|
|
84
|
+
this.socketUrl = socketUrl;
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
private checkReconnectionAttempts(): void {
|
|
91
88
|
if (this.attempts >= MAX_RECONNECTION_ATTEMPTS) {
|
|
92
|
-
|
|
93
|
-
this.flushQueue()
|
|
89
|
+
this.flushQueue();
|
|
94
90
|
}
|
|
95
91
|
}
|
|
96
92
|
|
|
97
|
-
|
|
98
93
|
private flushQueue(): void {
|
|
99
|
-
while (this.queue.length > 0 &&
|
|
100
|
-
const event = this.queue.shift()
|
|
101
|
-
if (!event) continue
|
|
94
|
+
while (this.queue.length > 0 && this.socket?.connected) {
|
|
95
|
+
const event = this.queue.shift();
|
|
96
|
+
if (!event) continue;
|
|
102
97
|
|
|
103
98
|
if (this.socket?.connected) {
|
|
104
|
-
this.socket.emit(event.name, event.data)
|
|
99
|
+
this.socket.emit(event.name, event.data);
|
|
105
100
|
}
|
|
106
101
|
}
|
|
107
102
|
}
|
|
@@ -109,47 +104,47 @@ export class EventExporter {
|
|
|
109
104
|
private unsubscribeFromSession() {
|
|
110
105
|
const payload = {
|
|
111
106
|
debugSessionId: this.sessionId,
|
|
112
|
-
}
|
|
107
|
+
};
|
|
113
108
|
if (this.socket?.connected) {
|
|
114
|
-
this.socket.emit(SESSION_UNSUBSCRIBE_EVENT, payload)
|
|
109
|
+
this.socket.emit(SESSION_UNSUBSCRIBE_EVENT, payload);
|
|
115
110
|
}
|
|
116
111
|
}
|
|
117
112
|
|
|
118
113
|
public send(event: any): void {
|
|
119
114
|
if (this.socket?.connected) {
|
|
120
|
-
this.socket.emit(SESSION_ADD_EVENT, event)
|
|
115
|
+
this.socket.emit(SESSION_ADD_EVENT, event);
|
|
121
116
|
} else {
|
|
122
|
-
this.queue.push({ data: event, name: SESSION_ADD_EVENT })
|
|
123
|
-
this.init()
|
|
117
|
+
this.queue.push({ data: event, name: SESSION_ADD_EVENT });
|
|
118
|
+
this.init();
|
|
124
119
|
}
|
|
125
120
|
}
|
|
126
121
|
|
|
127
122
|
public subscribeToSession(session: ISession): void {
|
|
128
|
-
this.sessionId = session.shortId || session._id
|
|
123
|
+
this.sessionId = session.shortId || session._id;
|
|
129
124
|
const payload = {
|
|
130
125
|
projectId: session.project,
|
|
131
126
|
workspaceId: session.workspace,
|
|
132
127
|
debugSessionId: this.sessionId,
|
|
133
128
|
sessionType: session.creationType,
|
|
134
|
-
}
|
|
129
|
+
};
|
|
135
130
|
if (this.socket?.connected) {
|
|
136
|
-
this.socket.emit(SESSION_SUBSCRIBE_EVENT, payload)
|
|
131
|
+
this.socket.emit(SESSION_SUBSCRIBE_EVENT, payload);
|
|
137
132
|
} else {
|
|
138
|
-
this.queue.push({ data: payload, name: SESSION_SUBSCRIBE_EVENT })
|
|
139
|
-
this.init()
|
|
133
|
+
this.queue.push({ data: payload, name: SESSION_SUBSCRIBE_EVENT });
|
|
134
|
+
this.init();
|
|
140
135
|
}
|
|
141
136
|
}
|
|
142
137
|
|
|
143
138
|
public close(): void {
|
|
144
139
|
if (this.socket?.connected) {
|
|
145
140
|
setTimeout(() => {
|
|
146
|
-
this.unsubscribeFromSession()
|
|
147
|
-
this.attempts = 0
|
|
148
|
-
this.isConnected = false
|
|
149
|
-
this.isConnecting = false
|
|
150
|
-
this.socket?.disconnect()
|
|
151
|
-
this.socket = null
|
|
152
|
-
}, 500)
|
|
141
|
+
this.unsubscribeFromSession();
|
|
142
|
+
this.attempts = 0;
|
|
143
|
+
this.isConnected = false;
|
|
144
|
+
this.isConnecting = false;
|
|
145
|
+
this.socket?.disconnect();
|
|
146
|
+
this.socket = null;
|
|
147
|
+
}, 500);
|
|
153
148
|
}
|
|
154
149
|
}
|
|
155
150
|
}
|