Problem statement
A small storefront page needs one config module that reads a raw settings object off window and hands typed, defaulted, frozen values to every consumer on the page — so nothing else on the page has to know the global exists, and a fake key never comes back as undefined, using Vanilla TypeScript and standard DOM APIs.
Demo
The page, styles, seeded product data, DOM helpers, price label consumer, promo banner consumer, API client consumer, and bootstrap entry are already scaffolded and wired. Only the logic inside src/js/config.ts is missing — implement it so every test passes. Do not edit any other file.
What to implement
- Read the settings object the page put on the window before the bundle ran, and use whatever values it holds.
- For any setting the page did not include, fall back to the documented default value.
- Show a featured product card with the product name and its price prefixed by the currency symbol chosen by the current setting.
- Show a promo banner strip only when the current setting turns the promo on; keep it hidden otherwise.
- Show the current API base URL in the small footer.
- Prevent the rest of the page from changing any value it reads back — once handed out, the settings snapshot cannot be mutated.
- Raise the named error when the page asks for a setting name that is not one of the known settings.
- Everything shown must come from the injected settings and their documented defaults — nothing should be hardcoded.
