@multiplayer-app/session-recorder-react-native 0.0.1-beta.10 → 0.0.1-beta.12

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.
@@ -27,6 +27,9 @@ fi
27
27
  echo "🔄 Copying dist folder..."
28
28
  cp -r "$SOURCE_DIR" "$TARGET_DIR/"
29
29
 
30
+ # Copy the package.json file
31
+ cp "$SOURCE_DIR/package.json" "$TARGET_DIR/"
32
+
30
33
  echo "✅ Successfully copied dist folder to sample Expo app!"
31
34
  echo "📍 Source: $SOURCE_DIR"
32
35
  echo "📍 Target: $TARGET_DIR/dist"
@@ -0,0 +1,108 @@
1
+ # Automatic App Metadata Detection
2
+
3
+ The session recorder automatically detects app metadata from your project configuration files **without requiring any developer intervention**.
4
+
5
+ ## How It Works
6
+
7
+ The library automatically extracts app information from common configuration files in this priority order:
8
+
9
+ 1. **`app.json`** - Expo/React Native app configuration
10
+ 2. **`app.config.js`** - Dynamic Expo configuration
11
+ 3. **`package.json`** - Node.js package configuration (fallback)
12
+
13
+ ## Supported Configuration Files
14
+
15
+ ### app.json
16
+
17
+ ```json
18
+ {
19
+ "name": "My Awesome App",
20
+ "version": "1.2.3",
21
+ "displayName": "My App",
22
+ "ios": {
23
+ "bundleIdentifier": "com.mycompany.myapp",
24
+ "buildNumber": "123"
25
+ },
26
+ "android": {
27
+ "package": "com.mycompany.myapp",
28
+ "versionCode": 123
29
+ }
30
+ }
31
+ ```
32
+
33
+ ### app.config.js
34
+
35
+ ```javascript
36
+ export default {
37
+ name: 'My Awesome App',
38
+ version: '1.2.3',
39
+ displayName: 'My App',
40
+ ios: {
41
+ bundleIdentifier: 'com.mycompany.myapp',
42
+ buildNumber: '123'
43
+ },
44
+ android: {
45
+ package: 'com.mycompany.myapp',
46
+ versionCode: 123
47
+ }
48
+ }
49
+ ```
50
+
51
+ ### package.json (fallback)
52
+
53
+ ```json
54
+ {
55
+ "name": "my-awesome-app",
56
+ "version": "1.2.3"
57
+ }
58
+ ```
59
+
60
+ ## Detected Metadata
61
+
62
+ The following information is automatically extracted:
63
+
64
+ - **App Name** - From `name` or `displayName`
65
+ - **App Version** - From `version`
66
+ - **Bundle ID** - From `ios.bundleIdentifier` or `android.package`
67
+ - **Build Number** - From `ios.buildNumber` or `android.versionCode`
68
+
69
+ ## Build Process
70
+
71
+ The metadata detection happens automatically during the build process:
72
+
73
+ 1. The build script scans your project root for configuration files
74
+ 2. Extracts relevant metadata from the first found configuration
75
+ 3. Generates a TypeScript file with the detected metadata
76
+ 4. The session recorder uses this metadata in all recordings
77
+
78
+ ## No Developer Action Required
79
+
80
+ ✅ **Zero configuration** - Works out of the box
81
+ ✅ **Automatic detection** - Scans common config files
82
+ ✅ **Build-time generation** - No runtime file reading
83
+ ✅ **Fallback support** - Graceful degradation
84
+
85
+ ## Manual Override (Optional)
86
+
87
+ If you need to override the auto-detected metadata, you can still use the manual configuration:
88
+
89
+ ```typescript
90
+ import { configureAppMetadata } from '@multiplayer-app/session-recorder-react-native'
91
+
92
+ configureAppMetadata({
93
+ name: 'Custom App Name',
94
+ version: '2.0.0',
95
+ bundleId: 'com.custom.app'
96
+ })
97
+ ```
98
+
99
+ ## Priority Order
100
+
101
+ The metadata detection follows this priority:
102
+
103
+ 1. **Expo Config** (if using Expo)
104
+ 2. **Manual Configuration** (if `configureAppMetadata` was called)
105
+ 3. **Auto-detected Metadata** (from config files)
106
+ 4. **Fallback Values** (defaults)
107
+
108
+ This ensures maximum compatibility across different React Native setups while providing rich metadata for debugging sessions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplayer-app/session-recorder-react-native",
3
- "version": "0.0.1-beta.10",
3
+ "version": "0.0.1-beta.12",
4
4
  "description": "Multiplayer Fullstack Session Recorder for React Native",
