@oxyhq/services 5.4.4 → 5.4.6

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 (105) hide show
  1. package/lib/commonjs/core/index.js +81 -3
  2. package/lib/commonjs/core/index.js.map +1 -1
  3. package/lib/commonjs/index.js +50 -1
  4. package/lib/commonjs/index.js.map +1 -1
  5. package/lib/commonjs/ui/components/FollowButton.js +94 -31
  6. package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
  7. package/lib/commonjs/ui/components/OxySignInButton.js +2 -2
  8. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  9. package/lib/commonjs/ui/context/OxyContext.js +11 -1
  10. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  11. package/lib/commonjs/ui/hooks/index.js +13 -0
  12. package/lib/commonjs/ui/hooks/index.js.map +1 -0
  13. package/lib/commonjs/ui/hooks/useFollow.js +203 -0
  14. package/lib/commonjs/ui/hooks/useFollow.js.map +1 -0
  15. package/lib/commonjs/ui/index.js +25 -1
  16. package/lib/commonjs/ui/index.js.map +1 -1
  17. package/lib/commonjs/ui/screens/AccountCenterScreen.js +4 -3
  18. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  19. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +7 -6
  20. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
  21. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +3 -2
  22. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  23. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +3 -2
  24. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  25. package/lib/commonjs/ui/screens/AppInfoScreen.js +25 -45
  26. package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
  27. package/lib/commonjs/ui/screens/FileManagementScreen.js +9 -27
  28. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  29. package/lib/commonjs/ui/screens/SignInScreen.js +1 -1
  30. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
  31. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +5 -4
  32. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  33. package/lib/commonjs/ui/store/index.js +223 -4
  34. package/lib/commonjs/ui/store/index.js.map +1 -1
  35. package/lib/module/core/index.js +81 -3
  36. package/lib/module/core/index.js.map +1 -1
  37. package/lib/module/index.js +6 -2
  38. package/lib/module/index.js.map +1 -1
  39. package/lib/module/ui/components/FollowButton.js +95 -32
  40. package/lib/module/ui/components/FollowButton.js.map +1 -1
  41. package/lib/module/ui/components/OxySignInButton.js +2 -2
  42. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  43. package/lib/module/ui/context/OxyContext.js +11 -1
  44. package/lib/module/ui/context/OxyContext.js.map +1 -1
  45. package/lib/module/ui/hooks/index.js +4 -0
  46. package/lib/module/ui/hooks/index.js.map +1 -0
  47. package/lib/module/ui/hooks/useFollow.js +199 -0
  48. package/lib/module/ui/hooks/useFollow.js.map +1 -0
  49. package/lib/module/ui/index.js +9 -0
  50. package/lib/module/ui/index.js.map +1 -1
  51. package/lib/module/ui/screens/AccountCenterScreen.js +4 -3
  52. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  53. package/lib/module/ui/screens/AccountOverviewScreen.js +7 -6
  54. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  55. package/lib/module/ui/screens/AccountSettingsScreen.js +3 -2
  56. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  57. package/lib/module/ui/screens/AccountSwitcherScreen.js +3 -2
  58. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  59. package/lib/module/ui/screens/AppInfoScreen.js +25 -45
  60. package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
  61. package/lib/module/ui/screens/FileManagementScreen.js +9 -27
  62. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  63. package/lib/module/ui/screens/SignInScreen.js +1 -1
  64. package/lib/module/ui/screens/SignInScreen.js.map +1 -1
  65. package/lib/module/ui/screens/karma/KarmaCenterScreen.js +5 -4
  66. package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  67. package/lib/module/ui/store/index.js +219 -4
  68. package/lib/module/ui/store/index.js.map +1 -1
  69. package/lib/typescript/core/index.d.ts +44 -3
  70. package/lib/typescript/core/index.d.ts.map +1 -1
  71. package/lib/typescript/index.d.ts +4 -2
  72. package/lib/typescript/index.d.ts.map +1 -1
  73. package/lib/typescript/ui/components/FollowButton.d.ts +1 -0
  74. package/lib/typescript/ui/components/FollowButton.d.ts.map +1 -1
  75. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  76. package/lib/typescript/ui/hooks/index.d.ts +2 -0
  77. package/lib/typescript/ui/hooks/index.d.ts.map +1 -0
  78. package/lib/typescript/ui/hooks/useFollow.d.ts +43 -0
  79. package/lib/typescript/ui/hooks/useFollow.d.ts.map +1 -0
  80. package/lib/typescript/ui/index.d.ts +3 -0
  81. package/lib/typescript/ui/index.d.ts.map +1 -1
  82. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
  83. package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
  84. package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +1 -1
  85. package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
  86. package/lib/typescript/ui/store/index.d.ts +47 -0
  87. package/lib/typescript/ui/store/index.d.ts.map +1 -1
  88. package/package.json +1 -1
  89. package/src/core/index.ts +88 -3
  90. package/src/index.ts +19 -3
  91. package/src/ui/components/FollowButton.tsx +128 -56
  92. package/src/ui/components/OxySignInButton.tsx +2 -2
  93. package/src/ui/context/OxyContext.tsx +12 -2
  94. package/src/ui/hooks/index.ts +1 -0
  95. package/src/ui/hooks/useFollow.ts +193 -0
  96. package/src/ui/index.ts +9 -0
  97. package/src/ui/screens/AccountCenterScreen.tsx +17 -15
  98. package/src/ui/screens/AccountOverviewScreen.tsx +25 -25
  99. package/src/ui/screens/AccountSettingsScreen.tsx +30 -30
  100. package/src/ui/screens/AccountSwitcherScreen.tsx +34 -33
  101. package/src/ui/screens/AppInfoScreen.tsx +173 -192
  102. package/src/ui/screens/FileManagementScreen.tsx +248 -268
  103. package/src/ui/screens/SignInScreen.tsx +2 -2
  104. package/src/ui/screens/karma/KarmaCenterScreen.tsx +4 -4
  105. package/src/ui/store/index.ts +202 -3
