@oxyhq/services 5.7.5 → 5.8.1

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 (239) hide show
  1. package/README.md +76 -76
  2. package/lib/commonjs/core/index.js +177 -102
  3. package/lib/commonjs/core/index.js.map +1 -1
  4. package/lib/commonjs/index.js +88 -29
  5. package/lib/commonjs/index.js.map +1 -1
  6. package/lib/commonjs/node/createAuth.js +585 -7
  7. package/lib/commonjs/node/createAuth.js.map +1 -1
  8. package/lib/commonjs/node/index.js +38 -1
  9. package/lib/commonjs/node/index.js.map +1 -1
  10. package/lib/commonjs/ui/components/Avatar.js +15 -6
  11. package/lib/commonjs/ui/components/Avatar.js.map +1 -1
  12. package/lib/commonjs/ui/components/GroupedItem.js +58 -13
  13. package/lib/commonjs/ui/components/GroupedItem.js.map +1 -1
  14. package/lib/commonjs/ui/components/GroupedSection.js +7 -1
  15. package/lib/commonjs/ui/components/GroupedSection.js.map +1 -1
  16. package/lib/commonjs/ui/components/Header.js +322 -0
  17. package/lib/commonjs/ui/components/Header.js.map +1 -0
  18. package/lib/commonjs/ui/components/OxyProvider.js +23 -7
  19. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  20. package/lib/commonjs/ui/components/index.js +7 -0
  21. package/lib/commonjs/ui/components/index.js.map +1 -1
  22. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +1 -1
  23. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
  24. package/lib/commonjs/ui/components/internal/TextField.js +606 -546
  25. package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
  26. package/lib/commonjs/ui/components/internal/TextField.md +436 -0
  27. package/lib/commonjs/ui/context/OxyContext.js +122 -78
  28. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  29. package/lib/commonjs/ui/hooks/useSessionSocket.js +5 -2
  30. package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -1
  31. package/lib/commonjs/ui/navigation/OxyRouter.js +1 -1
  32. package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
  33. package/lib/commonjs/ui/screens/AccountCenterScreen.js +6 -6
  34. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  35. package/lib/commonjs/ui/screens/AccountManagementDemo.js +3 -3
  36. package/lib/commonjs/ui/screens/AccountManagementDemo.js.map +1 -1
  37. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +241 -598
  38. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
  39. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +1151 -406
  40. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  41. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +135 -237
  42. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  43. package/lib/commonjs/ui/screens/AppInfoScreen.js +246 -463
  44. package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
  45. package/lib/commonjs/ui/screens/FeedbackScreen.js +3 -3
  46. package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
  47. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +808 -650
  48. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
  49. package/lib/commonjs/ui/screens/RecoverAccountScreen.js +51 -72
  50. package/lib/commonjs/ui/screens/RecoverAccountScreen.js.map +1 -1
  51. package/lib/commonjs/ui/screens/SessionManagementScreen.js +11 -29
  52. package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
  53. package/lib/commonjs/ui/screens/SignInScreen.js +30 -303
  54. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
  55. package/lib/commonjs/ui/screens/SignUpScreen.js +4 -4
  56. package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -1
  57. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +19 -31
  58. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +1 -1
  59. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +7 -10
  60. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -1
  61. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js +11 -5
  62. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js.map +1 -1
  63. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js +11 -4
  64. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js.map +1 -1
  65. package/lib/commonjs/ui/stores/authStore.js +12 -0
  66. package/lib/commonjs/ui/stores/authStore.js.map +1 -1
  67. package/lib/commonjs/ui/styles/authStyles.js +337 -0
  68. package/lib/commonjs/ui/styles/authStyles.js.map +1 -0
  69. package/lib/commonjs/ui/styles/index.js +11 -0
  70. package/lib/commonjs/ui/styles/index.js.map +1 -1
  71. package/lib/module/core/index.js +177 -41
  72. package/lib/module/core/index.js.map +1 -1
  73. package/lib/module/index.js +26 -4
  74. package/lib/module/index.js.map +1 -1
  75. package/lib/module/node/createAuth.js +584 -7
  76. package/lib/module/node/createAuth.js.map +1 -1
  77. package/lib/module/node/index.js +7 -1
  78. package/lib/module/node/index.js.map +1 -1
  79. package/lib/module/ui/components/Avatar.js +15 -6
  80. package/lib/module/ui/components/Avatar.js.map +1 -1
  81. package/lib/module/ui/components/GroupedItem.js +59 -14
  82. package/lib/module/ui/components/GroupedItem.js.map +1 -1
  83. package/lib/module/ui/components/GroupedSection.js +7 -1
  84. package/lib/module/ui/components/GroupedSection.js.map +1 -1
  85. package/lib/module/ui/components/Header.js +317 -0
  86. package/lib/module/ui/components/Header.js.map +1 -0
  87. package/lib/module/ui/components/OxyProvider.js +25 -9
  88. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  89. package/lib/module/ui/components/index.js +1 -0
  90. package/lib/module/ui/components/index.js.map +1 -1
  91. package/lib/module/ui/components/internal/GroupedPillButtons.js +1 -1
  92. package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
  93. package/lib/module/ui/components/internal/TextField.js +607 -547
  94. package/lib/module/ui/components/internal/TextField.js.map +1 -1
  95. package/lib/module/ui/components/internal/TextField.md +436 -0
  96. package/lib/module/ui/context/OxyContext.js +121 -77
  97. package/lib/module/ui/context/OxyContext.js.map +1 -1
  98. package/lib/module/ui/hooks/useSessionSocket.js +5 -2
  99. package/lib/module/ui/hooks/useSessionSocket.js.map +1 -1
  100. package/lib/module/ui/navigation/OxyRouter.js +1 -1
  101. package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
  102. package/lib/module/ui/screens/AccountCenterScreen.js +6 -6
  103. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  104. package/lib/module/ui/screens/AccountManagementDemo.js +3 -3
  105. package/lib/module/ui/screens/AccountManagementDemo.js.map +1 -1
  106. package/lib/module/ui/screens/AccountOverviewScreen.js +242 -597
  107. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  108. package/lib/module/ui/screens/AccountSettingsScreen.js +1152 -407
  109. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  110. package/lib/module/ui/screens/AccountSwitcherScreen.js +135 -237
  111. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  112. package/lib/module/ui/screens/AppInfoScreen.js +248 -465
  113. package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
  114. package/lib/module/ui/screens/FeedbackScreen.js +3 -3
  115. package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
  116. package/lib/module/ui/screens/PaymentGatewayScreen.js +809 -651
  117. package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
  118. package/lib/module/ui/screens/RecoverAccountScreen.js +53 -74
  119. package/lib/module/ui/screens/RecoverAccountScreen.js.map +1 -1
  120. package/lib/module/ui/screens/SessionManagementScreen.js +11 -29
  121. package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
  122. package/lib/module/ui/screens/SignInScreen.js +32 -305
  123. package/lib/module/ui/screens/SignInScreen.js.map +1 -1
  124. package/lib/module/ui/screens/SignUpScreen.js +5 -5
  125. package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
  126. package/lib/module/ui/screens/internal/SignInPasswordStep.js +19 -31
  127. package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +1 -1
  128. package/lib/module/ui/screens/internal/SignInUsernameStep.js +7 -10
  129. package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -1
  130. package/lib/module/ui/screens/internal/SignUpIdentityStep.js +11 -5
  131. package/lib/module/ui/screens/internal/SignUpIdentityStep.js.map +1 -1
  132. package/lib/module/ui/screens/internal/SignUpSecurityStep.js +11 -4
  133. package/lib/module/ui/screens/internal/SignUpSecurityStep.js.map +1 -1
  134. package/lib/module/ui/stores/authStore.js +12 -0
  135. package/lib/module/ui/stores/authStore.js.map +1 -1
  136. package/lib/module/ui/styles/authStyles.js +332 -0
  137. package/lib/module/ui/styles/authStyles.js.map +1 -0
  138. package/lib/module/ui/styles/index.js +1 -0
  139. package/lib/module/ui/styles/index.js.map +1 -1
  140. package/lib/typescript/core/index.d.ts +68 -24
  141. package/lib/typescript/core/index.d.ts.map +1 -1
  142. package/lib/typescript/index.d.ts +13 -3
  143. package/lib/typescript/index.d.ts.map +1 -1
  144. package/lib/typescript/node/createAuth.d.ts +112 -0
  145. package/lib/typescript/node/createAuth.d.ts.map +1 -1
  146. package/lib/typescript/node/index.d.ts +2 -0
  147. package/lib/typescript/node/index.d.ts.map +1 -1
  148. package/lib/typescript/ui/components/Avatar.d.ts.map +1 -1
  149. package/lib/typescript/ui/components/GroupedItem.d.ts +6 -0
  150. package/lib/typescript/ui/components/GroupedItem.d.ts.map +1 -1
  151. package/lib/typescript/ui/components/GroupedSection.d.ts +6 -0
  152. package/lib/typescript/ui/components/GroupedSection.d.ts.map +1 -1
  153. package/lib/typescript/ui/components/Header.d.ts +22 -0
  154. package/lib/typescript/ui/components/Header.d.ts.map +1 -0
  155. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
  156. package/lib/typescript/ui/components/index.d.ts +1 -0
  157. package/lib/typescript/ui/components/index.d.ts.map +1 -1
  158. package/lib/typescript/ui/components/internal/TextField.d.ts +31 -16
  159. package/lib/typescript/ui/components/internal/TextField.d.ts.map +1 -1
  160. package/lib/typescript/ui/context/OxyContext.d.ts +5 -2
  161. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  162. package/lib/typescript/ui/hooks/useSessionSocket.d.ts.map +1 -1
  163. package/lib/typescript/ui/navigation/types.d.ts +9 -2
  164. package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
  165. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
  166. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  167. package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
  168. package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +1 -1
  169. package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
  170. package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts +5 -1
  171. package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts.map +1 -1
  172. package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
  173. package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
  174. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +1 -1
  175. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +1 -1
  176. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +0 -1
  177. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +1 -1
  178. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts.map +1 -1
  179. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts.map +1 -1
  180. package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
  181. package/lib/typescript/ui/styles/authStyles.d.ts +326 -0
  182. package/lib/typescript/ui/styles/authStyles.d.ts.map +1 -0
  183. package/lib/typescript/ui/styles/index.d.ts +1 -0
  184. package/lib/typescript/ui/styles/index.d.ts.map +1 -1
  185. package/package.json +1 -4
  186. package/src/core/index.ts +195 -41
  187. package/src/index.ts +72 -4
  188. package/src/node/createAuth.ts +623 -7
  189. package/src/node/index.ts +19 -1
  190. package/src/ui/components/Avatar.tsx +11 -5
  191. package/src/ui/components/GroupedItem.tsx +57 -9
  192. package/src/ui/components/GroupedSection.tsx +12 -0
  193. package/src/ui/components/Header.tsx +364 -0
  194. package/src/ui/components/OxyProvider.tsx +31 -15
  195. package/src/ui/components/index.ts +1 -0
  196. package/src/ui/components/internal/GroupedPillButtons.tsx +1 -1
  197. package/src/ui/components/internal/TextField.md +436 -0
  198. package/src/ui/components/internal/TextField.tsx +720 -620
  199. package/src/ui/context/OxyContext.tsx +150 -63
  200. package/src/ui/hooks/useSessionSocket.ts +5 -2
  201. package/src/ui/navigation/OxyRouter.tsx +1 -1
  202. package/src/ui/navigation/types.ts +10 -2
  203. package/src/ui/screens/AccountCenterScreen.tsx +5 -5
  204. package/src/ui/screens/AccountManagementDemo.tsx +9 -9
  205. package/src/ui/screens/AccountOverviewScreen.tsx +265 -414
  206. package/src/ui/screens/AccountSettingsScreen.tsx +1165 -403
  207. package/src/ui/screens/AccountSwitcherScreen.tsx +158 -202
  208. package/src/ui/screens/AppInfoScreen.tsx +270 -497
  209. package/src/ui/screens/FeedbackScreen.tsx +3 -3
  210. package/src/ui/screens/PaymentGatewayScreen.tsx +668 -365
  211. package/src/ui/screens/ProfileScreen.tsx +5 -5
  212. package/src/ui/screens/RecoverAccountScreen.tsx +46 -74
  213. package/src/ui/screens/SessionManagementScreen.tsx +14 -22
  214. package/src/ui/screens/SignInScreen.tsx +27 -294
  215. package/src/ui/screens/SignUpScreen.tsx +5 -5
  216. package/src/ui/screens/internal/SignInPasswordStep.tsx +11 -22
  217. package/src/ui/screens/internal/SignInUsernameStep.tsx +3 -10
  218. package/src/ui/screens/internal/SignUpIdentityStep.tsx +2 -5
  219. package/src/ui/screens/internal/SignUpSecurityStep.tsx +3 -4
  220. package/src/ui/stores/authStore.ts +12 -0
  221. package/src/ui/styles/authStyles.ts +352 -0
  222. package/src/ui/styles/index.ts +1 -0
  223. package/lib/commonjs/core/auth-manager.js +0 -440
  224. package/lib/commonjs/core/auth-manager.js.map +0 -1
  225. package/lib/commonjs/core/use-auth.js +0 -244
  226. package/lib/commonjs/core/use-auth.js.map +0 -1
  227. package/lib/module/core/auth-manager.js +0 -432
  228. package/lib/module/core/auth-manager.js.map +0 -1
  229. package/lib/module/core/use-auth.js +0 -235
  230. package/lib/module/core/use-auth.js.map +0 -1
  231. package/lib/typescript/core/auth-manager.d.ts +0 -136
  232. package/lib/typescript/core/auth-manager.d.ts.map +0 -1
  233. package/lib/typescript/core/use-auth.d.ts +0 -79
  234. package/lib/typescript/core/use-auth.d.ts.map +0 -1
  235. package/src/__tests__/middleware.test.ts +0 -105
  236. package/src/__tests__/setup.ts +0 -10
  237. package/src/__tests__/zero-config-auth.test.ts +0 -607
  238. package/src/core/auth-manager.ts +0 -500
  239. package/src/core/use-auth.tsx +0 -245
