@multiplayer-app/session-recorder-react-native 0.0.1-beta.4 → 0.0.1-beta.6
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/build.gradle +32 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/multiplayer/sessionrecorder/ScreenMaskingModule.kt +202 -0
- package/android/src/main/java/com/multiplayer/sessionrecorder/ScreenMaskingPackage.kt +16 -0
- package/android/src/main/java/com/multiplayer/sessionrecorder/SessionRecorderModule.kt +202 -0
- package/android/src/main/java/com/multiplayer/sessionrecorder/SessionRecorderPackage.kt +16 -0
- package/dist/components/MaskableComponent.d.ts +22 -0
- package/dist/components/MaskableComponent.js +1 -0
- package/dist/components/MaskableComponent.js.map +1 -0
- package/dist/components/MaskableTextInput.d.ts +14 -0
- package/dist/components/MaskableTextInput.js +1 -0
- package/dist/components/MaskableTextInput.js.map +1 -0
- package/dist/components/SessionRecorderWidget/FinalPopover.js +1 -1
- package/dist/components/SessionRecorderWidget/FinalPopover.js.map +1 -1
- package/dist/components/SessionRecorderWidget/FloatingButton.js +1 -1
- package/dist/components/SessionRecorderWidget/FloatingButton.js.map +1 -1
- package/dist/components/SessionRecorderWidget/InitialPopover.js +1 -1
- package/dist/components/SessionRecorderWidget/InitialPopover.js.map +1 -1
- package/dist/components/SessionRecorderWidget/ModalContainer.js +1 -1
- package/dist/components/SessionRecorderWidget/ModalContainer.js.map +1 -1
- package/dist/components/SessionRecorderWidget/ModalHeader.d.ts +6 -0
- package/dist/components/SessionRecorderWidget/ModalHeader.js +1 -0
- package/dist/components/SessionRecorderWidget/ModalHeader.js.map +1 -0
- package/dist/components/SessionRecorderWidget/icons.d.ts +1 -0
- package/dist/components/SessionRecorderWidget/icons.js +1 -1
- package/dist/components/SessionRecorderWidget/icons.js.map +1 -1
- package/dist/components/SessionRecorderWidget/styles.d.ts +39 -22
- package/dist/components/SessionRecorderWidget/styles.js +1 -1
- package/dist/components/SessionRecorderWidget/styles.js.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/config/defaults.js +1 -1
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/masking.js +1 -1
- package/dist/config/masking.js.map +1 -1
- package/dist/native/ScreenMasking.d.ts +21 -0
- package/dist/native/ScreenMasking.js +1 -0
- package/dist/native/ScreenMasking.js.map +1 -0
- package/dist/native/SessionRecorderNative.d.ts +21 -0
- package/dist/native/SessionRecorderNative.js +1 -0
- package/dist/native/SessionRecorderNative.js.map +1 -0
- package/dist/recorder/screenRecorder.d.ts +1 -0
- package/dist/recorder/screenRecorder.js +1 -1
- package/dist/recorder/screenRecorder.js.map +1 -1
- package/dist/recorder/screenshotManager.d.ts +10 -0
- package/dist/recorder/screenshotManager.js +1 -0
- package/dist/recorder/screenshotManager.js.map +1 -0
- package/dist/services/screenMaskingService.d.ts +39 -0
- package/dist/services/screenMaskingService.js +1 -0
- package/dist/services/screenMaskingService.js.map +1 -0
- package/dist/types/session-recorder.d.ts +6 -0
- package/dist/types/session-recorder.js.map +1 -1
- package/dist/utils/componentRegistry.d.ts +64 -0
- package/dist/utils/componentRegistry.js +1 -0
- package/dist/utils/componentRegistry.js.map +1 -0
- package/dist/utils/nativeModuleTest.d.ts +8 -0
- package/dist/utils/nativeModuleTest.js +1 -0
- package/dist/utils/nativeModuleTest.js.map +1 -0
- package/dist/utils/reactNativeHierarchyExtractor.d.ts +38 -0
- package/dist/utils/reactNativeHierarchyExtractor.js +1 -0
- package/dist/utils/reactNativeHierarchyExtractor.js.map +1 -0
- package/dist/utils/screenshotMasker.d.ts +96 -0
- package/dist/utils/screenshotMasker.js +1 -0
- package/dist/utils/screenshotMasker.js.map +1 -0
- package/dist/utils/viewHierarchyTracker.d.ts +89 -0
- package/dist/utils/viewHierarchyTracker.js +1 -0
- package/dist/utils/viewHierarchyTracker.js.map +1 -0
- package/docs/TROUBLESHOOTING.md +168 -0
- package/ios/ScreenMasking.m +12 -0
- package/ios/ScreenMasking.podspec +21 -0
- package/ios/ScreenMasking.swift +205 -0
- package/ios/SessionRecorder.m +12 -0
- package/ios/SessionRecorder.podspec +21 -0
- package/ios/SessionRecorder.swift +205 -0
- package/ios/SessionRecorderNative.podspec +21 -0
- package/package.json +10 -1
- package/react-native.config.js +15 -0
- package/src/components/SessionRecorderWidget/FinalPopover.tsx +5 -16
- package/src/components/SessionRecorderWidget/FloatingButton.tsx +14 -27
- package/src/components/SessionRecorderWidget/InitialPopover.tsx +3 -9
- package/src/components/SessionRecorderWidget/ModalContainer.tsx +77 -29
- package/src/components/SessionRecorderWidget/ModalHeader.tsx +24 -0
- package/src/components/SessionRecorderWidget/icons.tsx +9 -0
- package/src/components/SessionRecorderWidget/styles.ts +48 -35
- package/src/components/index.ts +3 -1
- package/src/config/defaults.ts +1 -0
- package/src/config/masking.ts +1 -0
- package/src/native/ScreenMasking.ts +34 -0
- package/src/native/SessionRecorderNative.ts +34 -0
- package/src/recorder/screenRecorder.ts +31 -2
- package/src/services/screenMaskingService.ts +118 -0
- package/src/types/session-recorder.ts +7 -1
- package/src/utils/nativeModuleTest.ts +60 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import SessionRecorderNative, { MaskingOptions } from '../native/SessionRecorderNative'
|
|
2
|
+
import { logger } from '../utils'
|
|
3
|
+
import { testNativeModuleAvailability } from '../utils/nativeModuleTest'
|
|
4
|
+
|
|
5
|
+
export interface ScreenMaskingConfig {
|
|
6
|
+
/** Whether screen masking is enabled */
|
|
7
|
+
enabled: boolean
|
|
8
|
+
/** Whether to mask all input fields automatically */
|
|
9
|
+
inputMasking: boolean
|
|
10
|
+
/** Default masking options */
|
|
11
|
+
defaultOptions?: MaskingOptions
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class ScreenMaskingService {
|
|
15
|
+
private config: ScreenMaskingConfig
|
|
16
|
+
private isAvailable: boolean = false
|
|
17
|
+
|
|
18
|
+
constructor(config: ScreenMaskingConfig = { enabled: true, inputMasking: true }) {
|
|
19
|
+
this.config = config
|
|
20
|
+
this.checkAvailability()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Check if the native masking module is available
|
|
25
|
+
*/
|
|
26
|
+
private checkAvailability(): void {
|
|
27
|
+
try {
|
|
28
|
+
// Try to access the native module to check if it's available
|
|
29
|
+
if (SessionRecorderNative && typeof SessionRecorderNative.captureAndMask === 'function') {
|
|
30
|
+
this.isAvailable = true
|
|
31
|
+
logger.info('ScreenMaskingService', 'Screen masking native module is available')
|
|
32
|
+
} else {
|
|
33
|
+
this.isAvailable = false
|
|
34
|
+
logger.warn('ScreenMaskingService', 'Screen masking native module is not available - auto-linking may still be in progress')
|
|
35
|
+
|
|
36
|
+
// Run diagnostic test
|
|
37
|
+
testNativeModuleAvailability()
|
|
38
|
+
|
|
39
|
+
// Retry after a delay for auto-linking
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
this.checkAvailability()
|
|
42
|
+
}, 2000)
|
|
43
|
+
}
|
|
44
|
+
} catch (error) {
|
|
45
|
+
this.isAvailable = false
|
|
46
|
+
logger.error('ScreenMaskingService', 'Error checking screen masking availability:', error)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Capture screen with masking applied
|
|
52
|
+
*/
|
|
53
|
+
async captureMaskedScreen(options?: MaskingOptions): Promise<string | null> {
|
|
54
|
+
if (!this.isAvailable || !this.config.enabled) {
|
|
55
|
+
logger.warn('ScreenMaskingService', 'Screen masking is not available or disabled')
|
|
56
|
+
return null
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
const maskingOptions: MaskingOptions = {
|
|
61
|
+
...this.config.defaultOptions,
|
|
62
|
+
...options,
|
|
63
|
+
inputMasking: this.config.inputMasking,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const maskedImageBase64 = await SessionRecorderNative.captureAndMaskWithOptions(maskingOptions)
|
|
67
|
+
logger.info('ScreenMaskingService', 'Successfully captured masked screen')
|
|
68
|
+
return maskedImageBase64
|
|
69
|
+
} catch (error) {
|
|
70
|
+
logger.error('ScreenMaskingService', 'Failed to capture masked screen:', error)
|
|
71
|
+
return null
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Capture screen with basic masking (no custom options)
|
|
77
|
+
*/
|
|
78
|
+
async captureMaskedScreenBasic(): Promise<string | null> {
|
|
79
|
+
if (!this.isAvailable || !this.config.enabled) {
|
|
80
|
+
logger.warn('ScreenMaskingService', 'Screen masking is not available or disabled')
|
|
81
|
+
return null
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
const maskedImageBase64 = await SessionRecorderNative.captureAndMask()
|
|
86
|
+
logger.info('ScreenMaskingService', 'Successfully captured masked screen (basic)')
|
|
87
|
+
return maskedImageBase64
|
|
88
|
+
} catch (error) {
|
|
89
|
+
logger.error('ScreenMaskingService', 'Failed to capture masked screen (basic):', error)
|
|
90
|
+
return null
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Update the masking configuration
|
|
96
|
+
*/
|
|
97
|
+
updateConfig(config: Partial<ScreenMaskingConfig>): void {
|
|
98
|
+
this.config = { ...this.config, ...config }
|
|
99
|
+
logger.info('ScreenMaskingService', 'Screen masking configuration updated')
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Check if screen masking is available
|
|
104
|
+
*/
|
|
105
|
+
isScreenMaskingAvailable(): boolean {
|
|
106
|
+
return this.isAvailable && this.config.enabled
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Get the current configuration
|
|
111
|
+
*/
|
|
112
|
+
getConfig(): ScreenMaskingConfig {
|
|
113
|
+
return { ...this.config }
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Create a singleton instance
|
|
118
|
+
export const screenMaskingService = new ScreenMaskingService()
|
|
@@ -150,7 +150,6 @@ export interface MaskingConfig {
|
|
|
150
150
|
/** Custom function for masking headers in traces */
|
|
151
151
|
maskHeaders?: (headers: any, span: any) => any;
|
|
152
152
|
|
|
153
|
-
|
|
154
153
|
/** List of body fields to mask in traces */
|
|
155
154
|
maskBodyFieldsList?: string[]
|
|
156
155
|
/** List of headers to mask in traces */
|
|
@@ -160,6 +159,11 @@ export interface MaskingConfig {
|
|
|
160
159
|
headersToInclude?: string[]
|
|
161
160
|
/** List of headers to exclude from traces */
|
|
162
161
|
headersToExclude?: string[]
|
|
162
|
+
|
|
163
|
+
/** Whether to mask all input fields during screen recording
|
|
164
|
+
* @default true
|
|
165
|
+
*/
|
|
166
|
+
inputMasking?: boolean
|
|
163
167
|
}
|
|
164
168
|
|
|
165
169
|
/**
|
|
@@ -222,6 +226,8 @@ export interface RecorderConfig extends BaseConfig {
|
|
|
222
226
|
recordNavigation?: boolean
|
|
223
227
|
/** Whether to record screen */
|
|
224
228
|
recordScreen?: boolean
|
|
229
|
+
/** Configuration for masking sensitive data in session recordings */
|
|
230
|
+
masking?: MaskingConfig
|
|
225
231
|
}
|
|
226
232
|
|
|
227
233
|
/**
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { NativeModules } from 'react-native'
|
|
2
|
+
import { logger } from './logger'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Test function to verify native module availability
|
|
6
|
+
*/
|
|
7
|
+
export function testNativeModuleAvailability(): void {
|
|
8
|
+
logger.info('NativeModuleTest', 'Testing native module availability...')
|
|
9
|
+
|
|
10
|
+
// Log all available native modules
|
|
11
|
+
const availableModules = Object.keys(NativeModules)
|
|
12
|
+
logger.info('NativeModuleTest', `Available native modules: ${availableModules.join(', ')}`)
|
|
13
|
+
|
|
14
|
+
// Check specifically for SessionRecorderNative
|
|
15
|
+
const { SessionRecorderNative } = NativeModules
|
|
16
|
+
|
|
17
|
+
if (SessionRecorderNative) {
|
|
18
|
+
logger.info('NativeModuleTest', '✅ SessionRecorderNative module is available!')
|
|
19
|
+
|
|
20
|
+
// Test if the methods exist
|
|
21
|
+
if (typeof SessionRecorderNative.captureAndMask === 'function') {
|
|
22
|
+
logger.info('NativeModuleTest', '✅ captureAndMask method is available!')
|
|
23
|
+
} else {
|
|
24
|
+
logger.warn('NativeModuleTest', '❌ captureAndMask method is not available')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (typeof SessionRecorderNative.captureAndMaskWithOptions === 'function') {
|
|
28
|
+
logger.info('NativeModuleTest', '✅ captureAndMaskWithOptions method is available!')
|
|
29
|
+
} else {
|
|
30
|
+
logger.warn('NativeModuleTest', '❌ captureAndMaskWithOptions method is not available')
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
logger.error('NativeModuleTest', '❌ SessionRecorderNative module is not available')
|
|
34
|
+
logger.info('NativeModuleTest', 'This could mean:')
|
|
35
|
+
logger.info('NativeModuleTest', '1. Auto-linking has not completed yet')
|
|
36
|
+
logger.info('NativeModuleTest', '2. The native module was not properly built')
|
|
37
|
+
logger.info('NativeModuleTest', '3. The module name does not match')
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Test function to verify auto-linking configuration
|
|
43
|
+
*/
|
|
44
|
+
export function testAutoLinkingConfig(): void {
|
|
45
|
+
logger.info('NativeModuleTest', 'Testing auto-linking configuration...')
|
|
46
|
+
|
|
47
|
+
// Check if react-native.config.js exists and is properly configured
|
|
48
|
+
try {
|
|
49
|
+
const config = require('../../react-native.config.js')
|
|
50
|
+
logger.info('NativeModuleTest', '✅ react-native.config.js found')
|
|
51
|
+
|
|
52
|
+
if (config.dependencies && config.dependencies['react-native-session-recorder']) {
|
|
53
|
+
logger.info('NativeModuleTest', '✅ Auto-linking configuration found for react-native-session-recorder')
|
|
54
|
+
} else {
|
|
55
|
+
logger.warn('NativeModuleTest', '❌ Auto-linking configuration not found for react-native-session-recorder')
|
|
56
|
+
}
|
|
57
|
+
} catch (error) {
|
|
58
|
+
logger.warn('NativeModuleTest', '❌ react-native.config.js not found or invalid')
|
|
59
|
+
}
|
|
60
|
+
}
|