@oxyhq/services 25.0.1 → 26.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  2. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +34 -11
  3. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  4. package/lib/commonjs/ui/screens/CreateAccountScreen.js +32 -10
  5. package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
  6. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +2 -2
  7. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
  8. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  9. package/lib/module/ui/screens/AccountSettingsScreen.js +35 -12
  10. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  11. package/lib/module/ui/screens/CreateAccountScreen.js +33 -11
  12. package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
  13. package/lib/module/ui/screens/EditProfileFieldScreen.js +3 -3
  14. package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
  15. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts +2 -1
  16. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
  17. package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  18. package/lib/typescript/commonjs/ui/screens/CreateAccountScreen.d.ts.map +1 -1
  19. package/lib/typescript/module/ui/components/OxySignInButton.d.ts +2 -1
  20. package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
  21. package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  22. package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts.map +1 -1
  23. package/lib/typescript/types/expo-image-picker.d.ts +35 -0
  24. package/package.json +4 -4
  25. package/src/types/expo-image-picker.d.ts +35 -0
  26. package/src/ui/components/OxySignInButton.tsx +2 -1
  27. package/src/ui/screens/AccountSettingsScreen.tsx +41 -13
  28. package/src/ui/screens/CreateAccountScreen.tsx +42 -12
  29. package/src/ui/screens/EditProfileFieldScreen.tsx +3 -3
@@ -3,7 +3,7 @@ import { useState, useCallback, useRef, useEffect } from 'react';
3
3
  import { View, ActivityIndicator } from 'react-native';
4
4
  import Ionicons from '@expo/vector-icons/Ionicons';
5
5
  import type { AccountKind, CreateAccountInput, OrganizationCategory } from '@oxyhq/core';
6
- import { ORGANIZATION_CATEGORIES } from '@oxyhq/core';
6
+ import { DISPLAY_NAME_INVALID_MESSAGE, isValidDisplayName, MAX_DISPLAY_NAME_LENGTH, ORGANIZATION_CATEGORIES } from '@oxyhq/core';
7
7
  import type { BaseScreenProps } from '../types/navigation';
8
8
  import { useI18n } from '../hooks/useI18n';
9
9
  import { useSurfaceHeader } from '../hooks/useSurfaceHeader';
@@ -23,7 +23,7 @@ type CreatableAccountKind = Exclude<AccountKind, 'personal'>;
23
23
  const USERNAME_REGEX = /^[a-zA-Z0-9_-]{3,30}$/;
24
24
  const DEBOUNCE_MS = 400;
25
25
  const USERNAME_MAX = 30;
26
- const DISPLAY_NAME_MAX = 50;
26
+ const DISPLAY_NAME_MAX = MAX_DISPLAY_NAME_LENGTH;
27
27
  const BIO_MAX = 160;
28
28
 
