@oxyhq/services 0.0.85 → 0.1.0

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 (181) hide show
  1. package/README.md +269 -79
  2. package/dist/components/AuthBottomSheet/types.d.ts +24 -0
  3. package/dist/components/AuthBottomSheet/types.js +2 -0
  4. package/dist/components/FileSelectorModal/types.d.ts +35 -0
  5. package/dist/components/FileSelectorModal/types.js +2 -0
  6. package/dist/components/SessionProvider.d.ts +26 -0
  7. package/dist/components/SessionProvider.js +367 -0
  8. package/dist/config.d.ts +169 -0
  9. package/dist/config.js +115 -0
  10. package/dist/constants.d.ts +54 -0
  11. package/dist/constants.js +61 -0
  12. package/dist/hooks/index.d.ts +11 -0
  13. package/dist/hooks/index.js +23 -0
  14. package/dist/hooks/useAuth.d.ts +6 -0
  15. package/dist/hooks/useAuth.js +17 -0
  16. package/dist/hooks/useFiles.d.ts +10 -0
  17. package/dist/hooks/useFiles.js +329 -0
  18. package/dist/hooks/useProfile.d.ts +13 -0
  19. package/dist/hooks/useProfile.js +154 -0
  20. package/dist/hooks/useSession.d.ts +2 -0
  21. package/dist/hooks/useSession.js +12 -0
  22. package/dist/hooks/useSubscription.d.ts +15 -0
  23. package/dist/hooks/useSubscription.js +85 -0
  24. package/dist/index.d.ts +28 -7
  25. package/dist/index.js +82 -6
  26. package/dist/package.json +71 -0
  27. package/dist/reducers/index.d.ts +8 -0
  28. package/dist/reducers/index.js +29 -0
  29. package/dist/reducers/profileReducer.d.ts +55 -0
  30. package/dist/reducers/profileReducer.js +136 -0
  31. package/dist/services/OxyClient.d.ts +84 -0
  32. package/dist/services/OxyClient.js +309 -0
  33. package/dist/services/api.service.d.ts +61 -0
  34. package/dist/services/api.service.js +289 -0
  35. package/dist/services/auth.service.d.ts +87 -0
  36. package/dist/services/auth.service.js +266 -0
  37. package/dist/services/index.d.ts +30 -0
  38. package/dist/services/index.js +88 -0
  39. package/dist/services/payment.service.d.ts +20 -0
  40. package/dist/services/payment.service.js +56 -0
  41. package/dist/services/privacy.service.d.ts +16 -0
  42. package/dist/services/privacy.service.js +69 -0
  43. package/dist/services/profile.service.d.ts +20 -0
  44. package/dist/services/profile.service.js +158 -0
  45. package/dist/services/subscription.service.d.ts +7 -0
  46. package/dist/services/subscription.service.js +46 -0
  47. package/dist/services/user.service.d.ts +25 -0
  48. package/dist/services/user.service.js +109 -0
  49. package/dist/styles/colors.d.ts +24 -0
  50. package/dist/styles/colors.js +31 -0
  51. package/dist/styles/shared.d.ts +168 -0
  52. package/dist/styles/shared.js +177 -0
  53. package/dist/types/index.d.ts +136 -2
  54. package/dist/types/index.js +7 -1
  55. package/dist/utils/api.d.ts +20 -0
  56. package/dist/utils/api.js +546 -0
  57. package/dist/utils/authEvents.d.ts +44 -0
  58. package/dist/utils/authEvents.js +73 -0
  59. package/dist/utils/errorHandler.d.ts +68 -0
  60. package/dist/utils/errorHandler.js +166 -0
  61. package/dist/utils/index.d.ts +12 -0
  62. package/dist/utils/index.js +41 -0
  63. package/dist/utils/logger.d.ts +100 -0
  64. package/dist/utils/logger.js +298 -0
  65. package/dist/utils/socket.d.ts +6 -0
  66. package/dist/utils/socket.js +179 -0
  67. package/dist/utils/socketConfig.d.ts +32 -0
  68. package/dist/utils/socketConfig.js +67 -0
  69. package/dist/utils/storage.d.ts +54 -0
  70. package/dist/utils/storage.js +253 -0
  71. package/package.json +71 -59
  72. package/dist/assets/dot-icon.d.ts +0 -3
  73. package/dist/assets/dot-icon.d.ts.map +0 -1
  74. package/dist/assets/dot-icon.js +0 -6
  75. package/dist/assets/verified-icon.d.ts +0 -3
  76. package/dist/assets/verified-icon.d.ts.map +0 -1
  77. package/dist/assets/verified-icon.js +0 -10
  78. package/dist/components/assets/oxy-logo.d.ts +0 -3
  79. package/dist/components/assets/oxy-logo.d.ts.map +0 -1
  80. package/dist/components/assets/oxy-logo.js +0 -30
  81. package/dist/components/auth/AccountSwitcherModal.d.ts +0 -7
  82. package/dist/components/auth/AccountSwitcherModal.d.ts.map +0 -1
  83. package/dist/components/auth/AccountSwitcherModal.js +0 -91
  84. package/dist/components/auth/SessionOwnerButton.d.ts +0 -3
  85. package/dist/components/auth/SessionOwnerButton.d.ts.map +0 -1
  86. package/dist/components/auth/SessionOwnerButton.js +0 -35
  87. package/dist/components/auth/SignInButton.d.ts +0 -8
  88. package/dist/components/auth/SignInButton.d.ts.map +0 -1
  89. package/dist/components/auth/SignInButton.js +0 -15
  90. package/dist/components/auth/styles/account-switcher-modal.module.css +0 -29
  91. package/dist/components/auth/styles/account-switcher-modal.module.css.map +0 -1
  92. package/dist/components/auth/styles/oavatar.module.css +0 -34
  93. package/dist/components/auth/styles/oavatar.module.css.map +0 -1
  94. package/dist/components/auth/styles/session-owner-modal.module.css +0 -35
  95. package/dist/components/auth/styles/session-owner-modal.module.css.map +0 -1
  96. package/dist/components/auth/styles/sign-in-button.module.css +0 -30
  97. package/dist/components/auth/styles/sign-in-button.module.css.map +0 -1
  98. package/dist/components/elements/button/components/button.d.ts +0 -7
  99. package/dist/components/elements/button/components/button.d.ts.map +0 -1
  100. package/dist/components/elements/button/components/button.js +0 -6
  101. package/dist/components/elements/button/components/styles/button.module.css +0 -25
  102. package/dist/components/elements/button/components/styles/button.module.css.map +0 -1
  103. package/dist/components/elements/button/index.d.ts +0 -2
  104. package/dist/components/elements/button/index.d.ts.map +0 -1
  105. package/dist/components/elements/button/index.js +0 -1
  106. package/dist/components/elements/ellipsis-wrapper/components/EllipsisWrapper.d.ts +0 -5
  107. package/dist/components/elements/ellipsis-wrapper/components/EllipsisWrapper.d.ts.map +0 -1
  108. package/dist/components/elements/ellipsis-wrapper/components/EllipsisWrapper.js +0 -4
  109. package/dist/components/elements/ellipsis-wrapper/components/ellipsis-wrapper.d.ts +0 -5
  110. package/dist/components/elements/ellipsis-wrapper/components/ellipsis-wrapper.d.ts.map +0 -1
  111. package/dist/components/elements/ellipsis-wrapper/components/ellipsis-wrapper.js +0 -4
  112. package/dist/components/elements/ellipsis-wrapper/components/styles/ellipses-wrapper.module.css +0 -11
  113. package/dist/components/elements/ellipsis-wrapper/components/styles/ellipses-wrapper.module.css.map +0 -1
  114. package/dist/components/elements/ellipsis-wrapper/index.d.ts +0 -2
  115. package/dist/components/elements/ellipsis-wrapper/index.d.ts.map +0 -1
  116. package/dist/components/elements/ellipsis-wrapper/index.js +0 -1
  117. package/dist/components/elements/modal/components/confirmation-modal.d.ts +0 -12
  118. package/dist/components/elements/modal/components/confirmation-modal.d.ts.map +0 -1
  119. package/dist/components/elements/modal/components/confirmation-modal.js +0 -21
  120. package/dist/components/elements/modal/components/modal.d.ts +0 -13
  121. package/dist/components/elements/modal/components/modal.d.ts.map +0 -1
  122. package/dist/components/elements/modal/components/modal.js +0 -111
  123. package/dist/components/elements/modal/components/styles/confirmation-modal.module.css +0 -105
  124. package/dist/components/elements/modal/components/styles/confirmation-modal.module.css.map +0 -1
  125. package/dist/components/elements/modal/components/styles/modal.module.css +0 -10
  126. package/dist/components/elements/modal/components/styles/modal.module.css.map +0 -1
  127. package/dist/components/elements/modal/hooks/use-track-position.d.ts +0 -5
  128. package/dist/components/elements/modal/hooks/use-track-position.d.ts.map +0 -1
  129. package/dist/components/elements/modal/hooks/use-track-position.js +0 -35
  130. package/dist/components/elements/modal/index.d.ts +0 -4
  131. package/dist/components/elements/modal/index.d.ts.map +0 -1
  132. package/dist/components/elements/modal/index.js +0 -3
  133. package/dist/config/index.d.ts +0 -21
  134. package/dist/config/index.d.ts.map +0 -1
  135. package/dist/config/index.js +0 -7
  136. package/dist/features/profile/components/avatar.d.ts +0 -10
  137. package/dist/features/profile/components/avatar.d.ts.map +0 -1
  138. package/dist/features/profile/components/avatar.js +0 -7
  139. package/dist/features/profile/components/styles/avatar.module.css +0 -15
  140. package/dist/features/profile/components/styles/avatar.module.css.map +0 -1
  141. package/dist/features/profile/components/styles/user-name.module.css +0 -18
  142. package/dist/features/profile/components/styles/user-name.module.css.map +0 -1
  143. package/dist/features/profile/components/styles/user-username.module.css +0 -6
  144. package/dist/features/profile/components/styles/user-username.module.css.map +0 -1
  145. package/dist/features/profile/components/user-name.d.ts +0 -7
  146. package/dist/features/profile/components/user-name.d.ts.map +0 -1
  147. package/dist/features/profile/components/user-name.js +0 -8
  148. package/dist/features/profile/components/user-username.d.ts +0 -5
  149. package/dist/features/profile/components/user-username.d.ts.map +0 -1
  150. package/dist/features/profile/components/user-username.js +0 -7
  151. package/dist/features/profile/index.d.ts +0 -4
  152. package/dist/features/profile/index.d.ts.map +0 -1
  153. package/dist/features/profile/index.js +0 -3
  154. package/dist/hooks/get-user.d.ts +0 -2
  155. package/dist/hooks/get-user.d.ts.map +0 -1
  156. package/dist/hooks/get-user.js +0 -31
  157. package/dist/hooks/getClientKey.d.ts +0 -2
  158. package/dist/hooks/getClientKey.d.ts.map +0 -1
  159. package/dist/hooks/getClientKey.js +0 -19
  160. package/dist/hooks/getUserById.d.ts +0 -11
  161. package/dist/hooks/getUserById.d.ts.map +0 -1
  162. package/dist/hooks/getUserById.js +0 -31
  163. package/dist/hooks/use-user.d.ts +0 -14
  164. package/dist/hooks/use-user.d.ts.map +0 -1
  165. package/dist/hooks/use-user.js +0 -8
  166. package/dist/hooks/useCrossDomainStorage.d.ts +0 -6
  167. package/dist/hooks/useCrossDomainStorage.d.ts.map +0 -1
  168. package/dist/hooks/useCrossDomainStorage.js +0 -24
  169. package/dist/hooks/useOxySession.d.ts +0 -30
  170. package/dist/hooks/useOxySession.d.ts.map +0 -1
  171. package/dist/hooks/useOxySession.js +0 -64
  172. package/dist/index.css +0 -5
  173. package/dist/index.css.map +0 -1
  174. package/dist/index.d.ts.map +0 -1
  175. package/dist/interfaces/index.d.ts +0 -10
  176. package/dist/interfaces/index.d.ts.map +0 -1
  177. package/dist/interfaces/index.js +0 -1
  178. package/dist/types/index.d.ts.map +0 -1
  179. package/dist/utils/cn.d.ts +0 -3
  180. package/dist/utils/cn.d.ts.map +0 -1
  181. package/dist/utils/cn.js +0 -5
