Component Events
Everee Embed Components use events to communicate with your host application. You should listen for these events as they include important information and helpful errors.
In order to listen for events, you'll need to give us a way to communicate. This can be done one of two ways. If you're using a UI library to present "web-view" components, you'll likely need to use that library's unique approach to attach an event listener, JavaScript message channel, or similar. If you're using an <iframe>
element, you can provide a communication channel directly. See below for examples.
Embed Component events have data payloads with the following shape:
{
"eventType": "EVENT_TYPE",
"error": false,
"errorCode": "EMB-101",
"errorMessage": "Error message text",
"eventHandlerName": "Your provided 'eventHandlerName'"
}
Embed Components can broadcast the following events:
Event | eventType | Description |
---|---|---|
Message Port Successfully Registered | MESSAGE_PORT_REGISTERED | A message port has been successfully registered with the Component, and the Component is now able to broadcast events to the host. |
Worker Onboarding Complete | WORKER_ONBOARDING_COMPLETE | The worker onboarding process has been successfully completed. A corresponding webhook event will be transmitted shortly after this event is broadcast. |
Dismiss Container View | DISMISS | The Component is requesting the host to dismiss or remove its container view. This could be because the Component's workflow has been successfully completed, or that the user pressed a button wanting to return to the host UX. |
Successful registration
Once an event handler has been successfully registered with the Embed Component, your handler will receive an initial event with eventType: "MESSAGE_PORT_REGISTERED"
. This event will be delivered strictly before any other events are published from the Component, and confirms that the Component is able to communicate with your host application.
Error codes
You may see errors during development or production. Use these error codes below to identify and resolve issues.
Code | Message | Details |
---|---|---|
EMB-101 | Session creation token expired | Tokens generated from a session creation request are one-time use and only valid for a short period of time. Each time you need to present an embedded experience, create a new session immediately prior to displaying it. Don’t create a session before you need it. |
EMB-102 | No event handler registered | No event handler has been registered with the embedded experience. Make sure the appropriate eventHandlerName has been specified (see the docs for platform-specific instructions). |
EMB-201 | Onboarding already complete | The ONBOARDING experience is only available for workers whose onboarding has not yet been completed.Create a new worker record to start a new onboarding sequence instead. |
EMB-202 | Onboarding not yet complete | Only the ONBOARDING experience is available until workers have completed onboarding.Complete the onboarding sequence in order to present other experiences. |
Updated 26 days ago