5
5
  "author": {
6
6
  "name": "Multiplayer Software, Inc.",
@@ -20,8 +20,7 @@
20
20
  ".": {
21
21
  "import": "./dist/index.js",
22
22
  "require": "./dist/index.js"
23
- },
24
- "./app.plugin.js": "./app.plugin.js"
23
+ }
25
24
  },
26
25
  "engines": {
27
26
  "node": ">=18",
@@ -41,7 +40,7 @@
41
40
  "scripts": {
42
41
  "clean": "rimraf dist",
43
42
  "prepublishOnly": "npm run build",
44
- "build": "tsc && babel ./dist --out-dir dist --extensions '.js' && ./copy-react-native-dist.sh",
43
+ "build": "tsc && babel ./dist --out-dir dist --extensions '.js'",
45
44
  "generate-metadata": "node scripts/generate-app-metadata.js"
46
45
  },
47
46
  "devDependencies": {
@@ -82,13 +81,27 @@
82
81
  "socket.io-client": "4.7.5"
83
82
  },
84
83
  "peerDependencies": {
85
- "@opentelemetry/api": "^1.9.0",
86
- "react": ">=18.0.0 <20.0.0",
87
- "react-native": ">=0.72.0 <0.82.0",
88
- "react-native-svg": "^15.13.0"
84
+ "@opentelemetry/api": "*",
85
+ "react": "*",
86
+ "react-native": "*",
87
+ "react-native-svg": "*"
88
+ },
89
+ "peerDependenciesMeta": {
90
+ "@opentelemetry/api": {
91
+ "optional": true
92
+ },
93
+ "react": {
94
+ "optional": true
95
+ },
96
+ "react-native": {
97
+ "optional": true
98
+ },
99
+ "react-native-svg": {
100
+ "optional": true
101
+ }
89
102
  },
90
103
  "optionalDependencies": {
91
- "expo-constants": "^15.0.0"
104
+ "expo-constants": "*"
92
105
  },
93
106
  "react-native": {
94
107
  "ios": {
@@ -108,4 +121,4 @@
108
121
  "packageImportPath": "import com.multiplayer.sessionrecorder.SessionRecorderPackage;"
109
122
  }
110
123
  }
111
- }
124
+ }
package/app.plugin.js DELETED
@@ -1,42 +0,0 @@
1
- const { withDangerousMod } = require('@expo/config-plugins')
2
- const fs = require('fs')
3
- const path = require('path')
4
-
5
- const withSessionRecorder = (config) => {
6
- return withDangerousMod(config, [
7
- 'ios',
8
- async (config) => {
9
- const projectRoot = config.modRequest.projectRoot
10
- const platformRoot = config.modRequest.platformProjectRoot
11
-
12
- // Ensure the Podfile includes our native module
13
- const podfilePath = path.join(platformRoot, 'Podfile')
14
-
15
- if (fs.existsSync(podfilePath)) {
16
- let podfileContent = fs.readFileSync(podfilePath, 'utf8')
17
-
18
- // Check if our pod is already included
19
- if (!podfileContent.includes('SessionRecorderNative')) {
20
- // Add our pod to the Podfile
21
- const podEntry = ` pod 'SessionRecorderNative', :path => '../node_modules/@multiplayer-app/session-recorder-react-native/ios'\n`
22
-
23
- // Find the target section and add our pod
24
- const targetRegex = /(target ['"][^'"]+['"] do)/
25
- if (targetRegex.test(podfileContent)) {
26
- podfileContent = podfileContent.replace(targetRegex, `$1\n${podEntry}`)
27
- } else {
28
- // If no target found, add at the end before the end statement
29
- podfileContent = podfileContent.replace(/(end\s*$)/, `${podEntry}$1`)
30
- }
31
-
32
- fs.writeFileSync(podfilePath, podfileContent)
33
- console.log('✅ Added SessionRecorderNative to Podfile')
34
- }
35
- }
36
-
37
- return config
38
- }
39
- ])
40
- }
41
-
42
- module.exports = withSessionRecorder
@@ -1,177 +0,0 @@
1
- # Native Module Setup Guide
2
-
3
- This guide explains how to properly set up the Session Recorder React Native library with native modules in both React Native and Expo projects.
4
-
5
- ## Issues Fixed
6
-
7
- ### 1. Missing iOS Native Files in NPM Package
8
-
9
- **Problem**: The iOS native implementation files (`SessionRecorderNative.m` and `SessionRecorderNative.swift`) were not being included in the published npm package.
10
-
11
- **Solution**: Updated `.npmignore` to exclude source files but include the compiled native modules.
12
-
13
- ### 2. Auto-linking Configuration
14
-
15
- **Problem**: The library wasn't properly configured for auto-linking in Expo projects.
16
-
17
- **Solution**:
18
-
19
- - Added `expo` configuration section to `package.json`
20
- - Created an Expo plugin for automatic Podfile configuration
21
- - Updated podspec with proper Expo compatibility settings
22
-
23
- ### 3. Podspec Configuration
24
-
25
- **Problem**: The podspec wasn't optimized for Expo compatibility.
26
-
27
- **Solution**: Added proper header search paths and Expo-specific configurations.
28
-
29
- ## Setup Instructions
30
-
31
- ### For Expo Projects
32
-
33
- 1. **Install the package**:
34
-
35
- ```bash
36
- npm install @multiplayer-app/session-recorder-react-native
37
- ```
38
-
39
- 2. **Add to app.json/app.config.js**:
40
-
41
- ```json
42
- {
43
- "expo": {
44
- "plugins": ["@multiplayer-app/session-recorder-react-native"]
45
- }
46
- }
47
- ```
48
-
49
- The plugin will automatically be detected via the `app.plugin.js` file in the package root.
50
-
51
- 3. **Run prebuild** (if using development build):
52
-
53
- ```bash
54
- npx expo prebuild --clean
55
- ```
56
-
57
- 4. **Install iOS dependencies**:
58
- ```bash
59
- cd ios && pod install && cd ..
60
- ```
61
-
62
- ### For React Native CLI Projects
63
-
64
- 1. **Install the package**:
65
-
66
- ```bash
67
- npm install @multiplayer-app/session-recorder-react-native
68
- ```
69
-
70
- 2. **iOS Setup**:
71
-
72
- ```bash
73
- cd ios && pod install && cd ..
74
- ```
75
-
76
- 3. **Android Setup**: No additional steps required (auto-linking handles it)
77
-
78
- ## Troubleshooting
79
-
80
- ### "Pod SessionRecorderNative files are missing"
81
-
82
- This error occurs when the iOS native files aren't properly included in the package or auto-linking fails.
83
-
84
- **Solutions**:
85
-
86
- 1. **Check package installation**:
87
-
88
- ```bash
89
- ls node_modules/@multiplayer-app/session-recorder-react-native/ios/
90
- ```
91
-
92
- Should show: `SessionRecorderNative.m`, `SessionRecorderNative.podspec`, `SessionRecorderNative.swift`
93
-
94
- 2. **Clear and reinstall**:
95
-
96
- ```bash
97
- rm -rf node_modules
98
- npm install
99
- cd ios && pod install --repo-update && cd ..
100
- ```
101
-
102
- 3. **For Expo projects, ensure plugin is configured**:
103
- ```json
104
- {
105
- "expo": {
106
- "plugins": ["@multiplayer-app/session-recorder-react-native"]
107
- }
108
- }
109
- ```
110
-
111
- ### Auto-linking Issues
112
-
113
- If auto-linking doesn't work:
114
-
115
- 1. **Check react-native.config.js** (should be automatically created):
116
-
117
- ```javascript
118
- module.exports = {
119
- dependencies: {
120
- '@multiplayer-app/session-recorder-react-native': {
121
- platforms: {
122
- android: {
123
- sourceDir: '../android',
124
- packageImportPath: 'import com.multiplayer.sessionrecorder.SessionRecorderPackage;'
125
- },
126
- ios: {
127
- podspecPath: '../ios/SessionRecorderNative.podspec'
128
- }
129
- }
130
- }
131
- }
132
- }
133
- ```
134
-
135
- 2. **Manual linking** (if auto-linking fails):
136
- - iOS: Add to Podfile manually
137
- - Android: Add to MainApplication.java manually
138
-
139
- ## File Structure
140
-
141
- The package includes these native files:
142
-
143
- ```
144
- ios/
145
- ├── SessionRecorderNative.m # Objective-C bridge
146
- ├── SessionRecorderNative.podspec # CocoaPods specification
147
- └── SessionRecorderNative.swift # Swift implementation
148
-
149
- android/
150
- ├── build.gradle # Android build configuration
151
- └── src/main/java/com/multiplayer/sessionrecorder/
152
- ├── SessionRecorderModule.kt # Main Android module
153
- ├── SessionRecorderPackage.kt # Package registration
154
- ├── ScreenMaskingModule.kt # Screen masking module
155
- └── ScreenMaskingPackage.kt # Screen masking package
156
- ```
157
-
158
- ## Verification
159
-
160
- To verify the setup is working:
161
-
162
- 1. **Check iOS**:
163
-
164
- ```bash
165
- cd ios && pod list | grep SessionRecorderNative
166
- ```
167
-
168
- 2. **Check Android**: Look for the package in `android/app/src/main/java/`
169
-
170
- 3. **Test in code**:
171
-
172
- ```javascript
173
- import { SessionRecorderNative } from '@multiplayer-app/session-recorder-react-native'
174
-
175
- // This should not throw an error
176
- console.log('Native module loaded:', SessionRecorderNative)
177
- ```
@@ -1,20 +0,0 @@
1
- {
2
- "name": "@multiplayer-app/session-recorder-react-native-plugin",
3
- "version": "0.0.1-beta.10",
4
- "description": "Expo plugin for Session Recorder React Native",
5
- "main": "src/index.js",
6
- "keywords": [
7
- "expo",
8
- "plugin",
9
- "session-recorder",
10
- "react-native"
11
- ],
12
- "author": "Multiplayer Software, Inc.",
13
- "license": "MIT",
14
- "dependencies": {
15
- "@expo/config-plugins": "^7.0.0"
16
- },
17
- "peerDependencies": {
18
- "expo": ">=49.0.0"
19
- }
20
- }
@@ -1,42 +0,0 @@
1
- const { withDangerousMod } = require('@expo/config-plugins')
2
- const fs = require('fs')
3
- const path = require('path')
4
-
5
- const withSessionRecorder = (config) => {
6
- return withDangerousMod(config, [
7
- 'ios',
8
- async (config) => {
9
- const projectRoot = config.modRequest.projectRoot
10
- const platformRoot = config.modRequest.platformProjectRoot
11
-
12
- // Ensure the Podfile includes our native module
13
- const podfilePath = path.join(platformRoot, 'Podfile')
14
-
15
- if (fs.existsSync(podfilePath)) {
16
- let podfileContent = fs.readFileSync(podfilePath, 'utf8')
17
-
18
- // Check if our pod is already included
19
- if (!podfileContent.includes('SessionRecorderNative')) {
20
- // Add our pod to the Podfile
21
- const podEntry = ` pod 'SessionRecorderNative', :path => '../node_modules/@multiplayer-app/session-recorder-react-native/ios'\n`
22
-
23
- // Find the target section and add our pod
24
- const targetRegex = /(target ['"][^'"]+['"] do)/
25
- if (targetRegex.test(podfileContent)) {
26
- podfileContent = podfileContent.replace(targetRegex, `$1\n${podEntry}`)
27
- } else {
28
- // If no target found, add at the end before the end statement
29
- podfileContent = podfileContent.replace(/(end\s*$)/, `${podEntry}$1`)
30
- }
31
-
32
- fs.writeFileSync(podfilePath, podfileContent)
33
- console.log('✅ Added SessionRecorderNative to Podfile')
34
- }
35
- }
36
-
37
- return config
38
- }
39
- ])
40
- }
41
-
42
- module.exports = withSessionRecorder