package/README.md CHANGED
@@ -1,114 +1,304 @@
1
- # Oxy Services Module 🚀
1
+ # OxyHQ Services Module
2
2
 
3
- The Oxy Services Module is a comprehensive package designed to provide reusable services and components for building front-end applications with Oxy. It includes hooks and components for session management, user handling, and more, making it easier to integrate Oxy-based functionalities into your React applications.
3
+ A comprehensive module for interacting with the OxyHQ platform APIs. This module provides authentication, profile management, file handling, and other services.
4
4
 
5
- ## Features
6
- - **Session Management**: Easily manage user sessions with hooks like `useOxySession`.
7
- - **User Handling**: Fetch and display user information using functions like `getUserById`.
8
- - **Components**: Ready-to-use components such as `SignInButton`, `AccountSwitcherModal`, and `SessionOwnerButton`.
5
+ ## Features
9
6
 
10
- ## Usage Instructions
7
+ - 🔐 **Authentication**: Complete authentication flow with token management
8
+ - 👤 **Profile Management**: User profile creation, retrieval, and updates
9
+ - 📁 **File Handling**: Upload, download, and manage files
10
+ - 💳 **Payments**: Process payments and manage subscriptions
11
+ - 🔄 **Caching**: Efficient data caching for improved performance
12
+ - 🔌 **Offline Support**: Graceful handling of offline scenarios
13
+ - 📊 **Analytics**: User activity tracking and reporting
14
+ - 🚀 **Performance Optimized**: Lazy loading, request deduplication, and more
11
15
 
