# IDAA Integration Module

This module integrates features from the Aether (AE) application into the IDAA (International Doctors in Alcoholics Anonymous) website, which is powered by a system called Novi. The integration is achieved by embedding Aether pages within iframes inside the Novi site.

This directory (`src/routes/idaa`) contains the Svelte routes that correspond to the pages on the main IDAA site.

## Architecture

The integration uses a multi-step iframe-based approach:

1.  **Novi Page:** A page on the IDAA website contains a snippet of code that loads a static HTML file from this Aether project's `static/` directory into an iframe.
2.  **Static HTML Bridge:** The static file (e.g., `static/idaa_novi_iframe_archives.html`) acts as a bridge. It contains JavaScript that:
    a. Executes within the context of the Novi site, allowing it to access Novi-specific data like the current user's unique ID (`<%=Novi.User.CustomerUniqueId%>`).
    b. Uses the Novi user ID to make a call to the Novi API to get more user details (like email and full name).
    c. Uses the retrieved user details to construct a URL for the actual Aether application page.
    d. Loads the Aether page into a nested iframe on the static page.
3.  **Aether Application:** The final Aether page (e.g., `/idaa/archives`) receives the user information via URL parameters and displays the relevant content.

This architecture allows the Aether application to securely authenticate and identify the Novi user without a complex SSO integration.

## Sub-modules

The IDAA integration includes the following features, each corresponding to a route in this directory and a static HTML bridge file.

### IDAA - Archives

- **Route:** `/idaa/archives`
- **Bridge File:** `static/idaa_novi_iframe_archives.html`
- **Functionality:** Provides access to the Aether Archives module, allowing IDAA members to view and search archived content.

### IDAA - Bulletin Board (BB)

- **Route:** `/idaa/bb`
- **Bridge File:** `static/idaa_novi_iframe_bulletin_board.html`
- **Functionality:** Provides a bulletin board or forum feature, powered by the Aether Posts module.

### IDAA - Recovery Meetings

- **Route:** `/idaa/recovery_meetings`
- **Bridge File:** `static/idaa_novi_iframe_recovery_meetings.html`
- **Functionality:** Displays a list of recovery meetings. This may also integrate with a Jitsi meeting interface (`idaa_novi_iframe_jitsi_meeting.html`).

## Novi API Verification (brief)

The IDAA routes receive a `uuid` parameter when loaded via the Novi iframe bridge. The application verifies that UUID by calling Novi's customers API (using the `novi_idaa_api_key` from site config) and then sets verified fields in the IDAA store (`novi_uuid`, `novi_email`, `novi_full_name`, `novi_verified`).

For full implementation details, verification flow, and the list of `site_cfg_json` fields used by IDAA, see the client documentation: [documentation/CLIENT\_\_IDAA_and_customized_mods.md](documentation/CLIENT__IDAA_and_customized_mods.md).
