Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Summary
Add a country/dial code picker to the POS phone input with per-country validation. This fixes the immediate phone validation bug and lays the foundation for full internationalization.
Part of epic: #18
Problem
The POS phone number field uses a hardcoded CURRENCY_DIAL_CODE map (currency → dial code) with a phoneDigits setting for max length. This breaks worldwide deployment:
- Dial code derived from currency, not country (USD → +1 but Canada/US have different formats)
- No way to change dial code for customers from different countries
- Single global
phoneDigitssetting — different countries need different digit counts - No format validation
Scope
- Extend
frontend/src/lib/countries.tswithdial_code,phone_digit_min,phone_digit_max,phone_placeholder - Install
libphonenumber-jsfor phone validation - Build searchable
CountryPickercomponent (dropdown with country name + dial code + flag) - Update
CustomerSearch.tsxto use CountryPicker instead ofCURRENCY_DIAL_CODE - Validate phone on blur using libphonenumber-js
- Canonicalize to E.164 on blur (before form submission)
- Handle legacy phone numbers (display as-is if no
+prefix) - Update tables page phone input
- Remove
CURRENCY_DIAL_CODEmap - Add test coverage (unit tests for validation, CountryPicker, regression for Indian flow)
Files Touched
frontend/src/lib/countries.ts(extend)frontend/src/components/pos/CustomerSearch.tsx(rewrite phone input)frontend/src/app/(dashboard)/tables/page.tsx(update phone validation)- New:
frontend/src/lib/phone-validation.ts(libphonenumber wrapper) - New:
frontend/src/components/pos/CountryPicker.tsx(dropdown component)
Acceptance Criteria
- Phone input shows a country/dial code picker (not auto-prefix from currency)
- Phone numbers are validated per-country (length, format)
- Existing Indian users see no change (INR, +91, 10 digits still works)
- Adding a new country requires one line in countries.ts
- Phone numbers are stored in E.164 format
- Legacy phone numbers (without + prefix) display correctly
- Unit tests pass for phone validation and CountryPicker
Notes
libphonenumber-jsis Google-maintained, 2M+ weekly downloads — gold standard for phone validation- E.164 format:
+[country code][number]— canonical, no injection vector - CountryPicker defaults to tenant's country from settings (fallback: first in list)
- This ships independently — no backend changes needed
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
khaira777 commentedon Jul 6, 2026
Part of epic #18 — Internationalization
feat(i18n): country profiles, language-first wizard, Argentina IVA
feat(i18n): country profiles, language-first wizard, Argentina IVA
khaira777 commentedon Jul 18, 2026
✅ Completed in PR #116 & #119.
Closing as complete.
fix(tax): remap every override entity on manual category changes; ali…