12
- To use the OxyServicesModule, follow these steps:
16
+ ## Installation
13
17
 
14
- 1. Install the package:
15
- ```bash
16
- npm install @oxyhq/services
17
- ```
18
+ ```bash
19
+ npm install @oxyhq/services
20
+ ```
18
21
 
19
- 2. Import the necessary components and hooks in your project:
20
- ```javascript
21
- import { useOxySession, getUserById, SignInButton, AccountSwitcherModal, SessionOwnerButton } from '@oxyhq/services';
22
- ```
22
+ ## Quick Start
23
23
 
24
- 3. Use the components and hooks in your application. For example, to use the `SignInButton` component:
25
- ```javascript
26
- import React from 'react';
27
- import { SignInButton } from '@oxyhq/services';
24
+ ```typescript
25
+ import { initialize, authService, oxyClient } from '@oxyhq/services';
28
26
 
29
- const App = () => {
30
- return (
31
- <div>
32
- <SignInButton />
33
- </div>
34
- );
35
- };
27
+ // Initialize the module with custom configuration
28
+ initialize({
29
+ apiUrl: 'https://api.your-instance.oxy.so',
30
+ enableLogging: true,
31
+ logLevel: 'debug'
32
+ });
36
33
 
37
- export default App;
38
- ```
34
+ // Use the authentication service
35
+ const login = async () => {
36
+ try {
37
+ const result = await authService.login({
38
+ email: 'user@example.com',
39
+ password: 'password123'
40
+ });
41
+ console.log('Logged in successfully', result.user);
42
+ } catch (error) {
43
+ console.error('Login failed', error);
44
+ }
45
+ };
39
46
 
40
- ## Examples
47
+ // Get a user profile
48
+ const getProfile = async (userId) => {
49
+ try {
50
+ const profile = await oxyClient.getProfile(userId);
51
+ console.log('Profile retrieved', profile);
52
+ } catch (error) {
53
+ console.error('Failed to get profile', error);
54
+ }
55
+ };
56
+ ```
41
57
 
