diff --git a/apps/backoffice/src/app/features/profile/pages/ProfilePage.tsx b/apps/backoffice/src/app/features/profile/pages/ProfilePage.tsx index 51f3dd333..1cffa5444 100644 --- a/apps/backoffice/src/app/features/profile/pages/ProfilePage.tsx +++ b/apps/backoffice/src/app/features/profile/pages/ProfilePage.tsx @@ -42,7 +42,7 @@ import { useForm } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; import { z } from 'zod'; import { useTranslation } from 'react-i18next'; -import { notify, PageHeader, useErrorHandler, passwordSchema as strongPasswordSchema, PasswordRequirements } from '@ema-platform/ui'; +import { notify, PageHeader, useErrorHandler, passwordSchema as strongPasswordSchema, PasswordRequirements, phoneNumber } from '@ema-platform/ui'; import { useApiMutation } from '@ema-platform/api'; import { ActiveSessions, setUser } from '@ema-platform/auth'; import type { AuthUser } from '@ema-platform/auth'; @@ -126,9 +126,9 @@ export function ProfilePage() { .string() .min(1, { message: t('profile.validation.usernameRequired') }), email: z.string().email({ message: t('profile.validation.emailInvalid') }), - phoneNumber: z - .string() - .min(1, { message: t('profile.validation.phoneRequired') }), + // Shared international rule: bare 09xxxxxxxx normalizes to +251, any + // other E.164 number is accepted as typed. + phoneNumber, }); type ProfileValues = z.infer; diff --git a/apps/portal/src/app/features/licensing/components/ConfigDrivenSection.tsx b/apps/portal/src/app/features/licensing/components/ConfigDrivenSection.tsx index 15c658b79..52e3cebc5 100644 --- a/apps/portal/src/app/features/licensing/components/ConfigDrivenSection.tsx +++ b/apps/portal/src/app/features/licensing/components/ConfigDrivenSection.tsx @@ -14,7 +14,7 @@ import { type FormSectionConfig, type Vessel, } from '@ema-platform/api'; -import { AmharicDatePicker, CountrySelect } from '@ema-platform/ui'; +import { AmharicDatePicker, CountrySelect, PhoneInput } from '@ema-platform/ui'; import { useTranslation } from 'react-i18next'; import { LocationPicker } from '../../location/components/LocationPicker'; @@ -223,6 +223,12 @@ export function ConfigDrivenSection({ value={(value as string) ?? ''} onChange={(v) => onChange(field.key, v)} /> + ) : field.type === 'PHONE' ? ( + onChange(field.key, v)} + /> ) : field.type === 'TEXTAREA' ? (