@oxyhq/services 5.12.11 → 5.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/lib/commonjs/core/OxyServices.js +86 -8
  2. package/lib/commonjs/core/OxyServices.js.map +1 -1
  3. package/lib/commonjs/i18n/index.js +37 -1
  4. package/lib/commonjs/i18n/index.js.map +1 -1
  5. package/lib/commonjs/i18n/locales/ar-SA.json +128 -0
  6. package/lib/commonjs/i18n/locales/ca-ES.json +128 -0
  7. package/lib/commonjs/i18n/locales/de-DE.json +128 -0
  8. package/lib/commonjs/i18n/locales/en-US.json +85 -12
  9. package/lib/commonjs/i18n/locales/es-ES.json +58 -6
  10. package/lib/commonjs/i18n/locales/fr-FR.json +128 -0
  11. package/lib/commonjs/i18n/locales/it-IT.json +128 -0
  12. package/lib/commonjs/i18n/locales/ja-JP.json +127 -0
  13. package/lib/commonjs/i18n/locales/ko-KR.json +128 -0
  14. package/lib/commonjs/i18n/locales/pt-PT.json +128 -0
  15. package/lib/commonjs/i18n/locales/zh-CN.json +128 -0
  16. package/lib/commonjs/ui/components/FontLoader.js +22 -42
  17. package/lib/commonjs/ui/components/FontLoader.js.map +1 -1
  18. package/lib/commonjs/ui/components/OxyProvider.js +5 -8
  19. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  20. package/lib/commonjs/ui/components/StepBasedScreen.js +64 -44
  21. package/lib/commonjs/ui/components/StepBasedScreen.js.map +1 -1
  22. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +14 -35
  23. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
  24. package/lib/commonjs/ui/components/internal/PinInput.js +2 -2
  25. package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -1
  26. package/lib/commonjs/ui/context/OxyContext.js +434 -321
  27. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  28. package/lib/commonjs/ui/screens/FileManagementScreen.js +56 -5
  29. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  30. package/lib/commonjs/ui/screens/SignInScreen.js +43 -39
  31. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
  32. package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +139 -125
  33. package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -1
  34. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +2 -4
  35. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -1
  36. package/lib/commonjs/ui/screens/steps/RecoverRequestStep.js +45 -25
  37. package/lib/commonjs/ui/screens/steps/RecoverRequestStep.js.map +1 -1
  38. package/lib/commonjs/ui/screens/steps/RecoverResetPasswordStep.js +88 -53
  39. package/lib/commonjs/ui/screens/steps/RecoverResetPasswordStep.js.map +1 -1
  40. package/lib/commonjs/ui/screens/steps/RecoverSuccessStep.js +79 -58
  41. package/lib/commonjs/ui/screens/steps/RecoverSuccessStep.js.map +1 -1
  42. package/lib/commonjs/ui/screens/steps/RecoverVerifyStep.js +61 -52
  43. package/lib/commonjs/ui/screens/steps/RecoverVerifyStep.js.map +1 -1
  44. package/lib/commonjs/ui/screens/steps/SignInPasswordStep.js +220 -31
  45. package/lib/commonjs/ui/screens/steps/SignInPasswordStep.js.map +1 -1
  46. package/lib/commonjs/ui/screens/steps/SignInTotpStep.js +77 -50
  47. package/lib/commonjs/ui/screens/steps/SignInTotpStep.js.map +1 -1
  48. package/lib/commonjs/ui/screens/steps/SignInUsernameStep.js +527 -66
  49. package/lib/commonjs/ui/screens/steps/SignInUsernameStep.js.map +1 -1
  50. package/lib/commonjs/ui/screens/steps/SignUpIdentityStep.js +55 -30
  51. package/lib/commonjs/ui/screens/steps/SignUpIdentityStep.js.map +1 -1
  52. package/lib/commonjs/ui/screens/steps/SignUpSecurityStep.js +64 -46
  53. package/lib/commonjs/ui/screens/steps/SignUpSecurityStep.js.map +1 -1
  54. package/lib/commonjs/ui/screens/steps/SignUpSummaryStep.js +84 -146
  55. package/lib/commonjs/ui/screens/steps/SignUpSummaryStep.js.map +1 -1
  56. package/lib/commonjs/ui/screens/steps/SignUpWelcomeStep.js +113 -34
  57. package/lib/commonjs/ui/screens/steps/SignUpWelcomeStep.js.map +1 -1
  58. package/lib/commonjs/ui/stores/authStore.js +16 -20
  59. package/lib/commonjs/ui/stores/authStore.js.map +1 -1
  60. package/lib/commonjs/ui/styles/authStyles.js +2 -1
  61. package/lib/commonjs/ui/styles/authStyles.js.map +1 -1
  62. package/lib/commonjs/ui/styles/index.js +11 -0
  63. package/lib/commonjs/ui/styles/index.js.map +1 -1
  64. package/lib/commonjs/ui/styles/spacing.js +51 -0
  65. package/lib/commonjs/ui/styles/spacing.js.map +1 -0
  66. package/lib/commonjs/utils/validationUtils.js +1 -1
  67. package/lib/module/core/OxyServices.js +86 -8
  68. package/lib/module/core/OxyServices.js.map +1 -1
  69. package/lib/module/i18n/index.js +37 -1
  70. package/lib/module/i18n/index.js.map +1 -1
  71. package/lib/module/i18n/locales/ar-SA.json +128 -0
  72. package/lib/module/i18n/locales/ca-ES.json +128 -0
  73. package/lib/module/i18n/locales/de-DE.json +128 -0
  74. package/lib/module/i18n/locales/en-US.json +85 -12
  75. package/lib/module/i18n/locales/es-ES.json +58 -6
  76. package/lib/module/i18n/locales/fr-FR.json +128 -0
  77. package/lib/module/i18n/locales/it-IT.json +128 -0
  78. package/lib/module/i18n/locales/ja-JP.json +127 -0
  79. package/lib/module/i18n/locales/ko-KR.json +128 -0
  80. package/lib/module/i18n/locales/pt-PT.json +128 -0
  81. package/lib/module/i18n/locales/zh-CN.json +128 -0
  82. package/lib/module/ui/components/FontLoader.js +23 -43
  83. package/lib/module/ui/components/FontLoader.js.map +1 -1
  84. package/lib/module/ui/components/OxyProvider.js +6 -8
  85. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  86. package/lib/module/ui/components/StepBasedScreen.js +65 -45
  87. package/lib/module/ui/components/StepBasedScreen.js.map +1 -1
  88. package/lib/module/ui/components/internal/GroupedPillButtons.js +14 -35
  89. package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
  90. package/lib/module/ui/components/internal/PinInput.js +2 -2
  91. package/lib/module/ui/components/internal/PinInput.js.map +1 -1
  92. package/lib/module/ui/context/OxyContext.js +434 -321
  93. package/lib/module/ui/context/OxyContext.js.map +1 -1
  94. package/lib/module/ui/screens/FileManagementScreen.js +56 -5
  95. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  96. package/lib/module/ui/screens/SignInScreen.js +44 -40
  97. package/lib/module/ui/screens/SignInScreen.js.map +1 -1
  98. package/lib/module/ui/screens/WelcomeNewUserScreen.js +138 -126
  99. package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
  100. package/lib/module/ui/screens/internal/SignInUsernameStep.js +2 -4
  101. package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -1
  102. package/lib/module/ui/screens/steps/RecoverRequestStep.js +45 -25
  103. package/lib/module/ui/screens/steps/RecoverRequestStep.js.map +1 -1
  104. package/lib/module/ui/screens/steps/RecoverResetPasswordStep.js +89 -54
  105. package/lib/module/ui/screens/steps/RecoverResetPasswordStep.js.map +1 -1
  106. package/lib/module/ui/screens/steps/RecoverSuccessStep.js +80 -59
  107. package/lib/module/ui/screens/steps/RecoverSuccessStep.js.map +1 -1
  108. package/lib/module/ui/screens/steps/RecoverVerifyStep.js +62 -53
  109. package/lib/module/ui/screens/steps/RecoverVerifyStep.js.map +1 -1
  110. package/lib/module/ui/screens/steps/SignInPasswordStep.js +221 -32
  111. package/lib/module/ui/screens/steps/SignInPasswordStep.js.map +1 -1
  112. package/lib/module/ui/screens/steps/SignInTotpStep.js +78 -51
  113. package/lib/module/ui/screens/steps/SignInTotpStep.js.map +1 -1
  114. package/lib/module/ui/screens/steps/SignInUsernameStep.js +530 -68
  115. package/lib/module/ui/screens/steps/SignInUsernameStep.js.map +1 -1
  116. package/lib/module/ui/screens/steps/SignUpIdentityStep.js +55 -30
  117. package/lib/module/ui/screens/steps/SignUpIdentityStep.js.map +1 -1
  118. package/lib/module/ui/screens/steps/SignUpSecurityStep.js +65 -47
  119. package/lib/module/ui/screens/steps/SignUpSecurityStep.js.map +1 -1
  120. package/lib/module/ui/screens/steps/SignUpSummaryStep.js +84 -146
  121. package/lib/module/ui/screens/steps/SignUpSummaryStep.js.map +1 -1
  122. package/lib/module/ui/screens/steps/SignUpWelcomeStep.js +114 -35
  123. package/lib/module/ui/screens/steps/SignUpWelcomeStep.js.map +1 -1
  124. package/lib/module/ui/stores/authStore.js +16 -20
  125. package/lib/module/ui/stores/authStore.js.map +1 -1
  126. package/lib/module/ui/styles/authStyles.js +2 -1
  127. package/lib/module/ui/styles/authStyles.js.map +1 -1
  128. package/lib/module/ui/styles/index.js +1 -0
  129. package/lib/module/ui/styles/index.js.map +1 -1
  130. package/lib/module/ui/styles/spacing.js +48 -0
  131. package/lib/module/ui/styles/spacing.js.map +1 -0
  132. package/lib/module/utils/validationUtils.js +1 -1
  133. package/lib/typescript/core/OxyServices.d.ts +38 -2
  134. package/lib/typescript/core/OxyServices.d.ts.map +1 -1
  135. package/lib/typescript/i18n/index.d.ts.map +1 -1
  136. package/lib/typescript/ui/components/FontLoader.d.ts +3 -3
  137. package/lib/typescript/ui/components/FontLoader.d.ts.map +1 -1
  138. package/lib/typescript/ui/components/OxyProvider.d.ts +2 -2
  139. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
  140. package/lib/typescript/ui/components/StepBasedScreen.d.ts.map +1 -1
  141. package/lib/typescript/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
  142. package/lib/typescript/ui/context/OxyContext.d.ts +1 -0
  143. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  144. package/lib/typescript/ui/screens/FileManagementScreen.d.ts +10 -0
  145. package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
  146. package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
  147. package/lib/typescript/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
  148. package/lib/typescript/ui/screens/steps/RecoverRequestStep.d.ts.map +1 -1
  149. package/lib/typescript/ui/screens/steps/RecoverResetPasswordStep.d.ts.map +1 -1
  150. package/lib/typescript/ui/screens/steps/RecoverSuccessStep.d.ts.map +1 -1
  151. package/lib/typescript/ui/screens/steps/RecoverVerifyStep.d.ts.map +1 -1
  152. package/lib/typescript/ui/screens/steps/SignInPasswordStep.d.ts +2 -0
  153. package/lib/typescript/ui/screens/steps/SignInPasswordStep.d.ts.map +1 -1
  154. package/lib/typescript/ui/screens/steps/SignInTotpStep.d.ts.map +1 -1
  155. package/lib/typescript/ui/screens/steps/SignInUsernameStep.d.ts.map +1 -1
  156. package/lib/typescript/ui/screens/steps/SignUpIdentityStep.d.ts.map +1 -1
  157. package/lib/typescript/ui/screens/steps/SignUpSecurityStep.d.ts.map +1 -1
  158. package/lib/typescript/ui/screens/steps/SignUpSummaryStep.d.ts.map +1 -1
  159. package/lib/typescript/ui/screens/steps/SignUpWelcomeStep.d.ts.map +1 -1
  160. package/lib/typescript/ui/stores/authStore.d.ts +7 -3
  161. package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
  162. package/lib/typescript/ui/styles/authStyles.d.ts +1 -0
  163. package/lib/typescript/ui/styles/authStyles.d.ts.map +1 -1
  164. package/lib/typescript/ui/styles/index.d.ts +1 -0
  165. package/lib/typescript/ui/styles/index.d.ts.map +1 -1
  166. package/lib/typescript/ui/styles/spacing.d.ts +43 -0
  167. package/lib/typescript/ui/styles/spacing.d.ts.map +1 -0
  168. package/lib/typescript/utils/validationUtils.d.ts +1 -1
  169. package/package.json +1 -1
  170. package/src/core/OxyServices.ts +96 -10
  171. package/src/i18n/index.ts +36 -0
  172. package/src/i18n/locales/ar-SA.json +128 -0
  173. package/src/i18n/locales/ca-ES.json +128 -0
  174. package/src/i18n/locales/de-DE.json +128 -0
  175. package/src/i18n/locales/en-US.json +85 -12
  176. package/src/i18n/locales/es-ES.json +58 -6
  177. package/src/i18n/locales/fr-FR.json +128 -0
  178. package/src/i18n/locales/it-IT.json +128 -0
  179. package/src/i18n/locales/ja-JP.json +127 -0
  180. package/src/i18n/locales/ko-KR.json +128 -0
  181. package/src/i18n/locales/pt-PT.json +128 -0
  182. package/src/i18n/locales/zh-CN.json +128 -0
  183. package/src/ui/components/FontLoader.tsx +17 -37
  184. package/src/ui/components/OxyProvider.tsx +14 -13
  185. package/src/ui/components/StepBasedScreen.tsx +66 -43
  186. package/src/ui/components/internal/GroupedPillButtons.tsx +15 -31
  187. package/src/ui/components/internal/PinInput.tsx +2 -2
  188. package/src/ui/context/OxyContext.tsx +404 -285
  189. package/src/ui/screens/FileManagementScreen.tsx +81 -4
  190. package/src/ui/screens/SignInScreen.tsx +59 -36
  191. package/src/ui/screens/WelcomeNewUserScreen.tsx +102 -91
  192. package/src/ui/screens/internal/SignInUsernameStep.tsx +1 -1
  193. package/src/ui/screens/steps/RecoverRequestStep.tsx +34 -24
  194. package/src/ui/screens/steps/RecoverResetPasswordStep.tsx +65 -36
  195. package/src/ui/screens/steps/RecoverSuccessStep.tsx +71 -47
  196. package/src/ui/screens/steps/RecoverVerifyStep.tsx +60 -50
  197. package/src/ui/screens/steps/SignInPasswordStep.tsx +191 -29
  198. package/src/ui/screens/steps/SignInTotpStep.tsx +68 -34
  199. package/src/ui/screens/steps/SignInUsernameStep.tsx +586 -57
  200. package/src/ui/screens/steps/SignUpIdentityStep.tsx +49 -35
  201. package/src/ui/screens/steps/SignUpSecurityStep.tsx +56 -39
  202. package/src/ui/screens/steps/SignUpSummaryStep.tsx +99 -89
  203. package/src/ui/screens/steps/SignUpWelcomeStep.tsx +88 -20
  204. package/src/ui/stores/authStore.ts +15 -19
  205. package/src/ui/styles/authStyles.ts +2 -1
  206. package/src/ui/styles/index.ts +1 -0
  207. package/src/ui/styles/spacing.ts +46 -0
  208. package/src/utils/validationUtils.ts +1 -1
