/** * PhoneField helper functions * Extracted for better code organization and testability */ import type { ReactNode } from 'react'; import type { PhoneCountryData } from '@galaxy-dev/metadsl-core'; import type { PhoneFieldConfig, ParsedPhoneValue, PhoneValue } from './types'; /** * Resolved field configuration with all required field names * All fields are string (null is normalized to '') */ export type ResolvedPhoneFieldConfig = { phoneNumberName: string; countryCodeName: string; dialCodeName: string; phoneNumberCleanedName: string; }; /** * Get resolved field configuration * Uses name prop as default phoneNumberName if not specified in fieldConfig * Note: flatOutput only affects how these field names are used, not the resolution logic * * Normalizes null to '' (both mean "skip this field") */ export declare function getFieldConfig(name: string, userFieldConfig?: PhoneFieldConfig): ResolvedPhoneFieldConfig; /** * Extract error message from field meta * Priority: customError (async validation) > error (sync validation) */ export declare function getFieldError(meta: any): ReactNode; /** * Parse phone value from external value * Supports both nested object and flat string formats */ export declare function parsePhoneValue(flatOutput: boolean, externalValue: any, formContext: any, fieldConfig: ResolvedPhoneFieldConfig): ParsedPhoneValue; /** * Build complete phone value object */ export declare function buildPhoneValue(country: PhoneCountryData, phoneNumber: string): { countryCode: string; dialCode: string; phoneNumber: string; phoneNumberCleaned: string; }; /** * Get initial country from parsed value and sorted countries */ export declare function getInitialCountry(parsedValue: ParsedPhoneValue, sortedCountries: PhoneCountryData[], defaultCountry?: string): PhoneCountryData; /** * Clean phone number (remove non-digit characters except spaces, hyphens, parentheses) */ export declare function cleanPhoneNumber(phoneNumber: string): string; /** * Compare two phone values for equality * Returns true if values are equal (no update needed) * * @param prevValue - Previous external value (string in flat mode, PhoneValue in nested mode) * @param currValue - Current external value (string in flat mode, PhoneValue in nested mode) * @param flatOutput - Whether using flat output mode * @returns true if values are equal */ export declare function isPhoneValueEqual(prevValue: string | PhoneValue | undefined | null, currValue: string | PhoneValue | undefined | null, flatOutput: boolean): boolean; //# sourceMappingURL=helpers.d.ts.map