This page tests all 5 required scenarios for the Mother Hospitals Centralized Offer Management System. Each scenario overrides window.MH_OFFERS in-memory and re-runs the manager so you can see the result live.
Sets enabled: true, start: yesterday, end: tomorrow.
Sets enabled: false β date is in range but offer is off.
Sets enabled: true, start = 30 days in future.
Sets enabled: true, end = 30 days in past.
Sets MH_OFFERS: [] β empty list.
CENTRALIZED OFFER MANAGEMENT β Architecture
============================================
Config File (single source of truth):
/assets/js/offer-config.js
βββ window.MH_OFFERS[] (array of offer objects)
Engine:
/assets/js/offer-manager.js
βββ getActiveOffer() β filters by enabled + date range, picks highest priority
βββ injectBanner() β injects .offer-banner before <nav>, sessionStorage dismiss
βββ injectNavbar() β injects .offer-nav-link into .nav-links + .mob-menu
βββ injectPopup() β delayed modal overlay, sessionStorage dismiss
βββ MHOfferManager.closePopup() β public API for popup dismiss button
Styles:
/assets/style.css
βββ .offer-banner, .offer-close, .offer-nav-link, .offer-mob-link,
.offer-popup-overlay, .offer-popup-card, .offer-popup-cta β¦
Page Integration (all 226 HTML pages):
<script src="/assets/js/offer-config.js"></script>
<script src="/assets/js/offer-manager.js"></script>
injected before </body> in every page β one-time, never needs editing again.
To run a new campaign:
1. Add offer object to window.MH_OFFERS in offer-config.js
2. Set enabled: true, start_datetime, end_datetime
3. Commit & deploy β zero template edits
To disable:
Set enabled: false in offer-config.js β vanishes site-wide instantly.
The injected banner and nav item will appear above the nav element below when an active offer is running.