@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.
- package/package.json +4 -4
- 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/otel/instrumentations/index.ts +22 -22
- 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 -222
- 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,340 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import OptionalConstants from "./constants.optional.js";
|
|
4
|
-
import { Platform, Dimensions, PixelRatio } from 'react-native';
|
|
5
|
-
import { version } from "../version.js";
|
|
6
|
-
import { getAutoDetectedAppMetadata } from "./app-metadata.js";
|
|
7
|
-
|
|
8
|
-
// Global app metadata configuration for non-Expo apps
|
|
9
|
-
let globalAppMetadata = {};
|
|
10
|
-
|
|
11
|
-
// Cache for auto-detected metadata to avoid repeated file reads
|
|
12
|
-
let autoDetectedMetadata = null;
|
|
13
|
-
export function detectPlatform() {
|
|
14
|
-
try {
|
|
15
|
-
// Check if we're in an Expo environment
|
|
16
|
-
const isExpo = !!OptionalConstants?.expoVersion;
|
|
17
|
-
if (isExpo) {
|
|
18
|
-
const expoVersion = OptionalConstants?.expoVersion;
|
|
19
|
-
const platform = OptionalConstants?.platform;
|
|
20
|
-
return {
|
|
21
|
-
isExpo: true,
|
|
22
|
-
isReactNative: true,
|
|
23
|
-
platform: platform?.ios ? 'ios' : platform?.android ? 'android' : 'unknown',
|
|
24
|
-
expoVersion,
|
|
25
|
-
deviceType: 'expo'
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Fallback to React Native detection
|
|
30
|
-
return {
|
|
31
|
-
isExpo: false,
|
|
32
|
-
isReactNative: true,
|
|
33
|
-
platform: Platform.OS,
|
|
34
|
-
platformVersion: Platform.Version?.toString(),
|
|
35
|
-
deviceType: Platform.OS
|
|
36
|
-
};
|
|
37
|
-
} catch (error) {
|
|
38
|
-
// Fallback for web or other environments
|
|
39
|
-
return {
|
|
40
|
-
isExpo: false,
|
|
41
|
-
isReactNative: false,
|
|
42
|
-
platform: 'unknown',
|
|
43
|
-
deviceType: 'unknown'
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
export function getPlatformAttributes() {
|
|
48
|
-
const platformInfo = detectPlatform();
|
|
49
|
-
const attributes = {
|
|
50
|
-
'platform': platformInfo.isExpo ? 'expo' : 'react-native',
|
|
51
|
-
'device.type': platformInfo.deviceType
|
|
52
|
-
};
|
|
53
|
-
if (platformInfo.platformVersion) {
|
|
54
|
-
attributes['platform.version'] = platformInfo.platformVersion;
|
|
55
|
-
}
|
|
56
|
-
if (platformInfo.expoVersion) {
|
|
57
|
-
attributes['expo.version'] = platformInfo.expoVersion;
|
|
58
|
-
}
|
|
59
|
-
return attributes;
|
|
60
|
-
}
|
|
61
|
-
export function isExpoEnvironment() {
|
|
62
|
-
return detectPlatform().isExpo;
|
|
63
|
-
}
|
|
64
|
-
export function isReactNativeEnvironment() {
|
|
65
|
-
return detectPlatform().isReactNative;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Configure app metadata for non-Expo React Native apps
|
|
70
|
-
* Call this function in your app initialization to provide app information
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```typescript
|
|
74
|
-
* import { configureAppMetadata } from '@multiplayer-app/session-recorder-react-native'
|
|
75
|
-
*
|
|
76
|
-
* // In your App.tsx or index.js
|
|
77
|
-
* configureAppMetadata({
|
|
78
|
-
* name: 'My Awesome App',
|
|
79
|
-
* version: '1.2.3',
|
|
80
|
-
* bundleId: 'com.mycompany.myapp',
|
|
81
|
-
* buildNumber: '123',
|
|
82
|
-
* displayName: 'My App',
|
|
83
|
-
* })
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
export function configureAppMetadata(metadata) {
|
|
87
|
-
globalAppMetadata = {
|
|
88
|
-
...globalAppMetadata,
|
|
89
|
-
...metadata
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Get configured app metadata
|
|
95
|
-
*/
|
|
96
|
-
export function getConfiguredAppMetadata() {
|
|
97
|
-
return {
|
|
98
|
-
...globalAppMetadata
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Automatically detect app metadata from common configuration files
|
|
104
|
-
* This runs without developer intervention
|
|
105
|
-
*/
|
|
106
|
-
function autoDetectAppMetadata() {
|
|
107
|
-
if (autoDetectedMetadata) {
|
|
108
|
-
return autoDetectedMetadata;
|
|
109
|
-
}
|
|
110
|
-
try {
|
|
111
|
-
// Get auto-detected metadata from build-time generated file
|
|
112
|
-
const autoMetadata = getAutoDetectedAppMetadata();
|
|
113
|
-
|
|
114
|
-
// Filter out undefined values
|
|
115
|
-
const metadata = {};
|
|
116
|
-
if (autoMetadata.name) metadata.name = autoMetadata.name;
|
|
117
|
-
if (autoMetadata.version) metadata.version = autoMetadata.version;
|
|
118
|
-
if (autoMetadata.bundleId) metadata.bundleId = autoMetadata.bundleId;
|
|
119
|
-
autoDetectedMetadata = metadata;
|
|
120
|
-
return metadata;
|
|
121
|
-
} catch (error) {
|
|
122
|
-
// Silently fail - this is optional auto-detection
|
|
123
|
-
autoDetectedMetadata = {};
|
|
124
|
-
return {};
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Enhanced app metadata detection with automatic fallbacks
|
|
130
|
-
*/
|
|
131
|
-
export function getAppMetadata() {
|
|
132
|
-
// Priority order:
|
|
133
|
-
// 1. Expo config (if available)
|
|
134
|
-
// 2. Manually configured metadata
|
|
135
|
-
// 3. Auto-detected metadata
|
|
136
|
-
// 4. Fallbacks
|
|
137
|
-
|
|
138
|
-
const expoMetadata = getExpoMetadata();
|
|
139
|
-
const configuredMetadata = getConfiguredAppMetadata();
|
|
140
|
-
const autoMetadata = autoDetectAppMetadata();
|
|
141
|
-
return {
|
|
142
|
-
name: expoMetadata.name || configuredMetadata.name || autoMetadata.name,
|
|
143
|
-
version: expoMetadata.version || configuredMetadata.version || autoMetadata.version,
|
|
144
|
-
bundleId: expoMetadata.bundleId || configuredMetadata.bundleId || autoMetadata.bundleId
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Get metadata from Expo config
|
|
150
|
-
*/
|
|
151
|
-
function getExpoMetadata() {
|
|
152
|
-
const expoConfig = OptionalConstants?.expoConfig;
|
|
153
|
-
if (!expoConfig) return {};
|
|
154
|
-
return {
|
|
155
|
-
name: expoConfig.name,
|
|
156
|
-
version: expoConfig.version,
|
|
157
|
-
bundleId: expoConfig.ios?.bundleIdentifier || expoConfig.android?.package
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
export const getNavigatorInfo = () => {
|
|
161
|
-
const platformInfo = detectPlatform();
|
|
162
|
-
const screenData = Dimensions.get('window');
|
|
163
|
-
const screenDataScreen = Dimensions.get('screen');
|
|
164
|
-
const pixelRatio = PixelRatio.get();
|
|
165
|
-
|
|
166
|
-
// Get device type based on screen dimensions
|
|
167
|
-
const getDeviceType = () => {
|
|
168
|
-
const {
|
|
169
|
-
width,
|
|
170
|
-
height
|
|
171
|
-
} = screenData;
|
|
172
|
-
const minDimension = Math.min(width, height);
|
|
173
|
-
const maxDimension = Math.max(width, height);
|
|
174
|
-
|
|
175
|
-
// Rough device type detection based on screen size
|
|
176
|
-
if (maxDimension >= 1024) {
|
|
177
|
-
return 'Tablet';
|
|
178
|
-
} else if (minDimension >= 600) {
|
|
179
|
-
return 'Large Phone';
|
|
180
|
-
} else {
|
|
181
|
-
return 'Phone';
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
// Get orientation
|
|
186
|
-
const getOrientation = () => {
|
|
187
|
-
const {
|
|
188
|
-
width,
|
|
189
|
-
height
|
|
190
|
-
} = screenData;
|
|
191
|
-
return width > height ? 'Landscape' : 'Portrait';
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
// Get OS version details
|
|
195
|
-
const getOSInfo = () => {
|
|
196
|
-
if (platformInfo.isExpo) {
|
|
197
|
-
const platform = OptionalConstants?.platform;
|
|
198
|
-
if (platform?.ios) {
|
|
199
|
-
return `iOS ${Platform.Version}`;
|
|
200
|
-
} else if (platform?.android) {
|
|
201
|
-
return `Android ${Platform.Version}`;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
if (Platform.OS === 'ios') {
|
|
205
|
-
return `iOS ${Platform.Version}`;
|
|
206
|
-
} else if (Platform.OS === 'android') {
|
|
207
|
-
return `Android ${Platform.Version}`;
|
|
208
|
-
}
|
|
209
|
-
return `${Platform.OS} ${Platform.Version || 'Unknown'}`;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
// Get device info string
|
|
213
|
-
const getDeviceInfo = () => {
|
|
214
|
-
const deviceType = getDeviceType();
|
|
215
|
-
const osInfo = getOSInfo();
|
|
216
|
-
return `${deviceType} - ${osInfo}`;
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
// Get browser/runtime info
|
|
220
|
-
const getBrowserInfo = () => {
|
|
221
|
-
if (platformInfo.isExpo) {
|
|
222
|
-
return `Expo ${platformInfo.expoVersion || 'Unknown'} - React Native`;
|
|
223
|
-
}
|
|
224
|
-
return 'React Native';
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
// Get screen size string
|
|
228
|
-
const getScreenSize = () => {
|
|
229
|
-
return `${Math.round(screenData.width)}x${Math.round(screenData.height)}`;
|
|
230
|
-
};
|
|
231
|
-
const metadata = getAppMetadata();
|
|
232
|
-
// Get app info with fallbacks for non-Expo apps
|
|
233
|
-
const getAppInfo = () => {
|
|
234
|
-
const appName = getAppName();
|
|
235
|
-
const appVersion = getAppVersion();
|
|
236
|
-
return `${appName} v${appVersion}`;
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
// Get app name with automatic detection
|
|
240
|
-
const getAppName = () => {
|
|
241
|
-
if (metadata.name) return metadata.name;
|
|
242
|
-
|
|
243
|
-
// Try configured display name as fallback
|
|
244
|
-
const configuredMetadata = getConfiguredAppMetadata();
|
|
245
|
-
if (configuredMetadata.displayName) return configuredMetadata.displayName;
|
|
246
|
-
|
|
247
|
-
// Final fallback
|
|
248
|
-
return 'React Native App';
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
// Get app version with automatic detection
|
|
252
|
-
const getAppVersion = () => {
|
|
253
|
-
if (metadata.version) return metadata.version;
|
|
254
|
-
|
|
255
|
-
// Final fallback
|
|
256
|
-
return 'Unknown';
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
// Get bundle ID with automatic detection
|
|
260
|
-
const getBundleId = () => {
|
|
261
|
-
if (metadata.bundleId) return metadata.bundleId;
|
|
262
|
-
|
|
263
|
-
// Fallback
|
|
264
|
-
return 'com.reactnative.app';
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
// Get build number with multiple fallback strategies
|
|
268
|
-
const getBuildNumber = () => {
|
|
269
|
-
// Try Expo config first
|
|
270
|
-
const expoBuildNumber = OptionalConstants?.expoConfig?.ios?.buildNumber || OptionalConstants?.expoConfig?.android?.versionCode;
|
|
271
|
-
if (expoBuildNumber) return expoBuildNumber.toString();
|
|
272
|
-
|
|
273
|
-
// Try configured metadata for non-Expo apps
|
|
274
|
-
const configuredMetadata = getConfiguredAppMetadata();
|
|
275
|
-
if (configuredMetadata.buildNumber) return configuredMetadata.buildNumber;
|
|
276
|
-
|
|
277
|
-
// Fallback
|
|
278
|
-
return '1';
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
// Get hardware info
|
|
282
|
-
const getHardwareInfo = () => {
|
|
283
|
-
const pixelRatioInfo = `Pixel Ratio: ${pixelRatio}`;
|
|
284
|
-
const screenDensity = PixelRatio.getFontScale();
|
|
285
|
-
return `${pixelRatioInfo}, Font Scale: ${screenDensity}`;
|
|
286
|
-
};
|
|
287
|
-
return {
|
|
288
|
-
// Core platform info
|
|
289
|
-
platform: platformInfo.isExpo ? 'expo' : 'react-native',
|
|
290
|
-
userAgent: getBrowserInfo(),
|
|
291
|
-
timestamp: new Date().toISOString(),
|
|
292
|
-
// Device and OS information
|
|
293
|
-
deviceInfo: getDeviceInfo(),
|
|
294
|
-
osInfo: getOSInfo(),
|
|
295
|
-
browserInfo: getBrowserInfo(),
|
|
296
|
-
// Screen information
|
|
297
|
-
screenSize: getScreenSize(),
|
|
298
|
-
pixelRatio: pixelRatio,
|
|
299
|
-
orientation: getOrientation(),
|
|
300
|
-
screenWidth: Math.round(screenData.width),
|
|
301
|
-
screenHeight: Math.round(screenData.height),
|
|
302
|
-
screenScale: pixelRatio,
|
|
303
|
-
// Device capabilities
|
|
304
|
-
hardwareConcurrency: 1,
|
|
305
|
-
// React Native doesn't expose CPU cores directly
|
|
306
|
-
cookiesEnabled: 'N/A',
|
|
307
|
-
// Not applicable in React Native
|
|
308
|
-
|
|
309
|
-
// App information
|
|
310
|
-
packageVersion: version,
|
|
311
|
-
appInfo: getAppInfo(),
|
|
312
|
-
appName: getAppName(),
|
|
313
|
-
appVersion: getAppVersion(),
|
|
314
|
-
bundleId: getBundleId(),
|
|
315
|
-
buildNumber: getBuildNumber(),
|
|
316
|
-
// Platform specific
|
|
317
|
-
platformType: platformInfo.platform,
|
|
318
|
-
platformVersion: platformInfo.platformVersion,
|
|
319
|
-
expoVersion: platformInfo.expoVersion,
|
|
320
|
-
deviceType: getDeviceType(),
|
|
321
|
-
// Performance and hardware
|
|
322
|
-
hardwareInfo: getHardwareInfo(),
|
|
323
|
-
// Screen details
|
|
324
|
-
screenDensity: PixelRatio.getFontScale(),
|
|
325
|
-
screenScaleFactor: pixelRatio,
|
|
326
|
-
windowWidth: Math.round(screenData.width),
|
|
327
|
-
windowHeight: Math.round(screenData.height),
|
|
328
|
-
fullScreenWidth: Math.round(screenDataScreen.width),
|
|
329
|
-
fullScreenHeight: Math.round(screenDataScreen.height),
|
|
330
|
-
// Environment info
|
|
331
|
-
isExpo: platformInfo.isExpo,
|
|
332
|
-
isReactNative: platformInfo.isReactNative,
|
|
333
|
-
environment: platformInfo.isExpo ? 'expo' : 'react-native',
|
|
334
|
-
// System type identifier (previously in system tags)
|
|
335
|
-
systemType: 'mobile'
|
|
336
|
-
// Additional platform attributes
|
|
337
|
-
// ...getPlatformAttributes(),
|
|
338
|
-
};
|
|
339
|
-
};
|
|
340
|
-
//# sourceMappingURL=platform.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["OptionalConstants","Platform","Dimensions","PixelRatio","version","getAutoDetectedAppMetadata","globalAppMetadata","autoDetectedMetadata","detectPlatform","isExpo","expoVersion","platform","isReactNative","ios","android","deviceType","OS","platformVersion","Version","toString","error","getPlatformAttributes","platformInfo","attributes","isExpoEnvironment","isReactNativeEnvironment","configureAppMetadata","metadata","getConfiguredAppMetadata","autoDetectAppMetadata","autoMetadata","name","bundleId","getAppMetadata","expoMetadata","getExpoMetadata","configuredMetadata","expoConfig","bundleIdentifier","package","getNavigatorInfo","screenData","get","screenDataScreen","pixelRatio","getDeviceType","width","height","minDimension","Math","min","maxDimension","max","getOrientation","getOSInfo","getDeviceInfo","osInfo","getBrowserInfo","getScreenSize","round","getAppInfo","appName","getAppName","appVersion","getAppVersion","displayName","getBundleId","getBuildNumber","expoBuildNumber","buildNumber","versionCode","getHardwareInfo","pixelRatioInfo","screenDensity","getFontScale","userAgent","timestamp","Date","toISOString","deviceInfo","browserInfo","screenSize","orientation","screenWidth","screenHeight","screenScale","hardwareConcurrency","cookiesEnabled","packageVersion","appInfo","platformType","hardwareInfo","screenScaleFactor","windowWidth","windowHeight","fullScreenWidth","fullScreenHeight","environment","systemType"],"sourceRoot":"../../../src","sources":["utils/platform.ts"],"mappings":";;AACA,OAAOA,iBAAiB,MAAM,yBAAsB;AACpD,SAASC,QAAQ,EAAEC,UAAU,EAAEC,UAAU,QAAQ,cAAc;AAC/D,SAASC,OAAO,QAAQ,eAAY;AACpC,SAASC,0BAA0B,QAAQ,mBAAgB;;AAE3D;AACA,IAAIC,iBAAyE,GAC3E,CAAC,CAAC;;AAEJ;AACA,IAAIC,oBA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}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Request utility functions for React Native
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Convert FormData to query string (React Native compatible)
|
|
9
|
-
* @param formData - FormData object
|
|
10
|
-
* @returns Query string
|
|
11
|
-
*/
|
|
12
|
-
export const formDataToQuery = formData => {
|
|
13
|
-
if (!formData) return '';
|
|
14
|
-
|
|
15
|
-
// In React Native, FormData is handled differently
|
|
16
|
-
// This is a simplified implementation
|
|
17
|
-
const params = new URLSearchParams();
|
|
18
|
-
if (typeof formData.entries === 'function') {
|
|
19
|
-
for (const [key, value] of formData.entries()) {
|
|
20
|
-
params.append(key, value);
|
|
21
|
-
}
|
|
22
|
-
} else if (typeof formData === 'object') {
|
|
23
|
-
for (const [key, value] of Object.entries(formData)) {
|
|
24
|
-
params.append(key, String(value));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return params.toString();
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Convert object to query string
|
|
32
|
-
* @param obj - Object to convert
|
|
33
|
-
* @returns Query string
|
|
34
|
-
*/
|
|
35
|
-
export const objectToQuery = obj => {
|
|
36
|
-
const params = new URLSearchParams();
|
|
37
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
38
|
-
if (value !== null && value !== undefined) {
|
|
39
|
-
params.append(key, String(value));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return params.toString();
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Parse query string to object
|
|
47
|
-
* @param queryString - Query string to parse
|
|
48
|
-
* @returns Object with parsed parameters
|
|
49
|
-
*/
|
|
50
|
-
export const queryToObject = queryString => {
|
|
51
|
-
const params = new URLSearchParams(queryString);
|
|
52
|
-
const obj = {};
|
|
53
|
-
for (const [key, value] of params.entries()) {
|
|
54
|
-
obj[key] = value;
|
|
55
|
-
}
|
|
56
|
-
return obj;
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=request-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["formDataToQuery","formData","params","URLSearchParams","entries","key","value","append","Object","String","toString","objectToQuery","obj","undefined","queryToObject","queryString"],"sourceRoot":"../../../src","sources":["utils/request-utils.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,eAAe,GAAIC,QAAa,IAAa;EACxD,IAAI,CAACA,QAAQ,EAAE,OAAO,EAAE;;EAExB;EACA;EACA,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC,CAAC;EAEpC,IAAI,OAAOF,QAAQ,CAACG,OAAO,KAAK,UAAU,EAAE;IAC1C,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIL,QAAQ,CAACG,OAAO,CAAC,CAAC,EAAE;MAC7CF,MAAM,CAACK,MAAM,CAACF,GAAG,EAAEC,KAAe,CAAC;IACrC;EACF,CAAC,MAAM,IAAI,OAAOL,QAAQ,KAAK,QAAQ,EAAE;IACvC,KAAK,MAAM,CAACI,GAAG,EAAEC,KAAK,CAAC,IAAIE,MAAM,CAACJ,OAAO,CAACH,QAAQ,CAAC,EAAE;MACnDC,MAAM,CAACK,MAAM,CAACF,GAAG,EAAEI,MAAM,CAACH,KAAK,CAAC,CAAC;IACnC;EACF;EAEA,OAAOJ,MAAM,CAACQ,QAAQ,CAAC,CAAC;AAC1B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAIC,GAAwB,IAAa;EACjE,MAAMV,MAAM,GAAG,IAAIC,eAAe,CAAC,CAAC;EAEpC,KAAK,MAAM,CAACE,GAAG,EAAEC,KAAK,CAAC,IAAIE,MAAM,CAACJ,OAAO,CAACQ,GAAG,CAAC,EAAE;IAC9C,IAAIN,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKO,SAAS,EAAE;MACzCX,MAAM,CAACK,MAAM,CAACF,GAAG,EAAEI,MAAM,CAACH,KAAK,CAAC,CAAC;IACnC;EACF;EAEA,OAAOJ,MAAM,CAACQ,QAAQ,CAAC,CAAC;AAC1B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,aAAa,GAAIC,WAAmB,IAA6B;EAC5E,MAAMb,MAAM,GAAG,IAAIC,eAAe,CAACY,WAAW,CAAC;EAC/C,MAAMH,GAA2B,GAAG,CAAC,CAAC;EAEtC,KAAK,MAAM,CAACP,GAAG,EAAEC,KAAK,CAAC,IAAIJ,MAAM,CAACE,OAAO,CAAC,CAAC,EAAE;IAC3CQ,GAAG,CAACP,GAAG,CAAC,GAAGC,KAAK;EAClB;EAEA,OAAOM,GAAG;AACZ,CAAC","ignoreList":[]}
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { Dimensions } from 'react-native';
|
|
4
|
-
import { NodeType, EventType, IncrementalSource } from '@rrweb/types';
|
|
5
|
-
import { getAppMetadata } from "./platform.js";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Creates a meta event to mark the start of recording
|
|
9
|
-
* @param sessionId - The session ID
|
|
10
|
-
* @param sessionType - The type of session (PLAIN or CONTINUOUS)
|
|
11
|
-
* @param additionalData - Additional data to include in the meta event
|
|
12
|
-
* @returns MetaEvent object
|
|
13
|
-
*/
|
|
14
|
-
export function createRecordingMetaEvent() {
|
|
15
|
-
const screenDimensions = Dimensions.get('window');
|
|
16
|
-
const metadata = getAppMetadata();
|
|
17
|
-
return {
|
|
18
|
-
type: EventType.Meta,
|
|
19
|
-
data: {
|
|
20
|
-
href: metadata.bundleId || metadata.name || 'https://native.multiplayer.app',
|
|
21
|
-
width: screenDimensions.width,
|
|
22
|
-
height: screenDimensions.height
|
|
23
|
-
},
|
|
24
|
-
timestamp: Date.now()
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Create a full snapshot event with the given base64 image
|
|
30
|
-
* @param base64Image - Base64 encoded image data
|
|
31
|
-
* @param width - Screen width
|
|
32
|
-
* @param height - Screen height
|
|
33
|
-
* @param captureFormat - Image format (png, jpg, etc.)
|
|
34
|
-
* @param nodeIdCounter - Starting node ID counter (will be modified)
|
|
35
|
-
* @param timestamp - Optional timestamp to use for the event
|
|
36
|
-
* @returns Full snapshot event
|
|
37
|
-
*/
|
|
38
|
-
export function createFullSnapshotEvent(base64Image, width, height, captureFormat = 'jpg', nodeIdCounter, timestamp) {
|
|
39
|
-
// Create a virtual DOM node representing the screen as an image
|
|
40
|
-
const imageNode = {
|
|
41
|
-
type: NodeType.Element,
|
|
42
|
-
id: 0,
|
|
43
|
-
tagName: 'img',
|
|
44
|
-
attributes: {
|
|
45
|
-
src: `data:image/${captureFormat};base64,${base64Image}`,
|
|
46
|
-
width: width.toString(),
|
|
47
|
-
height: height.toString(),
|
|
48
|
-
style: `width: ${width}px; height: ${height}px;`
|
|
49
|
-
},
|
|
50
|
-
childNodes: []
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// Create the root container
|
|
54
|
-
const rootNode = {
|
|
55
|
-
type: NodeType.Element,
|
|
56
|
-
id: nodeIdCounter.current++,
|
|
57
|
-
tagName: 'div',
|
|
58
|
-
attributes: {
|
|
59
|
-
style: `width: ${width}px; height: ${height}px; position: relative;`
|
|
60
|
-
},
|
|
61
|
-
childNodes: [imageNode]
|
|
62
|
-
};
|
|
63
|
-
const domNode = {
|
|
64
|
-
type: NodeType.Document,
|
|
65
|
-
childNodes: [{
|
|
66
|
-
type: NodeType.DocumentType,
|
|
67
|
-
name: 'html',
|
|
68
|
-
publicId: '',
|
|
69
|
-
systemId: '',
|
|
70
|
-
id: nodeIdCounter.current++
|
|
71
|
-
}, {
|
|
72
|
-
type: NodeType.Element,
|
|
73
|
-
tagName: 'html',
|
|
74
|
-
attributes: {},
|
|
75
|
-
childNodes: [{
|
|
76
|
-
type: NodeType.Element,
|
|
77
|
-
tagName: 'head',
|
|
78
|
-
attributes: {},
|
|
79
|
-
childNodes: [{
|
|
80
|
-
type: NodeType.Element,
|
|
81
|
-
tagName: 'meta',
|
|
82
|
-
attributes: {
|
|
83
|
-
charset: 'utf-8'
|
|
84
|
-
},
|
|
85
|
-
childNodes: [],
|
|
86
|
-
id: nodeIdCounter.current++
|
|
87
|
-
}, {
|
|
88
|
-
type: NodeType.Element,
|
|
89
|
-
tagName: 'meta',
|
|
90
|
-
attributes: {
|
|
91
|
-
name: 'viewport',
|
|
92
|
-
content: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'
|
|
93
|
-
},
|
|
94
|
-
childNodes: [],
|
|
95
|
-
id: nodeIdCounter.current++
|
|
96
|
-
}],
|
|
97
|
-
id: nodeIdCounter.current++
|
|
98
|
-
}, {
|
|
99
|
-
type: NodeType.Element,
|
|
100
|
-
tagName: 'body',
|
|
101
|
-
attributes: {
|
|
102
|
-
style: 'margin: 0; padding: 0; width: 100%; height: 100%;'
|
|
103
|
-
},
|
|
104
|
-
childNodes: [rootNode],
|
|
105
|
-
id: nodeIdCounter.current++
|
|
106
|
-
}],
|
|
107
|
-
id: nodeIdCounter.current++
|
|
108
|
-
}],
|
|
109
|
-
id: nodeIdCounter.current++
|
|
110
|
-
};
|
|
111
|
-
return {
|
|
112
|
-
type: EventType.FullSnapshot,
|
|
113
|
-
data: {
|
|
114
|
-
node: domNode,
|
|
115
|
-
initialOffset: {
|
|
116
|
-
left: 0,
|
|
117
|
-
top: 0
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
timestamp: timestamp || Date.now()
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Create an incremental snapshot event with mutation data to update image src
|
|
126
|
-
* @param base64Image - New base64 encoded image data
|
|
127
|
-
* @param captureFormat - Image format (png, jpg, etc.)
|
|
128
|
-
* @param timestamp - Optional timestamp to use for the event
|
|
129
|
-
* @returns Incremental snapshot event with mutation data
|
|
130
|
-
*/
|
|
131
|
-
export function createIncrementalSnapshotWithImageUpdate(base64Image, captureFormat = 'jpg', timestamp) {
|
|
132
|
-
const mutationData = {
|
|
133
|
-
source: IncrementalSource.Mutation,
|
|
134
|
-
texts: [],
|
|
135
|
-
attributes: [{
|
|
136
|
-
id: 0,
|
|
137
|
-
attributes: {
|
|
138
|
-
src: `data:image/${captureFormat};base64,${base64Image}`
|
|
139
|
-
}
|
|
140
|
-
}],
|
|
141
|
-
removes: [],
|
|
142
|
-
adds: []
|
|
143
|
-
};
|
|
144
|
-
return {
|
|
145
|
-
type: EventType.IncrementalSnapshot,
|
|
146
|
-
data: mutationData,
|
|
147
|
-
timestamp: timestamp || Date.now()
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Create a simple image node for React Native screen capture
|
|
153
|
-
* @param base64Image - Base64 encoded image data
|
|
154
|
-
* @param width - Image width
|
|
155
|
-
* @param height - Image height
|
|
156
|
-
* @param captureFormat - Image format (png, jpg, etc.)
|
|
157
|
-
* @param nodeId - Node ID for the image
|
|
158
|
-
* @returns Serialized node with ID
|
|
159
|
-
*/
|
|
160
|
-
export function createImageNode(base64Image, width, height, captureFormat = 'jpg', nodeId) {
|
|
161
|
-
return {
|
|
162
|
-
type: NodeType.Element,
|
|
163
|
-
id: nodeId,
|
|
164
|
-
tagName: 'img',
|
|
165
|
-
attributes: {
|
|
166
|
-
src: `data:image/${captureFormat};base64,${base64Image}`,
|
|
167
|
-
width: width.toString(),
|
|
168
|
-
height: height.toString(),
|
|
169
|
-
style: `width: ${width}px; height: ${height}px;`
|
|
170
|
-
},
|
|
171
|
-
childNodes: []
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Create a document node for React Native screen capture
|
|
177
|
-
* @param imageNode - The image node to include
|
|
178
|
-
* @param width - Screen width
|
|
179
|
-
* @param height - Screen height
|
|
180
|
-
* @param nodeIdCounter - Node ID counter (will be modified)
|
|
181
|
-
* @returns Document node
|
|
182
|
-
*/
|
|
183
|
-
export function createDocumentNode(imageNode, width, height, nodeIdCounter) {
|
|
184
|
-
// Create the root container
|
|
185
|
-
const rootNode = {
|
|
186
|
-
type: NodeType.Element,
|
|
187
|
-
id: nodeIdCounter.current++,
|
|
188
|
-
tagName: 'div',
|
|
189
|
-
attributes: {
|
|
190
|
-
style: `width: ${width}px; height: ${height}px; position: relative;`
|
|
191
|
-
},
|
|
192
|
-
childNodes: [imageNode]
|
|
193
|
-
};
|
|
194
|
-
return {
|
|
195
|
-
type: NodeType.Document,
|
|
196
|
-
childNodes: [{
|
|
197
|
-
type: NodeType.DocumentType,
|
|
198
|
-
name: 'html',
|
|
199
|
-
publicId: '',
|
|
200
|
-
systemId: '',
|
|
201
|
-
id: nodeIdCounter.current++
|
|
202
|
-
}, {
|
|
203
|
-
type: NodeType.Element,
|
|
204
|
-
tagName: 'html',
|
|
205
|
-
attributes: {},
|
|
206
|
-
childNodes: [{
|
|
207
|
-
type: NodeType.Element,
|
|
208
|
-
tagName: 'head',
|
|
209
|
-
attributes: {},
|
|
210
|
-
childNodes: [{
|
|
211
|
-
type: NodeType.Element,
|
|
212
|
-
tagName: 'meta',
|
|
213
|
-
attributes: {
|
|
214
|
-
charset: 'utf-8'
|
|
215
|
-
},
|
|
216
|
-
childNodes: [],
|
|
217
|
-
id: nodeIdCounter.current++
|
|
218
|
-
}, {
|
|
219
|
-
type: NodeType.Element,
|
|
220
|
-
tagName: 'meta',
|
|
221
|
-
attributes: {
|
|
222
|
-
name: 'viewport',
|
|
223
|
-
content: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'
|
|
224
|
-
},
|
|
225
|
-
childNodes: [],
|
|
226
|
-
id: nodeIdCounter.current++
|
|
227
|
-
}],
|
|
228
|
-
id: nodeIdCounter.current++
|
|
229
|
-
}, {
|
|
230
|
-
type: NodeType.Element,
|
|
231
|
-
tagName: 'body',
|
|
232
|
-
attributes: {},
|
|
233
|
-
childNodes: [rootNode],
|
|
234
|
-
id: nodeIdCounter.current++
|
|
235
|
-
}],
|
|
236
|
-
id: nodeIdCounter.current++
|
|
237
|
-
}],
|
|
238
|
-
id: nodeIdCounter.current++
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Generate a simple hash for screen comparison
|
|
244
|
-
* This is a lightweight hash that focuses on the beginning and end of the base64 string
|
|
245
|
-
* to detect changes without doing a full comparison
|
|
246
|
-
* @param base64Image - Base64 encoded image
|
|
247
|
-
* @param sampleSize - Number of characters to sample from each part
|
|
248
|
-
* @returns Hash string for comparison
|
|
249
|
-
*/
|
|
250
|
-
export function generateScreenHash(base64Image, sampleSize = 100) {
|
|
251
|
-
// Use a simple hash that samples the beginning, middle, and end of the base64 string
|
|
252
|
-
// This is much faster than comparing the entire string
|
|
253
|
-
const start = base64Image.substring(0, sampleSize);
|
|
254
|
-
const middle = base64Image.substring(Math.floor(base64Image.length / 2) - sampleSize / 2, Math.floor(base64Image.length / 2) + sampleSize / 2);
|
|
255
|
-
const end = base64Image.substring(base64Image.length - sampleSize);
|
|
256
|
-
|
|
257
|
-
// Combine samples and create a simple hash
|
|
258
|
-
const combined = start + middle + end;
|
|
259
|
-
return simpleHash(combined);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Simple hash function for string comparison
|
|
264
|
-
* @param str - String to hash
|
|
265
|
-
* @returns Hash value as string
|
|
266
|
-
*/
|
|
267
|
-
export function simpleHash(str) {
|
|
268
|
-
let hash = 0;
|
|
269
|
-
for (let i = 0; i < str.length; i++) {
|
|
270
|
-
const char = str.charCodeAt(i);
|
|
271
|
-
hash = (hash << 5) - hash + char;
|
|
272
|
-
hash = hash & hash; // Convert to 32-bit integer
|
|
273
|
-
}
|
|
274
|
-
return Math.abs(hash).toString(36);
|
|
275
|
-
}
|
|
276
|
-
//# sourceMappingURL=rrweb-events.js.map
|