42
- ### Example 1: Using `useOxySession` Hook
58
+ ## Architecture
43
59
 
44
- The `useOxySession` hook fetches session data and provides error handling and status management.
60
+ The OxyHQ Services module is built with a focus on performance, maintainability, and developer experience. Key architectural features include:
45
61
 
46
- ```javascript
47
- import React from 'react';
48
- import { useOxySession } from '@oxyhq/services';
62
+ ### Service Layer
49
63
 
50
- const SessionComponent = () => {
51
- const { session, status, error } = useOxySession();
64
+ The module is organized into specialized services, each responsible for a specific domain:
52
65
 
53
- if (status === 'loading') {
54
- return <div>Loading...</div>;
55
- }
66
+ - **ApiService**: Core HTTP client with caching, retry logic, and token management
67
+ - **AuthService**: Authentication and session management
68
+ - **OxyClient**: High-level client for OxyHQ platform features
69
+ - **ProfileService**: User profile management
70
+ - **PaymentService**: Payment processing
71
+ - **SubscriptionService**: Subscription management
72
+ - **PrivacyService**: Privacy settings management
56
73
 
57
- if (status === 'error') {
58
- return <div>Error: {error}</div>;
59
- }
74
+ ### Lazy Loading
60
75
 
61
- return (
62
- <div>
63
- <h1>Welcome, {session.user.name}!</h1>
64
- <p>Email: {session.user.email}</p>
65
- </div>
66
- );
67
- };
76
+ Services are lazy-loaded to minimize initial bundle size and improve startup performance. The module exports getter functions that instantiate services only when needed:
68
77
 
69
- export default SessionComponent;
78
+ ```typescript
79
+ import { getAuthService, getOxyClient } from '@oxyhq/services';
80
+
81
+ // Service is instantiated only when called
82
+ const auth = getAuthService();
70
83
  ```
71
84
 
72
- ### Example 2: Using `getUserById` Function
85
+ ### Caching System
73
86
 
74
- The `getUserById` function fetches user data by ID and handles possible errors.
87
+ The module includes a sophisticated caching system to minimize network requests:
75
88
 
76
- ```javascript
77
- import React, { useEffect, useState } from 'react';
78
- import { getUserById } from '@oxyhq/services';
89
+ - **In-memory Cache**: Fast access to recently used data
90
+ - **Persistent Cache**: Data is stored for offline access
91
+ - **Cache Invalidation**: Automatic and manual cache invalidation strategies
92
+ - **TTL Support**: Time-based expiration for cached items
79
93
 