@@ -1,16 +1,24 @@
1
1
  "use strict";
2
2
 
3
- import { useRef, useEffect } from 'react';
4
- import { View, Text } from 'react-native';
3
+ import { useRef, useEffect, useMemo, useState, useCallback } from 'react';
4
+ import { View, Text, Platform, StyleSheet, ActivityIndicator } from 'react-native';
5
5
  import { Ionicons } from '@expo/vector-icons';
6
6
  import HighFive from '../../../assets/illustrations/HighFive';
7
7
  import GroupedPillButtons from '../../components/internal/GroupedPillButtons';
8
8
  import TextField from '../../components/internal/TextField';
9
9
  import { useI18n } from '../../hooks/useI18n';
10
+ import { stepStyles } from '../../styles/spacing';
11
+ import Avatar from '../../components/Avatar';
12
+ import { TouchableOpacity } from 'react-native';
13
+ import { useOxy } from '../../context/OxyContext';
14
+ import { toast } from '../../../lib/sonner';
10
15
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
16
+ const MAX_QUICK_ACCOUNTS = 3;
17
+ const getThemeMode = theme => theme === 'dark' ? 'dark' : 'light';
11
18
  const SignInUsernameStep = ({
12
19
  colors,
13
20
  styles,
21
+ theme,
14
22
  navigate,
15
23
  nextStep,
16
24
  username,
@@ -28,86 +36,221 @@ const SignInUsernameStep = ({
28
36
  const {
29
37
  t
30
38
  } = useI18n();
39
+ const {
40
+ sessions,
41
+ activeSessionId,
42
+ switchSession,
43
+ oxyServices
44
+ } = useOxy();
45
+ const baseStyles = stepStyles;
46
+ const webShadowReset = Platform.OS === 'web' ? {
47
+ boxShadow: 'none'
48
+ } : null;
49
+ const themeMode = getThemeMode(theme);
50
+ const [quickAccounts, setQuickAccounts] = useState([]);
51
+ const [loadingAccounts, setLoadingAccounts] = useState(false);
52
+ const [switchingSessionId, setSwitchingSessionId] = useState(null);
53
+ const [showAccounts, setShowAccounts] = useState(false);
54
+ const otherSessions = useMemo(() => (sessions ?? []).filter(session => session.sessionId !== activeSessionId), [sessions, activeSessionId]);
55
+
56
+ // Show accounts if we have any sessions (either in add account mode or just have saved sessions)
57
+ const hasSessions = (sessions ?? []).length > 0;
58
+
59
+ // Use other sessions if in add account mode, otherwise show all sessions
60
+ const sessionsToShow = isAddAccountMode ? otherSessions : sessions ?? [];
31
61
 
32
- // Monitor username prop changes
62
+ // Debug logging
63
+ if (__DEV__) {
64
+ console.log('SignInUsernameStep - Debug:', {
65
+ isAddAccountMode,
66
+ hasSessions,
67
+ sessionsCount: sessions?.length ?? 0,
68
+ otherSessionsCount: otherSessions.length,
69
+ sessionsToShowCount: sessionsToShow.length,
70
+ activeSessionId,
71
+ quickAccountsCount: quickAccounts.length,
72
+ loadingAccounts
73
+ });
74
+ }
33
75
  useEffect(() => {
34
- console.log('👀 SignInUsernameStep username prop changed:', username);
35
- }, [username]);
76
+ let cancelled = false;
77
+ const loadQuickAccounts = async () => {
78
+ // Show accounts if we have sessions and services available
79
+ // In add account mode, show other sessions; otherwise show all sessions
80
+ if (!hasSessions || !oxyServices) {
81
+ if (!cancelled) {
82
+ setQuickAccounts([]);
83
+ setLoadingAccounts(false);
84
+ }
85
+ return;
86
+ }
87
+
88
+ // If in add account mode and no other sessions, don't show anything
89
+ if (isAddAccountMode && sessionsToShow.length === 0) {
90
+ if (!cancelled) {
91
+ setQuickAccounts([]);
92
+ setLoadingAccounts(false);
93
+ }
94
+ return;
95
+ }
96
+
97
+ // If not in add account mode and no sessions, don't show anything
98
+ if (!isAddAccountMode && sessionsToShow.length === 0) {
99
+ if (!cancelled) {
100
+ setQuickAccounts([]);
101
+ setLoadingAccounts(false);
102
+ }
103
+ return;
104
+ }
105
+ setLoadingAccounts(true);
106
+ const targetSessions = sessionsToShow.slice(0, MAX_QUICK_ACCOUNTS);
107
+ try {
108
+ const results = await Promise.all(targetSessions.map(async session => {
109
+ try {
110
+ const profile = await oxyServices.getUserBySession(session.sessionId);
111
+ const displayName = profile?.name?.full || profile?.name?.first || profile?.username || 'Account';
112
+ return {
113
+ sessionId: session.sessionId,
114
+ username: profile?.username ?? 'account',
115
+ displayName,
116
+ avatar: profile?.avatar
117
+ };
118
+ } catch (error) {
119
+ if (__DEV__) {
120
+ console.error(`Failed to load profile for session ${session.sessionId}`, error);
121
+ }
122
+ return null;
123
+ }
124
+ }));
125
+ if (!cancelled) {
126
+ setQuickAccounts(results.filter(item => Boolean(item)));
127
+ }
128
+ } finally {
129
+ if (!cancelled) {
130
+ setLoadingAccounts(false);
131
+ }
132
+ }
133
+ };
134
+ void loadQuickAccounts();
135
+ return () => {
136
+ cancelled = true;
137
+ };
138
+ }, [hasSessions, sessionsToShow, oxyServices, isAddAccountMode]);
139
+ const handleSwitchAccount = useCallback(async sessionId => {
140
+ setSwitchingSessionId(sessionId);
141
+ try {
142
+ await switchSession(sessionId);
143
+ const switchedAccount = quickAccounts.find(account => account.sessionId === sessionId) ?? null;
144
+ const successMessage = t('signin.status.accountSwitched', {
145
+ name: switchedAccount?.displayName ?? t('signin.actions.openAccountSwitcher')
146
+ }) || 'Account switched';
147
+ toast.success(successMessage);
148
+ } catch (error) {
149
+ if (__DEV__) {
150
+ console.error('Failed to switch account:', error);
151
+ }
152
+ toast.error(t('signin.actions.switchAccountFailed') || 'Unable to switch accounts. Please try again.');
153
+ } finally {
154
+ setSwitchingSessionId(null);
155
+ }
156
+ }, [quickAccounts, switchSession, t]);
157
+ const otherAccountsCount = sessionsToShow.length;
158
+
159
+ // Get all accounts for avatar display (current user + quick accounts)
160
+ const allAccountsForAvatars = useMemo(() => {
161
+ const accounts = [];
162
+
163
+ // Add current user if in add account mode
164
+ if (isAddAccountMode && user) {
165
+ accounts.push({
166
+ sessionId: activeSessionId || '',
167
+ displayName: user.name?.full || user.username || 'Account',
168
+ username: user.username,
169
+ avatar: user.avatar,
170
+ isCurrent: true
171
+ });
172
+ }
173
+
174
+ // Add quick accounts
175
+ quickAccounts.forEach(account => {
176
+ accounts.push({
177
+ sessionId: account.sessionId,
178
+ displayName: account.displayName,
179
+ username: account.username,
180
+ avatar: account.avatar,
181
+ isCurrent: account.sessionId === activeSessionId
182
+ });
183
+ });
184
+ return accounts;
185
+ }, [isAddAccountMode, user, quickAccounts, activeSessionId]);
36
186
  const handleUsernameChange = text => {
37
- console.log('📝 Username input changed:', text);
38
- setUsername(text);
187
+ // Text is already filtered by formatValue prop, but ensure it's clean
188
+ const filteredText = text.replace(/[^a-zA-Z0-9]/g, '');
189
+ setUsername(filteredText);
39
190
  if (errorMessage) setErrorMessage('');
40
191
  };
41
192
  const handleContinue = async () => {
42
- console.log('🚀 Continue button pressed, username:', username);
43
193
  const trimmedUsername = username?.trim() || '';
44
194
  if (!trimmedUsername) {
45
- console.log(' Username is empty');
46
- setErrorMessage('Please enter your username.');
195
+ setErrorMessage(t('signin.username.required') || 'Please enter your username.');
47
196
  setTimeout(() => inputRef.current?.focus(), 0);
48
197
  return;
49
198
  }
50
- if (trimmedUsername.length < 2) {
51
- console.log(' Username too short');
52
- setErrorMessage('Username must be at least 3 characters.');
199
+ if (trimmedUsername.length < 3) {
200
+ setErrorMessage(t('signin.username.minLength') || 'Username must be at least 3 characters.');
53
201
  return;
54
202
  }
55
- console.log('🔍 Starting username validation...');
56
203
  try {
57
204
  // Validate the username before proceeding
58
205
  const isValid = await validateUsername(trimmedUsername);
59
- console.log('📊 Validation result:', isValid);
60
206
  if (isValid) {
61
- console.log('✅ Validation passed, proceeding to next step');
62
207
  nextStep();
63
- } else {
64
- console.log('❌ Validation failed, staying on current step');
65
208
  }
66
209
  } catch (error) {
67
- console.error('🚨 Error during validation:', error);
210
+ if (__DEV__) console.error('Error during username validation:', error);
68
211
  setErrorMessage('Unable to validate username. Please try again.');
69
212
  }
70
213
  };
71
214
  return /*#__PURE__*/_jsxs(_Fragment, {
72
- children: [/*#__PURE__*/_jsx(HighFive, {
73
- width: 100,
74
- height: 100
215
+ children: [/*#__PURE__*/_jsxs(View, {
216
+ style: [baseStyles.container, baseStyles.sectionSpacing, {
217
+ alignItems: 'flex-start',
218
+ position: 'relative'
219
+ }],
220
+ children: [/*#__PURE__*/_jsx(HighFive, {
221
+ width: 100,
222
+ height: 100
223
+ }), /*#__PURE__*/_jsx(TouchableOpacity, {
224
+ style: [stylesheet.languageButton, {
225
+ backgroundColor: colors.inputBackground
226
+ }],
227
+ onPress: () => navigate('LanguageSelector'),
228
+ activeOpacity: 0.7,
229
+ children: /*#__PURE__*/_jsx(Ionicons, {
230
+ name: "globe-outline",
231
+ size: 20,
232
+ color: colors.primary
233
+ })
234
+ })]
75
235
  }), /*#__PURE__*/_jsxs(View, {
76
- style: styles.modernHeader,
236
+ style: [baseStyles.container, baseStyles.sectionSpacing, baseStyles.header],
77
237
  children: [/*#__PURE__*/_jsx(Text, {
78
- style: [styles.modernTitle, {
79
- color: colors.text
238
+ style: [styles.modernTitle, baseStyles.title, {
239
+ color: colors.text,
240
+ marginBottom: 0,
241
+ marginTop: 0
80
242
  }],
81
- children: isAddAccountMode ? t('signin.addAccountTitle') : t('signin.title')
243
+ children: t('signin.title')
82
244
  }), /*#__PURE__*/_jsx(Text, {
83
- style: [styles.modernSubtitle, {
84
- color: colors.secondaryText
245
+ style: [styles.modernSubtitle, baseStyles.subtitle, {
246
+ color: colors.secondaryText,
247
+ marginBottom: 0,
248
+ marginTop: 0
85
249
  }],
86
- children: isAddAccountMode ? t('signin.addAccountSubtitle') : t('signin.subtitle')
87
- })]
88
- }), isAddAccountMode && user && /*#__PURE__*/_jsxs(View, {
89
- style: [styles.modernInfoCard, {
90
- backgroundColor: colors.inputBackground
91
- }],
92
- children: [/*#__PURE__*/_jsx(Ionicons, {
93
- name: "information-circle",
94
- size: 20,
95
- color: colors.primary
96
- }), /*#__PURE__*/_jsxs(Text, {
97
- style: [styles.modernInfoText, {
98
- color: colors.text
99
- }],
100
- children: [t('signin.currentlySignedInAs', {
101
- username: user.username
102
- }) || 'Currently signed in as ', /*#__PURE__*/_jsx(Text, {
103
- style: {
104
- fontWeight: 'bold'
105
- },
106
- children: user.username
107
- })]
250
+ children: t('signin.subtitle')
108
251
  })]
109
252
  }), /*#__PURE__*/_jsx(View, {
110
- style: styles.modernInputContainer,
253
+ style: [baseStyles.container, baseStyles.sectionSpacing],
111
254
  children: /*#__PURE__*/_jsx(TextField, {
112
255
  ref: inputRef,
113
256
  label: t('common.labels.username'),
@@ -118,6 +261,8 @@ const SignInUsernameStep = ({
118
261
  }),
119
262
  value: username,
120
263
  onChangeText: handleUsernameChange,
264
+ formatValue: text => text.replace(/[^a-zA-Z0-9]/g, ''),
265
+ maxLength: 30,
121
266
  autoCapitalize: "none",
122
267
  autoCorrect: false,
123
268
  testID: "username-input",
@@ -125,27 +270,344 @@ const SignInUsernameStep = ({
125
270
  error: validationStatus === 'invalid' ? errorMessage : undefined,
126
271
  loading: validationStatus === 'validating',
127
272
  success: validationStatus === 'valid',
273
+ helperText: t('signin.username.helper') || '3-30 characters, letters and numbers only',
128
274
  onSubmitEditing: () => handleContinue(),
129
- autoFocus: true
275
+ autoFocus: true,
276
+ accessibilityLabel: t('common.labels.username'),
277
+ accessibilityHint: t('signin.username.helper') || 'Enter your username, 3-30 characters, letters and numbers only',
278
+ style: {
279
+ marginBottom: 0
280
+ }
281
+ })
282
+ }), (isAddAccountMode && user || hasSessions && sessionsToShow.length > 0) && /*#__PURE__*/_jsxs(View, {
283
+ style: [baseStyles.container, baseStyles.sectionSpacing, stylesheet.dividerContainer],
284
+ children: [/*#__PURE__*/_jsx(View, {
285
+ style: [stylesheet.dividerLine, {
286
+ backgroundColor: colors.border
287
+ }]
288
+ }), /*#__PURE__*/_jsx(Text, {
289
+ style: [stylesheet.dividerText, {
290
+ color: colors.secondaryText
291
+ }],
292
+ children: t('signin.or') || 'or'
293
+ }), /*#__PURE__*/_jsx(View, {
294
+ style: [stylesheet.dividerLine, {
295
+ backgroundColor: colors.border
296
+ }]
297
+ })]
298
+ }), isAddAccountMode && user || hasSessions && sessionsToShow.length > 0 ? /*#__PURE__*/_jsxs(View, {
299
+ style: [baseStyles.container, baseStyles.sectionSpacing],
300
+ children: [/*#__PURE__*/_jsx(TouchableOpacity, {
301
+ style: [stylesheet.toggleButton, {
302
+ backgroundColor: colors.inputBackground
303
+ }],
304
+ onPress: () => setShowAccounts(!showAccounts),
305
+ activeOpacity: 0.7,
306
+ children: /*#__PURE__*/_jsxs(View, {
307
+ style: stylesheet.toggleButtonContent,
308
+ children: [/*#__PURE__*/_jsx(Ionicons, {
309
+ name: showAccounts ? 'chevron-down' : 'chevron-forward',
310
+ size: 18,
311
+ color: colors.primary
312
+ }), /*#__PURE__*/_jsx(Text, {
313
+ style: [stylesheet.toggleButtonText, {
314
+ color: colors.text
315
+ }],
316
+ children: t('signin.alreadySignedInWith') || 'Already signed in with'
317
+ }), allAccountsForAvatars.length > 0 && /*#__PURE__*/_jsx(View, {
318
+ style: stylesheet.avatarsContainer,
319
+ children: allAccountsForAvatars.slice(0, 5).map((account, index) => /*#__PURE__*/_jsx(View, {
320
+ style: [stylesheet.avatarWrapper, account.isCurrent && stylesheet.currentAvatarWrapper, index > 0 && {
321
+ marginLeft: -12
322
+ }, {
323
+ zIndex: Math.min(allAccountsForAvatars.length, 5) - index
324
+ }, {
325
+ borderColor: colors.inputBackground || colors.background || '#FFFFFF'
326
+ }],
327
+ children: /*#__PURE__*/_jsx(Avatar, {
328
+ name: account.displayName,
329
+ text: account.displayName.charAt(0).toUpperCase(),
330
+ size: 28,
331
+ theme: themeMode,
332
+ backgroundColor: colors.primary,
333
+ uri: account.avatar && oxyServices ? oxyServices.getFileDownloadUrl(account.avatar, 'thumb') : undefined
334
+ })
335
+ }, account.sessionId))
336
+ }), !showAccounts && (quickAccounts.length > 0 || otherAccountsCount > 0) && allAccountsForAvatars.length === 0 && /*#__PURE__*/_jsx(View, {
337
+ style: [stylesheet.accountCountBadge, {
338
+ backgroundColor: `${colors.primary}15`
339
+ }],
340
+ children: /*#__PURE__*/_jsx(Text, {
341
+ style: [stylesheet.accountCountText, {
342
+ color: colors.primary
343
+ }],
344
+ children: otherAccountsCount + (isAddAccountMode && user ? 1 : 0)
345
+ })
346
+ })]
347
+ })
348
+ }), showAccounts && /*#__PURE__*/_jsx(View, {
349
+ style: stylesheet.accountsList,
350
+ children: loadingAccounts && quickAccounts.length === 0 && !isAddAccountMode ? /*#__PURE__*/_jsx(View, {
351
+ style: stylesheet.accountItem,
352
+ children: /*#__PURE__*/_jsx(ActivityIndicator, {
353
+ color: colors.primary,
354
+ size: "small"
355
+ })
356
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
357
+ children: [isAddAccountMode && user && /*#__PURE__*/_jsxs(View, {
358
+ style: [stylesheet.accountItem, {
359
+ backgroundColor: colors.inputBackground
360
+ }],
361
+ children: [/*#__PURE__*/_jsx(View, {
362
+ style: [stylesheet.accountItemAvatarWrapper, {
363
+ borderColor: colors.inputBackground || colors.background || '#FFFFFF'
364
+ }],
365
+ children: /*#__PURE__*/_jsx(Avatar, {
366
+ name: user.name?.full || user.username,
367
+ text: (user.name?.full || user.username || 'U').slice(0, 1).toUpperCase(),
368
+ size: 36,
369
+ theme: themeMode,
370
+ backgroundColor: colors.primary,
371
+ uri: user.avatar && oxyServices ? oxyServices.getFileDownloadUrl(user.avatar, 'thumb') : undefined
372
+ })
373
+ }), /*#__PURE__*/_jsxs(View, {
374
+ style: stylesheet.accountItemText,
375
+ children: [/*#__PURE__*/_jsx(Text, {
376
+ style: [stylesheet.accountItemName, {
377
+ color: colors.text
378
+ }],
379
+ numberOfLines: 1,
380
+ children: user.name?.full || user.username
381
+ }), user.username && /*#__PURE__*/_jsxs(Text, {
382
+ style: [stylesheet.accountItemUsername, {
383
+ color: colors.secondaryText
384
+ }],
385
+ numberOfLines: 1,
386
+ children: ["@", user.username]
387
+ })]
388
+ }), /*#__PURE__*/_jsx(View, {
389
+ style: [stylesheet.currentAccountBadgeContainer, {
390
+ backgroundColor: `${colors.primary}15`
391
+ }],
392
+ children: /*#__PURE__*/_jsx(Text, {
393
+ style: [stylesheet.currentAccountBadge, {
394
+ color: colors.primary
395
+ }],
396
+ children: t('signin.currentAccount') || 'Current'
397
+ })
398
+ })]
399
+ }), quickAccounts.map(account => /*#__PURE__*/_jsx(TouchableOpacity, {
400
+ style: [stylesheet.accountItem, {
401
+ backgroundColor: colors.inputBackground
402
+ }, switchingSessionId === account.sessionId && stylesheet.accountItemLoading],
403
+ onPress: () => handleSwitchAccount(account.sessionId),
404
+ disabled: switchingSessionId === account.sessionId,
405
+ activeOpacity: 0.7,
406
+ children: switchingSessionId === account.sessionId ? /*#__PURE__*/_jsx(ActivityIndicator, {
407
+ color: colors.primary,
408
+ size: "small"
409
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
410
+ children: [/*#__PURE__*/_jsx(View, {
411
+ style: [stylesheet.accountItemAvatarWrapper, {
412
+ borderColor: colors.inputBackground || colors.background || '#FFFFFF'
413
+ }],
414
+ children: /*#__PURE__*/_jsx(Avatar, {
415
+ name: account.displayName,
416
+ text: account.displayName.charAt(0).toUpperCase(),
417
+ size: 36,
418
+ theme: themeMode,
419
+ backgroundColor: colors.primary,
420
+ uri: account.avatar && oxyServices ? oxyServices.getFileDownloadUrl(account.avatar, 'thumb') : undefined
421
+ })
422
+ }), /*#__PURE__*/_jsxs(View, {
423
+ style: stylesheet.accountItemText,
424
+ children: [/*#__PURE__*/_jsx(Text, {
425
+ style: [stylesheet.accountItemName, {
426
+ color: colors.text
427
+ }],
428
+ numberOfLines: 1,
429
+ children: account.displayName
430
+ }), account.username && /*#__PURE__*/_jsxs(Text, {
431
+ style: [stylesheet.accountItemUsername, {
432
+ color: colors.secondaryText
433
+ }],
434
+ numberOfLines: 1,
435
+ children: ["@", account.username]
436
+ })]
437
+ })]
438
+ })
439
+ }, account.sessionId)), otherAccountsCount > MAX_QUICK_ACCOUNTS && /*#__PURE__*/_jsxs(TouchableOpacity, {
440
+ style: [stylesheet.accountItem, stylesheet.viewAllItem, {
441
+ backgroundColor: colors.inputBackground
442
+ }],
443
+ onPress: () => navigate('AccountSwitcher'),
444
+ activeOpacity: 0.7,
445
+ children: [/*#__PURE__*/_jsx(Ionicons, {
446
+ name: "chevron-forward",
447
+ size: 18,
448
+ color: colors.primary
449
+ }), /*#__PURE__*/_jsx(Text, {
450
+ style: [stylesheet.viewAllText, {
451
+ color: colors.primary
452
+ }],
453
+ children: t('signin.viewAllAccounts', {
454
+ count: otherAccountsCount - MAX_QUICK_ACCOUNTS
455
+ }) || `View ${otherAccountsCount - MAX_QUICK_ACCOUNTS} more`
456
+ })]
457
+ })]
458
+ })
459
+ })]
460
+ }) : null, /*#__PURE__*/_jsx(View, {
461
+ style: [baseStyles.container, baseStyles.sectionSpacing, baseStyles.buttonContainer],
462
+ children: /*#__PURE__*/_jsx(GroupedPillButtons, {
463
+ buttons: [{
464
+ text: t('common.links.signUp'),
465
+ onPress: () => navigate('SignUp'),
466
+ icon: 'person-add',
467
+ variant: 'transparent'
468
+ }, {
469
+ text: t('common.actions.continue'),
470
+ onPress: handleContinue,
471
+ icon: 'arrow-forward',
472
+ variant: 'primary',
473
+ loading: isValidating,
474
+ disabled: !username || username.trim().length < 3 || isValidating,
475
+ testID: 'username-next-button'
476
+ }],
477
+ colors: colors
130
478
  })
131
- }), /*#__PURE__*/_jsx(GroupedPillButtons, {
132
- buttons: [{
133
- text: t('common.links.signUp'),
134
- onPress: () => navigate('SignUp'),
135
- icon: 'person-add',
136
- variant: 'transparent'
137
- }, {
138
- text: t('common.actions.continue'),
139
- onPress: handleContinue,
140
- icon: 'arrow-forward',
141
- variant: 'primary',
142
- loading: isValidating,
143
- disabled: !username || username.trim().length < 2 || isValidating,
144
- testID: 'username-next-button'
145
- }],
146
- colors: colors
147
479
  })]
148
480
  });
149
481
  };
150
482
  export default SignInUsernameStep;
483
+ const stylesheet = StyleSheet.create({
484
+ toggleButton: {
485
+ borderRadius: 24,
486
+ borderWidth: 0
487
+ },
488
+ toggleButtonContent: {
489
+ flexDirection: 'row',
490
+ alignItems: 'center',
491
+ paddingHorizontal: 12,
492
+ paddingVertical: 10,
493
+ minHeight: 48,
494
+ gap: 10
495
+ },
496
+ toggleButtonText: {
497
+ fontSize: 14,
498
+ fontWeight: '500'
499
+ },
500
+ accountCountBadge: {
501
+ paddingHorizontal: 8,
502
+ paddingVertical: 3,
503
+ borderRadius: 16,
504
+ minWidth: 22,
505
+ alignItems: 'center'
506
+ },
507
+ accountCountText: {
508
+ fontSize: 11,
509
+ fontWeight: '600'
510
+ },
511
+ accountsList: {
512
+ gap: 6,
513
+ marginTop: 6
514
+ },
515
+ accountItem: {
516
+ flexDirection: 'row',
517
+ alignItems: 'center',
518
+ paddingHorizontal: 12,
519
+ paddingVertical: 10,
520
+ borderRadius: 24,
521
+ borderWidth: 0,
522
+ gap: 12,
523
+ minHeight: 56
524
+ },
525
+ accountItemLoading: {
526
+ justifyContent: 'center',
527
+ paddingHorizontal: 16
528
+ },
529
+ accountItemText: {
530
+ flex: 1
531
+ },
532
+ accountItemName: {
533
+ fontSize: 15,
534
+ fontWeight: '500',
535
+ marginBottom: 2
536
+ },
537
+ accountItemUsername: {
538
+ fontSize: 12
539
+ },
540
+ viewAllItem: {
541
+ justifyContent: 'center',
542
+ paddingVertical: 10
543
+ },
544
+ viewAllText: {
545
+ fontSize: 14,
546
+ fontWeight: '500',
547
+ marginLeft: 4
548
+ },
549
+ currentAccountBadgeContainer: {
550
+ paddingHorizontal: 10,
551
+ paddingVertical: 4,
552
+ borderRadius: 16
553
+ },
554
+ currentAccountBadge: {
555
+ fontSize: 10,
556
+ fontWeight: '600',
557
+ letterSpacing: 0.3
558
+ },
559
+ dividerContainer: {
560
+ flexDirection: 'row',
561
+ alignItems: 'center',
562
+ marginVertical: 8
563
+ },
564
+ dividerLine: {
565
+ flex: 1,
566
+ height: 1
567
+ },
568
+ dividerText: {
569
+ fontSize: 14,
570
+ fontWeight: '500',
571
+ paddingHorizontal: 16,
572
+ textTransform: 'lowercase'
573
+ },
574
+ avatarsContainer: {
575
+ flexDirection: 'row',
576
+ alignItems: 'center',
577
+ marginLeft: 'auto'
578
+ },
579
+ avatarWrapper: {
580
+ position: 'relative',
581
+ borderRadius: 20,
582
+ borderWidth: 3
583
+ },
584
+ currentAvatarWrapper: {
585
+ borderWidth: 3
586
+ },
587
+ currentBadge: {
588
+ position: 'absolute',
589
+ bottom: -2,
590
+ right: -2,
591
+ width: 14,
592
+ height: 14,
593
+ borderRadius: 7,
594
+ alignItems: 'center',
595
+ justifyContent: 'center',
596
+ borderWidth: 0
597
+ },
598
+ accountItemAvatarWrapper: {
599
+ borderRadius: 20,
600
+ borderWidth: 3
601
+ },
602
+ languageButton: {
603
+ position: 'absolute',
604
+ top: 0,
605
+ right: 0,
606
+ width: 40,
607
+ height: 40,
608
+ borderRadius: 20,
609
+ alignItems: 'center',
610
+ justifyContent: 'center'
611
+ }
612
+ });
151
613
  //# sourceMappingURL=SignInUsernameStep.js.map