@multiplayer-app/session-recorder-react-native 1.3.36 → 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.
- package/package.json +13 -8
- package/src/NativeSessionRecorderModule.ts +4 -2
- package/src/NativeSessionRecorderModuleSpec.ts +4 -2
- package/src/NativeSessionRecorderNative.ts +1 -1
- package/src/index.ts +0 -1
- package/src/native/SessionRecorderNative.ts +22 -13
- package/src/otel/helpers.ts +5 -1
- package/src/otel/index.ts +1 -1
- package/src/otel/instrumentations/index.ts +22 -22
- package/src/patch/configs.ts +15 -10
- package/src/patch/fetch.ts +98 -89
- package/src/patch/index.ts +1 -1
- package/src/patch/xhr.ts +3 -4
- package/src/services/screenRecordingService.ts +7 -2
- package/src/services/storage.service.ts +4 -1
- package/src/session-recorder.ts +4 -0
- package/src/types/configs.ts +1 -2
- package/lib/module/NativeSessionRecorderModule.js +0 -5
- package/lib/module/NativeSessionRecorderModule.js.map +0 -1
- package/lib/module/NativeSessionRecorderModuleSpec.js +0 -5
- package/lib/module/NativeSessionRecorderModuleSpec.js.map +0 -1
- package/lib/module/NativeSessionRecorderNative.js +0 -5
- package/lib/module/NativeSessionRecorderNative.js.map +0 -1
- package/lib/module/components/ErrorBoundary.js +0 -32
- package/lib/module/components/ErrorBoundary.js.map +0 -1
- package/lib/module/components/ScreenRecorderView/ScreenRecorderView.js +0 -23
- package/lib/module/components/ScreenRecorderView/ScreenRecorderView.js.map +0 -1
- package/lib/module/components/ScreenRecorderView/index.js +0 -4
- package/lib/module/components/ScreenRecorderView/index.js.map +0 -1
- package/lib/module/components/SessionRecorderWidget/ErrorBanner.js +0 -64
- package/lib/module/components/SessionRecorderWidget/ErrorBanner.js.map +0 -1
- package/lib/module/components/SessionRecorderWidget/FinalPopover.js +0 -74
- package/lib/module/components/SessionRecorderWidget/FinalPopover.js.map +0 -1
- package/lib/module/components/SessionRecorderWidget/FloatingButton.js +0 -191
- package/lib/module/components/SessionRecorderWidget/FloatingButton.js.map +0 -1
- package/lib/module/components/SessionRecorderWidget/InitialPopover.js +0 -138
- package/lib/module/components/SessionRecorderWidget/InitialPopover.js.map +0 -1
- package/lib/module/components/SessionRecorderWidget/ModalContainer.js +0 -177
- package/lib/module/components/SessionRecorderWidget/ModalContainer.js.map +0 -1
- package/lib/module/components/SessionRecorderWidget/ModalHeader.js +0 -27
- package/lib/module/components/SessionRecorderWidget/ModalHeader.js.map +0 -1
- package/lib/module/components/SessionRecorderWidget/SessionRecorderWidget.js +0 -133
- package/lib/module/components/SessionRecorderWidget/SessionRecorderWidget.js.map +0 -1
- package/lib/module/components/SessionRecorderWidget/icons.js +0 -93
- package/lib/module/components/SessionRecorderWidget/icons.js.map +0 -1
- package/lib/module/components/SessionRecorderWidget/index.js +0 -5
- package/lib/module/components/SessionRecorderWidget/index.js.map +0 -1
- package/lib/module/components/SessionRecorderWidget/styles.js +0 -173
- package/lib/module/components/SessionRecorderWidget/styles.js.map +0 -1
- package/lib/module/components/index.js +0 -6
- package/lib/module/components/index.js.map +0 -1
- package/lib/module/config/constants.js +0 -47
- package/lib/module/config/constants.js.map +0 -1
- package/lib/module/config/defaults.js +0 -87
- package/lib/module/config/defaults.js.map +0 -1
- package/lib/module/config/index.js +0 -9
- package/lib/module/config/index.js.map +0 -1
- package/lib/module/config/masking.js +0 -35
- package/lib/module/config/masking.js.map +0 -1
- package/lib/module/config/session-recorder.js +0 -50
- package/lib/module/config/session-recorder.js.map +0 -1
- package/lib/module/config/validators.js +0 -28
- package/lib/module/config/validators.js.map +0 -1
- package/lib/module/config/widget.js +0 -35
- package/lib/module/config/widget.js.map +0 -1
- package/lib/module/context/SessionRecorderContext.js +0 -100
- package/lib/module/context/SessionRecorderContext.js.map +0 -1
- package/lib/module/context/SessionRecorderStore.js +0 -12
- package/lib/module/context/SessionRecorderStore.js.map +0 -1
- package/lib/module/context/createStore.js +0 -27
- package/lib/module/context/createStore.js.map +0 -1
- package/lib/module/context/useSessionRecorderStore.js +0 -45
- package/lib/module/context/useSessionRecorderStore.js.map +0 -1
- package/lib/module/context/useStoreSelector.js +0 -27
- package/lib/module/context/useStoreSelector.js.map +0 -1
- package/lib/module/index.js +0 -14
- package/lib/module/index.js.map +0 -1
- package/lib/module/native/SessionRecorderNative.js +0 -76
- package/lib/module/native/SessionRecorderNative.js.map +0 -1
- package/lib/module/native/index.js +0 -4
- package/lib/module/native/index.js.map +0 -1
- package/lib/module/otel/CrashBufferSpanProcessor.js +0 -42
- package/lib/module/otel/CrashBufferSpanProcessor.js.map +0 -1
- package/lib/module/otel/helpers.js +0 -218
- package/lib/module/otel/helpers.js.map +0 -1
- package/lib/module/otel/index.js +0 -202
- package/lib/module/otel/index.js.map +0 -1
- package/lib/module/otel/instrumentations/index.js +0 -122
- package/lib/module/otel/instrumentations/index.js.map +0 -1
- package/lib/module/package.json +0 -1
- package/lib/module/patch/configs.js +0 -18
- package/lib/module/patch/configs.js.map +0 -1
- package/lib/module/patch/fetch.js +0 -224
- package/lib/module/patch/fetch.js.map +0 -1
- package/lib/module/patch/index.js +0 -6
- package/lib/module/patch/index.js.map +0 -1
- package/lib/module/patch/xhr.js +0 -100
- package/lib/module/patch/xhr.js.map +0 -1
- package/lib/module/recorder/gestureRecorder.js +0 -641
- package/lib/module/recorder/gestureRecorder.js.map +0 -1
- package/lib/module/recorder/index.js +0 -176
- package/lib/module/recorder/index.js.map +0 -1
- package/lib/module/recorder/navigationRecorder.js +0 -238
- package/lib/module/recorder/navigationRecorder.js.map +0 -1
- package/lib/module/recorder/screenRecorder.js +0 -527
- package/lib/module/recorder/screenRecorder.js.map +0 -1
- package/lib/module/services/api.service.js +0 -166
- package/lib/module/services/api.service.js.map +0 -1
- package/lib/module/services/crashBuffer.service.js +0 -280
- package/lib/module/services/crashBuffer.service.js.map +0 -1
- package/lib/module/services/network.service.js +0 -178
- package/lib/module/services/network.service.js.map +0 -1
- package/lib/module/services/screenRecordingService.js +0 -107
- package/lib/module/services/screenRecordingService.js.map +0 -1
- package/lib/module/services/socket.service.js +0 -186
- package/lib/module/services/socket.service.js.map +0 -1
- package/lib/module/services/storage.service.js +0 -178
- package/lib/module/services/storage.service.js.map +0 -1
- package/lib/module/session-recorder.js +0 -750
- package/lib/module/session-recorder.js.map +0 -1
- package/lib/module/types/configs.js +0 -4
- package/lib/module/types/configs.js.map +0 -1
- package/lib/module/types/expo-constants.d.js +0 -2
- package/lib/module/types/expo-constants.d.js.map +0 -1
- package/lib/module/types/index.js +0 -10
- package/lib/module/types/index.js.map +0 -1
- package/lib/module/types/session-recorder.js +0 -68
- package/lib/module/types/session-recorder.js.map +0 -1
- package/lib/module/utils/app-metadata.js +0 -28
- package/lib/module/utils/app-metadata.js.map +0 -1
- package/lib/module/utils/constants.optional.expo.js +0 -6
- package/lib/module/utils/constants.optional.expo.js.map +0 -1
- package/lib/module/utils/constants.optional.js +0 -8
- package/lib/module/utils/constants.optional.js.map +0 -1
- package/lib/module/utils/index.js +0 -11
- package/lib/module/utils/index.js.map +0 -1
- package/lib/module/utils/logger.js +0 -185
- package/lib/module/utils/logger.js.map +0 -1
- package/lib/module/utils/platform.js +0 -340
- package/lib/module/utils/platform.js.map +0 -1
- package/lib/module/utils/request-utils.js +0 -58
- package/lib/module/utils/request-utils.js.map +0 -1
- package/lib/module/utils/rrweb-events.js +0 -276
- package/lib/module/utils/rrweb-events.js.map +0 -1
- package/lib/module/utils/session.js +0 -21
- package/lib/module/utils/session.js.map +0 -1
- package/lib/module/utils/shallowEqual.js +0 -17
- package/lib/module/utils/shallowEqual.js.map +0 -1
- package/lib/module/utils/time.js +0 -17
- package/lib/module/utils/time.js.map +0 -1
- package/lib/module/utils/type-utils.js +0 -69
- package/lib/module/utils/type-utils.js.map +0 -1
- package/lib/module/version.js +0 -4
- package/lib/module/version.js.map +0 -1
- package/lib/typescript/package.json +0 -1
- package/lib/typescript/src/NativeSessionRecorderModule.d.ts +0 -25
- package/lib/typescript/src/NativeSessionRecorderModule.d.ts.map +0 -1
- package/lib/typescript/src/NativeSessionRecorderModuleSpec.d.ts +0 -25
- package/lib/typescript/src/NativeSessionRecorderModuleSpec.d.ts.map +0 -1
- package/lib/typescript/src/NativeSessionRecorderNative.d.ts +0 -25
- package/lib/typescript/src/NativeSessionRecorderNative.d.ts.map +0 -1
- package/lib/typescript/src/components/ErrorBoundary.d.ts +0 -16
- package/lib/typescript/src/components/ErrorBoundary.d.ts.map +0 -1
- package/lib/typescript/src/components/ScreenRecorderView/ScreenRecorderView.d.ts +0 -6
- package/lib/typescript/src/components/ScreenRecorderView/ScreenRecorderView.d.ts.map +0 -1
- package/lib/typescript/src/components/ScreenRecorderView/index.d.ts +0 -2
- package/lib/typescript/src/components/ScreenRecorderView/index.d.ts.map +0 -1
- package/lib/typescript/src/components/SessionRecorderWidget/ErrorBanner.d.ts +0 -8
- package/lib/typescript/src/components/SessionRecorderWidget/ErrorBanner.d.ts.map +0 -1
- package/lib/typescript/src/components/SessionRecorderWidget/FinalPopover.d.ts +0 -13
- package/lib/typescript/src/components/SessionRecorderWidget/FinalPopover.d.ts.map +0 -1
- package/lib/typescript/src/components/SessionRecorderWidget/FloatingButton.d.ts +0 -9
- package/lib/typescript/src/components/SessionRecorderWidget/FloatingButton.d.ts.map +0 -1
- package/lib/typescript/src/components/SessionRecorderWidget/InitialPopover.d.ts +0 -17
- package/lib/typescript/src/components/SessionRecorderWidget/InitialPopover.d.ts.map +0 -1
- package/lib/typescript/src/components/SessionRecorderWidget/ModalContainer.d.ts +0 -9
- package/lib/typescript/src/components/SessionRecorderWidget/ModalContainer.d.ts.map +0 -1
- package/lib/typescript/src/components/SessionRecorderWidget/ModalHeader.d.ts +0 -7
- package/lib/typescript/src/components/SessionRecorderWidget/ModalHeader.d.ts.map +0 -1
- package/lib/typescript/src/components/SessionRecorderWidget/SessionRecorderWidget.d.ts +0 -6
- package/lib/typescript/src/components/SessionRecorderWidget/SessionRecorderWidget.d.ts.map +0 -1
- package/lib/typescript/src/components/SessionRecorderWidget/icons.d.ts +0 -12
- package/lib/typescript/src/components/SessionRecorderWidget/icons.d.ts.map +0 -1
- package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts +0 -3
- package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts.map +0 -1
- package/lib/typescript/src/components/SessionRecorderWidget/styles.d.ts +0 -166
- package/lib/typescript/src/components/SessionRecorderWidget/styles.d.ts.map +0 -1
- package/lib/typescript/src/components/index.d.ts +0 -4
- package/lib/typescript/src/components/index.d.ts.map +0 -1
- package/lib/typescript/src/config/constants.d.ts +0 -22
- package/lib/typescript/src/config/constants.d.ts.map +0 -1
- package/lib/typescript/src/config/defaults.d.ts +0 -5
- package/lib/typescript/src/config/defaults.d.ts.map +0 -1
- package/lib/typescript/src/config/index.d.ts +0 -6
- package/lib/typescript/src/config/index.d.ts.map +0 -1
- package/lib/typescript/src/config/masking.d.ts +0 -3
- package/lib/typescript/src/config/masking.d.ts.map +0 -1
- package/lib/typescript/src/config/session-recorder.d.ts +0 -3
- package/lib/typescript/src/config/session-recorder.d.ts.map +0 -1
- package/lib/typescript/src/config/validators.d.ts +0 -11
- package/lib/typescript/src/config/validators.d.ts.map +0 -1
- package/lib/typescript/src/config/widget.d.ts +0 -10
- package/lib/typescript/src/config/widget.d.ts.map +0 -1
- package/lib/typescript/src/context/SessionRecorderContext.d.ts +0 -22
- package/lib/typescript/src/context/SessionRecorderContext.d.ts.map +0 -1
- package/lib/typescript/src/context/SessionRecorderStore.d.ts +0 -13
- package/lib/typescript/src/context/SessionRecorderStore.d.ts.map +0 -1
- package/lib/typescript/src/context/createStore.d.ts +0 -9
- package/lib/typescript/src/context/createStore.d.ts.map +0 -1
- package/lib/typescript/src/context/useSessionRecorderStore.d.ts +0 -29
- package/lib/typescript/src/context/useSessionRecorderStore.d.ts.map +0 -1
- package/lib/typescript/src/context/useStoreSelector.d.ts +0 -5
- package/lib/typescript/src/context/useStoreSelector.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts +0 -9
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/native/SessionRecorderNative.d.ts +0 -29
- package/lib/typescript/src/native/SessionRecorderNative.d.ts.map +0 -1
- package/lib/typescript/src/native/index.d.ts +0 -2
- package/lib/typescript/src/native/index.d.ts.map +0 -1
- package/lib/typescript/src/otel/CrashBufferSpanProcessor.d.ts +0 -17
- package/lib/typescript/src/otel/CrashBufferSpanProcessor.d.ts.map +0 -1
- package/lib/typescript/src/otel/helpers.d.ts +0 -46
- package/lib/typescript/src/otel/helpers.d.ts.map +0 -1
- package/lib/typescript/src/otel/index.d.ts +0 -33
- package/lib/typescript/src/otel/index.d.ts.map +0 -1
- package/lib/typescript/src/otel/instrumentations/index.d.ts +0 -5
- package/lib/typescript/src/otel/instrumentations/index.d.ts.map +0 -1
- package/lib/typescript/src/patch/configs.d.ts +0 -9
- package/lib/typescript/src/patch/configs.d.ts.map +0 -1
- package/lib/typescript/src/patch/fetch.d.ts +0 -2
- package/lib/typescript/src/patch/fetch.d.ts.map +0 -1
- package/lib/typescript/src/patch/index.d.ts +0 -4
- package/lib/typescript/src/patch/index.d.ts.map +0 -1
- package/lib/typescript/src/patch/xhr.d.ts +0 -2
- package/lib/typescript/src/patch/xhr.d.ts.map +0 -1
- package/lib/typescript/src/recorder/gestureRecorder.d.ts +0 -66
- package/lib/typescript/src/recorder/gestureRecorder.d.ts.map +0 -1
- package/lib/typescript/src/recorder/index.d.ts +0 -79
- package/lib/typescript/src/recorder/index.d.ts.map +0 -1
- package/lib/typescript/src/recorder/navigationRecorder.d.ts +0 -29
- package/lib/typescript/src/recorder/navigationRecorder.d.ts.map +0 -1
- package/lib/typescript/src/recorder/screenRecorder.d.ts +0 -127
- package/lib/typescript/src/recorder/screenRecorder.d.ts.map +0 -1
- package/lib/typescript/src/services/api.service.d.ts +0 -116
- package/lib/typescript/src/services/api.service.d.ts.map +0 -1
- package/lib/typescript/src/services/crashBuffer.service.d.ts +0 -27
- package/lib/typescript/src/services/crashBuffer.service.d.ts.map +0 -1
- package/lib/typescript/src/services/network.service.d.ts +0 -47
- package/lib/typescript/src/services/network.service.d.ts.map +0 -1
- package/lib/typescript/src/services/screenRecordingService.d.ts +0 -48
- package/lib/typescript/src/services/screenRecordingService.d.ts.map +0 -1
- package/lib/typescript/src/services/socket.service.d.ts +0 -44
- package/lib/typescript/src/services/socket.service.d.ts.map +0 -1
- package/lib/typescript/src/services/storage.service.d.ts +0 -47
- package/lib/typescript/src/services/storage.service.d.ts.map +0 -1
- package/lib/typescript/src/session-recorder.d.ts +0 -191
- package/lib/typescript/src/session-recorder.d.ts.map +0 -1
- package/lib/typescript/src/types/configs.d.ts +0 -92
- package/lib/typescript/src/types/configs.d.ts.map +0 -1
- package/lib/typescript/src/types/index.d.ts +0 -21
- package/lib/typescript/src/types/index.d.ts.map +0 -1
- package/lib/typescript/src/types/session-recorder.d.ts +0 -367
- package/lib/typescript/src/types/session-recorder.d.ts.map +0 -1
- package/lib/typescript/src/utils/app-metadata.d.ts +0 -17
- package/lib/typescript/src/utils/app-metadata.d.ts.map +0 -1
- package/lib/typescript/src/utils/constants.optional.d.ts +0 -22
- package/lib/typescript/src/utils/constants.optional.d.ts.map +0 -1
- package/lib/typescript/src/utils/constants.optional.expo.d.ts +0 -4
- package/lib/typescript/src/utils/constants.optional.expo.d.ts.map +0 -1
- package/lib/typescript/src/utils/index.d.ts +0 -8
- package/lib/typescript/src/utils/index.d.ts.map +0 -1
- package/lib/typescript/src/utils/logger.d.ts +0 -108
- package/lib/typescript/src/utils/logger.d.ts.map +0 -1
- package/lib/typescript/src/utils/platform.d.ts +0 -58
- package/lib/typescript/src/utils/platform.d.ts.map +0 -1
- package/lib/typescript/src/utils/request-utils.d.ts +0 -22
- package/lib/typescript/src/utils/request-utils.d.ts.map +0 -1
- package/lib/typescript/src/utils/rrweb-events.d.ts +0 -67
- package/lib/typescript/src/utils/rrweb-events.d.ts.map +0 -1
- package/lib/typescript/src/utils/session.d.ts +0 -7
- package/lib/typescript/src/utils/session.d.ts.map +0 -1
- package/lib/typescript/src/utils/shallowEqual.d.ts +0 -2
- package/lib/typescript/src/utils/shallowEqual.d.ts.map +0 -1
- package/lib/typescript/src/utils/time.d.ts +0 -5
- package/lib/typescript/src/utils/time.d.ts.map +0 -1
- package/lib/typescript/src/utils/type-utils.d.ts +0 -17
- package/lib/typescript/src/utils/type-utils.d.ts.map +0 -1
- package/lib/typescript/src/version.d.ts +0 -2
- package/lib/typescript/src/version.d.ts.map +0 -1
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { EventType } from '@rrweb/types';
|
|
4
|
-
import { SessionType } from '@multiplayer-app/session-recorder-common';
|
|
5
|
-
import { logger } from "../utils/index.js";
|
|
6
|
-
import { ScreenRecorder } from "./screenRecorder.js";
|
|
7
|
-
import { GestureRecorder } from "./gestureRecorder.js";
|
|
8
|
-
import { NavigationRecorder } from "./navigationRecorder.js";
|
|
9
|
-
export class RecorderReactNativeSDK {
|
|
10
|
-
isRecording = false;
|
|
11
|
-
recordedEvents = [];
|
|
12
|
-
bufferingEnabled = false;
|
|
13
|
-
bufferWindowMs = 2 * 60 * 1000;
|
|
14
|
-
sessionId = null;
|
|
15
|
-
sessionType = SessionType.MANUAL;
|
|
16
|
-
constructor() {
|
|
17
|
-
this.screenRecorder = new ScreenRecorder();
|
|
18
|
-
this.gestureRecorder = new GestureRecorder();
|
|
19
|
-
this.navigationRecorder = new NavigationRecorder();
|
|
20
|
-
}
|
|
21
|
-
init(config, socketService, crashBuffer, buffering) {
|
|
22
|
-
this.config = config;
|
|
23
|
-
this.socketService = socketService;
|
|
24
|
-
this.crashBuffer = crashBuffer;
|
|
25
|
-
this.bufferingEnabled = Boolean(buffering?.enabled);
|
|
26
|
-
this.bufferWindowMs = Math.max(10_000, buffering?.windowMs || 0.5 * 60 * 1000);
|
|
27
|
-
this.screenRecorder.init(config, this);
|
|
28
|
-
this.navigationRecorder.init(config, this.screenRecorder);
|
|
29
|
-
this.gestureRecorder.init(config, this, this.screenRecorder);
|
|
30
|
-
}
|
|
31
|
-
start(sessionId, sessionType) {
|
|
32
|
-
if (!this.config) {
|
|
33
|
-
throw new Error('Configuration not initialized. Call init() before start().');
|
|
34
|
-
}
|
|
35
|
-
this.sessionId = sessionId;
|
|
36
|
-
this.sessionType = sessionType;
|
|
37
|
-
this.isRecording = true;
|
|
38
|
-
|
|
39
|
-
// Emit recording started meta event
|
|
40
|
-
|
|
41
|
-
if (this.config.recordScreen) {
|
|
42
|
-
this.screenRecorder.setBufferOnlyMode(!sessionId && this.bufferingEnabled);
|
|
43
|
-
this.screenRecorder.start();
|
|
44
|
-
}
|
|
45
|
-
if (this.config.recordGestures) {
|
|
46
|
-
this.gestureRecorder.start();
|
|
47
|
-
}
|
|
48
|
-
if (this.config.recordNavigation) {
|
|
49
|
-
this.navigationRecorder.start();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
stop() {
|
|
53
|
-
this.isRecording = false;
|
|
54
|
-
this.gestureRecorder.stop();
|
|
55
|
-
this.navigationRecorder.stop();
|
|
56
|
-
this.screenRecorder.stop();
|
|
57
|
-
this.socketService?.close();
|
|
58
|
-
}
|
|
59
|
-
setNavigationRef(ref) {
|
|
60
|
-
this.navigationRecorder.setNavigationRef(ref);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Set the viewshot ref for screen capture
|
|
65
|
-
* @param ref - React Native View ref for screen capture
|
|
66
|
-
*/
|
|
67
|
-
setViewShotRef(ref) {
|
|
68
|
-
this.screenRecorder.setViewShotRef(ref);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Record an rrweb event
|
|
73
|
-
* @param event - The rrweb event to record
|
|
74
|
-
*/
|
|
75
|
-
recordEvent(event) {
|
|
76
|
-
if (!this.isRecording) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Buffer-only mode (no active debug session): persist locally.
|
|
81
|
-
if (!this.sessionId && this.crashBuffer && this.bufferingEnabled) {
|
|
82
|
-
void this.crashBuffer.appendEvent({
|
|
83
|
-
ts: event.timestamp,
|
|
84
|
-
isFullSnapshot: event.type === EventType.FullSnapshot,
|
|
85
|
-
event: {
|
|
86
|
-
event: event,
|
|
87
|
-
eventType: event.type,
|
|
88
|
-
timestamp: event.timestamp
|
|
89
|
-
}
|
|
90
|
-
}, this.bufferWindowMs);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (this.socketService) {
|
|
94
|
-
logger.debug('RecorderReactNativeSDK', 'Sending to socket service', event);
|
|
95
|
-
// Skip packing to avoid blob creation issues in Hermes
|
|
96
|
-
// const packedEvent = pack(event)
|
|
97
|
-
this.socketService.send({
|
|
98
|
-
event: event,
|
|
99
|
-
// Send raw event instead of packed
|
|
100
|
-
eventType: event.type,
|
|
101
|
-
timestamp: event.timestamp,
|
|
102
|
-
debugSessionId: this.sessionId,
|
|
103
|
-
debugSessionType: this.sessionType
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Record touch start event
|
|
110
|
-
* @param x - X coordinate
|
|
111
|
-
* @param y - Y coordinate
|
|
112
|
-
* @param target - Target element identifier
|
|
113
|
-
* @param pressure - Touch pressure
|
|
114
|
-
*/
|
|
115
|
-
recordTouchStart(x, y, target, pressure) {
|
|
116
|
-
if (!this.isRecording) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
this.gestureRecorder.recordTouchStart(x, y, target, pressure);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Record touch move event
|
|
124
|
-
* @param x - X coordinate
|
|
125
|
-
* @param y - Y coordinate
|
|
126
|
-
* @param target - Target element identifier
|
|
127
|
-
* @param pressure - Touch pressure
|
|
128
|
-
*/
|
|
129
|
-
recordTouchMove(x, y, target, pressure) {
|
|
130
|
-
if (!this.isRecording) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
this.gestureRecorder.recordTouchMove(x, y, target, pressure);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Record touch end event
|
|
138
|
-
* @param x - X coordinate
|
|
139
|
-
* @param y - Y coordinate
|
|
140
|
-
* @param target - Target element identifier
|
|
141
|
-
* @param pressure - Touch pressure
|
|
142
|
-
*/
|
|
143
|
-
recordTouchEnd(x, y, target, pressure) {
|
|
144
|
-
if (!this.isRecording) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
this.gestureRecorder.recordTouchEnd(x, y, target, pressure);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Get all recorded events
|
|
152
|
-
* @returns Array of recorded rrweb events
|
|
153
|
-
*/
|
|
154
|
-
getRecordedEvents() {
|
|
155
|
-
return [...this.recordedEvents];
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Clear all recorded events
|
|
160
|
-
*/
|
|
161
|
-
clearRecordedEvents() {
|
|
162
|
-
this.recordedEvents = [];
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Get recording statistics
|
|
167
|
-
* @returns Recording statistics
|
|
168
|
-
*/
|
|
169
|
-
getRecordingStats() {
|
|
170
|
-
return {
|
|
171
|
-
totalEvents: this.recordedEvents.length,
|
|
172
|
-
isRecording: this.isRecording
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["EventType","SessionType","logger","ScreenRecorder","GestureRecorder","NavigationRecorder","RecorderReactNativeSDK","isRecording","recordedEvents","bufferingEnabled","bufferWindowMs","sessionId","sessionType","MANUAL","constructor","screenRecorder","gestureRecorder","navigationRecorder","init","config","socketService","crashBuffer","buffering","Boolean","enabled","Math","max","windowMs","start","Error","recordScreen","setBufferOnlyMode","recordGestures","recordNavigation","stop","close","setNavigationRef","ref","setViewShotRef","recordEvent","event","appendEvent","ts","timestamp","isFullSnapshot","type","FullSnapshot","eventType","debug","send","debugSessionId","debugSessionType","recordTouchStart","x","y","target","pressure","recordTouchMove","recordTouchEnd","getRecordedEvents","clearRecordedEvents","getRecordingStats","totalEvents","length"],"sourceRoot":"../../../src","sources":["recorder/index.ts"],"mappings":";;AAAA,SAASA,SAAS,QAA4B,cAAc;AAC5D,SAASC,WAAW,QAAQ,0CAA0C;AAEtE,SAASC,MAAM,QAAQ,mBAAU;AAKjC,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,kBAAkB,QAAQ,yBAAsB;AAEzD,OAAO,MAAMC,sBAAsB,CAA0B;EACnDC,WAAW,GAAG,KAAK;EAKnBC,cAAc,GAAoB,EAAE;EAGpCC,gBAAgB,GAAY,KAAK;EACjCC,cAAc,GAAW,CAAC,GAAG,EAAE,GAAG,IAAI;EACtCC,SAAS,GAAkB,IAAI;EAC/BC,WAAW,GAAgBX,WAAW,CAACY,MAAM;EAErDC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,cAAc,GAAG,IAAIZ,cAAc,CAAC,CAAC;IAC1C,IAAI,CAACa,eAAe,GAAG,IAAIZ,eAAe,CAAC,CAAC;IAC5C,IAAI,CAACa,kBAAkB,GAAG,IAAIZ,kBAAkB,CAAC,CAAC;EACpD;EAEAa,IAAIA,CACFC,MAAsB,EACtBC,aAA4B,EAC5BC,WAAgC,EAChCC,SAAkD,EAC5C;IACN,IAAI,CAACH,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACC,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACZ,gBAAgB,GAAGc,OAAO,CAACD,SAAS,EAAEE,OAAO,CAAC;IACnD,IAAI,CAACd,cAAc,GAAGe,IAAI,CAACC,GAAG,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EwC,gBAAgBA,CACdC,CAAS,EACTC,CAAS,EACTC,MAAe,EACfC,QAAiB,EACX;IACN,IAAI,CAAC,IAAI,CAACjD,WAAW,EAAE;MACrB;IACF;IAEA,IAAI,CAACS,eAAe,CAACoC,gBAAgB,CAACC,CAAC,EAAEC,CAAC,EAAEC,MAAM,EAAEC,QAAQ,CAAC;EAC/D;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,eAAeA,CACbJ,CAAS,EACTC,CAAS,EACTC,MAAe,EACfC,QAAiB,EACX;IACN,IAAI,CAAC,IAAI,CAACjD,WAAW,EAAE;MACrB;IACF;IAEA,IAAI,CAACS,eAAe,CAACyC,eAAe,CAACJ,CAAC,EAAEC,CAAC,EAAEC,MAAM,EAAEC,QAAQ,CAAC;EAC9D;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEE,cAAcA,CACZL,CAAS,EACTC,CAAS,EACTC,MAAe,EACfC,QAAiB,EACX;IACN,IAAI,CAAC,IAAI,CAACjD,WAAW,EAAE;MACrB;IACF;IAEA,IAAI,CAACS,eAAe,CAAC0C,cAAc,CAACL,CAAC,EAAEC,CAAC,EAAEC,MAAM,EAAEC,QAAQ,CAAC;EAC7D;;EAEA;AACF;AACA;AACA;EACEG,iBAAiBA,CAAA,EAAoB;IACnC,OAAO,CAAC,GAAG,IAAI,CAACnD,cAAc,CAAC;EACjC;;EAEA;AACF;AACA;EACEoD,mBAAmBA,CAAA,EAAS;IAC1B,IAAI,CAACpD,cAAc,GAAG,EAAE;EAC1B;;EAEA;AACF;AACA;AACA;EACEqD,iBAAiBA,CAAA,EAAkD;IACjE,OAAO;MACLC,WAAW,EAAE,IAAI,CAACtD,cAAc,CAACuD,MAAM;MACvCxD,WAAW,EAAE,IAAI,CAACA;IACpB,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { trace, SpanStatusCode } from '@opentelemetry/api';
|
|
4
|
-
import { logger } from "../utils/index.js";
|
|
5
|
-
export class NavigationRecorder {
|
|
6
|
-
isRecording = false;
|
|
7
|
-
navigationRef = null;
|
|
8
|
-
navigationListeners = new Map();
|
|
9
|
-
currentRoute = null;
|
|
10
|
-
navigationStack = [];
|
|
11
|
-
navigationStartTime = 0;
|
|
12
|
-
// Reference to screen recorder for force capture
|
|
13
|
-
|
|
14
|
-
init(config, screenRecorder) {
|
|
15
|
-
this.config = config;
|
|
16
|
-
this.screenRecorder = screenRecorder;
|
|
17
|
-
logger.info('NavigationRecorder', 'Navigation tracker initialized', {
|
|
18
|
-
config: this.config,
|
|
19
|
-
screenRecorder: this.screenRecorder
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
setNavigationRef(ref) {
|
|
23
|
-
if (this.navigationRef === ref) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Clean up listeners attached to the previous ref before switching.
|
|
28
|
-
if (this.isRecording && this.navigationRef) {
|
|
29
|
-
this._removeNavigationListener();
|
|
30
|
-
}
|
|
31
|
-
this.navigationRef = ref;
|
|
32
|
-
if (this.isRecording) {
|
|
33
|
-
this._setupNavigationListener();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
start() {
|
|
37
|
-
logger.info('NavigationRecorder', 'Navigation tracking started');
|
|
38
|
-
this.isRecording = true;
|
|
39
|
-
this.navigationStack = [];
|
|
40
|
-
this.navigationStartTime = Date.now();
|
|
41
|
-
this._setupNavigationListener();
|
|
42
|
-
// Navigation tracking started
|
|
43
|
-
}
|
|
44
|
-
stop() {
|
|
45
|
-
this.isRecording = false;
|
|
46
|
-
this._removeNavigationListener();
|
|
47
|
-
// Navigation tracking stopped
|
|
48
|
-
}
|
|
49
|
-
pause() {
|
|
50
|
-
this.isRecording = false;
|
|
51
|
-
}
|
|
52
|
-
resume() {
|
|
53
|
-
this.isRecording = true;
|
|
54
|
-
this._setupNavigationListener();
|
|
55
|
-
}
|
|
56
|
-
_setupNavigationListener() {
|
|
57
|
-
// Ensure we never accumulate duplicate listeners across restarts.
|
|
58
|
-
this._removeNavigationListener();
|
|
59
|
-
if (!this.navigationRef) {
|
|
60
|
-
// Navigation ref not set - silently continue
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
// Listen to navigation state changes
|
|
65
|
-
const stateListener = this.navigationRef.addListener('state', e => {
|
|
66
|
-
this._recordNavigationEvent('state_change', e.data);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// Listen to focus events
|
|
70
|
-
const focusListener = this.navigationRef.addListener('focus', e => {
|
|
71
|
-
this._recordNavigationEvent('focus', e.data);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// Listen to blur events
|
|
75
|
-
const blurListener = this.navigationRef.addListener('blur', e => {
|
|
76
|
-
this._recordNavigationEvent('blur', e.data);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// Listen to beforeRemove events
|
|
80
|
-
const beforeRemoveListener = this.navigationRef.addListener('beforeRemove', e => {
|
|
81
|
-
this._recordNavigationEvent('beforeRemove', e.data);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// Store listeners for cleanup
|
|
85
|
-
this.navigationListeners.set('state', stateListener);
|
|
86
|
-
this.navigationListeners.set('focus', focusListener);
|
|
87
|
-
this.navigationListeners.set('blur', blurListener);
|
|
88
|
-
this.navigationListeners.set('beforeRemove', beforeRemoveListener);
|
|
89
|
-
|
|
90
|
-
// Navigation listeners setup complete
|
|
91
|
-
} catch (error) {
|
|
92
|
-
// Failed to setup navigation listeners - silently continue
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
_removeNavigationListener() {
|
|
96
|
-
try {
|
|
97
|
-
// Remove all listeners
|
|
98
|
-
this.navigationListeners.forEach((listener, _) => {
|
|
99
|
-
if (listener && typeof listener === 'function') {
|
|
100
|
-
listener();
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
this.navigationListeners.clear();
|
|
104
|
-
// Navigation listeners removed
|
|
105
|
-
} catch (error) {
|
|
106
|
-
// Failed to remove navigation listeners - silently continue
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
_getFriendlyRouteTitle() {
|
|
110
|
-
try {
|
|
111
|
-
const current = this.navigationRef?.getCurrentRoute?.();
|
|
112
|
-
if (!current) return null;
|
|
113
|
-
// Prefer a title set via navigation.setOptions({ title }) if present in params
|
|
114
|
-
const titleFromParams = current.params && current.params.title;
|
|
115
|
-
if (titleFromParams && typeof titleFromParams === 'string') {
|
|
116
|
-
return titleFromParams;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Fallback to a prettified route name (handles Expo Router style names like 'user-posts/[id]')
|
|
120
|
-
if (current.name && typeof current.name === 'string') {
|
|
121
|
-
const raw = current.name;
|
|
122
|
-
// Remove group segments like "(tabs)/" at the beginning
|
|
123
|
-
const withoutGroups = raw.replace(/^\([^)]*\)\//, '');
|
|
124
|
-
// Take last path segment (e.g., 'user-posts/[id]' -> '[id]' is removed later, 'post/[id]' -> 'post')
|
|
125
|
-
const lastSegment = withoutGroups.split('/').filter(Boolean).slice(-2).join(' ');
|
|
126
|
-
// Remove dynamic segments like '[id]'
|
|
127
|
-
const withoutParams = lastSegment.replace(/\[[^\]]+\]/g, '').trim();
|
|
128
|
-
// Replace dashes/underscores with spaces and collapse spaces
|
|
129
|
-
const spaced = withoutParams.replace(/[-_]+/g, ' ').replace(/\s+/g, ' ').trim();
|
|
130
|
-
// Title case
|
|
131
|
-
const titleCase = spaced.split(' ').map(w => w ? w.charAt(0).toUpperCase() + w.slice(1) : w).join(' ');
|
|
132
|
-
return titleCase || raw;
|
|
133
|
-
}
|
|
134
|
-
return null;
|
|
135
|
-
} catch {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
_recordNavigationEvent(eventType, data) {
|
|
140
|
-
if (!this.isRecording) return;
|
|
141
|
-
const event = {
|
|
142
|
-
type: 'navigate',
|
|
143
|
-
timestamp: Date.now(),
|
|
144
|
-
metadata: {
|
|
145
|
-
eventType,
|
|
146
|
-
navigationDuration: Date.now() - this.navigationStartTime,
|
|
147
|
-
stackDepth: this.navigationStack.length
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
const currentRoute = this.navigationRef?.getCurrentRoute?.() || {};
|
|
151
|
-
const friendlyTitle = this._getFriendlyRouteTitle();
|
|
152
|
-
const routeName = data?.routeName || currentRoute?.name;
|
|
153
|
-
const params = data?.params || currentRoute?.params;
|
|
154
|
-
const key = data?.key || currentRoute?.key;
|
|
155
|
-
if (routeName) {
|
|
156
|
-
event.routeName = routeName;
|
|
157
|
-
this._updateNavigationStack(routeName, eventType);
|
|
158
|
-
}
|
|
159
|
-
if (params) {
|
|
160
|
-
event.params = params;
|
|
161
|
-
}
|
|
162
|
-
if (key) {
|
|
163
|
-
event.metadata.routeKey = key;
|
|
164
|
-
}
|
|
165
|
-
if (friendlyTitle) {
|
|
166
|
-
event.metadata.friendlyRouteName = friendlyTitle;
|
|
167
|
-
}
|
|
168
|
-
this._recordOpenTelemetrySpan(event);
|
|
169
|
-
|
|
170
|
-
// Force screen capture on navigation events
|
|
171
|
-
// this.screenRecorder?.forceCapture(event.timestamp)
|
|
172
|
-
}
|
|
173
|
-
_updateNavigationStack(routeName, eventType) {
|
|
174
|
-
if (eventType === 'focus' || eventType === 'state_change') {
|
|
175
|
-
if (this.currentRoute !== routeName) {
|
|
176
|
-
this.currentRoute = routeName;
|
|
177
|
-
this.navigationStack.push(routeName);
|
|
178
|
-
}
|
|
179
|
-
} else if (eventType === 'blur' || eventType === 'beforeRemove') {
|
|
180
|
-
const index = this.navigationStack.indexOf(routeName);
|
|
181
|
-
if (index > -1) {
|
|
182
|
-
this.navigationStack.splice(index, 1);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
_recordOpenTelemetrySpan(event) {
|
|
187
|
-
try {
|
|
188
|
-
const span = trace.getTracer('navigation').startSpan(`Navigation.${event.type}`, {
|
|
189
|
-
attributes: {
|
|
190
|
-
'navigation.system': 'ReactNavigation',
|
|
191
|
-
'navigation.operation': event.type,
|
|
192
|
-
'navigation.type': event.type,
|
|
193
|
-
'navigation.timestamp': event.timestamp,
|
|
194
|
-
'navigation.platform': 'react-native'
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
if (event.routeName) {
|
|
198
|
-
span.setAttribute('navigation.route_name', event.routeName);
|
|
199
|
-
}
|
|
200
|
-
if (event.params) {
|
|
201
|
-
span.setAttribute('navigation.params', JSON.stringify(event.params));
|
|
202
|
-
}
|
|
203
|
-
if (event.metadata) {
|
|
204
|
-
Object.entries(event.metadata).forEach(([key, value]) => {
|
|
205
|
-
span.setAttribute(`navigation.metadata.${key}`, String(value));
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
span.setStatus({
|
|
209
|
-
code: SpanStatusCode.OK
|
|
210
|
-
});
|
|
211
|
-
span.end();
|
|
212
|
-
} catch (error) {
|
|
213
|
-
// Failed to record OpenTelemetry span for navigation - silently continue
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// Get current navigation state
|
|
218
|
-
getCurrentRoute() {
|
|
219
|
-
return this.currentRoute;
|
|
220
|
-
}
|
|
221
|
-
getNavigationStack() {
|
|
222
|
-
return [...this.navigationStack];
|
|
223
|
-
}
|
|
224
|
-
getNavigationDepth() {
|
|
225
|
-
return this.navigationStack.length;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// Get recording status
|
|
229
|
-
isRecordingEnabled() {
|
|
230
|
-
return this.isRecording;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// Get navigation duration
|
|
234
|
-
getNavigationDuration() {
|
|
235
|
-
return Date.now() - this.navigationStartTime;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
//# sourceMappingURL=navigationRecorder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["trace","SpanStatusCode","logger","NavigationRecorder","isRecording","navigationRef","navigationListeners","Map","currentRoute","navigationStack","navigationStartTime","init","config","screenRecorder","info","setNavigationRef","ref","_removeNavigationListener","_setupNavigationListener","start","Date","now","stop","pause","resume","stateListener","addListener","e","_recordNavigationEvent","data","focusListener","blurListener","beforeRemoveListener","set","error","forEach","listener","_","clear","_getFriendlyRouteTitle","current","getCurrentRoute","titleFromParams","params","title","name","raw","withoutGroups","replace","lastSegment","split","filter","Boolean","slice","join","withoutParams","trim","spaced","titleCase","map","w","charAt","toUpperCase","eventType","event","type","timestamp","metadata","navigationDuration","stackDepth","length","friendlyTitle","routeName","key","_updateNavigationStack","routeKey","friendlyRouteName","_recordOpenTelemetrySpan","push","index","indexOf","splice","span","getTracer","startSpan","attributes","setAttribute","JSON","stringify","Object","entries","value","String","setStatus","code","OK","end","getNavigationStack","getNavigationDepth","isRecordingEnabled","getNavigationDuration"],"sourceRoot":"../../../src","sources":["recorder/navigationRecorder.ts"],"mappings":";;AACA,SAASA,KAAK,EAAEC,cAAc,QAAQ,oBAAoB;AAC1D,SAASC,MAAM,QAAQ,mBAAU;AAEjC,OAAO,MAAMC,kBAAkB,CAAC;EAEtBC,WAAW,GAAG,KAAK;EACnBC,aAAa,GAAQ,IAAI;EACzBC,mBAAmB,GAAqB,IAAIC,GAAG,CAAC,CAAC;EACjDC,YAAY,GAAkB,IAAI;EAClCC,eAAe,GAAa,EAAE;EAC9BC,mBAAmB,GAAW,CAAC;EACT;;EAE9BC,IAAIA,CAACC,MAAsB,EAAEC,cAAoB,EAAQ;IACvD,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,cAAc,GAAGA,cAAc;IACpCX,MAAM,CAACY,IAAI,CAAC,oBAAoB,EAAE,gCAAgC,EAAE;MAClEF,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBC,cAAc,EAAE,IAAI,CAACA;IACvB,CAAC,CAAC;EACJ;EAEAE,gBAAgBA,CA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