@@ -10,6 +10,7 @@ import {
10
10
  Clipboard,
11
11
  SafeAreaView,
12
12
  ScrollView,
13
+ ActivityIndicator,
13
14
  } from 'react-native';
14
15
  import { BaseScreenProps } from '../navigation/types';
15
16
  import { useOxy } from '../context/OxyContext';
@@ -20,6 +21,7 @@ import { confirmAction } from '../utils/confirmAction';
20
21
  import OxyIcon from '../components/icon/OxyIcon';
21
22
  import { Ionicons } from '@expo/vector-icons';
22
23
  import OxyServicesLogo from '../../assets/icons/OxyServices';
24
+ import { Section, GroupedSection } from '../components';
23
25
 
24
26
 
25
27
  interface SystemInfo {
@@ -102,115 +104,25 @@ const AppInfoScreen: React.FC<BaseScreenProps> = ({
102
104
  };
103
105
 
104
106
  const runSystemCheck = async () => {
105
- if (!oxyServices) {
106
- toast.error('OxyServices not initialized');
107
- return;
108
- }
109
-
110
107
  setIsRunningSystemCheck(true);
111
- const checks = [];
112
-
113
- // Get the API base URL from the services instance
114
- const apiBaseUrl = oxyServices?.getBaseURL() || 'https://api.oxy.so'; // Default for now, could be made configurable
115
108
 
116
109
  try {
117
- // Check 1: API Server Health
118
- checks.push('🔍 Checking API server connection...');
119
- toast.info('Running system checks...', { duration: 2000 });
110
+ // Simulate system check
111
+ await new Promise(resolve => setTimeout(resolve, 2000));
120
112
 
121
- try {
122
- const data = await oxyServices.healthCheck();
123
- checks.push('✅ API server is responding');
124
- checks.push(`📊 Server stats: ${data.users || 0} users`);
125
- checks.push(`🌐 API URL: ${apiBaseUrl}`);
126
- setConnectionStatus('connected');
127
- } catch (error) {
128
- checks.push('❌ API server connection failed');
129
- checks.push(` Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
130
- checks.push(` URL: ${apiBaseUrl}`);
131
- setConnectionStatus('disconnected');
132
- }
133
-
134
- // Check 2: Authentication Status
135
- checks.push('🔍 Checking authentication...');
136
- checks.push(`🔐 Authentication Status: ${isAuthenticated ? '✅ Authenticated' : '❌ Not authenticated'}`);
137
-
138
- if (isAuthenticated) {
139
- // Check 3: Token Validation
113
+ // Check API connection
114
+ if (oxyServices) {
140
115
  try {
141
- const isValid = await oxyServices.validate();
142
- if (isValid) {
143
- checks.push('✅ Authentication token is valid');
144
- } else {
145
- checks.push('❌ Authentication token is invalid');
146
- }
116
+ await oxyServices.healthCheck();
117
+ setConnectionStatus('connected');
147
118
  } catch (error) {
148
- checks.push('❌ Token validation failed');
149
- checks.push(` Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
119
+ setConnectionStatus('disconnected');
150
120
  }
151
121
  }
152
122
 
153
- // Check 4: Session Validation (if user has active sessions)
154
- if (user && sessions && sessions.length > 0) {
155
- checks.push('🔍 Checking active sessions...');
156
- try {
157
- // Just check if we can fetch sessions
158
- const userSessions = await oxyServices.getUserSessions();
159
- checks.push(`✅ Session validation successful (${userSessions.length} sessions)`);
160
- } catch (error) {
161
- checks.push('❌ Session validation failed');
162
- checks.push(` Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
163
- }
164
- }
165
-
166
- // Check 5: Platform Information
167
- checks.push('🔍 Checking platform information...');
168
- checks.push(`✅ Platform: ${Platform.OS} ${Platform.Version || 'Unknown'}`);
169
- checks.push(`✅ Screen: ${systemInfo?.screenDimensions.width || 0}x${systemInfo?.screenDimensions.height || 0}`);
170
- checks.push(`✅ Environment: ${__DEV__ ? 'Development' : 'Production'}`);
171
-
172
- // Check 6: Package Information
173
- checks.push('🔍 Checking package information...');
174
- checks.push(`✅ Package: ${packageInfo.name}@${packageInfo.version}`);
175
-
176
- // Check 7: Memory and Performance (basic)
177
- checks.push('🔍 Checking performance metrics...');
178
- const memoryUsage = (performance as any).memory;
179
- if (memoryUsage) {
180
- const usedMB = Math.round(memoryUsage.usedJSHeapSize / 1024 / 1024);
181
- const totalMB = Math.round(memoryUsage.totalJSHeapSize / 1024 / 1024);
182
- checks.push(`✅ Memory usage: ${usedMB}MB / ${totalMB}MB`);
183
- } else {
184
- checks.push('✅ Performance metrics not available on this platform');
185
- }
186
-
187
- // Final summary
188
- const errorCount = checks.filter(check => check.includes('❌')).length;
189
- const warningCount = checks.filter(check => check.includes('⚠️')).length;
190
-
191
- checks.push('');
192
- checks.push('📋 SYSTEM CHECK SUMMARY:');
193
- if (errorCount === 0 && warningCount === 0) {
194
- checks.push('✅ All systems operational');
195
- toast.success('System check completed - All systems operational!');
196
- } else if (errorCount === 0) {
197
- checks.push(`⚠️ ${warningCount} warning(s) found`);
198
- toast.warning(`System check completed with ${warningCount} warning(s)`);
199
- } else {
200
- checks.push(`❌ ${errorCount} error(s) and ${warningCount} warning(s) found`);
201
- toast.error(`System check failed with ${errorCount} error(s)`);
202
- }
203
-
204
- // Show results in an alert and copy to clipboard
205
- const report = checks.join('\n');
206
- confirmAction(
207
- `Check completed. Results copied to clipboard.\n\nSummary: ${errorCount} errors, ${warningCount} warnings.\n\nCopy full report to clipboard?`,
208
- () => copyToClipboard(report, 'System check report')
209
- );
210
-
123
+ toast.success('System check completed successfully');
211
124
  } catch (error) {
212
- toast.error('System check failed to run');
213
- console.error('System check error:', error);
125
+ toast.error('System check failed');
214
126
  } finally {
215
127
  setIsRunningSystemCheck(false);
216
128
  }
@@ -218,25 +130,17 @@ const AppInfoScreen: React.FC<BaseScreenProps> = ({
218
130
 
219
131
  const generateFullReport = () => {
220
132
  const report = {
221
- packageInfo: {
222
- name: packageInfo.name,
223
- version: packageInfo.version,
224
- description: packageInfo.description,
225
- },
226
- systemInfo,
227
- userInfo: {
228
- isAuthenticated: !!user,
229
- userId: user?.id || 'Not authenticated',
230
- username: user?.username || 'N/A',
231
- totalUsers: sessions?.length || 0,
232
- },
233
- apiConfiguration: {
234
- apiUrl: oxyServices?.getBaseURL() || 'Not configured',
235
- },
236
- buildInfo: {
237
- timestamp: new Date().toISOString(),
238
- environment: __DEV__ ? 'Development' : 'Production',
239
- },
133
+ package: packageInfo,
134
+ system: systemInfo,
135
+ user: user ? {
136
+ id: user.id,
137
+ username: user.username,
138
+ email: user.email,
139
+ isPremium: user.isPremium,
140
+ } : null,
141
+ sessions: sessions?.length || 0,
142
+ connection: connectionStatus,
143
+ timestamp: new Date().toISOString(),
240
144
  };
241
145
 
242
146
  return JSON.stringify(report, null, 2);
@@ -244,74 +148,9 @@ const AppInfoScreen: React.FC<BaseScreenProps> = ({
244
148
 
245
149
  const handleCopyFullReport = () => {
246
150
  const report = generateFullReport();
247
- copyToClipboard(report, 'Full application report');
151
+ copyToClipboard(report, 'Full system report');
248
152
  };
249
153
 
250
- const InfoRow: React.FC<{
251
- label: string;
252
- value: string;
253
- copyable?: boolean;
254
- icon?: string;
255
- iconComponent?: React.ReactNode;
256
- color?: string;
257
- isFirst?: boolean;
258
- isLast?: boolean;
259
- onPress?: () => void;
260
- showChevron?: boolean;
261
- }> = ({
262
- label,
263
- value,
264
- copyable = false,
265
- icon = 'information-circle',
266
- iconComponent,
267
- color = '#8E8E93',
268
- isFirst = false,
269
- isLast = false,
270
- onPress,
271
- showChevron = false,
272
- }) => {
273
- const handlePress = () => {
274
- if (onPress) {
275
- onPress();
276
- } else if (copyable) {
277
- copyToClipboard(value, label);
278
- }
279
- };
280
-
281
- const isInteractive = copyable || !!onPress;
282
-
283
- return (
284
- <TouchableOpacity
285
- style={[
286
- styles.settingItem,
287
- isFirst && styles.firstSettingItem,
288
- isLast && styles.lastSettingItem,
289
- ]}
290
- onPress={isInteractive ? handlePress : undefined}
291
- disabled={!isInteractive}
292
- >
293
- <View style={styles.settingInfo}>
294
- {iconComponent ? (
295
- React.cloneElement(iconComponent as React.ReactElement, { style: styles.settingIcon })
296
- ) : (
297
- <OxyIcon name={icon} size={20} color={color} style={styles.settingIcon} />
298
- )}
299
- <View style={styles.settingDetails}>
300
- <Text style={styles.settingLabel}>{label}</Text>
301
- <Text style={[
302
- styles.settingValue,
303
- (copyable || onPress) && { color: primaryColor }
304
- ]}>
305
- {value}
306
- </Text>
307
- </View>
308
- </View>
309
- {copyable && <OxyIcon name="copy" size={16} color="#ccc" />}
310
- {showChevron && <OxyIcon name="chevron-forward" size={16} color="#ccc" />}
311
- </TouchableOpacity>
312
- );
313
- };
314
-
315
154
  return (
316
155
  <View style={[styles.container, { backgroundColor }]}>
317
156
  {/* Header */}
@@ -325,280 +164,270 @@ const AppInfoScreen: React.FC<BaseScreenProps> = ({
325
164
 
326
165
  <ScrollView style={styles.content} showsVerticalScrollIndicator={false}>
327
166
  {/* Package Information */}
328
- <View style={styles.section}>
329
- <Text style={styles.sectionTitle}>Package Information</Text>
330
-
331
- <InfoRow
332
- label="Name"
333
- value={packageInfo.name}
334
- copyable
335
- iconComponent={<OxyServicesLogo width={20} height={20} />}
336
- color="#007AFF"
337
- isFirst
338
- />
339
- <InfoRow
340
- label="Version"
341
- value={packageInfo.version}
342
- copyable
343
- icon="pricetag"
344
- color="#5856D6"
345
- />
346
- <InfoRow
347
- label="Description"
348
- value={packageInfo.description || 'No description'}
349
- icon="document-text"
350
- color="#34C759"
351
- />
352
- <InfoRow
353
- label="Main Entry"
354
- value={packageInfo.main || 'N/A'}
355
- icon="code"
356
- color="#FF9500"
357
- />
358
- <InfoRow
359
- label="Module Entry"
360
- value={packageInfo.module || 'N/A'}
361
- icon="library"
362
- color="#FF3B30"
363
- />
364
- <InfoRow
365
- label="Types Entry"
366
- value={packageInfo.types || 'N/A'}
367
- icon="construct"
368
- color="#32D74B"
369
- isLast
167
+ <Section title="Package Information" theme={theme}>
168
+ <GroupedSection
169
+ items={[
170
+ {
171
+ id: 'name',
172
+ icon: 'information-circle',
173
+ iconColor: '#007AFF',
174
+ title: 'Name',
175
+ subtitle: packageInfo.name,
176
+ onPress: () => copyToClipboard(packageInfo.name, 'Package name'),
177
+ customContent: <OxyServicesLogo width={20} height={20} style={styles.settingIcon} />,
178
+ },
179
+ {
180
+ id: 'version',
181
+ icon: 'pricetag',
182
+ iconColor: '#5856D6',
183
+ title: 'Version',
184
+ subtitle: packageInfo.version,
185
+ onPress: () => copyToClipboard(packageInfo.version, 'Version'),
186
+ },
187
+ {
188
+ id: 'description',
189
+ icon: 'document-text',
190
+ iconColor: '#34C759',
191
+ title: 'Description',
192
+ subtitle: packageInfo.description || 'No description',
193
+ },
194
+ {
195
+ id: 'main-entry',
196
+ icon: 'code',
197
+ iconColor: '#FF9500',
198
+ title: 'Main Entry',
199
+ subtitle: packageInfo.main || 'N/A',
200
+ onPress: () => copyToClipboard(packageInfo.main || 'N/A', 'Main entry'),
201
+ },
202
+ {
203
+ id: 'module-entry',
204
+ icon: 'library',
205
+ iconColor: '#FF3B30',
206
+ title: 'Module Entry',
207
+ subtitle: packageInfo.module || 'N/A',
208
+ onPress: () => copyToClipboard(packageInfo.module || 'N/A', 'Module entry'),
209
+ },
210
+ {
211
+ id: 'types-entry',
212
+ icon: 'construct',
213
+ iconColor: '#32D74B',
214
+ title: 'Types Entry',
215
+ subtitle: packageInfo.types || 'N/A',
216
+ onPress: () => copyToClipboard(packageInfo.types || 'N/A', 'Types entry'),
217
+ },
218
+ ]}
219
+ theme={theme}
370
220
  />
371
- </View>
221
+ </Section>
372
222
 
373
223
  {/* System Information */}
374
- <View style={styles.section}>
375
- <Text style={styles.sectionTitle}>System Information</Text>
376
-
377
- <InfoRow
378
- label="Platform"
379
- value={Platform.OS}
380
- icon="phone-portrait"
381
- color="#007AFF"
382
- isFirst
383
- />
384
- <InfoRow
385
- label="Platform Version"
386
- value={systemInfo?.version || 'Loading...'}
387
- icon="hardware-chip"
388
- color="#5856D6"
389
- />
390
- <InfoRow
391
- label="Screen Width"
392
- value={`${systemInfo?.screenDimensions.width || 0}px`}
393
- icon="resize"
394
- color="#FF9500"
395
- />
396
- <InfoRow
397
- label="Screen Height"
398
- value={`${systemInfo?.screenDimensions.height || 0}px`}
399
- icon="resize"
400
- color="#FF3B30"
401
- />
402
- <InfoRow
403
- label="Environment"
404
- value={__DEV__ ? 'Development' : 'Production'}
405
- icon="settings"
406
- color="#34C759"
407
- isLast
224
+ <Section title="System Information" theme={theme}>
225
+ <GroupedSection
226
+ items={[
227
+ {
228
+ id: 'platform',
229
+ icon: 'phone-portrait',
230
+ iconColor: '#007AFF',
231
+ title: 'Platform',
232
+ subtitle: Platform.OS,
233
+ },
234
+ {
235
+ id: 'platform-version',
236
+ icon: 'hardware-chip',
237
+ iconColor: '#5856D6',
238
+ title: 'Platform Version',
239
+ subtitle: systemInfo?.version || 'Loading...',
240
+ },
241
+ {
242
+ id: 'screen-width',
243
+ icon: 'resize',
244
+ iconColor: '#FF9500',
245
+ title: 'Screen Width',
246
+ subtitle: `${systemInfo?.screenDimensions.width || 0}px`,
247
+ },
248
+ {
249
+ id: 'screen-height',
250
+ icon: 'resize',
251
+ iconColor: '#FF3B30',
252
+ title: 'Screen Height',
253
+ subtitle: `${systemInfo?.screenDimensions.height || 0}px`,
254
+ },
255
+ {
256
+ id: 'environment',
257
+ icon: 'settings',
258
+ iconColor: '#34C759',
259
+ title: 'Environment',
260
+ subtitle: __DEV__ ? 'Development' : 'Production',
261
+ },
262
+ ]}
263
+ theme={theme}
408
264
  />
409
- </View>
265
+ </Section>
410
266
 
411
267
  {/* User Information */}
412
- <View style={styles.section}>
413
- <Text style={styles.sectionTitle}>User Information</Text>
414
-
415
- <InfoRow
416
- label="Authentication Status"
417
- value={isAuthenticated ? 'Authenticated' : 'Not Authenticated'}
418
- icon="shield-checkmark"
419
- color={isAuthenticated ? '#34C759' : '#FF3B30'}
420
- isFirst
421
- />
422
- {user && (
423
- <>
424
- <InfoRow
425
- label="User ID"
426
- value={user.id}
427
- copyable
428
- icon="person"
429
- color="#007AFF"
430
- />
431
- <InfoRow
432
- label="Username"
433
- value={user.username || 'N/A'}
434
- icon="at"
435
- color="#5856D6"
436
- onPress={() => {
437
- if (user?.username && navigate) {
438
- navigate('Profile', { userId: user.id });
439
- } else {
440
- toast.info('No username available or navigation not supported');
441
- }
442
- }}
443
- showChevron={true}
444
- />
445
- <InfoRow
446
- label="Email"
447
- value={user.email || 'N/A'}
448
- icon="mail"
449
- color="#FF9500"
450
- />
451
- <InfoRow
452
- label="Premium Status"
453
- value={user.isPremium ? 'Premium' : 'Standard'}
454
- icon="star"
455
- color={user.isPremium ? '#FFD700' : '#8E8E93'}
456
- />
457
- </>
458
- )}
459
- <InfoRow
460
- label="Total Active Sessions"
461
- value={sessions?.length?.toString() || '0'}
462
- icon="people"
463
- color="#32D74B"
464
- isLast
268
+ <Section title="User Information" theme={theme}>
269
+ <GroupedSection
270
+ items={[
271
+ {
272
+ id: 'auth-status',
273
+ icon: 'shield-checkmark',
274
+ iconColor: isAuthenticated ? '#34C759' : '#FF3B30',
275
+ title: 'Authentication Status',
276
+ subtitle: isAuthenticated ? 'Authenticated' : 'Not Authenticated',
277
+ },
278
+ ...(user ? [
279
+ {
280
+ id: 'user-id',
281
+ icon: 'person',
282
+ iconColor: '#007AFF',
283
+ title: 'User ID',
284
+ subtitle: user.id,
285
+ onPress: () => copyToClipboard(user.id, 'User ID'),
286
+ },
287
+ {
288
+ id: 'username',
289
+ icon: 'at',
290
+ iconColor: '#5856D6',
291
+ title: 'Username',
292
+ subtitle: user.username || 'N/A',
293
+ onPress: () => {
294
+ if (user?.username && navigate) {
295
+ navigate('Profile', { userId: user.id });
296
+ } else {
297
+ toast.info('No username available or navigation not supported');
298
+ }
299
+ },
300
+ },
301
+ {
302
+ id: 'email',
303
+ icon: 'mail',
304
+ iconColor: '#FF9500',
305
+ title: 'Email',
306
+ subtitle: user.email || 'N/A',
307
+ },
308
+ {
309
+ id: 'premium-status',
310
+ icon: 'star',
311
+ iconColor: user.isPremium ? '#FFD700' : '#8E8E93',
312
+ title: 'Premium Status',
313
+ subtitle: user.isPremium ? 'Premium' : 'Standard',
314
+ },
315
+ ] : []),
316
+ {
317
+ id: 'active-sessions',
318
+ icon: 'people',
319
+ iconColor: '#32D74B',
320
+ title: 'Total Active Sessions',
321
+ subtitle: sessions?.length?.toString() || '0',
322
+ },
323
+ ]}
324
+ theme={theme}
465
325
  />
466
- </View>
326
+ </Section>
467
327
 
468
328
  {/* API Configuration */}
469
- <View style={styles.section}>
470
- <Text style={styles.sectionTitle}>API Configuration</Text>
471
-
472
- <InfoRow
473
- label="API Base URL"
474
- value={oxyServices?.getBaseURL() || 'Not configured'}
475
- copyable
476
- icon="server"
477
- color="#007AFF"
478
- isFirst
479
- />
480
- <InfoRow
481
- label="Connection Status"
482
- value={
483
- connectionStatus === 'checking' ? 'Checking...' :
484
- connectionStatus === 'connected' ? 'Connected' :
485
- connectionStatus === 'disconnected' ? 'Disconnected' :
486
- 'Unknown'
487
- }
488
- icon={
489
- connectionStatus === 'checking' ? 'sync' :
490
- connectionStatus === 'connected' ? 'wifi' :
491
- 'wifi-off'
492
- }
493
- color={
494
- connectionStatus === 'checking' ? '#FF9500' :
495
- connectionStatus === 'connected' ? '#34C759' :
496
- '#FF3B30'
497
- }
498
- onPress={async () => {
499
- setConnectionStatus('checking');
500
-
501
- if (!oxyServices) {
502
- setConnectionStatus('disconnected');
503
- toast.error('OxyServices not initialized');
504
- return;
505
- }
329
+ <Section title="API Configuration" theme={theme}>
330
+ <GroupedSection
331
+ items={[
332
+ {
333
+ id: 'api-base-url',
334
+ icon: 'server',
335
+ iconColor: '#007AFF',
336
+ title: 'API Base URL',
337
+ subtitle: oxyServices?.getBaseURL() || 'Not configured',
338
+ onPress: () => copyToClipboard(oxyServices?.getBaseURL() || 'Not configured', 'API Base URL'),
339
+ },
340
+ {
341
+ id: 'connection-status',
342
+ icon: connectionStatus === 'checking' ? 'sync' : connectionStatus === 'connected' ? 'wifi' : 'wifi-off',
343
+ iconColor: connectionStatus === 'checking' ? '#FF9500' : connectionStatus === 'connected' ? '#34C759' : '#FF3B30',
344
+ title: 'Connection Status',
345
+ subtitle: connectionStatus === 'checking' ? 'Checking...' : connectionStatus === 'connected' ? 'Connected' : connectionStatus === 'disconnected' ? 'Disconnected' : 'Unknown',
346
+ onPress: async () => {
347
+ setConnectionStatus('checking');
348
+
349
+ if (!oxyServices) {
350
+ setConnectionStatus('disconnected');
351
+ toast.error('OxyServices not initialized');
352
+ return;
353
+ }
506
354
 
507
- try {
508
- await oxyServices.healthCheck();
509
- setConnectionStatus('connected');
510
- toast.success('API connection successful');
511
- } catch (error) {
512
- setConnectionStatus('disconnected');
513
- toast.error('Failed to connect to API server');
514
- }
515
- }}
516
- showChevron={true}
517
- isLast
355
+ try {
356
+ await oxyServices.healthCheck();
357
+ setConnectionStatus('connected');
358
+ toast.success('API connection successful');
359
+ } catch (error) {
360
+ setConnectionStatus('disconnected');
361
+ toast.error('Failed to connect to API server');
362
+ }
363
+ },
364
+ },
365
+ ]}
366
+ theme={theme}
518
367
  />
519
- </View>
368
+ </Section>
520
369
 
521
370
  {/* Build Information */}
522
- <View style={styles.section}>
523
- <Text style={styles.sectionTitle}>Build Information</Text>
524
-
525
- <InfoRow
526
- label="Build Timestamp"
527
- value={systemInfo?.timestamp || 'Loading...'}
528
- copyable
529
- icon="time"
530
- color="#007AFF"
531
- isFirst
532
- />
533
- <InfoRow
534
- label="React Native"
535
- value="Expo/React Native"
536
- icon="logo-react"
537
- color="#61DAFB"
538
- />
539
- <InfoRow
540
- label="JavaScript Engine"
541
- value="Hermes"
542
- icon="flash"
543
- color="#FF3B30"
544
- isLast
371
+ <Section title="Build Information" theme={theme}>
372
+ <GroupedSection
373
+ items={[
374
+ {
375
+ id: 'build-timestamp',
376
+ icon: 'time',
377
+ iconColor: '#007AFF',
378
+ title: 'Build Timestamp',
379
+ subtitle: systemInfo?.timestamp || 'Loading...',
380
+ onPress: () => copyToClipboard(systemInfo?.timestamp || 'Loading...', 'Build timestamp'),
381
+ },
382
+ {
383
+ id: 'react-native',
384
+ icon: 'logo-react',
385
+ iconColor: '#61DAFB',
386
+ title: 'React Native',
387
+ subtitle: 'Expo/React Native',
388
+ },
389
+ {
390
+ id: 'js-engine',
391
+ icon: 'flash',
392
+ iconColor: '#FF3B30',
393
+ title: 'JavaScript Engine',
394
+ subtitle: 'Hermes',
395
+ },
396
+ ]}
397
+ theme={theme}
545
398
  />
546
- </View>
399
+ </Section>
547
400
 
548
401
  {/* Quick Actions */}
549
- <View style={styles.section}>
550
- <Text style={styles.sectionTitle}>Quick Actions</Text>
551
-
552
- <TouchableOpacity
553
- style={[styles.settingItem, styles.firstSettingItem]}
554
- onPress={handleCopyFullReport}
555
- >
556
- <View style={styles.settingInfo}>
557
- <OxyIcon name="copy" size={20} color="#007AFF" style={styles.settingIcon} />
558
- <View style={styles.settingDetails}>
559
- <Text style={styles.settingLabel}>Copy Full Report</Text>
560
- <Text style={styles.settingDescription}>
561
- Copy complete application information to clipboard
562
- </Text>
563
- </View>
564
- </View>
565
- <OxyIcon name="chevron-forward" size={16} color="#ccc" />
566
- </TouchableOpacity>
567
-
568
- <TouchableOpacity
569
- style={[
570
- styles.settingItem,
571
- styles.lastSettingItem,
572
- isRunningSystemCheck && styles.disabledSettingItem
402
+ <Section title="Quick Actions" theme={theme}>
403
+ <GroupedSection
404
+ items={[
405
+ {
406
+ id: 'copy-full-report',
407
+ icon: 'copy',
408
+ iconColor: '#007AFF',
409
+ title: 'Copy Full Report',
410
+ subtitle: 'Copy complete application information to clipboard',
411
+ onPress: handleCopyFullReport,
412
+ },
413
+ {
414
+ id: 'run-system-check',
415
+ icon: isRunningSystemCheck ? 'sync' : 'checkmark-circle',
416
+ iconColor: isRunningSystemCheck ? '#FF9500' : '#34C759',
417
+ title: isRunningSystemCheck ? 'Running System Check...' : 'Run System Check',
418
+ subtitle: isRunningSystemCheck
419
+ ? 'Checking API, authentication, and platform status...'
420
+ : 'Verify application health and status',
421
+ onPress: runSystemCheck,
422
+ disabled: isRunningSystemCheck,
423
+ customContent: isRunningSystemCheck ? (
424
+ <ActivityIndicator color="#FF9500" size="small" style={{ marginRight: 16 }} />
425
+ ) : null,
426
+ },
573
427
  ]}
574
- onPress={runSystemCheck}
575
- disabled={isRunningSystemCheck}
576
- >
577
- <View style={styles.settingInfo}>
578
- <OxyIcon
579
- name={isRunningSystemCheck ? "sync" : "checkmark-circle"}
580
- size={20}
581
- color={isRunningSystemCheck ? "#FF9500" : "#34C759"}
582
- style={[
583
- styles.settingIcon,
584
- isRunningSystemCheck && styles.spinningIcon
585
- ]}
586
- />
587
- <View style={styles.settingDetails}>
588
- <Text style={styles.settingLabel}>
589
- {isRunningSystemCheck ? 'Running System Check...' : 'Run System Check'}
590
- </Text>
591
- <Text style={styles.settingDescription}>
592
- {isRunningSystemCheck
593
- ? 'Checking API, authentication, and platform status...'
594
- : 'Verify application health and status'
595
- }
596
- </Text>
597
- </View>
598
- </View>
599
- {!isRunningSystemCheck && <OxyIcon name="chevron-forward" size={16} color="#ccc" />}
600
- </TouchableOpacity>
601
- </View>
428
+ theme={theme}
429
+ />
430
+ </Section>
602
431
  </ScrollView>
603
432
  </View>
604
433
  );
@@ -632,65 +461,9 @@ const styles = StyleSheet.create({
632
461
  flex: 1,
633
462
  padding: 16,
634
463
  },
635
- section: {
636
- marginBottom: 24,
637
- },
638
- sectionTitle: {
639
- fontSize: 16,
640
- fontWeight: '600',
641
- color: '#333',
642
- marginBottom: 12,
643
- fontFamily: fontFamilies.phuduSemiBold,
644
- },
645
- settingItem: {
646
- backgroundColor: '#fff',
647
- padding: 16,
648
- flexDirection: 'row',
649
- alignItems: 'center',
650
- justifyContent: 'space-between',
651
- marginBottom: 2,
652
- },
653
- firstSettingItem: {
654
- borderTopLeftRadius: 24,
655
- borderTopRightRadius: 24,
656
- },
657
- lastSettingItem: {
658
- borderBottomLeftRadius: 24,
659
- borderBottomRightRadius: 24,
660
- marginBottom: 8,
661
- },
662
- settingInfo: {
663
- flexDirection: 'row',
664
- alignItems: 'center',
665
- flex: 1,
666
- },
667
464
  settingIcon: {
668
465
  marginRight: 12,
669
466
  },
670
- settingDetails: {
671
- flex: 1,
672
- },
673
- settingLabel: {
674
- fontSize: 16,
675
- fontWeight: '500',
676
- color: '#333',
677
- marginBottom: 2,
678
- },
679
- settingValue: {
680
- fontSize: 14,
681
- color: '#666',
682
- },
683
- settingDescription: {
684
- fontSize: 14,
685
- color: '#999',
686
- },
687
- disabledSettingItem: {
688
- opacity: 0.6,
689
- },
690
- spinningIcon: {
691
- // Note: Animation would need to be implemented with Animated API
692
- // For now, just showing the sync icon to indicate loading
693
- },
694
467
  });
695
468
 
696
469
  export default AppInfoScreen;