@oxyhq/services 5.3.10 → 5.3.11

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 (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -571
  3. package/lib/commonjs/core/index.js +103 -34
  4. package/lib/commonjs/core/index.js.map +1 -1
  5. package/lib/commonjs/lib/sonner.js +17 -0
  6. package/lib/commonjs/lib/sonner.js.map +1 -0
  7. package/lib/commonjs/lib/sonner.web.js +17 -0
  8. package/lib/commonjs/lib/sonner.web.js.map +1 -0
  9. package/lib/commonjs/ui/components/FollowButton.js +54 -4
  10. package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
  11. package/lib/commonjs/ui/components/OxyProvider.js +22 -3
  12. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  13. package/lib/commonjs/ui/screens/AccountCenterScreen.js +4 -3
  14. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  15. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +15 -14
  16. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
  17. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +10 -9
  18. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  19. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +17 -16
  20. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  21. package/lib/commonjs/ui/screens/AppInfoScreen.js +4 -5
  22. package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
  23. package/lib/commonjs/ui/screens/SessionManagementScreen.js +7 -6
  24. package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
  25. package/lib/commonjs/ui/screens/SignInScreen.js +821 -74
  26. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
  27. package/lib/commonjs/ui/screens/SignUpScreen.js +7 -5
  28. package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -1
  29. package/lib/commonjs/ui/styles/theme.js +1 -1
  30. package/lib/module/core/index.js +103 -34
  31. package/lib/module/core/index.js.map +1 -1
  32. package/lib/module/lib/sonner.js +4 -0
  33. package/lib/module/lib/sonner.js.map +1 -0
  34. package/lib/module/lib/sonner.web.js +4 -0
  35. package/lib/module/lib/sonner.web.js.map +1 -0
  36. package/lib/module/ui/components/FollowButton.js +54 -4
  37. package/lib/module/ui/components/FollowButton.js.map +1 -1
  38. package/lib/module/ui/components/OxyProvider.js +22 -3
  39. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  40. package/lib/module/ui/screens/AccountCenterScreen.js +4 -3
  41. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  42. package/lib/module/ui/screens/AccountOverviewScreen.js +15 -14
  43. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  44. package/lib/module/ui/screens/AccountSettingsScreen.js +10 -9
  45. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  46. package/lib/module/ui/screens/AccountSwitcherScreen.js +17 -16
  47. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  48. package/lib/module/ui/screens/AppInfoScreen.js +5 -6
  49. package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
  50. package/lib/module/ui/screens/SessionManagementScreen.js +7 -6
  51. package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
  52. package/lib/module/ui/screens/SignInScreen.js +824 -77
  53. package/lib/module/ui/screens/SignInScreen.js.map +1 -1
  54. package/lib/module/ui/screens/SignUpScreen.js +7 -5
  55. package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
  56. package/lib/module/ui/styles/theme.js +1 -1
  57. package/lib/typescript/core/index.d.ts +44 -23
  58. package/lib/typescript/core/index.d.ts.map +1 -1
  59. package/lib/typescript/lib/sonner.d.ts +2 -0
  60. package/lib/typescript/lib/sonner.d.ts.map +1 -0
  61. package/lib/typescript/lib/sonner.web.d.ts +2 -0
  62. package/lib/typescript/lib/sonner.web.d.ts.map +1 -0
  63. package/lib/typescript/models/interfaces.d.ts +24 -0
  64. package/lib/typescript/models/interfaces.d.ts.map +1 -1
  65. package/lib/typescript/ui/components/FollowButton.d.ts +32 -1
  66. package/lib/typescript/ui/components/FollowButton.d.ts.map +1 -1
  67. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
  68. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
  69. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
  70. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  71. package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
  72. package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +1 -1
  73. package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
  74. package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
  75. package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -1
  76. package/package.json +5 -3
  77. package/src/core/index.ts +104 -36
  78. package/src/lib/sonner.ts +1 -0
  79. package/src/lib/sonner.web.ts +1 -0
  80. package/src/models/interfaces.ts +29 -0
  81. package/src/ui/components/FollowButton.tsx +67 -3
  82. package/src/ui/components/OxyProvider.tsx +15 -0
  83. package/src/ui/screens/AccountCenterScreen.tsx +4 -3
  84. package/src/ui/screens/AccountOverviewScreen.tsx +15 -14
  85. package/src/ui/screens/AccountSettingsScreen.tsx +10 -9
  86. package/src/ui/screens/AccountSwitcherScreen.tsx +17 -16
  87. package/src/ui/screens/AppInfoScreen.tsx +4 -7
  88. package/src/ui/screens/SessionManagementScreen.tsx +7 -15
  89. package/src/ui/screens/SignInScreen.tsx +729 -52
  90. package/src/ui/screens/SignUpScreen.tsx +7 -5
  91. package/src/ui/styles/theme.ts +1 -1
  92. package/CHANGELOG.md +0 -97
  93. package/UI_COMPONENTS.md +0 -462
@@ -20,6 +20,7 @@ import OxyLogo from '../components/OxyLogo';
20
20
  import { BottomSheetScrollView, BottomSheetView } from '@gorhom/bottom-sheet';
21
21
  import { Ionicons } from '@expo/vector-icons'; // Add icon import
22
22
  import Svg, { Path, Circle } from 'react-native-svg';
23
+ import { toast } from '../../lib/sonner';
23
24
 
24
25
  const SignUpScreen: React.FC<BaseScreenProps> = ({
25
26
  navigate,
@@ -134,31 +135,32 @@ const SignUpScreen: React.FC<BaseScreenProps> = ({
134
135
  const handleSignUp = async () => {
135
136
  // Validate inputs
136
137
  if (!username || !email || !password || !confirmPassword) {
137
- setErrorMessage('Please fill in all fields');
138
+ toast.error('Please fill in all fields');
138
139
  return;
139
140
  }
140
141
 
141
142
  if (!validateEmail(email)) {
142
- setErrorMessage('Please enter a valid email address');
143
+ toast.error('Please enter a valid email address');
143
144
  return;
144
145
  }
145
146
 
146
147
  if (password !== confirmPassword) {
147
- setErrorMessage('Passwords do not match');
148
+ toast.error('Passwords do not match');
148
149
  return;
149
150
  }
150
151
 
151
152
  if (password.length < 8) {
152
- setErrorMessage('Password must be at least 8 characters long');
153
+ toast.error('Password must be at least 8 characters long');
153
154
  return;
154
155
  }
155
156
 
156
157
  try {
157
158
  setErrorMessage('');
158
159
  await signUp(username, email, password);
160
+ toast.success('Account created successfully! Welcome to Oxy!');
159
161
  // The authentication state change will be handled through context
160
162
  } catch (error: any) {
161
- setErrorMessage(error.message || 'Sign up failed');
163
+ toast.error(error.message || 'Sign up failed');
162
164
  }
163
165
  };
164
166
 
@@ -100,7 +100,7 @@ export const createCommonStyles = (theme: 'light' | 'dark') => {
100
100
  backgroundColor: colors.background,
101
101
  },
102
102
  scrollContainer: {
103
- padding: 26,
103
+ padding: 10,
104
104
  },
105
105
  input: {
106
106
  height: 48,
package/CHANGELOG.md DELETED
@@ -1,97 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- ## [5.3.0] - 2025-05-31
6
-
7
- ### 🚀 Major Features Added
8
-
9
- #### Enhanced Device-Based Session Management
10
- - **DeviceManager**: New cross-platform utility for device fingerprinting and identification
11
- - Consistent device ID generation and persistent storage
12
- - Cross-platform support (web localStorage, React Native AsyncStorage)
13
- - Cryptographically secure device fingerprinting
14
- - Platform-aware device naming
15
-
16
- - **Enhanced Authentication Flow**:
17
- - Automatic device fingerprinting integration in login process
18
- - Server-side session validation with device context
19
- - Multi-user support on shared devices with session isolation
20
- - No local PII storage - only device identifiers
21
-
22
- - **Remote Session Management**:
23
- - View all device sessions for current user
24
- - Logout individual sessions or all device sessions
25
- - Update device names for better identification
26
- - Session activity tracking and management
27
-
28
- #### Complete UI Component Suite
29
- - **New Screens Added**:
30
- - `AccountSwitcherScreen` - Switch between multiple authenticated accounts
31
- - `KarmaCenterScreen` - Central hub for karma system management
32
- - `KarmaLeaderboardScreen` - Display karma rankings and leaderboards
33
- - `KarmaRewardsScreen` - Show available karma rewards and redemption
34
- - `KarmaRulesScreen` - Display karma rules and guidelines
35
- - `KarmaAboutScreen` - Information about the karma system
36
- - `KarmaFAQScreen` - Frequently asked questions about karma
37
-
38
- - **New Components Added**:
39
- - `OxyIcon` - Standardized icon component with Ionicons integration
40
-
41
- #### Enhanced TypeScript Support
42
- - Complete type definitions for all new device management features
43
- - Improved type exports for better IDE support
44
- - Enhanced interface definitions for session management
45
-
46
- ### 🔧 API Enhancements
47
-
48
- #### OxyServices Core
49
- - `getDeviceSessions(sessionId, deviceId?)` - Get sessions for current device
50
- - `logoutAllDeviceSessions(sessionId, deviceId?)` - Logout all sessions on device
51
- - `updateDeviceName(sessionId, deviceName, deviceId?)` - Update device display name
52
- - Enhanced `secureLogin()` with automatic device fingerprinting
53
-
54
- #### DeviceManager Utilities
55
- - `DeviceManager.getDeviceFingerprint()` - Generate device fingerprint
56
- - `DeviceManager.getDeviceInfo()` - Get or create device information
57
- - `DeviceManager.updateDeviceName(name)` - Update stored device name
58
- - `DeviceManager.clearDeviceInfo()` - Clear stored device data (for testing)
59
-
60
- ### 📦 Package Structure Improvements
61
- - Updated main exports to include all new components and utilities
62
- - Enhanced package.json with better module resolution
63
- - Improved build process with complete TypeScript compilation
64
- - Updated README and documentation for new features
65
-
66
- ### 🛠️ Technical Improvements
67
- - Cross-platform storage handling (localStorage/AsyncStorage)
68
- - Enhanced error handling and fallbacks for device detection
69
- - Improved security with cryptographically secure random device IDs
70
- - Better platform detection and device naming
71
-
72
- ### 📚 Documentation & Examples
73
- - New `DeviceSessionManagementExample.tsx` - Comprehensive device session management demo
74
- - Updated `MultiUserAuthenticationExample.tsx` - Enhanced with device session features
75
- - New `SimpleDeviceExample.tsx` - Basic device management demonstration
76
- - Enhanced README.md with v5.3.0 feature documentation
77
- - Updated UI_COMPONENTS.md with complete component reference
78
-
79
- ### 🔄 Breaking Changes
80
- None - This release is fully backward compatible with v5.2.x
81
-
82
- ### 🐛 Bug Fixes
83
- - Fixed TypeScript compilation issues with new components
84
- - Resolved export conflicts in main index files
85
- - Fixed cross-platform compatibility issues
86
- - Improved error handling in device detection
87
-
88
- ### 🚀 Performance Improvements
89
- - Optimized device fingerprinting for faster session initialization
90
- - Reduced bundle size with better tree-shaking support
91
- - Improved memory usage in session management
92
-
93
- ## [5.2.11] - Previous Version
94
- - Base authentication and user management features
95
- - Core UI components and screens
96
- - Payment and wallet functionality
97
- - Karma system foundation
package/UI_COMPONENTS.md DELETED
@@ -1,462 +0,0 @@
1
- # OxyHQ Services UI Components
2
-
3
- This document provides details about the UI components available in the `@oxyhq/services` package.
4
-
5
- ## What's New in v5.3.0
6
-
7
- ### 🔐 Enhanced Device-Based Session Management
8
- - **DeviceManager**: Cross-platform device fingerprinting and persistent device ID management
9
- - **Enhanced Authentication**: Login flow now includes automatic device fingerprinting
10
- - **Session Isolation**: Multiple users can sign in on shared devices with isolated sessions
11
- - **Remote Management**: View and manage sessions across all devices
12
-
13
- ### 🎨 Complete UI Component Suite
14
- All screens and components are now fully implemented and exported:
15
-
16
- **Authentication & Account Management:**
17
- - `SignInScreen`, `SignUpScreen`, `AccountCenterScreen`, `SessionManagementScreen`
18
- - `AccountOverviewScreen`, `AccountSettingsScreen`, `AccountSwitcherScreen`
19
-
20
- **Karma System:**
21
- - `KarmaCenterScreen`, `KarmaLeaderboardScreen`, `KarmaRewardsScreen`
22
- - `KarmaRulesScreen`, `KarmaAboutScreen`, `KarmaFAQScreen`
23
-
24
- **Utility Components:**
25
- - `OxyIcon`, `Avatar`, `FollowButton`, `OxyLogo`, `FontLoader`
26
-
27
- ### 📱 Cross-Platform Support
28
- All components work seamlessly across web browsers and React Native applications.
29
-
30
- ## Import Guide
31
-
32
- The package provides different entry points for different use cases:
33
-
34
- ### For Node.js/Express (Server-side only)
35
- ```javascript
36
- // Only core services and models - no UI components
37
- import { OxyServices } from '@oxyhq/services';
38
- ```
39
-
40
- ### For React/React Native apps (UI components only)
41
- ```javascript
42
- // UI components and context providers
43
- import { OxyProvider, OxySignInButton, OxyLogo, Avatar } from '@oxyhq/services/ui';
44
- ```
45
-
46
- ### For full package (Core + UI)
47
- ```javascript
48
- // Everything - core services, models, and UI components
49
- import { OxyServices, OxyProvider, OxySignInButton } from '@oxyhq/services/full';
50
- ```
51
-
52
- ## Table of Contents
53
-
54
- - [OxyProvider](#oxyprovider)
55
- - [OxySignInButton](#oxysigninbutton)
56
- - [OxyLogo](#oxylogo)
57
- - [Avatar](#avatar)
58
- - [FollowButton](#followbutton)
59
- - [Multi-User Components](#multi-user-components)
60
- - [AccountSwitcherScreen](#accountswitcherscreen)
61
- - [SessionManagementScreen](#sessionmanagementscreen)
62
- - [Enhanced SignInScreen](#enhanced-signinscreen)
63
- - [Screens](#screens)
64
- - [AccountCenterScreen](#accountcenterscreen)
65
- - [AppInfoScreen](#appinfoscreen)
66
-
67
- ## OxyProvider
68
-
69
- The main provider component that manages authentication state and exposes the bottom sheet for sign-in, sign-up, and account management.
70
-
71
- ```tsx
72
- import { OxyProvider } from '@oxyhq/services/ui';
73
-
74
- // In your app
75
- <OxyProvider
76
- oxyServices={oxyServicesInstance}
77
- initialScreen="SignIn"
78
- autoPresent={false}
79
- onAuthenticated={(user) => console.log('User authenticated:', user)}
80
- theme="light"
81
- >
82
- {children}
83
- </OxyProvider>
84
- ```
85
-
86
- ### Props
87
-
88
- | Prop | Type | Required | Description |
89
- |------|------|----------|-------------|
90
- | oxyServices | `OxyServices` | Yes | Instance of OxyServices initialized with your API configuration |
91
- | initialScreen | `'SignIn' \| 'SignUp' \| 'AccountCenter'` | No | Initial screen to display when the sheet opens |
92
- | autoPresent | `boolean` | No | Whether to automatically present the sheet on mount |
93
- | onAuthenticated | `(user: User) => void` | No | Callback when a user is authenticated |
94
- | onClose | `() => void` | No | Callback when the sheet is closed |
95
- | onAuthStateChange | `(user: User \| null) => void` | No | Callback when auth state changes |
96
- | storageKeyPrefix | `string` | No | Prefix for stored auth tokens |
97
- | theme | `'light' \| 'dark'` | No | Theme for the sheet UI |
98
-
99
- ## OxySignInButton
100
-
101
- A pre-styled button component for signing in with Oxy services. This component automatically integrates with the OxyProvider context and will control the authentication bottom sheet when pressed.
102
-
103
- ```tsx
104
- import { OxySignInButton } from '@oxyhq/services';
105
-
106
- // Basic usage
107
- <OxySignInButton />
108
-
109
- // Custom styling
110
- <OxySignInButton
111
- variant="contained"
112
- style={{ marginTop: 20 }}
113
- text="Login with Oxy"
114
- />
115
-
116
- // Custom handler
117
- <OxySignInButton onPress={() => {
118
- // Custom authentication flow
119
- console.log('Custom auth flow initiated');
120
- }} />
121
- ```
122
-
123
- ### Props
124
-
125
- | Prop | Type | Default | Description |
126
- |------|------|---------|-------------|
127
- | variant | `'default' \| 'outline' \| 'contained'` | `'default'` | Controls the appearance of the button |
128
- | onPress | `() => void` | `undefined` | Optional function to handle button press, if not provided, the button will use the `showBottomSheet` method from OxyContext |
129
- | style | `StyleProp<ViewStyle>` | `undefined` | Additional styles for the button container |
130
- | textStyle | `StyleProp<TextStyle>` | `undefined` | Additional styles for the button text |
131
- | text | `string` | `'Sign in with Oxy'` | Custom button text |
132
- | navigationDelay | `number` | `300` | Delay in milliseconds before navigating to SignIn screen after expanding |
133
- | disabled | `boolean` | `false` | Whether to disable the button |
134
- | showWhenAuthenticated | `boolean` | `false` | Whether to show the button even if user is already authenticated |
135
-
136
- ### Design Variants
137
-
138
- - **Default**: A flat white button with a subtle shadow
139
- - **Outline**: A transparent button with a colored border
140
- - **Contained**: A solid colored button with white text
141
-
142
- ### Behavior
143
-
144
- By default, the OxySignInButton:
145
-
146
- 1. Uses the context from OxyProvider to detect if a user is already authenticated
147
- 2. Only renders if no user is authenticated (unless showWhenAuthenticated is true)
148
- 3. When pressed, automatically opens the bottom sheet and navigates to the SignIn screen
149
- 4. Can be customized with your own onPress handler for custom authentication flows
150
-
151
- ## OxyLogo
152
-
153
- The Oxy logo component for React Native applications. This is an SVG component that can be used to display the Oxy logo in your app.
154
-
155
- ```tsx
156
- import { OxyLogo } from '@oxyhq/services';
157
-
158
- // Basic usage
159
- <OxyLogo />
160
-
161
- // Custom size
162
- <OxyLogo width={32} height={32} />
163
-
164
- // With custom style
165
- <OxyLogo
166
- width={24}
167
- height={24}
168
- style={{ margin: 5 }}
169
- />
170
-
171
- // With custom colors
172
- <OxyLogo
173
- width={24}
174
- height={24}
175
- fillColor="#9c27b0"
176
- secondaryFillColor="#ce93d8"
177
- />
178
- ```
179
-
180
- ### Props
181
-
182
- | Prop | Type | Default | Description |
183
- |------|------|---------|-------------|
184
- | width | `number` | `24` | Width of the logo in pixels |
185
- | height | `number` | `24` | Height of the logo in pixels |
186
- | style | `StyleProp<ViewStyle>` | `undefined` | Additional styles for the logo container |
187
- | fillColor | `string` | `'#d169e5'` | Primary fill color for the logo |
188
- | secondaryFillColor | `string` | `'#db85ec'` | Secondary fill color for the inner glow effect |
189
-
190
- ### Requirements
191
-
192
- This component requires `react-native-svg` to be installed in your project:
193
-
194
- ```bash
195
- npm install react-native-svg
196
- # or
197
- yarn add react-native-svg
198
- ```
199
-
200
- ## FollowButton
201
-
202
- An animated button component for social interactions that toggles between "Follow" and "Following" states with smooth transitions.
203
-
204
- ```tsx
205
- import { FollowButton } from '@oxyhq/services';
206
-
207
- // Basic usage
208
- <FollowButton userId="123" />
209
-
210
- // With custom styling
211
- <FollowButton
212
- userId="123"
213
- initiallyFollowing={true}
214
- size="large"
215
- style={{ borderRadius: 12 }}
216
- onFollowChange={(isFollowing) => console.log(`User is now ${isFollowing ? 'followed' : 'unfollowed'}`)}
217
- />
218
-
219
- // Different sizes
220
- <FollowButton userId="123" size="small" />
221
- <FollowButton userId="123" size="medium" /> // default
222
- <FollowButton userId="123" size="large" />
223
-
224
- // Disabled state
225
- <FollowButton userId="123" disabled={true} />
226
- ```
227
-
228
- ### Props
229
-
230
- | Prop | Type | Default | Description |
231
- |------|------|---------|-------------|
232
- | userId | `string` | *Required* | The ID of the user to follow/unfollow |
233
- | initiallyFollowing | `boolean` | `false` | Initial follow state, if already known |
234
- | size | `'small' \| 'medium' \| 'large'` | `'medium'` | Size variant of the button |
235
- | onFollowChange | `(isFollowing: boolean) => void` | `undefined` | Callback function invoked when follow state changes |
236
- | style | `StyleProp<ViewStyle>` | `undefined` | Additional styles for the button container |
237
- | textStyle | `StyleProp<TextStyle>` | `undefined` | Additional styles for the button text |
238
- | disabled | `boolean` | `false` | Whether the button is disabled |
239
- | showLoadingState | `boolean` | `true` | Whether to show loading indicator during API calls |
240
-
241
- ### Requirements
242
-
243
- This component requires `react-native-reanimated` to be installed in your project:
244
-
245
- ```bash
246
- npm install react-native-reanimated
247
- # or
248
- yarn add react-native-reanimated
249
- ```
250
-
251
- > **Note:** After installing react-native-reanimated, you may need to set up the Babel plugin. Add `'react-native-reanimated/plugin'` to your Babel plugins in `babel.config.js`.
252
-
253
- ## Multi-User Components
254
-
255
- The Oxy Services library includes several components specifically designed for multi-user authentication and session management.
256
-
257
- ### AccountSwitcherScreen
258
-
259
- A screen component that displays all authenticated user accounts and allows switching between them.
260
-
261
- **Features:**
262
- - Display all authenticated user accounts
263
- - Switch between accounts with a single tap
264
- - Remove accounts from the list
265
- - Add new accounts
266
- - Visual indication of the current active account
267
-
268
- **Usage:**
269
- ```tsx
270
- import { useOxy } from '@oxyhq/services/full';
271
-
272
- function MyComponent() {
273
- const { showBottomSheet } = useOxy();
274
-
275
- const openAccountSwitcher = () => {
276
- showBottomSheet('AccountSwitcher');
277
- };
278
-
279
- return (
280
- <button onClick={openAccountSwitcher}>
281
- Switch Account
282
- </button>
283
- );
284
- }
285
- ```
286
-
287
- **Navigation Path:** Available via `showBottomSheet('AccountSwitcher')`
288
-
289
- ### SessionManagementScreen
290
-
291
- A comprehensive session management interface that shows active sessions across all devices with logout capabilities.
292
-
293
- **Features:**
294
- - View all active sessions across devices
295
- - Display device information (platform, browser, OS, IP address)
296
- - Individual session logout
297
- - Bulk logout operations
298
- - Session activity timestamps
299
- - Current session indication
300
-
301
- **Usage:**
302
- ```tsx
303
- import { useOxy } from '@oxyhq/services/full';
304
-
305
- function MyComponent() {
306
- const { showBottomSheet } = useOxy();
307
-
308
- const openSessionManager = () => {
309
- showBottomSheet('SessionManagement');
310
- };
311
-
312
- return (
313
- <button onClick={openSessionManager}>
314
- Manage Sessions
315
- </button>
316
- );
317
- }
318
- ```
319
-
320
- **Navigation Path:** Available via `showBottomSheet('SessionManagement')`
321
-
322
- ### Enhanced SignInScreen
323
-
324
- The sign-in screen has been enhanced to support multi-user functionality. When a user is already authenticated, it automatically switches to "Add Account" mode.
325
-
326
- **Features:**
327
- - Standard sign-in/sign-up functionality
328
- - Automatic "Add Account" mode when user is authenticated
329
- - Seamless integration with existing authentication flow
330
- - Support for multiple account registration
331
-
332
- **Usage:**
333
- ```tsx
334
- import { useOxy } from '@oxyhq/services/full';
335
-
336
- function MyComponent() {
337
- const { showBottomSheet, user } = useOxy();
338
-
339
- const openSignIn = () => {
340
- // Will show "Add Account" mode if user is already authenticated
341
- showBottomSheet('SignIn');
342
- };
343
-
344
- return (
345
- <button onClick={openSignIn}>
346
- {user ? 'Add Another Account' : 'Sign In'}
347
- </button>
348
- );
349
- }
350
- ```
351
-
352
- **Multi-User Context Integration:**
353
- ```tsx
354
- // The enhanced context provides multi-user functionality
355
- const {
356
- user, // Current active user
357
- users, // All authenticated users
358
- switchUser, // Switch to different user
359
- removeUser, // Remove user from account list
360
- getUserSessions, // Get user's active sessions
361
- logoutSession, // Logout from specific session
362
- logoutAll // Logout from all accounts
363
- } = useOxy();
364
- ```
365
-
366
- ## Screens
367
-
368
- ### AccountCenterScreen
369
-
370
- The AccountCenterScreen component serves as a central hub for users to access and manage their account settings, preferences, and information.
371
-
372
- ```tsx
373
- import { AccountCenterScreen } from '@oxyhq/services';
374
-
375
- // Basic usage
376
- <AccountCenterScreen
377
- user={currentUser}
378
- onEditProfile={() => console.log('Edit profile')}
379
- onChangePassword={() => console.log('Change password')}
380
- />
381
- ```
382
-
383
- #### Props
384
-
385
- | Prop | Type | Default | Description |
386
- |------|------|---------|-------------|
387
- | user | `User` | *Required* | The current user object |
388
- | onEditProfile | `() => void` | `undefined` | Callback function invoked when editing the profile |
389
- | onChangePassword | `() => void` | `undefined` | Callback function invoked when changing the password |
390
-
391
- ### AppInfoScreen
392
-
393
- The AppInfoScreen component provides comprehensive information about the application, including package details, system information, user data, and diagnostic tools. This screen is useful for debugging, support, and transparency purposes.
394
-
395
- ```tsx
396
- import { AppInfoScreen } from '@oxyhq/services/ui';
397
-
398
- // Basic usage in OxyRouter
399
- <AppInfoScreen
400
- theme="light"
401
- onClose={() => console.log('Closing app info')}
402
- navigate={(route) => console.log(`Navigating to ${route}`)}
403
- />
404
- ```
405
-
406
- #### Features
407
-
408
- - **Package Information**: Displays current version, name, description, and module entry points
409
- - **System Information**: Shows platform details, screen dimensions, and environment data
410
- - **User Information**: Current authentication status, user details, and multi-user data
411
- - **API Configuration**: Base URL and connection status
412
- - **Build Information**: Timestamp, environment, and JavaScript engine details
413
- - **Dependencies**: Framework versions and enabled features
414
- - **Interactive Elements**: Copy-to-clipboard functionality and system check tools
415
-
416
- #### Props
417
-
418
- | Prop | Type | Default | Description |
419
- |------|------|---------|-------------|
420
- | theme | `'light' \| 'dark'` | `'light'` | Theme mode for styling |
421
- | onClose | `() => void` | `undefined` | Callback when user closes the screen |
422
- | navigate | `(route: string, params?: any) => void` | `undefined` | Navigation function for routing |
423
-
424
- #### Information Sections
425
-
426
- 1. **Package Information**
427
- - Package name and version (dynamically loaded from package.json)
428
- - Description and main entry points
429
- - Module and TypeScript definitions
430
-
431
- 2. **System Information**
432
- - Platform (iOS, Android, Web)
433
- - Platform version
434
- - Screen dimensions
435
- - Development/Production environment
436
-
437
- 3. **User Information**
438
- - Authentication status
439
- - Current user details (ID, username, email, premium status)
440
- - Multi-user account count
441
-
442
- 4. **API Configuration**
443
- - Base API URL
444
- - Connection status
445
-
446
- 5. **Build Information**
447
- - Build timestamp
448
- - React Native framework
449
- - JavaScript engine (Hermes)
450
-
451
- 6. **Actions**
452
- - Copy full report to clipboard (JSON format)
453
- - Run system check
454
- - Individual field copy functionality
455
-
456
- #### Usage in AccountCenter
457
-
458
- The AppInfoScreen is accessible from the AccountCenterScreen via the "App Information" button, providing users with transparency about the application and useful debugging information.
459
-
460
- #### Copy Functionality
461
-
462
- Users can copy individual fields by tapping on values marked as copyable, or generate a complete JSON report with all application information for support purposes.