Skip to main content

Migration Modal Event Communication

The Anon modal uses a structured event system to communicate user interactions and modal state to the parent window when embedded as an iframe. Events are sent via window.postMessage and always include user and migration context.

Event Types & Payloads

All events have the following payload components:
string
required
Unique identifier for the event
string
required
Always set to "event"
string
required
ISO 8601 timestamp of when the event was created
string
required
Event type. One of: migration_modal.opened, migration_modal.completed, migration_modal.closed, migration_modal.failed, migration_modal_step.started, migration_modal_step.submitted, migration_modal_step.completed, migration_modal_step.failed
object
required
Event-specific data containing user and migration context
Below is a summary of all event types, when they are emitted, and their payload structure.

Receiving Events in the Parent Window

To listen for modal events, add a message event listener in your parent application. Always check the event source and type:

Event Flows

Below are typical event flows for different user and system scenarios.
1

migration_modal.opened

Modal first displayed
2

migration_modal_step.started

Step displayed to user (e.g., “welcome”)
3

migration_modal_step.submitted

User clicks submit
4

migration_modal_step.completed

Step processed successfully
5

migration_modal_step.started

Next step displayed (e.g., “login”)
6

migration_modal.completed

All steps completed - authentication workflow successful

Best Practices:
  • Always verify the event source and origin.
  • Use the event type and data to drive analytics, UI, or business logic.
  • All events include user_id and migration_id for context.
  • The event system deduplicates identical events within a 3-second window.