Google Open Source Integrations
Visita leverages powerful open-source libraries from Google to enhance data validation, offline capabilities, and addressing precision.Plus Codes (Open Location Code)
Many areas in South African informal settlements lack formal street addresses. We use Plus Codes (Open Location Code) to provide digital, offline-friendly addresses for every signal.Implementation
- Library:
open-location-code(via local wrapper) - Utility:
lib/plus-codes.ts - Format:
8FJJ+4X Johannesburg(Short code with locality)
Usage
We automatically generate/display Plus Codes in theSignalCard based on coordinate data.
Phone Number Validation
To ensure reliable communication with residents and sellers, we use Google’s libphonenumber for strict parsing and validation of South African phone numbers.Implementation
- Library:
google-libphonenumber - Utility:
lib/phone-utils.ts
Capabilities
- Mobile Validation: Strictly enforce valid SA mobile numbers (082, 076, etc.) for user accounts.
- Formatting: Standardize input to E.164 format (
+2782...) for database storage and SMS services.
Progressive Web App (PWA)
Visita is a fully offline-capable PWA using Serwist (the modern successor to Google Workbox).Service Worker
Located atapp/sw.ts, our Service Worker handles:
- Precaching: Critical assets for instant load.
- Runtime Caching:
- Mapbox Tiles: Stale-while-revalidate strategy for map interactions.
- Supabase Storage: Cache-first strategy for ward maps and user uploads.
- Google Fonts: Cache-first for consistent typography.
Manifest
The dynamic manifest (app/manifest.ts) enables “Add to Home Screen” functionality, making the web app feal like a native mobile application with a focused UI (no browser bar) and brand colors.