@multiplayer-app/session-recorder-react-native 0.0.1-alpha.1 → 0.0.1-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.
Files changed (234) hide show
  1. package/RRWEB_INTEGRATION.md +336 -0
  2. package/VIEWSHOT_INTEGRATION_TEST.md +123 -0
  3. package/copy-react-native-dist.sh +38 -0
  4. package/dist/components/GestureCaptureWrapper/GestureCaptureWrapper.d.ts +6 -0
  5. package/dist/components/GestureCaptureWrapper/GestureCaptureWrapper.js +1 -0
  6. package/dist/components/GestureCaptureWrapper/GestureCaptureWrapper.js.map +1 -0
  7. package/dist/components/GestureCaptureWrapper/index.d.ts +1 -0
  8. package/dist/components/GestureCaptureWrapper/index.js +1 -0
  9. package/dist/components/GestureCaptureWrapper/index.js.map +1 -0
  10. package/dist/components/GestureCaptureWrapper.d.ts +6 -0
  11. package/dist/components/GestureCaptureWrapper.js +1 -0
  12. package/dist/components/GestureCaptureWrapper.js.map +1 -0
  13. package/dist/components/ScreenRecorderView/ScreenRecorderView.d.ts +5 -0
  14. package/dist/components/ScreenRecorderView/ScreenRecorderView.js +1 -0
  15. package/dist/components/ScreenRecorderView/ScreenRecorderView.js.map +1 -0
  16. package/dist/components/ScreenRecorderView/index.d.ts +1 -0
  17. package/dist/components/ScreenRecorderView/index.js +1 -0
  18. package/dist/components/ScreenRecorderView/index.js.map +1 -0
  19. package/dist/components/index.d.ts +1 -0
  20. package/dist/components/index.js +1 -0
  21. package/dist/components/index.js.map +1 -0
  22. package/dist/config/constants.d.ts +18 -0
  23. package/dist/config/constants.js +1 -0
  24. package/dist/config/constants.js.map +1 -0
  25. package/dist/config/defaults.d.ts +4 -0
  26. package/dist/config/defaults.js +1 -0
  27. package/dist/config/defaults.js.map +1 -0
  28. package/dist/config/index.d.ts +5 -0
  29. package/dist/config/index.js +1 -0
  30. package/dist/config/index.js.map +1 -0
  31. package/dist/config/masking.d.ts +2 -30
  32. package/dist/config/masking.js +1 -1
  33. package/dist/config/masking.js.map +1 -1
  34. package/dist/config/session-recorder.d.ts +2 -0
  35. package/dist/config/session-recorder.js +1 -0
  36. package/dist/config/session-recorder.js.map +1 -0
  37. package/dist/config/validators.d.ts +10 -0
  38. package/dist/config/validators.js +1 -0
  39. package/dist/config/validators.js.map +1 -0
  40. package/dist/context/SessionRecorderContext.d.ts +12 -0
  41. package/dist/context/SessionRecorderContext.js +1 -0
  42. package/dist/context/SessionRecorderContext.js.map +1 -0
  43. package/dist/expo.d.ts +5 -9
  44. package/dist/expo.js +1 -1
  45. package/dist/expo.js.map +1 -1
  46. package/dist/index.d.ts +6 -10
  47. package/dist/index.js +1 -1
  48. package/dist/index.js.map +1 -1
  49. package/dist/otel/helpers.d.ts +45 -3
  50. package/dist/otel/helpers.js +1 -1
  51. package/dist/otel/helpers.js.map +1 -1
  52. package/dist/otel/index.d.ts +4 -25
  53. package/dist/otel/index.js +1 -1
  54. package/dist/otel/index.js.map +1 -1
  55. package/dist/otel/instrumentations/gestureInstrumentation.js +1 -1
  56. package/dist/otel/instrumentations/gestureInstrumentation.js.map +1 -1
  57. package/dist/otel/instrumentations/index.d.ts +3 -4
  58. package/dist/otel/instrumentations/index.js +1 -1
  59. package/dist/otel/instrumentations/index.js.map +1 -1
  60. package/dist/otel/instrumentations/reactNativeInstrumentation.js +1 -1
  61. package/dist/otel/instrumentations/reactNativeInstrumentation.js.map +1 -1
  62. package/dist/otel/instrumentations/reactNavigationInstrumentation.d.ts +1 -0
  63. package/dist/otel/instrumentations/reactNavigationInstrumentation.js +1 -1
  64. package/dist/otel/instrumentations/reactNavigationInstrumentation.js.map +1 -1
  65. package/dist/patch/index.d.ts +1 -0
  66. package/dist/patch/index.js +1 -0
  67. package/dist/patch/index.js.map +1 -0
  68. package/dist/patch/xhr.d.ts +2 -0
  69. package/dist/patch/xhr.js +1 -0
  70. package/dist/patch/xhr.js.map +1 -0
  71. package/dist/recorder/eventExporter.d.ts +21 -0
  72. package/dist/recorder/eventExporter.js +1 -0
  73. package/dist/recorder/eventExporter.js.map +1 -0
  74. package/dist/recorder/gestureHandlerRecorder.d.ts +19 -0
  75. package/dist/recorder/gestureHandlerRecorder.js +1 -0
  76. package/dist/recorder/gestureHandlerRecorder.js.map +1 -0
  77. package/dist/recorder/gestureRecorder.d.ts +68 -11
  78. package/dist/recorder/gestureRecorder.js +1 -1
  79. package/dist/recorder/gestureRecorder.js.map +1 -1
  80. package/dist/recorder/index.d.ts +60 -6
  81. package/dist/recorder/index.js +1 -1
  82. package/dist/recorder/index.js.map +1 -1
  83. package/dist/recorder/navigationTracker.js +1 -1
  84. package/dist/recorder/navigationTracker.js.map +1 -1
  85. package/dist/recorder/screenRecorder.d.ts +79 -10
  86. package/dist/recorder/screenRecorder.js +1 -1
  87. package/dist/recorder/screenRecorder.js.map +1 -1
  88. package/dist/services/api.service.d.ts +62 -10
  89. package/dist/services/api.service.js +1 -1
  90. package/dist/services/api.service.js.map +1 -1
  91. package/dist/services/storage.service.d.ts +23 -16
  92. package/dist/services/storage.service.js +1 -1
  93. package/dist/services/storage.service.js.map +1 -1
  94. package/dist/session-recorder.d.ts +166 -0
  95. package/dist/session-recorder.js +1 -0
  96. package/dist/session-recorder.js.map +1 -0
  97. package/dist/types/index.d.ts +15 -76
  98. package/dist/types/index.js +1 -1
  99. package/dist/types/index.js.map +1 -1
  100. package/dist/types/rrweb.d.ts +118 -0
  101. package/dist/types/rrweb.js +1 -0
  102. package/dist/types/rrweb.js.map +1 -0
  103. package/dist/types/session-recorder.d.ts +366 -0
  104. package/dist/types/session-recorder.js +1 -0
  105. package/dist/types/session-recorder.js.map +1 -0
  106. package/dist/types/session.d.ts +59 -0
  107. package/dist/types/session.js +1 -0
  108. package/dist/types/session.js.map +1 -0
  109. package/dist/utils/app-metadata.d.ts +16 -0
  110. package/dist/utils/app-metadata.js +1 -0
  111. package/dist/utils/app-metadata.js.map +1 -0
  112. package/dist/utils/index.d.ts +7 -0
  113. package/dist/utils/index.js +1 -0
  114. package/dist/utils/index.js.map +1 -0
  115. package/dist/utils/logger.d.ts +112 -0
  116. package/dist/utils/logger.js +1 -0
  117. package/dist/utils/logger.js.map +1 -0
  118. package/dist/utils/platform.d.ts +37 -0
  119. package/dist/utils/platform.js +1 -1
  120. package/dist/utils/platform.js.map +1 -1
  121. package/dist/utils/request-utils.d.ts +21 -0
  122. package/dist/utils/request-utils.js +1 -0
  123. package/dist/utils/request-utils.js.map +1 -0
  124. package/dist/utils/rrweb-events.d.ts +65 -0
  125. package/dist/utils/rrweb-events.js +1 -0
  126. package/dist/utils/rrweb-events.js.map +1 -0
  127. package/dist/utils/session.d.ts +5 -0
  128. package/dist/utils/session.js +1 -0
  129. package/dist/utils/session.js.map +1 -0
  130. package/dist/utils/time.d.ts +4 -0
  131. package/dist/utils/time.js +1 -0
  132. package/dist/utils/time.js.map +1 -0
  133. package/dist/utils/type-utils.d.ts +16 -0
  134. package/dist/utils/type-utils.js +1 -0
  135. package/dist/utils/type-utils.js.map +1 -0
  136. package/dist/version.d.ts +1 -1
  137. package/dist/version.js +1 -1
  138. package/dist/version.js.map +1 -1
  139. package/docs/AUTO_METADATA_DETECTION.md +108 -0
  140. package/package.json +10 -9
  141. package/scripts/generate-app-metadata.js +173 -0
  142. package/src/components/GestureCaptureWrapper/GestureCaptureWrapper.tsx +86 -0
  143. package/src/components/GestureCaptureWrapper/index.ts +1 -0
  144. package/src/components/ScreenRecorderView/ScreenRecorderView.tsx +72 -0
  145. package/src/components/ScreenRecorderView/index.ts +1 -0
  146. package/src/components/index.ts +1 -0
  147. package/src/config/constants.ts +60 -0
  148. package/src/config/defaults.ts +82 -0
  149. package/src/config/index.ts +6 -0
  150. package/src/config/masking.ts +10 -61
  151. package/src/config/session-recorder.ts +55 -0
  152. package/src/config/validators.ts +31 -0
  153. package/src/context/SessionRecorderContext.tsx +75 -0
  154. package/src/expo.ts +7 -37
  155. package/src/index.ts +14 -17
  156. package/src/otel/helpers.ts +265 -11
  157. package/src/otel/index.ts +37 -247
  158. package/src/otel/instrumentations/index.ts +82 -53
  159. package/src/patch/index.ts +1 -0
  160. package/src/patch/xhr.ts +142 -0
  161. package/src/recorder/eventExporter.ts +141 -0
  162. package/src/recorder/gestureRecorder.ts +194 -125
  163. package/src/recorder/index.ts +132 -24
  164. package/src/recorder/navigationTracker.ts +12 -10
  165. package/src/recorder/screenRecorder.ts +242 -155
  166. package/src/services/api.service.ts +170 -45
  167. package/src/services/storage.service.ts +102 -74
  168. package/src/session-recorder.ts +600 -0
  169. package/src/types/index.ts +19 -79
  170. package/src/types/session-recorder.ts +423 -0
  171. package/src/types/session.ts +65 -0
  172. package/src/utils/app-metadata.ts +31 -0
  173. package/src/utils/index.ts +8 -0
  174. package/src/utils/logger.ts +225 -0
  175. package/src/utils/platform.ts +321 -6
  176. package/src/utils/request-utils.ts +61 -0
  177. package/src/utils/rrweb-events.ts +309 -0
  178. package/src/utils/session.ts +18 -0
  179. package/src/utils/time.ts +17 -0
  180. package/src/utils/type-utils.ts +75 -0
  181. package/src/version.ts +1 -1
  182. package/dist/sessionRecorder.d.ts +0 -54
  183. package/dist/sessionRecorder.js +0 -1
  184. package/dist/sessionRecorder.js.map +0 -1
  185. package/examples/sample-expo-app/README.md +0 -142
  186. package/examples/sample-expo-app/app/(tabs)/_layout.tsx +0 -60
  187. package/examples/sample-expo-app/app/(tabs)/explore.tsx +0 -110
  188. package/examples/sample-expo-app/app/(tabs)/index.tsx +0 -125
  189. package/examples/sample-expo-app/app/(tabs)/posts.tsx +0 -96
  190. package/examples/sample-expo-app/app/(tabs)/users.tsx +0 -131
  191. package/examples/sample-expo-app/app/+not-found.tsx +0 -32
  192. package/examples/sample-expo-app/app/_layout.tsx +0 -53
  193. package/examples/sample-expo-app/app/post/[id].tsx +0 -199
  194. package/examples/sample-expo-app/app/user/[id].tsx +0 -270
  195. package/examples/sample-expo-app/app.json +0 -42
  196. package/examples/sample-expo-app/assets/fonts/SpaceMono-Regular.ttf +0 -0
  197. package/examples/sample-expo-app/assets/images/adaptive-icon.png +0 -0
  198. package/examples/sample-expo-app/assets/images/favicon.png +0 -0
  199. package/examples/sample-expo-app/assets/images/icon.png +0 -0
  200. package/examples/sample-expo-app/assets/images/partial-react-logo.png +0 -0
  201. package/examples/sample-expo-app/assets/images/react-logo.png +0 -0
  202. package/examples/sample-expo-app/assets/images/react-logo@2x.png +0 -0
  203. package/examples/sample-expo-app/assets/images/react-logo@3x.png +0 -0
  204. package/examples/sample-expo-app/assets/images/splash-icon.png +0 -0
  205. package/examples/sample-expo-app/components/Collapsible.tsx +0 -45
  206. package/examples/sample-expo-app/components/ErrorView.tsx +0 -52
  207. package/examples/sample-expo-app/components/ExternalLink.tsx +0 -24
  208. package/examples/sample-expo-app/components/HapticTab.tsx +0 -18
  209. package/examples/sample-expo-app/components/HelloWave.tsx +0 -40
  210. package/examples/sample-expo-app/components/LoadingSpinner.tsx +0 -34
  211. package/examples/sample-expo-app/components/ParallaxScrollView.tsx +0 -82
  212. package/examples/sample-expo-app/components/ThemedText.tsx +0 -60
  213. package/examples/sample-expo-app/components/ThemedView.tsx +0 -14
  214. package/examples/sample-expo-app/components/ui/IconSymbol.ios.tsx +0 -32
  215. package/examples/sample-expo-app/components/ui/IconSymbol.tsx +0 -41
  216. package/examples/sample-expo-app/components/ui/TabBarBackground.ios.tsx +0 -19
  217. package/examples/sample-expo-app/components/ui/TabBarBackground.tsx +0 -6
  218. package/examples/sample-expo-app/constants/Colors.ts +0 -26
  219. package/examples/sample-expo-app/eslint.config.js +0 -10
  220. package/examples/sample-expo-app/hooks/useApi.ts +0 -41
  221. package/examples/sample-expo-app/hooks/useColorScheme.ts +0 -1
  222. package/examples/sample-expo-app/hooks/useColorScheme.web.ts +0 -21
  223. package/examples/sample-expo-app/hooks/useThemeColor.ts +0 -21
  224. package/examples/sample-expo-app/metro.config.js +0 -26
  225. package/examples/sample-expo-app/package-lock.json +0 -26296
  226. package/examples/sample-expo-app/package.json +0 -59
  227. package/examples/sample-expo-app/scripts/reset-project.js +0 -112
  228. package/examples/sample-expo-app/services/api.ts +0 -98
  229. package/examples/sample-expo-app/tsconfig.json +0 -17
  230. package/examples/sample-expo-app/utils/navigation.ts +0 -19
  231. package/src/otel/instrumentations/gestureInstrumentation.ts +0 -141
  232. package/src/otel/instrumentations/reactNativeInstrumentation.ts +0 -164
  233. package/src/otel/instrumentations/reactNavigationInstrumentation.ts +0 -114
  234. package/src/sessionRecorder.ts +0 -367
