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