Add support for forwarding `security-key` and `x-security-key` headers in the
proxy route. The proxy will now automatically inject a security key from
environment variables if it is not already present in the request headers.
Additionally, introduce new test API pages to facilitate debugging and
verifying API responses, including localized country name resolution and
proxy functionality.
- Add `security-key` and `x-security-key` to forwarded headers in proxy
- Implement automatic injection of security key in `src/app/api/proxy/route.ts`
- Add `src/app/[lang]/test-api/page.tsx` for comprehensive API testing
- Add `src/app/test-api/page.tsx` as a root-level redirect/wrapper for the
test API page
Extract geolocation detection and storage logic from `QuestionBirthplace`
and `QuestionPhone` into a new `geo-region.ts` library. This provides a
single source of truth for user region data, including city, country,
and phone calling codes.
- Create `src/lib/geo-region.ts` to manage GeoIP fetching, caching,
and subscription-based updates.
- Refactor `QuestionBirthplace` to use the new `getUserGeoRegion` utility
instead of inline fetch logic.
- Refactor `QuestionPhone` to use the unified storage and retrieval
mechanism for phone calling codes.
- Add unit tests in `ui-config.test.tsx` to verify auto-detection
behavior when `enable_geoip` is enabled.
Refactor the profile resolution flow to explicitly cache and redirect
to the `/intro` route when marriage profile basics are incomplete.
This ensures users are correctly routed to the onboarding sequence
via the entry route cache.
Additionally, adds optional chaining to `router.prefetch` calls to
prevent runtime errors and updates test suites to reflect the
newly cached `/intro` path behavior.
Refactor the marriage profile and assessment flow to use a new overview
endpoint, reducing the need to fetch full question schemas for the
initial list view.
- Implement `getFormOverview` and `useFormOverviewQuery` to fetch
high-level section metadata.
- Update `QuestionDetailClient` and `QuestionsListPage` to utilize
the overview data for rendering progress and section lists.
- Refactor `schema-adapter` to support mapping overview sections to
frontend `QuestionListItem` objects.
- Optimize proxy performance by adding TTFB metrics and improving
encoding support.
- Improve UI/UX with better overscroll behavior and viewport settings.
- Add unit and integration tests for the new schema adapter and
required steps component.
Refactor the application initialization and data fetching strategy to improve performance, reliability, and user experience, especially within the Flutter webview context.
Key changes:
- **Bootstrap & Initialization**: Implemented a `beforeInteractive` bootstrap script to handle locale correction and safe-area insets before the app becomes visible, reducing layout shift and flickering.
- **Locale Routing**: Enhanced the middleware proxy to prioritize authoritative cookie-based locales and improved `Accept-Language` header parsing to support complex device headers.
- **Assessment Progress**: Introduced a local assessment progress tracking mechanism that merges server-side completion data with local `localStorage` drafts, ensuring users don't lose progress during transitions.
- **Data Fetching**: Optimized React Query configurations by increasing `staleTime` and disabling aggressive refetching on window focus/mount to reduce unnecessary network overhead.
- **UI/UX Improvements**:
- Replaced `next/image` icon loading with an inline `UiIcon` component to eliminate per-icon network requests and ensure icons are available in the initial HTML.
- Implemented a Flutter-style skeleton shimmer animation using CSS transforms for smoother performance in the webview.
- Updated CSS variables to use `env(safe-area-inset-*)` for better mobile compatibility.
- **Refactoring**:
- Consolidated marriage-related data fetching into a unified `useFormSchemaQuery` pattern.
- Simplified component logic by removing redundant `silent-reloader` calls and manual cache-busting headers.
- Improved type safety for the Flutter bridge and window global objects.