@@ -1,59 +0,0 @@
1
- {
2
- "name": "sample-expo-app",
3
- "main": "expo-router/entry",
4
- "version": "1.0.0",
5
- "scripts": {
6
- "start": "expo start",
7
- "reset-project": "node ./scripts/reset-project.js",
8
- "android": "expo start --android",
9
- "ios": "expo start --ios",
10
- "web": "expo start --web",
11
- "lint": "expo lint",
12
- "postinstall": "expo-yarn-workspaces check workspaces"
13
- },
14
- "dependencies": {
15
- "@expo/vector-icons": "^14.1.0",
16
- "@multiplayer-app/session-recorder-react-native": "file:../..",
17
- "@react-native-async-storage/async-storage": "2.1.2",
18
- "@react-native-community/netinfo": "^11.1.0",
19
- "@react-navigation/bottom-tabs": "^7.3.10",
20
- "@react-navigation/elements": "^2.3.8",
21
- "@react-navigation/native": "^7.1.6",
22
- "axios": "^1.6.0",
23
- "expo": "~53.0.22",
24
- "expo-blur": "~14.1.5",
25
- "expo-constants": "~17.1.7",
26
- "expo-font": "~13.3.2",
27
- "expo-haptics": "~14.1.4",
28
- "expo-image": "~2.4.0",
29
- "expo-linking": "~7.1.7",
30
- "expo-router": "~5.1.5",
31
- "expo-splash-screen": "~0.30.10",
32
- "expo-status-bar": "~2.2.3",
33
- "expo-symbols": "~0.4.5",
34
- "expo-system-ui": "~5.0.11",
35
- "expo-web-browser": "~14.2.0",
36
- "react": "19.0.0",
37
- "react-dom": "19.0.0",
38
- "react-native": "^0.79.5",
39
- "react-native-gesture-handler": "~2.24.0",
40
- "react-native-mmkv": "^2.11.0",
41
- "react-native-reanimated": "~3.17.4",
42
- "react-native-safe-area-context": "5.4.0",
43
- "react-native-screens": "~4.11.1",
44
- "react-native-screenshot": "^1.0.0",
45
- "react-native-view-shot": "^4.0.3",
46
- "react-native-web": "~0.20.0",
47
- "react-native-webview": "13.13.5"
48
- },
49
- "devDependencies": {
50
- "@babel/core": "^7.25.2",
51
- "@react-native/metro-config": "^0.81.1",
52
- "@types/react": "~19.0.10",
53
- "eslint": "^9.25.0",
54
- "eslint-config-expo": "~9.2.0",
55
- "expo-yarn-workspaces": "^2.3.2",
56
- "typescript": "~5.8.3"
57
- },
58
- "private": true
59
- }
@@ -1,112 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * This script is used to reset the project to a blank state.
5
- * It deletes or moves the /app, /components, /hooks, /scripts, and /constants directories to /app-example based on user input and creates a new /app directory with an index.tsx and _layout.tsx file.
6
- * You can remove the `reset-project` script from package.json and safely delete this file after running it.
7
- */
8
-
9
- const fs = require("fs");
10
- const path = require("path");
11
- const readline = require("readline");
12
-
13
- const root = process.cwd();
14
- const oldDirs = ["app", "components", "hooks", "constants", "scripts"];
15
- const exampleDir = "app-example";
16
- const newAppDir = "app";
17
- const exampleDirPath = path.join(root, exampleDir);
18
-
19
- const indexContent = `import { Text, View } from "react-native";
20
-
21
- export default function Index() {
22
- return (
23
- <View
24
- style={{
25
- flex: 1,
26
- justifyContent: "center",
27
- alignItems: "center",
28
- }}
29
- >
30
- <Text>Edit app/index.tsx to edit this screen.</Text>
31
- </View>
32
- );
33
- }
34
- `;
35
-
36
- const layoutContent = `import { Stack } from "expo-router";
37
-
38
- export default function RootLayout() {
39
- return <Stack />;
40
- }
41
- `;
42
-
43
- const rl = readline.createInterface({
44
- input: process.stdin,
45
- output: process.stdout,
46
- });
47
-
48
- const moveDirectories = async (userInput) => {
49
- try {
50
- if (userInput === "y") {
51
- // Create the app-example directory
52
- await fs.promises.mkdir(exampleDirPath, { recursive: true });
53
- console.log(`📁 /${exampleDir} directory created.`);
54
- }
55
-
56
- // Move old directories to new app-example directory or delete them
57
- for (const dir of oldDirs) {
58
- const oldDirPath = path.join(root, dir);
59
- if (fs.existsSync(oldDirPath)) {
60
- if (userInput === "y") {
61
- const newDirPath = path.join(root, exampleDir, dir);
62
- await fs.promises.rename(oldDirPath, newDirPath);
63
- console.log(`➡️ /${dir} moved to /${exampleDir}/${dir}.`);
64
- } else {
65
- await fs.promises.rm(oldDirPath, { recursive: true, force: true });
66
- console.log(`❌ /${dir} deleted.`);
67
- }
68
- } else {
69
- console.log(`➡️ /${dir} does not exist, skipping.`);
70
- }
71
- }
72
-
73
- // Create new /app directory
74
- const newAppDirPath = path.join(root, newAppDir);
75
- await fs.promises.mkdir(newAppDirPath, { recursive: true });
76
- console.log("\n📁 New /app directory created.");
77
-
78
- // Create index.tsx
79
- const indexPath = path.join(newAppDirPath, "index.tsx");
80
- await fs.promises.writeFile(indexPath, indexContent);
81
- console.log("📄 app/index.tsx created.");
82
-
83
- // Create _layout.tsx
84
- const layoutPath = path.join(newAppDirPath, "_layout.tsx");
85
- await fs.promises.writeFile(layoutPath, layoutContent);
86
- console.log("📄 app/_layout.tsx created.");
87
-
88
- console.log("\n✅ Project reset complete. Next steps:");
89
- console.log(
90
- `1. Run \`npx expo start\` to start a development server.\n2. Edit app/index.tsx to edit the main screen.${
91
- userInput === "y"
92
- ? `\n3. Delete the /${exampleDir} directory when you're done referencing it.`
93
- : ""
94
- }`
95
- );
96
- } catch (error) {
97
- console.error(`❌ Error during script execution: ${error.message}`);
98
- }
99
- };
100
-
101
- rl.question(
102
- "Do you want to move existing files to /app-example instead of deleting them? (Y/n): ",
103
- (answer) => {
104
- const userInput = answer.trim().toLowerCase() || "y";
105
- if (userInput === "y" || userInput === "n") {
106
- moveDirectories(userInput).finally(() => rl.close());
107
- } else {
108
- console.log("❌ Invalid input. Please enter 'Y' or 'N'.");
109
- rl.close();
110
- }
111
- }
112
- );
@@ -1,98 +0,0 @@
1
- import axios from 'axios';
2
-
3
- const API_BASE_URL = 'https://jsonplaceholder.typicode.com';
4
-
5
- export interface Post {
6
- id: number;
7
- title: string;
8
- body: string;
9
- userId: number;
10
- }
11
-
12
- export interface User {
13
- id: number;
14
- name: string;
15
- username: string;
16
- email: string;
17
- phone: string;
18
- website: string;
19
- company: {
20
- name: string;
21
- catchPhrase: string;
22
- bs: string;
23
- };
24
- address: {
25
- street: string;
26
- suite: string;
27
- city: string;
28
- zipcode: string;
29
- geo: {
30
- lat: string;
31
- lng: string;
32
- };
33
- };
34
- }
35
-
36
- export interface Comment {
37
- id: number;
38
- postId: number;
39
- name: string;
40
- email: string;
41
- body: string;
42
- }
43
-
44
- class ApiService {
45
- private api = axios.create({
46
- baseURL: API_BASE_URL,
47
- timeout: 10000,
48
- });
49
-
50
- // Posts
51
- async getPosts(): Promise<Post[]> {
52
- const response = await this.api.get('/posts');
53
- return response.data;
54
- }
55
-
56
- async getPost(id: number): Promise<Post> {
57
- const response = await this.api.get(`/posts/${id}`);
58
- return response.data;
59
- }
60
-
61
- async getPostComments(postId: number): Promise<Comment[]> {
62
- const response = await this.api.get(`/posts/${postId}/comments`);
63
- return response.data;
64
- }
65
-
66
- // Users
67
- async getUsers(): Promise<User[]> {
68
- const response = await this.api.get('/users');
69
- return response.data;
70
- }
71
-
72
- async getUser(id: number): Promise<User> {
73
- const response = await this.api.get(`/users/${id}`);
74
- return response.data;
75
- }
76
-
77
- async getUserPosts(userId: number): Promise<Post[]> {
78
- const response = await this.api.get(`/users/${userId}/posts`);
79
- return response.data;
80
- }
81
-
82
- // Create/Update/Delete operations (for demo purposes)
83
- async createPost(post: Omit<Post, 'id'>): Promise<Post> {
84
- const response = await this.api.post('/posts', post);
85
- return response.data;
86
- }
87
-
88
- async updatePost(id: number, post: Partial<Post>): Promise<Post> {
89
- const response = await this.api.put(`/posts/${id}`, post);
90
- return response.data;
91
- }
92
-
93
- async deletePost(id: number): Promise<void> {
94
- await this.api.delete(`/posts/${id}`);
95
- }
96
- }
97
-
98
- export const apiService = new ApiService();
@@ -1,17 +0,0 @@
1
- {
2
- "extends": "expo/tsconfig.base",
3
- "compilerOptions": {
4
- "strict": true,
5
- "paths": {
6
- "@/*": [
7
- "./*"
8
- ]
9
- }
10
- },
11
- "include": [
12
- "**/*.ts",
13
- "**/*.tsx",
14
- ".expo/types/**/*.ts",
15
- "expo-env.d.ts"
16
- ]
17
- }
@@ -1,19 +0,0 @@
1
- // Navigation utility to avoid router import issues
2
- export const navigateTo = {
3
- post: (id: number) => {
4
- // This will be handled by the router in the component
5
- return `/post/${id}`
6
- },
7
- user: (id: number) => {
8
- return `/user/${id}`
9
- },
10
- posts: () => {
11
- return '/(tabs)/posts'
12
- },
13
- users: () => {
14
- return '/(tabs)/users'
15
- },
16
- home: () => {
17
- return '/(tabs)/'
18
- },
19
- }
@@ -1,141 +0,0 @@
1
- import { InstrumentationBase } from '@opentelemetry/instrumentation'
2
- import { trace, SpanStatusCode } from '@opentelemetry/api'
3
-
4
- export class GestureInstrumentation extends InstrumentationBase {
5
- private _isEnabled = false
6
-
7
- constructor() {
8
- super('react-native-gesture', '1.0.0', {})
9
- }
10
-
11
- init(): void {
12
- // Initialize the instrumentation
13
- }
14
-
15
- enable(): void {
16
- this._isEnabled = true
17
- }
18
-
19
- disable(): void {
20
- this._isEnabled = false
21
- }
22
-
23
- isEnabled(): boolean {
24
- return this._isEnabled
25
- }
26
-
27
- // Manual gesture tracking methods
28
- recordTap(x: number, y: number, target?: string) {
29
- if (!this._isEnabled) return
30
-
31
- const span = trace.getTracer('gesture').startSpan('Gesture.tap', {
32
- attributes: {
33
- 'gesture.type': 'tap',
34
- 'gesture.coordinates.x': x,
35
- 'gesture.coordinates.y': y,
36
- 'gesture.timestamp': Date.now(),
37
- },
38
- })
39
-
40
- if (target) {
41
- span.setAttribute('gesture.target', target)
42
- }
43
-
44
- span.setStatus({ code: SpanStatusCode.OK })
45
- span.end()
46
- }
47
-
48
- recordSwipe(direction: string, target?: string) {
49
- if (!this._isEnabled) return
50
-
51
- const span = trace.getTracer('gesture').startSpan('Gesture.swipe', {
52
- attributes: {
53
- 'gesture.type': 'swipe',
54
- 'gesture.direction': direction,
55
- 'gesture.timestamp': Date.now(),
56
- },
57
- })
58
-
59
- if (target) {
60
- span.setAttribute('gesture.target', target)
61
- }
62
-
63
- span.setStatus({ code: SpanStatusCode.OK })
64
- span.end()
65
- }
66
-
67
- recordPinch(scale: number, target?: string) {
68
- if (!this._isEnabled) return
69
-
70
- const span = trace.getTracer('gesture').startSpan('Gesture.pinch', {
71
- attributes: {
72
- 'gesture.type': 'pinch',
73
- 'gesture.scale': scale,
74
- 'gesture.timestamp': Date.now(),
75
- },
76
- })
77
-
78
- if (target) {
79
- span.setAttribute('gesture.target', target)
80
- }
81
-
82
- span.setStatus({ code: SpanStatusCode.OK })
83
- span.end()
84
- }
85
-
86
- recordPan(deltaX: number, deltaY: number, target?: string) {
87
- if (!this._isEnabled) return
88
-
89
- const span = trace.getTracer('gesture').startSpan('Gesture.pan', {
90
- attributes: {
91
- 'gesture.type': 'pan',
92
- 'gesture.delta_x': deltaX,
93
- 'gesture.delta_y': deltaY,
94
- 'gesture.timestamp': Date.now(),
95
- },
96
- })
97
-
98
- if (target) {
99
- span.setAttribute('gesture.target', target)
100
- }
101
-
102
- span.setStatus({ code: SpanStatusCode.OK })
103
- span.end()
104
- }
105
-
106
- recordLongPress(duration: number, target?: string) {
107
- if (!this._isEnabled) return
108
-
109
- const span = trace.getTracer('gesture').startSpan('Gesture.longPress', {
110
- attributes: {
111
- 'gesture.type': 'longPress',
112
- 'gesture.duration': duration,
113
- 'gesture.timestamp': Date.now(),
114
- },
115
- })
116
-
117
- if (target) {
118
- span.setAttribute('gesture.target', target)
119
- }
120
-
121
- span.setStatus({ code: SpanStatusCode.OK })
122
- span.end()
123
- }
124
-
125
- // Error tracking for gesture failures
126
- recordGestureError(error: Error, gestureType: string) {
127
- if (!this._isEnabled) return
128
-
129
- const span = trace.getTracer('gesture').startSpan(`Gesture.${gestureType}.error`, {
130
- attributes: {
131
- 'gesture.type': gestureType,
132
- 'gesture.error': true,
133
- 'gesture.timestamp': Date.now(),
134
- },
135
- })
136
-
137
- span.setStatus({ code: SpanStatusCode.ERROR, message: error.message })
138
- span.recordException(error)
139
- span.end()
140
- }
141
- }
@@ -1,164 +0,0 @@
1
- import { InstrumentationBase } from '@opentelemetry/instrumentation'
2
- import { trace, SpanStatusCode } from '@opentelemetry/api'
3
-
4
- export class ReactNativeInstrumentation extends InstrumentationBase {
5
- constructor() {
6
- super('react-native', '1.0.0', {})
7
- }
8
-
9
- init(): void {
10
- // Initialize the instrumentation
11
- }
12
-
13
- enable(): void {
14
- // Try to wrap AsyncStorage if it's available
15
- try {
16
- const asyncStorage = require('@react-native-async-storage/async-storage')
17
- if (asyncStorage) {
18
- this._wrap(asyncStorage, 'AsyncStorage', this._wrapAsyncStorage)
19
- }
20
- } catch (error) {
21
- console.warn('@react-native-async-storage/async-storage is not available. AsyncStorage instrumentation will be disabled.')
22
- }
23
- }
24
-
25
- disable(): void {
26
- // Try to unwrap AsyncStorage if it was wrapped
27
- try {
28
- const asyncStorage = require('@react-native-async-storage/async-storage')
29
- if (asyncStorage) {
30
- this._unwrap(asyncStorage, 'AsyncStorage')
31
- }
32
- } catch (error) {
33
- // AsyncStorage was not available, nothing to unwrap
34
- }
35
- }
36
-
37
- private _wrapAsyncStorage(originalModule: any) {
38
- const self = this
39
-
40
- // Wrap setItem
41
- const originalSetItem = originalModule.setItem
42
- originalModule.setItem = async function (key: string, value: string) {
43
- const startTime = Date.now()
44
- try {
45
- const result = await originalSetItem.call(this, key, value)
46
-
47
- const span = trace.getTracer('react-native').startSpan('AsyncStorage.setItem', {
48
- attributes: {
49
- 'storage.operation': 'setItem',
50
- 'storage.key': key,
51
- 'storage.value_length': value.length,
52
- 'storage.duration': Date.now() - startTime,
53
- },
54
- })
55
-
56
- span.setStatus({ code: SpanStatusCode.OK })
57
- span.end()
58
-
59
- return result
60
- } catch (error) {
61
- const span = trace.getTracer('react-native').startSpan('AsyncStorage.setItem', {
62
- attributes: {
63
- 'storage.operation': 'setItem',
64
- 'storage.key': key,
65
- 'storage.error': true,
66
- 'storage.duration': Date.now() - startTime,
67
- },
68
- })
69
-
70
- const errorMessage = error instanceof Error ? error.message : String(error)
71
- span.setStatus({ code: SpanStatusCode.ERROR, message: errorMessage })
72
- if (error instanceof Error) {
73
- span.recordException(error)
74
- }
75
- span.end()
76
-
77
- throw error
78
- }
79
- }
80
-
81
- // Wrap getItem
82
- const originalGetItem = originalModule.getItem
83
- originalModule.getItem = async function (key: string) {
84
- const startTime = Date.now()
85
- try {
86
- const result = await originalGetItem.call(this, key)
87
-
88
- const span = trace.getTracer('react-native').startSpan('AsyncStorage.getItem', {
89
- attributes: {
90
- 'storage.operation': 'getItem',
91
- 'storage.key': key,
92
- 'storage.value_length': result ? result.length : 0,
93
- 'storage.duration': Date.now() - startTime,
94
- },
95
- })
96
-
97
- span.setStatus({ code: SpanStatusCode.OK })
98
- span.end()
99
-
100
- return result
101
- } catch (error) {
102
- const span = trace.getTracer('react-native').startSpan('AsyncStorage.getItem', {
103
- attributes: {
104
- 'storage.operation': 'getItem',
105
- 'storage.key': key,
106
- 'storage.error': true,
107
- 'storage.duration': Date.now() - startTime,
108
- },
109
- })
110
-
111
- const errorMessage = error instanceof Error ? error.message : String(error)
112
- span.setStatus({ code: SpanStatusCode.ERROR, message: errorMessage })
113
- if (error instanceof Error) {
114
- span.recordException(error)
115
- }
116
- span.end()
117
-
118
- throw error
119
- }
120
- }
121
-
122
- // Wrap removeItem
123
- const originalRemoveItem = originalModule.removeItem
124
- originalModule.removeItem = async function (key: string) {
125
- const startTime = Date.now()
126
- try {
127
- const result = await originalRemoveItem.call(this, key)
128
-
129
- const span = trace.getTracer('react-native').startSpan('AsyncStorage.removeItem', {
130
- attributes: {
131
- 'storage.operation': 'removeItem',
132
- 'storage.key': key,
133
- 'storage.duration': Date.now() - startTime,
134
- },
135
- })
136
-
137
- span.setStatus({ code: SpanStatusCode.OK })
138
- span.end()
139
-
140
- return result
141
- } catch (error) {
142
- const span = trace.getTracer('react-native').startSpan('AsyncStorage.removeItem', {
143
- attributes: {
144
- 'storage.operation': 'removeItem',
145
- 'storage.key': key,
146
- 'storage.error': true,
147
- 'storage.duration': Date.now() - startTime,
148
- },
149
- })
150
-
151
- const errorMessage = error instanceof Error ? error.message : String(error)
152
- span.setStatus({ code: SpanStatusCode.ERROR, message: errorMessage })
153
- if (error instanceof Error) {
154
- span.recordException(error)
155
- }
156
- span.end()
157
-
158
- throw error
159
- }
160
- }
161
-
162
- return originalModule
163
- }
164
- }