πŸ§ͺ Offer Manager β€” QA Test Suite

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.

Loading offer status…

Scenario 1 β€” Offer Enabled, Date Within Range

Expected: Offer displays in top banner, navbar, and popup

Sets enabled: true, start: yesterday, end: tomorrow.

Scenario 2 β€” Offer Disabled

Expected: Offer disappears from all locations

Sets enabled: false β€” date is in range but offer is off.

Scenario 3 β€” Offer Enabled, Before Start Date

Expected: Offer remains hidden

Sets enabled: true, start = 30 days in future.

Scenario 4 β€” Offer Enabled, After End Date

Expected: Offer remains hidden

Sets enabled: true, end = 30 days in past.

Scenario 5 β€” No Active Offers

Expected: No banners, no popup, no empty spacing, layout normal

Sets MH_OFFERS: [] β€” empty list.

Live Configuration State

Architecture Summary

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.

Visual Preview Area

The injected banner and nav item will appear above the nav element below when an active offer is running.