Read TKF onboarding document links from the backend API#1557
Closed
stenehrlich-tuleva wants to merge 1 commit into
Closed
Read TKF onboarding document links from the backend API#1557stenehrlich-tuleva wants to merge 1 commit into
stenehrlich-tuleva wants to merge 1 commit into
Conversation
The savings fund (TKF100) signing step linked three legal documents — terms, prospectus, key information — from URLs hardcoded (and duplicated) in the two onboarding flow parents, which silently went stale when the documents were re-issued. Replace the hardcoded arrays with a useSavingsFundDocuments() react-query hook that reads GET /v1/savings/documents, and map the returned URLs onto the existing linkText label ids. WordPress stays the editable source (the backend mirrors it); the frontend no longer needs a deploy when the documents change. TermsStep renders a loading state (shared Loader) instead of an empty link list while the documents are loading, so the step never renders linkless mid-load. Tests via the mocked GET /v1/savings/documents backend; the flow test asserts the links carry the API-provided href, not a constant. No translation changes (labels already exist). Refs TulevaEE/TKF-VPII2026#63 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1557 +/- ##
==========================================
+ Coverage 81.97% 82.00% +0.02%
==========================================
Files 317 317
Lines 6576 6586 +10
Branches 1441 1444 +3
==========================================
+ Hits 5391 5401 +10
Misses 797 797
Partials 388 388 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Parking the WordPress-backed approach for now — it's more than we want to take on before our CTO is back to review the design. The branch stays put for pickup; tracking in TulevaEE/TKF-VPII2026#63. In the meantime we'll ship a minimal interim fix that just bumps the hardcoded document URLs to the current in-force (Feb 2026) versions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
The Täiendav Kogumisfond (TKF100) onboarding signing step links three legal documents — terms, prospectus, key information. Those URLs were hardcoded and duplicated in the two onboarding flow parents and silently went stale when the documents were re-issued (they pointed at the superseded
12.01.2026versions).This switches the frontend to read the URLs from the backend: a
useSavingsFundDocuments()hook callsGET /v1/savings/documentsand the returned URLs are mapped onto the existinglinkTextlabel ids. WordPress stays the editable source (the backend mirrors it) — the frontend no longer needs a deploy when the documents change.Issue: TulevaEE/TKF-VPII2026#63
Backend (serves the endpoint): TulevaEE/onboarding-service#1647
WordPress prereq (exposes the ACF fields over REST): TulevaEE/wordpress-theme#67
Changes
useSavingsFundDocuments()react-query hook +getSavingsFundDocuments()API fn +SavingsFundDocumentstype.SavingsFundOnboarding.tsxandSavingsFundCompanyOnboarding.tsxreaddocumentsfrom the hook and pass them toTermsStep— the hardcoded arrays are removed.TermsStepshows a loading state (sharedLoader) instead of an empty link list while documents are loading, so the step never renders linkless mid-load.linkText.{terms,prospectus,keyInfo}labels already exist.Tests
Strict TDD, semantic RTL queries.
TermsStepgets a graceful-loading test; both flow tests supply documents via a mockedGET /v1/savings/documentsbackend, and the happy-flow test asserts the Terms link carries the API-provided href (not a constant). Run with:Savings onboarding +
TermsStepsuites green (23/23);tsc --noEmit,eslint --max-warnings=0, and Prettier clean on the changed files.Note
Live end-to-end (URLs sourced from real WordPress REST) waits on TulevaEE/wordpress-theme#67 deploying; until then the backend serves a baked-in fallback, so the links are correct regardless.
🤖 Generated with Claude Code