Repository navigation
Closed
5 / 55 of 5 issues completedClosed
refactor(regionalization): harden country, regional formatting, and international data boundaries#388
5 / 55 of 5 issues completed
Copy link
Labels
area:backendBackend (Express/SQLite)area:frontendFrontend (React/Next.js)enhancementNew feature or requestepicTracks a group of related issues and pull requests
Description
Problem
FloCafe already supports multiple countries, regional phone formatting, currency/time formatting, country tax packs, and UI languages. However, several regional boundaries remain inconsistent:
- Timezones are currently tied directly to static country profiles, preventing multi-timezone countries (e.g. US, Canada, Australia) from configuring their true store timezone.
- Regional locale display preferences (such as Iranian Rial/Toman or Persian calendar) are validated against a global union enum rather than country-declared options, risking mismatched state during country transitions.
- Customer management search fails to match formatted phone inputs on the admin customer list.
- Country display names in setup and settings remain hardcoded in English regardless of the active UI language.
- Tax registration validation patterns are embedded in static application code rather than carried by versioned country tax packs.
These regionalization concerns are strictly distinct from the UI-language translation architecture migrating under #372.
Architectural Model
UI LANGUAGE
translated text + text direction
│
│ independent
▼
COUNTRY PROFILE
regional defaults (currency, format locale, phone dial code, default timezone suggestion)
│
▼
TENANT REGIONAL SETTINGS
authoritative runtime preferences (timezone, calendar, digits, currency display)
│
▼
COMPLIANCE / TAX / PROVIDERS
legal/business behavior (tax packs, rates, invoice rules, fiscal connectors)
Core Domain Boundaries
- UI Language: Governs translated UI prose, ICU message formatting, and LTR/RTL layout direction. Does NOT govern store country, currency, tax rules, phone parsing rules, or timezone.
- Country Profile: Governs sensible regional defaults (ISO code, default currency, default regional formatting locale, default timezone suggestion, calling code). These are defaults, not permanent tenant truth.
- Tenant Regional Settings: Authoritative runtime store configuration. Country default timezone is a suggestion; tenant timezone is authoritative.
- Compliance & Tax: Governed by TaxEngine, signed/versioned country tax packs, and fiscal connectors. Separate from UI translation and regional display preferences.
Explicit Invariants
- UI language does not determine tax behavior.
- UI language does not determine tenant country.
- Country default timezone is a suggestion; tenant timezone is authoritative.
- Canonical storage must remain region/language independent:
- Money is stored in canonical currency units (e.g. IRR for Iran; Toman is presentation only).
- Dates are stored as canonical UTC timestamps; timezone/calendar/digits are presentation formatting.
- Phones are stored in canonical E.164 format.
- Countries are stored as ISO 3166-1 alpha-2 codes (e.g.
CA,BR,US), never translated country names. - Historical transaction tax results are immutable snapshots.
- Tax calculation remains backend authoritative.
- Tax pack updates remain optional for offline operation once installed.
- Phone normalization remains based on
libphonenumber-js. - No countries database table (retains static profiles in application code).
- No arbitrary currency override or multi-currency checkout.
- Zero runtime network dependencies; complete offline-first operation.
- This epic is completely separate from refactor(i18n): migrate to scalable use-intl architecture #372 (UI-language / use-intl migration).
Non-Goals
- No UI translation architecture rewrite (owned by refactor(i18n): migrate to scalable use-intl architecture #372).
- No TaxEngine arithmetic rewrite.
- No multi-currency checkout or foreign currency exchange.
- No IP-based or browser geolocation timezone auto-detection.
- No database-backed country registry.
- No replacement of native
Intlorlibphonenumber-js. - No new SaaS dependencies or remote formatting APIs.
- No single monolithic migration PR.
Phases & Sub-issues
Phase 1 — Regional Correctness
- fix(settings): allow tenant timezone override independently of country default #389 —
fix(settings): allow tenant timezone override independently of country default - fix(settings): enforce country-scoped regional preference invariants #390 —
fix(settings): enforce country-scoped regional preference invariants
Phase 2 — International Data Ergonomics
- fix(customers): normalize formatted phone queries in customer list search #391 —
fix(customers): normalize formatted phone queries in customer list search
Phase 3 — Presentation Integration
- feat(countries): localize country display names using active UI locale #392 —
feat(countries): localize country display names using active UI locale(depends on refactor(i18n): install use-intl and establish language registry/provider foundation #373 foundation in refactor(i18n): migrate to scalable use-intl architecture #372)
Phase 4 — Compliance Boundary Cleanup
- refactor(tax-packs): version tax registration validation metadata with country packs #393 —
refactor(tax-packs): version tax registration validation metadata with country packs
Epic Acceptance Criteria
- Multi-timezone countries can configure and persist their authoritative timezone independently of country profile defaults.
- Stored regional preferences are strictly validated against the active country's declared
localeOptionswith clean backward-compatible normalization for legacy databases. - Customer search in admin list matches both formatted and unformatted phone inputs across international numbering formats.
- Country names in setup and settings render localized in the active UI language using native
Intl.DisplayNames. - Country tax packs can optionally provide versioned tax registration number validation patterns.
- All operations remain 100% functional offline with zero runtime network calls.
- Canonical storage contracts (UTC dates, E.164 phones, ISO country codes, canonical money units) remain intact.
Sub-issues
Collapse Sub-issuesSub-issues
Loading 5 sub-issues
Metadata
Metadata
Assignees
Labels
area:backendBackend (Express/SQLite)area:frontendFrontend (React/Next.js)enhancementNew feature or requestepicTracks a group of related issues and pull requests
Activity
khaira777 commentedon Aug 20, 2026
Epic status snapshot — 2026-08-20
Current delivery stage across the regionalization work:
282948b1exists, but the no-mistakes review step failed before a PR was opened; rerun/follow-up validation is needed.Epic overall: 2 of 5 child issues are complete, 1 is in active validation, 1 is blocked in validation, and 1 is ready to start. The epic remains open until #390, #391, and #392 are completed.
khaira777 commentedon Aug 20, 2026
Epic status snapshot — 2026-08-20
282948b1; run01M0GRWKXPW6DQW22YGCG29CH8is waiting on a real timezone-preservation regression finding before tests, push, and PR creation.e5ddfd3c, including the mixed digit-bearing name/email search correction.e624e729; run01M0GQR716R7VQGW1S7E2MESWMpassed rebase, review, and tests and is running documentation before push/PR.75883b36with CI in progress.Epic overall: 3 of 5 child issues are complete/closed, #390 is blocked at review by a regression finding, and #392 is progressing through final gate stages. The epic remains open until #390 and #392 are delivered; PR #434 is the outstanding compliance hardening follow-up.
khaira777 commentedon Aug 21, 2026
Epic status snapshot — 2026-08-21
01M0GRWKXPW6DQW22YGCG29CH8is applying the timezone-preservation regression fix at review. No PR yet.e5ddfd3c; mixed digit-bearing name/email search correction included.01M0GQR716R7VQGW1S7E2MESWMpassed rebase, review, and tests and is running documentation before lint, push, and PR creation.8730fc04, completing the tax-registration hardening follow-up.Epic overall: 3 of 5 child issues are complete/closed. #390 is actively resolving its final review regression, and #392 is progressing through final validation. The epic remains open only for #390 and #392.
khaira777 commentedon Aug 21, 2026
Epic complete — all child issues merged
Epic #388 is complete. All five child issues are now closed with merged implementations:
079edbabedb980adAll required CI and Greptile validation passed for the final two PRs.