29
29
  interface KindOption {
@@ -112,6 +112,7 @@ const CreateAccountScreen: React.FC<BaseScreenProps> = ({
112
112
  const [organizationCategory, setOrganizationCategory] = useState<OrganizationCategory>('agency');
113
113
  const [username, setUsername] = useState('');
114
114
  const [displayName, setDisplayName] = useState('');
115
+ const [displayNameError, setDisplayNameError] = useState('');
115
116
  const [bio, setBio] = useState('');
116
117
  const [usernameStatus, setUsernameStatus] = useState<UsernameStatus>('idle');
117
118
  const [usernameMessage, setUsernameMessage] = useState('');
@@ -180,7 +181,28 @@ const CreateAccountScreen: React.FC<BaseScreenProps> = ({
180
181
  checkUsername(cleaned);
181
182
  }, [checkUsername]);
182
183
 
183
- const canCreate = usernameStatus === 'available' && displayName.trim().length > 0 && !isCreating;
184
+ const handleDisplayNameChange = useCallback((value: string) => {
185
+ setDisplayName(value);
186
+ const trimmed = value.trim();
187
+ if (!trimmed) {
188
+ setDisplayNameError('');
189
+ return;
190
+ }
191
+ const nameParts = trimmed.split(/\s+/);
192
+ const firstName = nameParts[0] || '';
193
+ const lastName = nameParts.length > 1 ? nameParts.slice(1).join(' ') : '';
194
+ const invalidPart = [firstName, lastName].find((part) => part && !isValidDisplayName(part));
195
+ setDisplayNameError(
196
+ invalidPart
197
+ ? (t('accounts.create.displayName.invalidChars') || DISPLAY_NAME_INVALID_MESSAGE)
198
+ : '',
199
+ );
200
+ }, [t]);
201
+
202
+ const canCreate = usernameStatus === 'available'
203
+ && displayName.trim().length > 0
204
+ && !displayNameError
205
+ && !isCreating;
184
206
 
185
207
  const handleCreate = useCallback(async () => {
186
208
  if (!canCreate) return;
@@ -320,15 +342,23 @@ const CreateAccountScreen: React.FC<BaseScreenProps> = ({
320
342
  </View>
321
343
 
322
344
  {/* Display Name */}
323
- <TextField>
324
- <TextFieldInput
325
- floatingLabel
326
- label={t('accounts.create.displayName.label') || 'Display name'}
327
- value={displayName}
328
- onChangeText={setDisplayName}
329
- maxLength={DISPLAY_NAME_MAX}
330
- />
331
- </TextField>
345
+ <View className="gap-space-4">
346
+ <TextField isInvalid={Boolean(displayNameError)}>
347
+ <TextFieldInput
348
+ floatingLabel
349
+ label={t('accounts.create.displayName.label') || 'Display name'}
350
+ value={displayName}
351
+ onChangeText={handleDisplayNameChange}
352
+ isInvalid={Boolean(displayNameError)}
353
+ maxLength={DISPLAY_NAME_MAX}
354
+ />
355
+ </TextField>
356
+ {displayNameError ? (
357
+ <Text className="text-caption font-caption text-negative px-space-4">
358
+ {displayNameError}
359
+ </Text>
360
+ ) : null}
361
+ </View>
332
362
 
333
363
  {/* Bio */}
334
364
  <View className="gap-space-4">
@@ -20,7 +20,7 @@ import { SurfaceHeaderAction } from '../components/SurfaceHeaderAction';
20
20
  import { useOxy } from '../context/OxyContext';
21
21
  import { useProfileEditing } from '../hooks/useProfileEditing';
22
22
  import { toast } from '@oxyhq/bloom/toast';
23
- import { EMAIL_REGEX, isValidDisplayName } from '@oxyhq/core';
23
+ import { EMAIL_REGEX, DISPLAY_NAME_INVALID_MESSAGE, isValidDisplayName } from '@oxyhq/core';
24
24
  import { getLinkTitle, getLinkDescription, linksToListItems } from './linkFormat';
25
25
 
26
26
  /**
@@ -202,7 +202,7 @@ const EditProfileFieldScreen: React.FC<EditProfileFieldScreenProps> = ({
202
202
  isValidDisplayName(value)
203
203
  ? undefined
204
204
  : (t('editProfile.items.displayName.invalidChars')
205
- || 'Use letters and spaces only'),
205
+ || DISPLAY_NAME_INVALID_MESSAGE),
206
206
  },
207
207
  {
208
208
  key: 'lastName',
@@ -212,7 +212,7 @@ const EditProfileFieldScreen: React.FC<EditProfileFieldScreenProps> = ({
212
212
  isValidDisplayName(value)
213
213
  ? undefined
214
214
  : (t('editProfile.items.displayName.invalidChars')
215
- || 'Use letters and spaces only'),
215
+ || DISPLAY_NAME_INVALID_MESSAGE),
216
216
  },
217
217
  ],
218
218
  };