@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
package/src/utils/platform.ts
CHANGED
|
@@ -1,40 +1,49 @@
|
|
|
1
|
-
import { type IResourceAttributes } from '../types'
|
|
2
|
-
import OptionalConstants from './constants.optional'
|
|
3
|
-
import { Platform, Dimensions, PixelRatio } from 'react-native'
|
|
4
|
-
import { version } from '../version'
|
|
5
|
-
import { getAutoDetectedAppMetadata } from './app-metadata'
|
|
1
|
+
import { type IResourceAttributes } from '../types';
|
|
2
|
+
import OptionalConstants from './constants.optional';
|
|
3
|
+
import { Platform, Dimensions, PixelRatio } from 'react-native';
|
|
4
|
+
import { version } from '../version';
|
|
5
|
+
import { getAutoDetectedAppMetadata } from './app-metadata';
|
|
6
6
|
|
|
7
7
|
// Global app metadata configuration for non-Expo apps
|
|
8
|
-
let globalAppMetadata: { name?: string; version?: string; bundleId?: string } =
|
|
8
|
+
let globalAppMetadata: { name?: string; version?: string; bundleId?: string } =
|
|
9
|
+
{};
|
|
9
10
|
|
|
10
11
|
// Cache for auto-detected metadata to avoid repeated file reads
|
|
11
|
-
let autoDetectedMetadata: {
|
|
12
|
+
let autoDetectedMetadata: {
|
|
13
|
+
name?: string;
|
|
14
|
+
version?: string;
|
|
15
|
+
bundleId?: string;
|
|
16
|
+
} | null = null;
|
|
12
17
|
|
|
13
18
|
export interface PlatformInfo {
|
|
14
|
-
isExpo: boolean
|
|
15
|
-
isReactNative: boolean
|
|
16
|
-
platform: 'ios' | 'android' | 'web' | 'unknown'
|
|
17
|
-
platformVersion?: string
|
|
18
|
-
expoVersion?: string
|
|
19
|
-
deviceType: string
|
|
19
|
+
isExpo: boolean;
|
|
20
|
+
isReactNative: boolean;
|
|
21
|
+
platform: 'ios' | 'android' | 'web' | 'unknown';
|
|
22
|
+
platformVersion?: string;
|
|
23
|
+
expoVersion?: string;
|
|
24
|
+
deviceType: string;
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
export function detectPlatform(): PlatformInfo {
|
|
23
28
|
try {
|
|
24
29
|
// Check if we're in an Expo environment
|
|
25
|
-
const isExpo = !!OptionalConstants?.expoVersion
|
|
30
|
+
const isExpo = !!OptionalConstants?.expoVersion;
|
|
26
31
|
|
|
27
32
|
if (isExpo) {
|
|
28
|
-
const expoVersion = OptionalConstants?.expoVersion
|
|
29
|
-
const platform = OptionalConstants?.platform
|
|
33
|
+
const expoVersion = OptionalConstants?.expoVersion;
|
|
34
|
+
const platform = OptionalConstants?.platform;
|
|
30
35
|
|
|
31
36
|
return {
|
|
32
37
|
isExpo: true,
|
|
33
38
|
isReactNative: true,
|
|
34
|
-
platform: platform?.ios
|
|
39
|
+
platform: platform?.ios
|
|
40
|
+
? 'ios'
|
|
41
|
+
: platform?.android
|
|
42
|
+
? 'android'
|
|
43
|
+
: 'unknown',
|
|
35
44
|
expoVersion,
|
|
36
45
|
deviceType: 'expo',
|
|
37
|
-
}
|
|
46
|
+
};
|
|
38
47
|
}
|
|
39
48
|
|
|
40
49
|
// Fallback to React Native detection
|
|
@@ -44,7 +53,7 @@ export function detectPlatform(): PlatformInfo {
|
|
|
44
53
|
platform: Platform.OS as 'ios' | 'android' | 'web' | 'unknown',
|
|
45
54
|
platformVersion: Platform.Version?.toString(),
|
|
46
55
|
deviceType: Platform.OS,
|
|
47
|
-
}
|
|
56
|
+
};
|
|
48
57
|
} catch (error) {
|
|
49
58
|
// Fallback for web or other environments
|
|
50
59
|
return {
|
|
@@ -52,35 +61,35 @@ export function detectPlatform(): PlatformInfo {
|
|
|
52
61
|
isReactNative: false,
|
|
53
62
|
platform: 'unknown',
|
|
54
63
|
deviceType: 'unknown',
|
|
55
|
-
}
|
|
64
|
+
};
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
67
|
|
|
59
68
|
export function getPlatformAttributes(): Record<string, any> {
|
|
60
|
-
const platformInfo = detectPlatform()
|
|
69
|
+
const platformInfo = detectPlatform();
|
|
61
70
|
|
|
62
71
|
const attributes: Record<string, any> = {
|
|
63
|
-
platform: platformInfo.isExpo ? 'expo' : 'react-native',
|
|
72
|
+
'platform': platformInfo.isExpo ? 'expo' : 'react-native',
|
|
64
73
|
'device.type': platformInfo.deviceType,
|
|
65
|
-
}
|
|
74
|
+
};
|
|
66
75
|
|
|
67
76
|
if (platformInfo.platformVersion) {
|
|
68
|
-
attributes['platform.version'] = platformInfo.platformVersion
|
|
77
|
+
attributes['platform.version'] = platformInfo.platformVersion;
|
|
69
78
|
}
|
|
70
79
|
|
|
71
80
|
if (platformInfo.expoVersion) {
|
|
72
|
-
attributes['expo.version'] = platformInfo.expoVersion
|
|
81
|
+
attributes['expo.version'] = platformInfo.expoVersion;
|
|
73
82
|
}
|
|
74
83
|
|
|
75
|
-
return attributes
|
|
84
|
+
return attributes;
|
|
76
85
|
}
|
|
77
86
|
|
|
78
87
|
export function isExpoEnvironment(): boolean {
|
|
79
|
-
return detectPlatform().isExpo
|
|
88
|
+
return detectPlatform().isExpo;
|
|
80
89
|
}
|
|
81
90
|
|
|
82
91
|
export function isReactNativeEnvironment(): boolean {
|
|
83
|
-
return detectPlatform().isReactNative
|
|
92
|
+
return detectPlatform().isReactNative;
|
|
84
93
|
}
|
|
85
94
|
|
|
86
95
|
/**
|
|
@@ -102,212 +111,234 @@ export function isReactNativeEnvironment(): boolean {
|
|
|
102
111
|
* ```
|
|
103
112
|
*/
|
|
104
113
|
export function configureAppMetadata(metadata: {
|
|
105
|
-
name?: string
|
|
106
|
-
version?: string
|
|
107
|
-
bundleId?: string
|
|
108
|
-
buildNumber?: string
|
|
109
|
-
displayName?: string
|
|
114
|
+
name?: string;
|
|
115
|
+
version?: string;
|
|
116
|
+
bundleId?: string;
|
|
117
|
+
buildNumber?: string;
|
|
118
|
+
displayName?: string;
|
|
110
119
|
}): void {
|
|
111
|
-
globalAppMetadata = { ...globalAppMetadata, ...metadata }
|
|
120
|
+
globalAppMetadata = { ...globalAppMetadata, ...metadata };
|
|
112
121
|
}
|
|
113
122
|
|
|
114
123
|
/**
|
|
115
124
|
* Get configured app metadata
|
|
116
125
|
*/
|
|
117
|
-
export function getConfiguredAppMetadata(): {
|
|
118
|
-
|
|
126
|
+
export function getConfiguredAppMetadata(): {
|
|
127
|
+
name?: string;
|
|
128
|
+
version?: string;
|
|
129
|
+
bundleId?: string;
|
|
130
|
+
buildNumber?: string;
|
|
131
|
+
displayName?: string;
|
|
132
|
+
} {
|
|
133
|
+
return { ...globalAppMetadata };
|
|
119
134
|
}
|
|
120
135
|
|
|
121
136
|
/**
|
|
122
137
|
* Automatically detect app metadata from common configuration files
|
|
123
138
|
* This runs without developer intervention
|
|
124
139
|
*/
|
|
125
|
-
function autoDetectAppMetadata(): {
|
|
140
|
+
function autoDetectAppMetadata(): {
|
|
141
|
+
name?: string;
|
|
142
|
+
version?: string;
|
|
143
|
+
bundleId?: string;
|
|
144
|
+
} {
|
|
126
145
|
if (autoDetectedMetadata) {
|
|
127
|
-
return autoDetectedMetadata
|
|
146
|
+
return autoDetectedMetadata;
|
|
128
147
|
}
|
|
129
148
|
|
|
130
149
|
try {
|
|
131
150
|
// Get auto-detected metadata from build-time generated file
|
|
132
|
-
const autoMetadata = getAutoDetectedAppMetadata()
|
|
151
|
+
const autoMetadata = getAutoDetectedAppMetadata();
|
|
133
152
|
|
|
134
153
|
// Filter out undefined values
|
|
135
|
-
const metadata: { name?: string; version?: string; bundleId?: string } = {}
|
|
136
|
-
if (autoMetadata.name) metadata.name = autoMetadata.name
|
|
137
|
-
if (autoMetadata.version) metadata.version = autoMetadata.version
|
|
138
|
-
if (autoMetadata.bundleId) metadata.bundleId = autoMetadata.bundleId
|
|
154
|
+
const metadata: { name?: string; version?: string; bundleId?: string } = {};
|
|
155
|
+
if (autoMetadata.name) metadata.name = autoMetadata.name;
|
|
156
|
+
if (autoMetadata.version) metadata.version = autoMetadata.version;
|
|
157
|
+
if (autoMetadata.bundleId) metadata.bundleId = autoMetadata.bundleId;
|
|
139
158
|
|
|
140
|
-
autoDetectedMetadata = metadata
|
|
141
|
-
return metadata
|
|
159
|
+
autoDetectedMetadata = metadata;
|
|
160
|
+
return metadata;
|
|
142
161
|
} catch (error) {
|
|
143
162
|
// Silently fail - this is optional auto-detection
|
|
144
|
-
autoDetectedMetadata = {}
|
|
145
|
-
return {}
|
|
163
|
+
autoDetectedMetadata = {};
|
|
164
|
+
return {};
|
|
146
165
|
}
|
|
147
166
|
}
|
|
148
167
|
|
|
149
168
|
/**
|
|
150
169
|
* Enhanced app metadata detection with automatic fallbacks
|
|
151
170
|
*/
|
|
152
|
-
export function getAppMetadata(): {
|
|
171
|
+
export function getAppMetadata(): {
|
|
172
|
+
name?: string;
|
|
173
|
+
version?: string;
|
|
174
|
+
bundleId?: string;
|
|
175
|
+
} {
|
|
153
176
|
// Priority order:
|
|
154
177
|
// 1. Expo config (if available)
|
|
155
178
|
// 2. Manually configured metadata
|
|
156
179
|
// 3. Auto-detected metadata
|
|
157
180
|
// 4. Fallbacks
|
|
158
181
|
|
|
159
|
-
const expoMetadata = getExpoMetadata()
|
|
160
|
-
const configuredMetadata = getConfiguredAppMetadata()
|
|
161
|
-
const autoMetadata = autoDetectAppMetadata()
|
|
182
|
+
const expoMetadata = getExpoMetadata();
|
|
183
|
+
const configuredMetadata = getConfiguredAppMetadata();
|
|
184
|
+
const autoMetadata = autoDetectAppMetadata();
|
|
162
185
|
|
|
163
186
|
return {
|
|
164
187
|
name: expoMetadata.name || configuredMetadata.name || autoMetadata.name,
|
|
165
|
-
version:
|
|
166
|
-
|
|
167
|
-
|
|
188
|
+
version:
|
|
189
|
+
expoMetadata.version ||
|
|
190
|
+
configuredMetadata.version ||
|
|
191
|
+
autoMetadata.version,
|
|
192
|
+
bundleId:
|
|
193
|
+
expoMetadata.bundleId ||
|
|
194
|
+
configuredMetadata.bundleId ||
|
|
195
|
+
autoMetadata.bundleId,
|
|
196
|
+
};
|
|
168
197
|
}
|
|
169
198
|
|
|
170
199
|
/**
|
|
171
200
|
* Get metadata from Expo config
|
|
172
201
|
*/
|
|
173
|
-
function getExpoMetadata(): {
|
|
174
|
-
|
|
175
|
-
|
|
202
|
+
function getExpoMetadata(): {
|
|
203
|
+
name?: string;
|
|
204
|
+
version?: string;
|
|
205
|
+
bundleId?: string;
|
|
206
|
+
} {
|
|
207
|
+
const expoConfig = OptionalConstants?.expoConfig;
|
|
208
|
+
if (!expoConfig) return {};
|
|
176
209
|
|
|
177
210
|
return {
|
|
178
211
|
name: expoConfig.name,
|
|
179
212
|
version: expoConfig.version,
|
|
180
213
|
bundleId: expoConfig.ios?.bundleIdentifier || expoConfig.android?.package,
|
|
181
|
-
}
|
|
214
|
+
};
|
|
182
215
|
}
|
|
183
216
|
|
|
184
217
|
export const getNavigatorInfo = (): IResourceAttributes => {
|
|
185
|
-
const platformInfo = detectPlatform()
|
|
186
|
-
const screenData = Dimensions.get('window')
|
|
187
|
-
const screenDataScreen = Dimensions.get('screen')
|
|
188
|
-
const pixelRatio = PixelRatio.get()
|
|
218
|
+
const platformInfo = detectPlatform();
|
|
219
|
+
const screenData = Dimensions.get('window');
|
|
220
|
+
const screenDataScreen = Dimensions.get('screen');
|
|
221
|
+
const pixelRatio = PixelRatio.get();
|
|
189
222
|
|
|
190
223
|
// Get device type based on screen dimensions
|
|
191
224
|
const getDeviceType = (): string => {
|
|
192
|
-
const { width, height } = screenData
|
|
193
|
-
const minDimension = Math.min(width, height)
|
|
194
|
-
const maxDimension = Math.max(width, height)
|
|
225
|
+
const { width, height } = screenData;
|
|
226
|
+
const minDimension = Math.min(width, height);
|
|
227
|
+
const maxDimension = Math.max(width, height);
|
|
195
228
|
|
|
196
229
|
// Rough device type detection based on screen size
|
|
197
230
|
if (maxDimension >= 1024) {
|
|
198
|
-
return 'Tablet'
|
|
231
|
+
return 'Tablet';
|
|
199
232
|
} else if (minDimension >= 600) {
|
|
200
|
-
return 'Large Phone'
|
|
233
|
+
return 'Large Phone';
|
|
201
234
|
} else {
|
|
202
|
-
return 'Phone'
|
|
235
|
+
return 'Phone';
|
|
203
236
|
}
|
|
204
|
-
}
|
|
237
|
+
};
|
|
205
238
|
|
|
206
239
|
// Get orientation
|
|
207
240
|
const getOrientation = (): string => {
|
|
208
|
-
const { width, height } = screenData
|
|
209
|
-
return width > height ? 'Landscape' : 'Portrait'
|
|
210
|
-
}
|
|
241
|
+
const { width, height } = screenData;
|
|
242
|
+
return width > height ? 'Landscape' : 'Portrait';
|
|
243
|
+
};
|
|
211
244
|
|
|
212
245
|
// Get OS version details
|
|
213
246
|
const getOSInfo = (): string => {
|
|
214
247
|
if (platformInfo.isExpo) {
|
|
215
|
-
const platform = OptionalConstants?.platform
|
|
248
|
+
const platform = OptionalConstants?.platform;
|
|
216
249
|
if (platform?.ios) {
|
|
217
|
-
return `iOS ${Platform.Version}
|
|
250
|
+
return `iOS ${Platform.Version}`;
|
|
218
251
|
} else if (platform?.android) {
|
|
219
|
-
return `Android ${Platform.Version}
|
|
252
|
+
return `Android ${Platform.Version}`;
|
|
220
253
|
}
|
|
221
254
|
}
|
|
222
255
|
|
|
223
256
|
if (Platform.OS === 'ios') {
|
|
224
|
-
return `iOS ${Platform.Version}
|
|
257
|
+
return `iOS ${Platform.Version}`;
|
|
225
258
|
} else if (Platform.OS === 'android') {
|
|
226
|
-
return `Android ${Platform.Version}
|
|
259
|
+
return `Android ${Platform.Version}`;
|
|
227
260
|
}
|
|
228
261
|
|
|
229
|
-
return `${Platform.OS} ${Platform.Version || 'Unknown'}
|
|
230
|
-
}
|
|
262
|
+
return `${Platform.OS} ${Platform.Version || 'Unknown'}`;
|
|
263
|
+
};
|
|
231
264
|
|
|
232
265
|
// Get device info string
|
|
233
266
|
const getDeviceInfo = (): string => {
|
|
234
|
-
const deviceType = getDeviceType()
|
|
235
|
-
const osInfo = getOSInfo()
|
|
236
|
-
return `${deviceType} - ${osInfo}
|
|
237
|
-
}
|
|
267
|
+
const deviceType = getDeviceType();
|
|
268
|
+
const osInfo = getOSInfo();
|
|
269
|
+
return `${deviceType} - ${osInfo}`;
|
|
270
|
+
};
|
|
238
271
|
|
|
239
272
|
// Get browser/runtime info
|
|
240
273
|
const getBrowserInfo = (): string => {
|
|
241
274
|
if (platformInfo.isExpo) {
|
|
242
|
-
return `Expo ${platformInfo.expoVersion || 'Unknown'} - React Native
|
|
275
|
+
return `Expo ${platformInfo.expoVersion || 'Unknown'} - React Native`;
|
|
243
276
|
}
|
|
244
|
-
return 'React Native'
|
|
245
|
-
}
|
|
277
|
+
return 'React Native';
|
|
278
|
+
};
|
|
246
279
|
|
|
247
280
|
// Get screen size string
|
|
248
281
|
const getScreenSize = (): string => {
|
|
249
|
-
return `${Math.round(screenData.width)}x${Math.round(screenData.height)}
|
|
250
|
-
}
|
|
251
|
-
const metadata = getAppMetadata()
|
|
282
|
+
return `${Math.round(screenData.width)}x${Math.round(screenData.height)}`;
|
|
283
|
+
};
|
|
284
|
+
const metadata = getAppMetadata();
|
|
252
285
|
// Get app info with fallbacks for non-Expo apps
|
|
253
286
|
const getAppInfo = (): string => {
|
|
254
|
-
const appName = getAppName()
|
|
255
|
-
const appVersion = getAppVersion()
|
|
256
|
-
return `${appName} v${appVersion}
|
|
257
|
-
}
|
|
287
|
+
const appName = getAppName();
|
|
288
|
+
const appVersion = getAppVersion();
|
|
289
|
+
return `${appName} v${appVersion}`;
|
|
290
|
+
};
|
|
258
291
|
|
|
259
292
|
// Get app name with automatic detection
|
|
260
293
|
const getAppName = (): string => {
|
|
261
|
-
|
|
262
|
-
if (metadata.name) return metadata.name
|
|
294
|
+
if (metadata.name) return metadata.name;
|
|
263
295
|
|
|
264
296
|
// Try configured display name as fallback
|
|
265
|
-
const configuredMetadata = getConfiguredAppMetadata()
|
|
266
|
-
if (configuredMetadata.displayName) return configuredMetadata.displayName
|
|
297
|
+
const configuredMetadata = getConfiguredAppMetadata();
|
|
298
|
+
if (configuredMetadata.displayName) return configuredMetadata.displayName;
|
|
267
299
|
|
|
268
300
|
// Final fallback
|
|
269
|
-
return 'React Native App'
|
|
270
|
-
}
|
|
301
|
+
return 'React Native App';
|
|
302
|
+
};
|
|
271
303
|
|
|
272
304
|
// Get app version with automatic detection
|
|
273
305
|
const getAppVersion = (): string => {
|
|
274
|
-
if (metadata.version) return metadata.version
|
|
306
|
+
if (metadata.version) return metadata.version;
|
|
275
307
|
|
|
276
308
|
// Final fallback
|
|
277
|
-
return 'Unknown'
|
|
278
|
-
}
|
|
309
|
+
return 'Unknown';
|
|
310
|
+
};
|
|
279
311
|
|
|
280
312
|
// Get bundle ID with automatic detection
|
|
281
313
|
const getBundleId = (): string => {
|
|
282
|
-
if (metadata.bundleId) return metadata.bundleId
|
|
314
|
+
if (metadata.bundleId) return metadata.bundleId;
|
|
283
315
|
|
|
284
316
|
// Fallback
|
|
285
|
-
return 'com.reactnative.app'
|
|
286
|
-
}
|
|
317
|
+
return 'com.reactnative.app';
|
|
318
|
+
};
|
|
287
319
|
|
|
288
320
|
// Get build number with multiple fallback strategies
|
|
289
321
|
const getBuildNumber = (): string => {
|
|
290
322
|
// Try Expo config first
|
|
291
323
|
const expoBuildNumber =
|
|
292
324
|
OptionalConstants?.expoConfig?.ios?.buildNumber ||
|
|
293
|
-
OptionalConstants?.expoConfig?.android?.versionCode
|
|
294
|
-
if (expoBuildNumber) return expoBuildNumber.toString()
|
|
325
|
+
OptionalConstants?.expoConfig?.android?.versionCode;
|
|
326
|
+
if (expoBuildNumber) return expoBuildNumber.toString();
|
|
295
327
|
|
|
296
328
|
// Try configured metadata for non-Expo apps
|
|
297
|
-
const configuredMetadata = getConfiguredAppMetadata()
|
|
298
|
-
if (configuredMetadata.buildNumber) return configuredMetadata.buildNumber
|
|
329
|
+
const configuredMetadata = getConfiguredAppMetadata();
|
|
330
|
+
if (configuredMetadata.buildNumber) return configuredMetadata.buildNumber;
|
|
299
331
|
|
|
300
332
|
// Fallback
|
|
301
|
-
return '1'
|
|
302
|
-
}
|
|
303
|
-
|
|
333
|
+
return '1';
|
|
334
|
+
};
|
|
304
335
|
|
|
305
336
|
// Get hardware info
|
|
306
337
|
const getHardwareInfo = (): string => {
|
|
307
|
-
const pixelRatioInfo = `Pixel Ratio: ${pixelRatio}
|
|
308
|
-
const screenDensity = PixelRatio.getFontScale()
|
|
309
|
-
return `${pixelRatioInfo}, Font Scale: ${screenDensity}
|
|
310
|
-
}
|
|
338
|
+
const pixelRatioInfo = `Pixel Ratio: ${pixelRatio}`;
|
|
339
|
+
const screenDensity = PixelRatio.getFontScale();
|
|
340
|
+
return `${pixelRatioInfo}, Font Scale: ${screenDensity}`;
|
|
341
|
+
};
|
|
311
342
|
|
|
312
343
|
return {
|
|
313
344
|
// Core platform info
|
|
@@ -366,5 +397,5 @@ export const getNavigatorInfo = (): IResourceAttributes => {
|
|
|
366
397
|
systemType: 'mobile',
|
|
367
398
|
// Additional platform attributes
|
|
368
399
|
// ...getPlatformAttributes(),
|
|
369
|
-
}
|
|
370
|
-
}
|
|
400
|
+
};
|
|
401
|
+
};
|
|
@@ -8,24 +8,24 @@
|
|
|
8
8
|
* @returns Query string
|
|
9
9
|
*/
|
|
10
10
|
export const formDataToQuery = (formData: any): string => {
|
|
11
|
-
if (!formData) return ''
|
|
11
|
+
if (!formData) return '';
|
|
12
12
|
|
|
13
13
|
// In React Native, FormData is handled differently
|
|
14
14
|
// This is a simplified implementation
|
|
15
|
-
const params = new URLSearchParams()
|
|
15
|
+
const params = new URLSearchParams();
|
|
16
16
|
|
|
17
17
|
if (typeof formData.entries === 'function') {
|
|
18
18
|
for (const [key, value] of formData.entries()) {
|
|
19
|
-
params.append(key, value as string)
|
|
19
|
+
params.append(key, value as string);
|
|
20
20
|
}
|
|
21
21
|
} else if (typeof formData === 'object') {
|
|
22
22
|
for (const [key, value] of Object.entries(formData)) {
|
|
23
|
-
params.append(key, String(value))
|
|
23
|
+
params.append(key, String(value));
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
return params.toString()
|
|
28
|
-
}
|
|
27
|
+
return params.toString();
|
|
28
|
+
};
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Convert object to query string
|
|
@@ -33,16 +33,16 @@ export const formDataToQuery = (formData: any): string => {
|
|
|
33
33
|
* @returns Query string
|
|
34
34
|
*/
|
|
35
35
|
export const objectToQuery = (obj: Record<string, any>): string => {
|
|
36
|
-
const params = new URLSearchParams()
|
|
36
|
+
const params = new URLSearchParams();
|
|
37
37
|
|
|
38
38
|
for (const [key, value] of Object.entries(obj)) {
|
|
39
39
|
if (value !== null && value !== undefined) {
|
|
40
|
-
params.append(key, String(value))
|
|
40
|
+
params.append(key, String(value));
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
return params.toString()
|
|
45
|
-
}
|
|
44
|
+
return params.toString();
|
|
45
|
+
};
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Parse query string to object
|
|
@@ -50,12 +50,12 @@ export const objectToQuery = (obj: Record<string, any>): string => {
|
|
|
50
50
|
* @returns Object with parsed parameters
|
|
51
51
|
*/
|
|
52
52
|
export const queryToObject = (queryString: string): Record<string, string> => {
|
|
53
|
-
const params = new URLSearchParams(queryString)
|
|
54
|
-
const obj: Record<string, string> = {}
|
|
53
|
+
const params = new URLSearchParams(queryString);
|
|
54
|
+
const obj: Record<string, string> = {};
|
|
55
55
|
|
|
56
56
|
for (const [key, value] of params.entries()) {
|
|
57
|
-
obj[key] = value
|
|
57
|
+
obj[key] = value;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
return obj
|
|
61
|
-
}
|
|
60
|
+
return obj;
|
|
61
|
+
};
|