80
- const UserComponent = ({ userId }) => {
81
- const [user, setUser] = useState(null);
82
- const [error, setError] = useState(null);
94
+ ### Error Handling
83
95
 
84
- useEffect(() => {
85
- const fetchUser = async () => {
86
- try {
87
- const fetchedUser = await getUserById(userId);
88
- setUser(fetchedUser);
89
- } catch (err) {
90
- setError(err.message);
91
- }
92
- };
96
+ Comprehensive error handling with:
93
97
 
94
- fetchUser();
95
- }, [userId]);
98
+ - **Error Normalization**: Consistent error format across services
99
+ - **Retry Logic**: Automatic retry for transient failures
100
+ - **Offline Detection**: Graceful handling of network unavailability
101
+ - **Detailed Logging**: Contextual error information for debugging
96
102
 
97
- if (error) {
98
- return <div>Error: {error}</div>;
99
- }
103
+ ### Logging
100
104
 
101
- if (!user) {
102
- return <div>Loading...</div>;
103
- }
105
+ A centralized logging system with:
106
+
107
+ - **Log Levels**: DEBUG, INFO, WARN, ERROR, FATAL
108
+ - **Context Support**: Logs include contextual information
109
+ - **Remote Logging**: Optional sending of logs to a remote server
110
+ - **Performance Metrics**: Timing of operations for performance analysis
111
+ - **Sensitive Data Redaction**: Automatic redaction of sensitive information
112
+
113
+ ## API Reference
114
+
115
+ ### Core Services
116
+
117
+ #### ApiService
118
+
119
+ Low-level HTTP client with caching, retry logic, and token management.
120
+
121
+ ```typescript
122
+ import { apiService } from '@oxyhq/services';
123
+
124
+ // GET request with caching
125
+ const data = await apiService.get('/endpoint', {
126
+ useCache: true,
127
+ cacheTTL: 5 * 60 * 1000 // 5 minutes
128
+ });
129
+
130
+ // POST request
131
+ const result = await apiService.post('/endpoint', { data: 'value' });
132
+
133
+ // Cancel requests
134
+ apiService.cancelAllRequests();
135
+ ```
136
+
137
+ #### OxyClient
138
+
139
+ High-level client for OxyHQ platform features.
140
+
141
+ ```typescript
142
+ import { oxyClient } from '@oxyhq/services';
143
+
144
+ // Get user profile
145
+ const profile = await oxyClient.getProfile('user-id');
146
+
147
+ // Get file data
148
+ const files = await oxyClient.getFilesData(['file-id-1', 'file-id-2']);
149
+
150
+ // Get recommendations
151
+ const recommendations = await oxyClient.getRecommendations(10);
152
+ ```
153
+
154
+ ### Authentication
155
+
156
+ ```typescript
157
+ import { authService } from '@oxyhq/services';
158
+
159
+ // Login
160
+ const loginResult = await authService.login({
161
+ email: 'user@example.com',
162
+ password: 'password123'
163
+ });
164
+
165
+ // Register
166
+ const registerResult = await authService.register({
167
+ username: 'newuser',
168
+ email: 'newuser@example.com',
169
+ password: 'password123'
170
+ });
171
+
172
+ // Logout
173
+ await authService.logout();
174
+
175
+ // Check if user is authenticated
176
+ const isAuthenticated = await authService.isAuthenticated();
177
+ ```
178
+
179
+ ### User Management
180
+
181
+ ```typescript
182
+ import { userService } from '@oxyhq/services';
183
+
184
+ // Get current user
185
+ const currentUser = await userService.getCurrentUser();
186
+
187
+ // Update user profile
188
+ await userService.updateProfile({
189
+ name: {
190
+ first: 'John',
191
+ last: 'Doe'
192
+ },
193
+ avatar: 'avatar-url'
194
+ });
195
+
196
+ // Follow a user
197
+ await userService.followUser('user-id-to-follow');
198
+
199
+ // Unfollow a user
200
+ await userService.unfollowUser('user-id-to-unfollow');
201
+ ```
202
+
203
+ ### File Management
204
+
205
+ ```typescript
206
+ import { useFiles } from '@oxyhq/services';
207
+
208
+ // In a React component
209
+ function MyComponent() {
210
+ const {
211
+ uploadFile,
212
+ deleteFile,
213
+ getFileUrl,
214
+ isUploading
215
+ } = useFiles();
216
+
217
+ const handleUpload = async (file) => {
218
+ const fileId = await uploadFile(file);
219
+ console.log('File uploaded with ID:', fileId);
220
+ };
104
221
 
105
222
  return (
106
223
  <div>
107
- <h1>{user.name}</h1>
108
- <p>Email: {user.email}</p>
224
+ <input type="file" onChange={(e) => handleUpload(e.target.files[0])} />
225
+ {isUploading && <p>Uploading...</p>}
109
226
  </div>
110
227
  );
228
+ }
229
+ ```
230
+
231
+ ### Configuration
232
+
233
+ The module can be configured using the `initialize` function:
234
+
235
+ ```typescript
236
+ import { initialize } from '@oxyhq/services';
237
+
238
+ initialize({
239
+ apiUrl: 'https://api.custom-instance.oxy.so',
240
+ cloudUrl: 'https://files.custom-instance.oxy.so',
241
+ enableLogging: true,
242
+ logLevel: 'debug',
243
+ enableOfflineMode: true
244
+ });
245
+ ```
246
+
247
+ ## Advanced Usage
248
+
249
+ ### Custom Error Handling
250
+
251
+ ```typescript
252
+ import { errorHandler } from '@oxyhq/services';
253
+
254
+ try {
255
+ // Your code
256
+ } catch (error) {
257
+ errorHandler.handleError(error, {
258
+ context: 'Custom operation',
259
+ fallbackMessage: 'Operation failed',
260
+ showToast: true,
261
+ onAuthError: () => {
262
+ // Handle authentication errors
263
+ }
264
+ });
265
+ }
266
+ ```
267
+
268
+ ### Performance Logging
269
+
270
+ ```typescript
271
+ import { logger } from '@oxyhq/services';
272
+
273
+ const performOperation = async () => {
274
+ const startTime = Date.now();
275
+
276
+ try {
277
+ // Perform operation
278
+ await someExpensiveOperation();
279
+ } finally {
280
+ // Log performance metrics
281
+ logger.logPerformance('someExpensiveOperation', startTime, 'MyComponent');
282
+ }
111
283
  };
284
+ ```
285
+
286
+ ### Scoped Logging
287
+
288
+ ```typescript
289
+ import { logger } from '@oxyhq/services';
290
+
291
+ // Create a logger scoped to a specific context
292
+ const componentLogger = logger.createScopedLogger('MyComponent');
112
293
 
113
- export default UserComponent;
294
+ componentLogger.info('Component initialized');
295
+ componentLogger.error('Error in component', { details: 'error details' });
114
296
  ```
297
+
298
+ ## Contributing
299
+
300
+ We welcome contributions to the OxyHQ Services module! Please see our [Contributing Guide](CONTRIBUTING.md) for more information.
301
+
302
+ ## License
303
+
304
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,24 @@
1
+ import { OxyProfile } from '../../types';
2
+ export type AuthMode = 'signin' | 'signup' | 'session';
3
+ export interface AuthBottomSheetProps {
4
+ /** Initial auth mode to display */
5
+ initialMode?: AuthMode;
6
+ /** Whether to show the logo in the header (default: true) */
7
+ showLogo?: boolean;
8
+ /** Callback when authentication is successful */
9
+ onSuccess?: () => void;
10
+ }
11
+ export interface UserSession {
12
+ id: string;
13
+ username: string;
14
+ name?: {
15
+ first?: string;
16
+ last?: string;
17
+ };
18
+ avatar?: string;
19
+ }
20
+ export interface Session {
21
+ id: string;
22
+ profile: OxyProfile;
23
+ lastActive: Date;
24
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,35 @@
1
+ export interface FileType {
2
+ _id: string;
3
+ filename: string;
4
+ contentType: string;
5
+ uploadDate: string;
6
+ length: number;
7
+ metadata?: {
8
+ userID: string;
9
+ originalname?: string;
10
+ sanitizedFilename?: string;
11
+ size?: number;
12
+ uploadDate?: string;
13
+ };
14
+ }
15
+ export interface FileSelectorModalProps {
16
+ isVisible: boolean;
17
+ onClose: () => void;
18
+ onSelect: (files: FileType[]) => void;
19
+ options?: {
20
+ fileTypeFilter?: string[];
21
+ maxFiles?: number;
22
+ };
23
+ }
24
+ export interface UseFilesOptions {
25
+ fileTypeFilter?: string[];
26
+ maxFiles?: number;
27
+ userId?: string;
28
+ }
29
+ export interface FileItemProps {
30
+ file: FileType;
31
+ isSelected: boolean;
32
+ onSelect: (file: FileType) => void;
33
+ onDelete: (fileId: string) => void;
34
+ baseUrl: string;
35
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,26 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { User } from '../services/auth.service';
3
+ import type { UserSession } from '../services/user.service';
4
+ interface SessionState {
5
+ userId: string | null;
6
+ loading: boolean;
7
+ error: string | null;
8
+ user: User | null;
9
+ sessions: UserSession[];
10
+ lastActivity: number;
11
+ }
12
+ export interface SessionContextType {
13
+ state: SessionState;
14
+ loginUser: (username: string, password: string) => Promise<void>;
15
+ logoutUser: () => Promise<boolean>;
16
+ getCurrentUserId: () => string | null;
17
+ switchSession: (userId: string) => Promise<void>;
18
+ refreshTokenIfNeeded: () => Promise<boolean>;
19
+ sessions: UserSession[];
20
+ isAuthenticated: boolean;
21
+ }
22
+ export declare const SessionContext: import("react").Context<SessionContextType | null>;
23
+ export declare function SessionProvider({ children }: {
24
+ children: ReactNode;
25
+ }): import("react").JSX.Element;
26
+ export {};