@@ -43,20 +43,21 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
43
43
  goBack,
44
44
  oxyServices,
45
45
  }) => {
46
- const {
47
- user,
48
- sessions,
46
+ const {
47
+ user,
48
+ sessions,
49
49
  activeSessionId,
50
- switchSession,
51
- removeSession,
50
+ switchSession,
51
+ removeSession,
52
52
  logoutAll,
53
- isLoading
53
+ isLoading,
54
+ isAuthenticated
54
55
  } = useOxy();
55
56
 
56
57
  const [sessionsWithUsers, setSessionsWithUsers] = useState<SessionWithUser[]>([]);
57
58
  const [switchingToUserId, setSwitchingToUserId] = useState<string | null>(null);
58
59
  const [removingUserId, setRemovingUserId] = useState<string | null>(null);
59
-
60
+
60
61
  // Device session management state
61
62
  const [showDeviceManagement, setShowDeviceManagement] = useState(false);
62
63
  const [deviceSessions, setDeviceSessions] = useState<DeviceSession[]>([]);
@@ -66,7 +67,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
66
67
 
67
68
  const screenWidth = Dimensions.get('window').width;
68
69
  const isDarkTheme = theme === 'dark';
69
-
70
+
70
71
  // Modern color scheme
71
72
  const colors = {
72
73
  background: isDarkTheme ? '#000000' : '#FFFFFF',
@@ -99,19 +100,19 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
99
100
  try {
100
101
  // Try to get user profile using the session
101
102
  const userProfile = await oxyServices.getUserBySession(session.sessionId);
102
-
103
- setSessionsWithUsers(prev =>
104
- prev.map(s =>
105
- s.sessionId === session.sessionId
103
+
104
+ setSessionsWithUsers(prev =>
105
+ prev.map(s =>
106
+ s.sessionId === session.sessionId
106
107
  ? { ...s, userProfile, isLoadingProfile: false }
107
108
  : s
108
109
  )
109
110
  );
110
111
  } catch (error) {
111
112
  console.error(`Failed to load profile for session ${session.sessionId}:`, error);
112
- setSessionsWithUsers(prev =>
113
- prev.map(s =>
114
- s.sessionId === session.sessionId
113
+ setSessionsWithUsers(prev =>
114
+ prev.map(s =>
115
+ s.sessionId === session.sessionId
115
116
  ? { ...s, isLoadingProfile: false }
116
117
  : s
117
118
  )
@@ -145,7 +146,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
145
146
  const sessionToRemove = sessionsWithUsers.find(s => s.sessionId === sessionId);
146
147
  if (!sessionToRemove) return;
147
148
 
148
- const displayName = typeof sessionToRemove.userProfile?.name === 'object'
149
+ const displayName = typeof sessionToRemove.userProfile?.name === 'object'
149
150
  ? sessionToRemove.userProfile.name.full || sessionToRemove.userProfile.name.first || sessionToRemove.userProfile.username
150
151
  : sessionToRemove.userProfile?.name || sessionToRemove.userProfile?.username || 'this account';
151
152
 
@@ -187,20 +188,20 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
187
188
  console.log('🔴 sessions array:', sessions);
188
189
  console.log('🔴 isLoading:', isLoading);
189
190
  console.log('🔴 logoutAll function type:', typeof logoutAll);
190
-
191
+
191
192
  // Check if we have the required data
192
193
  if (!activeSessionId) {
193
194
  console.error('🔴 ERROR: No activeSessionId found!');
194
195
  toast.error('No active session found. You may already be logged out.');
195
196
  return;
196
197
  }
197
-
198
+
198
199
  if (typeof logoutAll !== 'function') {
199
200
  console.error('🔴 ERROR: logoutAll is not a function!', typeof logoutAll);
200
201
  toast.error('Logout function not available. Please try refreshing the app.');
201
202
  return;
202
203
  }
203
-
204
+
204
205
  // TEMPORARY: Skip confirmation dialog to test direct logout
205
206
  console.log('🔴 TESTING: Bypassing confirmation dialog for direct test');
206
207
  try {
@@ -222,7 +223,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
222
223
  // Device session management functions
223
224
  const loadAllDeviceSessions = async () => {
224
225
  if (!oxyServices || !user?.sessionId) return;
225
-
226
+
226
227
  setLoadingDeviceSessions(true);
227
228
  try {
228
229
  // This would call the API to get all device sessions for the current user
@@ -270,7 +271,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
270
271
 
271
272
  const handleLogoutAllDevices = async () => {
272
273
  const otherDevicesCount = deviceSessions.filter(session => !session.isCurrent).length;
273
-
274
+
274
275
  if (otherDevicesCount === 0) {
275
276
  toast.info('No other device sessions found to sign out from.');
276
277
  return;
@@ -331,10 +332,10 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
331
332
  ) : (
332
333
  <>
333
334
  {/* Current Account */}
334
- {user && (
335
+ {isAuthenticated && user && (
335
336
  <View style={styles.section}>
336
337
  <Text style={styles.sectionTitle}>Current Account</Text>
337
-
338
+
338
339
  <View style={[styles.settingItem, styles.firstSettingItem, styles.lastSettingItem, styles.currentAccountCard]}>
339
340
  <View style={styles.userIcon}>
340
341
  {user.avatar?.url ? (
@@ -371,7 +372,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
371
372
  <Text style={styles.sectionTitle}>
372
373
  Other Accounts ({sessionsWithUsers.filter(s => s.sessionId !== activeSessionId).length})
373
374
  </Text>
374
-
375
+
375
376
  {sessionsWithUsers
376
377
  .filter(s => s.sessionId !== activeSessionId)
377
378
  .map((sessionWithUser, index, filteredArray) => {
@@ -381,8 +382,8 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
381
382
  const isRemoving = removingUserId === sessionWithUser.sessionId;
382
383
  const { userProfile, isLoadingProfile } = sessionWithUser;
383
384
 
384
- const displayName = typeof userProfile?.name === 'object'
385
- ? userProfile.name.full || userProfile.name.first || userProfile.username
385
+ const displayName = typeof userProfile?.name === 'object'
386
+ ? userProfile.name.full || userProfile.name.first || userProfile.username
386
387
  : userProfile?.name || userProfile?.username || 'Unknown User';
387
388
 
388
389
  return (
@@ -450,7 +451,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
450
451
  {/* Quick Actions */}
451
452
  <View style={styles.section}>
452
453
  <Text style={styles.sectionTitle}>Quick Actions</Text>
453
-
454
+
454
455
  <TouchableOpacity
455
456
  style={[styles.settingItem, styles.firstSettingItem]}
456
457
  onPress={() => navigate?.('SignIn')}
@@ -507,7 +508,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
507
508
  {showDeviceManagement && (
508
509
  <View style={styles.section}>
509
510
  <Text style={styles.sectionTitle}>Device Sessions</Text>
510
-
511
+
511
512
  {loadingDeviceSessions ? (
512
513
  <View style={[styles.settingItem, styles.firstSettingItem, styles.lastSettingItem]}>
513
514
  <View style={styles.loadingContainer}>
@@ -539,11 +540,11 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
539
540
  ]}
540
541
  >
541
542
  <View style={styles.settingInfo}>
542
- <OxyIcon
543
- name={session.isCurrent ? "phone-portrait" : "phone-portrait-outline"}
544
- size={20}
545
- color={session.isCurrent ? "#34C759" : "#8E8E93"}
546
- style={styles.settingIcon}
543
+ <OxyIcon
544
+ name={session.isCurrent ? "phone-portrait" : "phone-portrait-outline"}
545
+ size={20}
546
+ color={session.isCurrent ? "#34C759" : "#8E8E93"}
547
+ style={styles.settingIcon}
547
548
  />
548
549
  <View>
549
550
  <Text style={styles.settingLabel}>