@oxyhq/services 5.2.2 → 5.2.4
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.
- package/lib/commonjs/core/index.js +117 -0
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/models/secureSession.js +2 -0
- package/lib/commonjs/models/secureSession.js.map +1 -0
- package/lib/commonjs/ui/context/LegacyOxyContext.js +643 -0
- package/lib/commonjs/ui/context/LegacyOxyContext.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +215 -450
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/SecureOxyContext.js +408 -0
- package/lib/commonjs/ui/context/SecureOxyContext.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +3 -3
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +31 -30
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +4 -4
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +34 -34
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +2 -2
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/core/index.js +117 -0
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/models/secureSession.js +2 -0
- package/lib/module/models/secureSession.js.map +1 -0
- package/lib/module/ui/context/LegacyOxyContext.js +639 -0
- package/lib/module/ui/context/LegacyOxyContext.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +214 -450
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/SecureOxyContext.js +403 -0
- package/lib/module/ui/context/SecureOxyContext.js.map +1 -0
- package/lib/module/ui/screens/AccountCenterScreen.js +3 -3
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +31 -30
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +4 -4
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +34 -34
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +2 -2
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/typescript/core/index.d.ts +51 -0
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/models/secureSession.d.ts +25 -0
- package/lib/typescript/models/secureSession.d.ts.map +1 -0
- package/lib/typescript/ui/context/LegacyOxyContext.d.ts +40 -0
- package/lib/typescript/ui/context/LegacyOxyContext.d.ts.map +1 -0
- package/lib/typescript/ui/context/OxyContext.d.ts +11 -12
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/context/SecureOxyContext.d.ts +39 -0
- package/lib/typescript/ui/context/SecureOxyContext.d.ts.map +1 -0
- package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/index.ts +117 -0
- package/src/index.ts +2 -2
- package/src/models/secureSession.ts +27 -0
- package/src/ui/context/LegacyOxyContext.tsx +735 -0
- package/src/ui/context/OxyContext.tsx +412 -674
- package/src/ui/context/SecureOxyContext.tsx +473 -0
- package/src/ui/screens/AccountCenterScreen.tsx +4 -4
- package/src/ui/screens/AccountSwitcherScreen.tsx +36 -34
- package/src/ui/screens/AppInfoScreen.tsx +3 -3
- package/src/ui/screens/SessionManagementScreen.tsx +31 -35
- package/src/ui/screens/SignInScreen.tsx +2 -2
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useLegacyOxy = exports.LegacyOxyContextProvider = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } // Define authenticated user with tokens
|
|
10
|
+
// Define the legacy context shape
|
|
11
|
+
// Create the context with default values
|
|
12
|
+
const LegacyOxyContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
13
|
+
|
|
14
|
+
// Props for the LegacyOxyContextProvider
|
|
15
|
+
|
|
16
|
+
// Platform storage implementation
|
|
17
|
+
|
|
18
|
+
// Web localStorage implementation
|
|
19
|
+
class WebStorage {
|
|
20
|
+
async getItem(key) {
|
|
21
|
+
return localStorage.getItem(key);
|
|
22
|
+
}
|
|
23
|
+
async setItem(key, value) {
|
|
24
|
+
localStorage.setItem(key, value);
|
|
25
|
+
}
|
|
26
|
+
async removeItem(key) {
|
|
27
|
+
localStorage.removeItem(key);
|
|
28
|
+
}
|
|
29
|
+
async clear() {
|
|
30
|
+
localStorage.clear();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// React Native AsyncStorage implementation
|
|
35
|
+
// This will be dynamically imported only in React Native environment
|
|
36
|
+
let AsyncStorage;
|
|
37
|
+
|
|
38
|
+
// Determine the platform and set up storage
|
|
39
|
+
const isReactNative = () => {
|
|
40
|
+
return typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Get appropriate storage for the platform
|
|
44
|
+
const getStorage = async () => {
|
|
45
|
+
if (isReactNative()) {
|
|
46
|
+
// Dynamically import AsyncStorage only in React Native environment
|
|
47
|
+
if (!AsyncStorage) {
|
|
48
|
+
try {
|
|
49
|
+
const asyncStorageModule = await Promise.resolve().then(() => _interopRequireWildcard(require('@react-native-async-storage/async-storage')));
|
|
50
|
+
AsyncStorage = asyncStorageModule.default;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error('Failed to import AsyncStorage:', error);
|
|
53
|
+
throw new Error('AsyncStorage is required in React Native environment');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return AsyncStorage;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Default to web storage
|
|
60
|
+
return new WebStorage();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// Storage keys
|
|
64
|
+
const getStorageKeys = (prefix = 'oxy') => ({
|
|
65
|
+
users: `${prefix}_users`,
|
|
66
|
+
// Array of authenticated users with tokens
|
|
67
|
+
activeUserId: `${prefix}_active_user_id`,
|
|
68
|
+
// ID of currently active user
|
|
69
|
+
// Legacy keys for migration
|
|
70
|
+
accessToken: `${prefix}_access_token`,
|
|
71
|
+
refreshToken: `${prefix}_refresh_token`,
|
|
72
|
+
user: `${prefix}_user`
|
|
73
|
+
});
|
|
74
|
+
const LegacyOxyContextProvider = ({
|
|
75
|
+
children,
|
|
76
|
+
oxyServices,
|
|
77
|
+
storageKeyPrefix = 'oxy',
|
|
78
|
+
onAuthStateChange,
|
|
79
|
+
bottomSheetRef
|
|
80
|
+
}) => {
|
|
81
|
+
// Authentication state
|
|
82
|
+
const [user, setUser] = (0, _react.useState)(null);
|
|
83
|
+
const [users, setUsers] = (0, _react.useState)([]);
|
|
84
|
+
const [isLoading, setIsLoading] = (0, _react.useState)(true);
|
|
85
|
+
const [error, setError] = (0, _react.useState)(null);
|
|
86
|
+
const [storage, setStorage] = (0, _react.useState)(null);
|
|
87
|
+
|
|
88
|
+
// Storage keys (memoized to prevent infinite loops)
|
|
89
|
+
const keys = (0, _react.useMemo)(() => getStorageKeys(storageKeyPrefix), [storageKeyPrefix]);
|
|
90
|
+
|
|
91
|
+
// Initialize storage
|
|
92
|
+
(0, _react.useEffect)(() => {
|
|
93
|
+
const initStorage = async () => {
|
|
94
|
+
try {
|
|
95
|
+
const platformStorage = await getStorage();
|
|
96
|
+
setStorage(platformStorage);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error('Failed to initialize storage:', error);
|
|
99
|
+
setError('Failed to initialize storage');
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
initStorage();
|
|
103
|
+
}, []);
|
|
104
|
+
|
|
105
|
+
// Effect to initialize authentication state
|
|
106
|
+
(0, _react.useEffect)(() => {
|
|
107
|
+
const initAuth = async () => {
|
|
108
|
+
if (!storage) return;
|
|
109
|
+
setIsLoading(true);
|
|
110
|
+
try {
|
|
111
|
+
// Check for multi-user data first
|
|
112
|
+
const usersData = await storage.getItem(keys.users);
|
|
113
|
+
const activeUserId = await storage.getItem(keys.activeUserId);
|
|
114
|
+
console.log('InitAuth - usersData:', usersData);
|
|
115
|
+
console.log('InitAuth - activeUserId:', activeUserId);
|
|
116
|
+
if (usersData) {
|
|
117
|
+
// Multi-user setup exists
|
|
118
|
+
const parsedUsers = JSON.parse(usersData);
|
|
119
|
+
console.log('InitAuth - parsedUsers:', parsedUsers);
|
|
120
|
+
setUsers(parsedUsers);
|
|
121
|
+
if (activeUserId && parsedUsers.length > 0) {
|
|
122
|
+
const activeUser = parsedUsers.find(u => u.id === activeUserId);
|
|
123
|
+
console.log('InitAuth - activeUser found:', activeUser);
|
|
124
|
+
if (activeUser) {
|
|
125
|
+
setUser(activeUser);
|
|
126
|
+
oxyServices.setTokens(activeUser.accessToken, activeUser.refreshToken || activeUser.accessToken);
|
|
127
|
+
|
|
128
|
+
// Validate the tokens
|
|
129
|
+
const isValid = await oxyServices.validate();
|
|
130
|
+
console.log('InitAuth - token validation result:', isValid);
|
|
131
|
+
if (!isValid) {
|
|
132
|
+
// Remove invalid user during initialization
|
|
133
|
+
console.log('InitAuth - removing invalid user due to failed validation');
|
|
134
|
+
const filteredUsers = parsedUsers.filter(u => u.id !== activeUser.id);
|
|
135
|
+
setUsers(filteredUsers);
|
|
136
|
+
await saveUsersToStorage(filteredUsers);
|
|
137
|
+
|
|
138
|
+
// If there are other users, switch to the first one
|
|
139
|
+
if (filteredUsers.length > 0) {
|
|
140
|
+
const newActiveUser = filteredUsers[0];
|
|
141
|
+
setUser(newActiveUser);
|
|
142
|
+
await saveActiveUserId(newActiveUser.id);
|
|
143
|
+
oxyServices.setTokens(newActiveUser.accessToken, newActiveUser.refreshToken || newActiveUser.accessToken);
|
|
144
|
+
if (onAuthStateChange) {
|
|
145
|
+
onAuthStateChange(newActiveUser);
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
// No valid users left
|
|
149
|
+
setUser(null);
|
|
150
|
+
await storage.removeItem(keys.activeUserId);
|
|
151
|
+
oxyServices.clearTokens();
|
|
152
|
+
if (onAuthStateChange) {
|
|
153
|
+
onAuthStateChange(null);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
console.log('InitAuth - user validated successfully, setting auth state');
|
|
158
|
+
// Notify about auth state change
|
|
159
|
+
if (onAuthStateChange) {
|
|
160
|
+
onAuthStateChange(activeUser);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
console.log('InitAuth - no users data, checking legacy auth');
|
|
167
|
+
// Check for legacy single-user data and migrate
|
|
168
|
+
await migrateLegacyAuth();
|
|
169
|
+
}
|
|
170
|
+
} catch (err) {
|
|
171
|
+
console.error('Auth initialization error:', err);
|
|
172
|
+
await clearAllStorage();
|
|
173
|
+
oxyServices.clearTokens();
|
|
174
|
+
} finally {
|
|
175
|
+
setIsLoading(false);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
if (storage) {
|
|
179
|
+
initAuth();
|
|
180
|
+
}
|
|
181
|
+
}, [storage, oxyServices, keys, onAuthStateChange]);
|
|
182
|
+
|
|
183
|
+
// Migrate legacy single-user authentication to multi-user
|
|
184
|
+
const migrateLegacyAuth = (0, _react.useCallback)(async () => {
|
|
185
|
+
if (!storage) return;
|
|
186
|
+
try {
|
|
187
|
+
const accessToken = await storage.getItem(keys.accessToken);
|
|
188
|
+
const refreshToken = await storage.getItem(keys.refreshToken);
|
|
189
|
+
const storedUser = await storage.getItem(keys.user);
|
|
190
|
+
if (accessToken && storedUser) {
|
|
191
|
+
// Set tokens in OxyServices
|
|
192
|
+
oxyServices.setTokens(accessToken, refreshToken || accessToken);
|
|
193
|
+
|
|
194
|
+
// Validate the tokens
|
|
195
|
+
const isValid = await oxyServices.validate();
|
|
196
|
+
if (isValid) {
|
|
197
|
+
const parsedUser = JSON.parse(storedUser);
|
|
198
|
+
const authenticatedUser = {
|
|
199
|
+
...parsedUser,
|
|
200
|
+
accessToken,
|
|
201
|
+
refreshToken: refreshToken || undefined
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// Store in new multi-user format
|
|
205
|
+
await storage.setItem(keys.users, JSON.stringify([authenticatedUser]));
|
|
206
|
+
await storage.setItem(keys.activeUserId, authenticatedUser.id);
|
|
207
|
+
|
|
208
|
+
// Set state
|
|
209
|
+
setUsers([authenticatedUser]);
|
|
210
|
+
setUser(authenticatedUser);
|
|
211
|
+
|
|
212
|
+
// Notify about auth state change
|
|
213
|
+
if (onAuthStateChange) {
|
|
214
|
+
onAuthStateChange(authenticatedUser);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Clear legacy storage
|
|
219
|
+
await storage.removeItem(keys.accessToken);
|
|
220
|
+
await storage.removeItem(keys.refreshToken);
|
|
221
|
+
await storage.removeItem(keys.user);
|
|
222
|
+
}
|
|
223
|
+
} catch (err) {
|
|
224
|
+
console.error('Migration error:', err);
|
|
225
|
+
}
|
|
226
|
+
}, [storage, keys, oxyServices, onAuthStateChange]);
|
|
227
|
+
|
|
228
|
+
// Helper to clear legacy storage
|
|
229
|
+
const clearStorage = (0, _react.useCallback)(async () => {
|
|
230
|
+
if (!storage) return;
|
|
231
|
+
try {
|
|
232
|
+
await storage.removeItem(keys.accessToken);
|
|
233
|
+
await storage.removeItem(keys.refreshToken);
|
|
234
|
+
await storage.removeItem(keys.user);
|
|
235
|
+
} catch (err) {
|
|
236
|
+
console.error('Clear storage error:', err);
|
|
237
|
+
}
|
|
238
|
+
}, [storage, keys]);
|
|
239
|
+
|
|
240
|
+
// Helper to clear all storage (multi-user)
|
|
241
|
+
const clearAllStorage = (0, _react.useCallback)(async () => {
|
|
242
|
+
if (!storage) return;
|
|
243
|
+
try {
|
|
244
|
+
await storage.removeItem(keys.users);
|
|
245
|
+
await storage.removeItem(keys.activeUserId);
|
|
246
|
+
// Also clear legacy keys
|
|
247
|
+
await clearStorage();
|
|
248
|
+
} catch (err) {
|
|
249
|
+
console.error('Clear all storage error:', err);
|
|
250
|
+
}
|
|
251
|
+
}, [storage, keys, clearStorage]);
|
|
252
|
+
|
|
253
|
+
// Save users to storage
|
|
254
|
+
const saveUsersToStorage = (0, _react.useCallback)(async usersList => {
|
|
255
|
+
if (!storage) return;
|
|
256
|
+
await storage.setItem(keys.users, JSON.stringify(usersList));
|
|
257
|
+
}, [storage, keys.users]);
|
|
258
|
+
|
|
259
|
+
// Save active user ID to storage
|
|
260
|
+
const saveActiveUserId = (0, _react.useCallback)(async userId => {
|
|
261
|
+
if (!storage) return;
|
|
262
|
+
await storage.setItem(keys.activeUserId, userId);
|
|
263
|
+
}, [storage, keys.activeUserId]);
|
|
264
|
+
|
|
265
|
+
// Utility function to handle different token response formats
|
|
266
|
+
const storeTokens = (0, _react.useCallback)(async response => {
|
|
267
|
+
// Store token and user data
|
|
268
|
+
if (response.accessToken) {
|
|
269
|
+
await storage?.setItem(keys.accessToken, response.accessToken);
|
|
270
|
+
if (response.refreshToken) {
|
|
271
|
+
await storage?.setItem(keys.refreshToken, response.refreshToken);
|
|
272
|
+
}
|
|
273
|
+
} else if (response.token) {
|
|
274
|
+
// Handle legacy API response
|
|
275
|
+
await storage?.setItem(keys.accessToken, response.token);
|
|
276
|
+
}
|
|
277
|
+
await storage?.setItem(keys.user, JSON.stringify(response.user));
|
|
278
|
+
}, [storage, keys]);
|
|
279
|
+
|
|
280
|
+
// Login method (updated for multi-user)
|
|
281
|
+
const login = async (username, password) => {
|
|
282
|
+
if (!storage) throw new Error('Storage not initialized');
|
|
283
|
+
setIsLoading(true);
|
|
284
|
+
setError(null);
|
|
285
|
+
try {
|
|
286
|
+
const response = await oxyServices.login(username, password);
|
|
287
|
+
const accessToken = response.accessToken || response.token;
|
|
288
|
+
if (!accessToken) {
|
|
289
|
+
throw new Error('No access token received from login');
|
|
290
|
+
}
|
|
291
|
+
const newUser = {
|
|
292
|
+
...response.user,
|
|
293
|
+
accessToken,
|
|
294
|
+
refreshToken: response.refreshToken
|
|
295
|
+
// sessionId will be set by backend, but we don't get it in response yet
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
// Check if user already exists
|
|
299
|
+
const existingUserIndex = users.findIndex(u => u.id === newUser.id);
|
|
300
|
+
let updatedUsers;
|
|
301
|
+
if (existingUserIndex >= 0) {
|
|
302
|
+
// Update existing user
|
|
303
|
+
updatedUsers = [...users];
|
|
304
|
+
updatedUsers[existingUserIndex] = newUser;
|
|
305
|
+
} else {
|
|
306
|
+
// Add new user
|
|
307
|
+
updatedUsers = [...users, newUser];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Update state
|
|
311
|
+
setUsers(updatedUsers);
|
|
312
|
+
setUser(newUser);
|
|
313
|
+
|
|
314
|
+
// Save to storage
|
|
315
|
+
await saveUsersToStorage(updatedUsers);
|
|
316
|
+
await saveActiveUserId(newUser.id);
|
|
317
|
+
|
|
318
|
+
// Notify about auth state change
|
|
319
|
+
if (onAuthStateChange) {
|
|
320
|
+
onAuthStateChange(newUser);
|
|
321
|
+
}
|
|
322
|
+
return newUser;
|
|
323
|
+
} catch (err) {
|
|
324
|
+
setError(err.message || 'Login failed');
|
|
325
|
+
throw err;
|
|
326
|
+
} finally {
|
|
327
|
+
setIsLoading(false);
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// Logout method (supports multi-user)
|
|
332
|
+
const logout = async userId => {
|
|
333
|
+
if (!storage) throw new Error('Storage not initialized');
|
|
334
|
+
setIsLoading(true);
|
|
335
|
+
setError(null);
|
|
336
|
+
try {
|
|
337
|
+
const targetUserId = userId || user?.id;
|
|
338
|
+
if (!targetUserId) return;
|
|
339
|
+
const targetUser = users.find(u => u.id === targetUserId);
|
|
340
|
+
if (targetUser) {
|
|
341
|
+
// Set the target user's tokens to logout
|
|
342
|
+
oxyServices.setTokens(targetUser.accessToken, targetUser.refreshToken || targetUser.accessToken);
|
|
343
|
+
try {
|
|
344
|
+
await oxyServices.logout();
|
|
345
|
+
} catch (logoutError) {
|
|
346
|
+
console.warn('Logout API call failed:', logoutError);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// Remove user from list
|
|
350
|
+
const updatedUsers = users.filter(u => u.id !== targetUserId);
|
|
351
|
+
setUsers(updatedUsers);
|
|
352
|
+
|
|
353
|
+
// If logging out current user, switch to another user or clear
|
|
354
|
+
if (targetUserId === user?.id) {
|
|
355
|
+
if (updatedUsers.length > 0) {
|
|
356
|
+
// Switch to first available user
|
|
357
|
+
const nextUser = updatedUsers[0];
|
|
358
|
+
setUser(nextUser);
|
|
359
|
+
oxyServices.setTokens(nextUser.accessToken, nextUser.refreshToken || nextUser.accessToken);
|
|
360
|
+
await saveActiveUserId(nextUser.id);
|
|
361
|
+
if (onAuthStateChange) {
|
|
362
|
+
onAuthStateChange(nextUser);
|
|
363
|
+
}
|
|
364
|
+
} else {
|
|
365
|
+
// No users left
|
|
366
|
+
setUser(null);
|
|
367
|
+
oxyServices.clearTokens();
|
|
368
|
+
await storage.removeItem(keys.activeUserId);
|
|
369
|
+
if (onAuthStateChange) {
|
|
370
|
+
onAuthStateChange(null);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// Save updated users list
|
|
376
|
+
await saveUsersToStorage(updatedUsers);
|
|
377
|
+
}
|
|
378
|
+
} catch (err) {
|
|
379
|
+
setError(err.message || 'Logout failed');
|
|
380
|
+
throw err;
|
|
381
|
+
} finally {
|
|
382
|
+
setIsLoading(false);
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
// Logout all users
|
|
387
|
+
const logoutAll = async () => {
|
|
388
|
+
if (!storage) throw new Error('Storage not initialized');
|
|
389
|
+
setIsLoading(true);
|
|
390
|
+
setError(null);
|
|
391
|
+
try {
|
|
392
|
+
// Logout each user
|
|
393
|
+
for (const userItem of users) {
|
|
394
|
+
try {
|
|
395
|
+
oxyServices.setTokens(userItem.accessToken, userItem.refreshToken || userItem.accessToken);
|
|
396
|
+
await oxyServices.logout();
|
|
397
|
+
} catch (logoutError) {
|
|
398
|
+
console.warn(`Logout failed for user ${userItem.id}:`, logoutError);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// Clear all state and storage
|
|
403
|
+
setUsers([]);
|
|
404
|
+
setUser(null);
|
|
405
|
+
oxyServices.clearTokens();
|
|
406
|
+
await clearAllStorage();
|
|
407
|
+
|
|
408
|
+
// Notify about auth state change
|
|
409
|
+
if (onAuthStateChange) {
|
|
410
|
+
onAuthStateChange(null);
|
|
411
|
+
}
|
|
412
|
+
} catch (err) {
|
|
413
|
+
setError(err.message || 'Logout all failed');
|
|
414
|
+
throw err;
|
|
415
|
+
} finally {
|
|
416
|
+
setIsLoading(false);
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
// Switch user
|
|
421
|
+
const switchUser = async userId => {
|
|
422
|
+
if (!storage) throw new Error('Storage not initialized');
|
|
423
|
+
setError(null);
|
|
424
|
+
try {
|
|
425
|
+
const targetUser = users.find(u => u.id === userId);
|
|
426
|
+
if (!targetUser) {
|
|
427
|
+
throw new Error('User not found');
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// Validate tokens before switching
|
|
431
|
+
oxyServices.setTokens(targetUser.accessToken, targetUser.refreshToken || targetUser.accessToken);
|
|
432
|
+
const isValid = await oxyServices.validate();
|
|
433
|
+
if (!isValid) {
|
|
434
|
+
// Remove invalid user
|
|
435
|
+
await removeUser(userId);
|
|
436
|
+
throw new Error('User session is invalid');
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// Switch to the user
|
|
440
|
+
setUser(targetUser);
|
|
441
|
+
await saveActiveUserId(userId);
|
|
442
|
+
|
|
443
|
+
// Notify about auth state change
|
|
444
|
+
if (onAuthStateChange) {
|
|
445
|
+
onAuthStateChange(targetUser);
|
|
446
|
+
}
|
|
447
|
+
} catch (err) {
|
|
448
|
+
setError(err.message || 'Switch user failed');
|
|
449
|
+
throw err;
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
// Remove user
|
|
454
|
+
const removeUser = async userId => {
|
|
455
|
+
if (!storage) throw new Error('Storage not initialized');
|
|
456
|
+
try {
|
|
457
|
+
const updatedUsers = users.filter(u => u.id !== userId);
|
|
458
|
+
setUsers(updatedUsers);
|
|
459
|
+
|
|
460
|
+
// If removing current user, switch to another or clear
|
|
461
|
+
if (userId === user?.id) {
|
|
462
|
+
if (updatedUsers.length > 0) {
|
|
463
|
+
await switchUser(updatedUsers[0].id);
|
|
464
|
+
} else {
|
|
465
|
+
setUser(null);
|
|
466
|
+
oxyServices.clearTokens();
|
|
467
|
+
await storage.removeItem(keys.activeUserId);
|
|
468
|
+
if (onAuthStateChange) {
|
|
469
|
+
onAuthStateChange(null);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// Save updated users list
|
|
475
|
+
await saveUsersToStorage(updatedUsers);
|
|
476
|
+
} catch (err) {
|
|
477
|
+
setError(err.message || 'Remove user failed');
|
|
478
|
+
throw err;
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
// Get user sessions
|
|
483
|
+
const getUserSessions = async userId => {
|
|
484
|
+
try {
|
|
485
|
+
const targetUserId = userId || user?.id;
|
|
486
|
+
if (!targetUserId) return [];
|
|
487
|
+
const targetUser = users.find(u => u.id === targetUserId);
|
|
488
|
+
if (!targetUser) return [];
|
|
489
|
+
|
|
490
|
+
// Store current tokens to restore later
|
|
491
|
+
const currentUser = user;
|
|
492
|
+
const wasCurrentUser = targetUserId === user?.id;
|
|
493
|
+
if (!wasCurrentUser) {
|
|
494
|
+
// Temporarily switch to target user's tokens
|
|
495
|
+
oxyServices.setTokens(targetUser.accessToken, targetUser.refreshToken || targetUser.accessToken);
|
|
496
|
+
}
|
|
497
|
+
try {
|
|
498
|
+
// Use the new OxyServices method
|
|
499
|
+
const sessions = await oxyServices.getUserSessions();
|
|
500
|
+
return sessions;
|
|
501
|
+
} finally {
|
|
502
|
+
if (!wasCurrentUser && currentUser) {
|
|
503
|
+
// Restore original tokens
|
|
504
|
+
oxyServices.setTokens(currentUser.accessToken, currentUser.refreshToken || currentUser.accessToken);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
} catch (err) {
|
|
508
|
+
console.error('Get user sessions failed:', err);
|
|
509
|
+
return [];
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
// Logout specific session
|
|
514
|
+
const logoutSession = async (sessionId, userId) => {
|
|
515
|
+
try {
|
|
516
|
+
const targetUserId = userId || user?.id;
|
|
517
|
+
if (!targetUserId) return;
|
|
518
|
+
const targetUser = users.find(u => u.id === targetUserId);
|
|
519
|
+
if (!targetUser) return;
|
|
520
|
+
|
|
521
|
+
// Store current tokens to restore later
|
|
522
|
+
const currentUser = user;
|
|
523
|
+
const wasCurrentUser = targetUserId === user?.id;
|
|
524
|
+
if (!wasCurrentUser) {
|
|
525
|
+
// Temporarily switch to target user's tokens
|
|
526
|
+
oxyServices.setTokens(targetUser.accessToken, targetUser.refreshToken || targetUser.accessToken);
|
|
527
|
+
}
|
|
528
|
+
try {
|
|
529
|
+
// Use the new OxyServices method
|
|
530
|
+
await oxyServices.logoutSession(sessionId);
|
|
531
|
+
|
|
532
|
+
// If this is the current user's session, remove them from local state
|
|
533
|
+
if (wasCurrentUser && sessionId === targetUser.sessionId) {
|
|
534
|
+
await removeUser(targetUserId);
|
|
535
|
+
}
|
|
536
|
+
} finally {
|
|
537
|
+
if (!wasCurrentUser && currentUser) {
|
|
538
|
+
// Restore original tokens
|
|
539
|
+
oxyServices.setTokens(currentUser.accessToken, currentUser.refreshToken || currentUser.accessToken);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
} catch (err) {
|
|
543
|
+
console.error('Logout session failed:', err);
|
|
544
|
+
throw err;
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
// Sign up method
|
|
549
|
+
const signUp = async (username, email, password) => {
|
|
550
|
+
if (!storage) throw new Error('Storage not initialized');
|
|
551
|
+
setIsLoading(true);
|
|
552
|
+
setError(null);
|
|
553
|
+
try {
|
|
554
|
+
const response = await oxyServices.signUp(username, email, password);
|
|
555
|
+
setUser(response.user);
|
|
556
|
+
|
|
557
|
+
// Store tokens
|
|
558
|
+
await storeTokens(response);
|
|
559
|
+
|
|
560
|
+
// Notify about auth state change
|
|
561
|
+
if (onAuthStateChange) {
|
|
562
|
+
onAuthStateChange(response.user);
|
|
563
|
+
}
|
|
564
|
+
return response.user;
|
|
565
|
+
} catch (err) {
|
|
566
|
+
setError(err.message || 'Sign up failed');
|
|
567
|
+
throw err;
|
|
568
|
+
} finally {
|
|
569
|
+
setIsLoading(false);
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
// Methods to control the bottom sheet
|
|
574
|
+
const showBottomSheet = (0, _react.useCallback)(screenOrConfig => {
|
|
575
|
+
if (bottomSheetRef?.current) {
|
|
576
|
+
// Expand the bottom sheet
|
|
577
|
+
bottomSheetRef.current.expand();
|
|
578
|
+
if (typeof screenOrConfig === 'string') {
|
|
579
|
+
// If a screen is specified, navigate to it
|
|
580
|
+
if (screenOrConfig && bottomSheetRef.current._navigateToScreen) {
|
|
581
|
+
setTimeout(() => {
|
|
582
|
+
bottomSheetRef.current._navigateToScreen(screenOrConfig);
|
|
583
|
+
}, 100);
|
|
584
|
+
}
|
|
585
|
+
} else if (screenOrConfig && typeof screenOrConfig === 'object' && screenOrConfig.screen) {
|
|
586
|
+
// If an object is passed, navigate and pass props
|
|
587
|
+
if (bottomSheetRef.current._navigateToScreen) {
|
|
588
|
+
setTimeout(() => {
|
|
589
|
+
bottomSheetRef.current._navigateToScreen(screenOrConfig.screen, screenOrConfig.props || {});
|
|
590
|
+
}, 100);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}, [bottomSheetRef]);
|
|
595
|
+
const hideBottomSheet = (0, _react.useCallback)(() => {
|
|
596
|
+
if (bottomSheetRef?.current) {
|
|
597
|
+
bottomSheetRef.current.close();
|
|
598
|
+
}
|
|
599
|
+
}, [bottomSheetRef]);
|
|
600
|
+
|
|
601
|
+
// Build context value
|
|
602
|
+
const contextValue = {
|
|
603
|
+
// Single user state (current active user)
|
|
604
|
+
user,
|
|
605
|
+
isAuthenticated: !!user,
|
|
606
|
+
isLoading,
|
|
607
|
+
error,
|
|
608
|
+
// Multi-user state
|
|
609
|
+
users,
|
|
610
|
+
// Auth methods
|
|
611
|
+
login,
|
|
612
|
+
logout,
|
|
613
|
+
logoutAll,
|
|
614
|
+
signUp,
|
|
615
|
+
// Multi-user methods
|
|
616
|
+
switchUser,
|
|
617
|
+
removeUser,
|
|
618
|
+
getUserSessions,
|
|
619
|
+
logoutSession,
|
|
620
|
+
// OxyServices instance
|
|
621
|
+
oxyServices,
|
|
622
|
+
// Bottom sheet methods
|
|
623
|
+
bottomSheetRef,
|
|
624
|
+
showBottomSheet,
|
|
625
|
+
hideBottomSheet
|
|
626
|
+
};
|
|
627
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(LegacyOxyContext.Provider, {
|
|
628
|
+
value: contextValue,
|
|
629
|
+
children: children
|
|
630
|
+
});
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
// Hook to use the legacy context
|
|
634
|
+
exports.LegacyOxyContextProvider = LegacyOxyContextProvider;
|
|
635
|
+
const useLegacyOxy = () => {
|
|
636
|
+
const context = (0, _react.useContext)(LegacyOxyContext);
|
|
637
|
+
if (!context) {
|
|
638
|
+
throw new Error('useLegacyOxy must be used within a LegacyOxyContextProvider');
|
|
639
|
+
}
|
|
640
|
+
return context;
|
|
641
|
+
};
|
|
642
|
+
exports.useLegacyOxy = useLegacyOxy;
|
|
643
|
+
//# sourceMappingURL=LegacyOxyContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LegacyOxyContext","createContext","WebStorage","getItem","key","localStorage","setItem","value","removeItem","clear","AsyncStorage","isReactNative","navigator","product","getStorage","asyncStorageModule","Promise","resolve","then","error","console","Error","getStorageKeys","prefix","users","activeUserId","accessToken","refreshToken","user","LegacyOxyContextProvider","children","oxyServices","storageKeyPrefix","onAuthStateChange","bottomSheetRef","setUser","useState","setUsers","isLoading","setIsLoading","setError","storage","setStorage","keys","useMemo","useEffect","initStorage","platformStorage","initAuth","usersData","log","parsedUsers","JSON","parse","length","activeUser","find","u","id","setTokens","isValid","validate","filteredUsers","filter","saveUsersToStorage","newActiveUser","saveActiveUserId","clearTokens","migrateLegacyAuth","err","clearAllStorage","useCallback","storedUser","parsedUser","authenticatedUser","undefined","stringify","clearStorage","usersList","userId","storeTokens","response","token","login","username","password","newUser","existingUserIndex","findIndex","updatedUsers","message","logout","targetUserId","targetUser","logoutError","warn","nextUser","logoutAll","userItem","switchUser","removeUser","getUserSessions","currentUser","wasCurrentUser","sessions","logoutSession","sessionId","signUp","email","showBottomSheet","screenOrConfig","current","expand","_navigateToScreen","setTimeout","screen","props","hideBottomSheet","close","contextValue","isAuthenticated","jsx","Provider","exports","useLegacyOxy","context","useContext"],"sourceRoot":"../../../../src","sources":["ui/context/LegacyOxyContext.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+G,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,w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