▲ Top

Event Notifier

This topic describes the Event Notifier that was introduced in the 10.13.14 and 11.0.5 releases of OneSpan Sign.

When OneSpan Sign's User Interface is being integrated into an iFrame, the Event Notifier can send event notifications to the person who is integrating. This is useful if the integrator wants to be notified when certain steps of the integration have been accomplished. After receiving such a notification, integrators can interrupt OneSpan Sign’s normal activity to perform some asynchronous task (e.g., ask the user to confirm a request), and then notify OneSpan Sign to resume its normal flow.

The rest of this document describes:

Starting the Event Notifier

The steps required to start the Event Notifier are executed in plain JavaScript. The client software must be listening to OneSpan Sign’s message events, as the following code illustrates:

window.addEventListener('message', receiveMessage, false);

For more information about the code in this chapter, click here.

To register with the Event Notifier, the Listener code should look something like this:eSignLive for Microsoft Dynamics CRM

// Receive message listener
    function receiveMessage(event) {
      var origin = event.origin || event.originalEvent.origin;
      var data = event.data;
      console.log(data, origin);

      switch (data) {
         case 'ESL:MESSAGE:REGISTER':       
           event.source.postMessage('ESL:MESSAGE:ACTIVATE_EVENTS', origin);
           break;
         default:
           event.source.postMessage(data, origin)
           break;
      }
    }

After loading a page, OneSpan Sign initially fires the event ESL:MESSAGE:REGISTER. In return, the client’s software must send back to OneSpan Sign the event ESL:MESSAGE:ACTIVATE_EVENTS. If this doesn't happen, OneSpan Sign assumes that no one is listening, and no other events will be fired.

Interrupting OneSpan Sign’s Normal Activity

To interrupt OneSpan Sign’s normal activity, some events can be stopped temporarily (the events in question are identified in the third column of the table below).

To stop events temporarily, the above code for the Listener can be amended as follows:

switch (data) {
   ...
   case 'ESL:MESSAGE:STARTED:DOCUMENT_NAVIGATION':
     // Do some async stuff, then notify OneSpan Sign of the same event.
     setTimeout(function(){
       event.source.postMessage('ESL:MESSAGE:STARTED:DOCUMENT_NAVIGATION', origin)
     }, 5000);
     break;
   ...
}

If events are not sent back as they are received, OneSpan Sign will not resume its normal activity.

Notification Event Types

The following table describes the types of notification events to which a registered Listener can listen.

Event Name Meaning of the Event Event can be temporarily stopped? Compatible with the Standard Signing Ceremony? Compatible with the Mobile Signing Ceremony?
ESL:MESSAGE:STARTED:DOCUMENT_ACCEPT A signer has started to accept a consent or disclosure NO YES YES
ESL:MESSAGE:SUCCESS:DOCUMENT_ACCEPT A signer has successfully accepted a consent or disclosure YES YES YES
ESL:MESSAGE:ERROR:DOCUMENT_ACCEPT A signer has failed in their attempt to accept a consent or disclosure NO YES YES
ESL:MESSAGE:STARTED:PACKAGE_OPT_OUT A signer has started to opt out of a transaction NO YES YES
ESL:MESSAGE:SUCCESS:PACKAGE_OPT_OUT A signer has successfully opted out of a transaction YES YES YES
ESL:MESSAGE:ERROR:PACKAGE_OPT_OUT A signer has failed in their attempt to opt out of a transaction NO YES YES
ESL:MESSAGE:STARTED:PACKAGE_DECLINE A signer has started to decline a transaction NO YES YES
ESL:MESSAGE:SUCCESS:PACKAGE_DECLINE A signer has successfully declined a transaction YES YES YES
ESL:MESSAGE:ERROR:PACKAGE_DECLINE A signer has failed in their attempt to decline a transaction NO YES YES
ESL:MESSAGE:STARTED:DOCUMENT_CONFIRM A signer has started to confirm a document NO YES YES
ESL:MESSAGE:SUCCESS:DOCUMENT_CONFIRM A signer has successfully confirmed a document YES YES YES
ESL:MESSAGE:ERROR:DOCUMENT_CONFIRM A signer has failed in their attempt to confirm a document NO YES YES
ESL:MESSAGE:STARTED:SIGNER_COMPLETE A signer has started to complete a transaction YES YES YES
ESL:MESSAGE:SUCCESS:SIGNER_COMPLETE A signer has successfully completed a transaction NO YES YES
ESL:MESSAGE:STARTED:DOCUMENT_NAVIGATION The user has started navigating to another document YES YES YES
ESL:MESSAGE:SUCCESS:DOCUMENT_NAVIGATION The user has successfully navigated to another document NO YES YES