/** * A phone number as the server keeps it: digits, spaces and + ( ) - . /, * five digits at least. Words ("call us") are no number to call. */ export const isPhoneOrEmpty = (value: string): boolean => { const phone = value.trim().replace(/\s+/g, ' '); return ( phone === '' || (/^\+?[\d\s()./-]{5,40}$/.test(phone) && (phone.match(/\d/g) ?? []).length >= 5) ); }; export const PHONE_ERROR = 'A phone number: digits, with spaces, +, ( ), - or . between them.';