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 viawindow.postMessage and always include user and migration context.
Event Types & Payloads
All events have the following payload components: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.failedReceiving Events in the Parent Window
To listen for modal events, add amessage 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.- Successful Migration
- Validation or Login Error
- Unrecoverable Error
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_idandmigration_idfor context. - The event system deduplicates identical events within a 3-second window.