cindy | Posts: 380

front-end event notification

0 votes

Hi Support team,

 

our client is expecting front-end event notification when signing is completed, does OneSpan provide it? not the one registered in the portal. 

by the way, client using iFrame to launch OSS.

thanks,

Cindy


cindy | Posts: 380

Reply to: front-end event notification

0 votes

I found this post https://community.onespan.com/forum/signercomplete-event-does-not-get-received-addeventlistener

it seems those event are only available via launching from iFrame. do you know if client complains not to receive the event, they received some but not all, what could be the issue? where to start troubleshoot?

thanks,

Cindy


cindy | Posts: 380

Reply to: front-end event notification

0 votes

they are not getting these events: ESL:MESSAGE:SUCCESS:SIGNER_COMPLETE, ESL:MESSAGE:SUCCESS:SIGNER_COMPLETE_REVIEWED, ESL:MESSAGE:SUCCESS:PACKAGE_OPT_OUT, ESL:MESSAGE:SUCCESS:PACKAGE_DECLINE

they are getting only one event MSL:MESSAGE:REGISTER


Duo_Liang | Posts: 3776

Reply to: front-end event notification

0 votes

Hi Cindy,

 

Yes, when the signing ceremony is embedded in an iFrame, OSS sends Javascript notifications to your parent window when specific actions are triggered.

You can find an iFrame example for how to listen for OneSpan Sign events from this guide "Using JavaScript Event Notifiers".

Typically a listener function looks like this:

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;
      }
}

As the signing process goes, you should be able to see a list of events printed in the dev console.

 

Duo

 

 


cindy | Posts: 380

Reply to: front-end event notification

0 votes

thanks Duo, I will refer to the post you posted.


cindy | Posts: 380

Reply to: front-end event notification

0 votes

Hi Duo,

if signer clicks handover button, is there front-end event listen to that? if so, what's the event name?

thanks,

Cindy


Duo_Liang | Posts: 3776

Reply to: front-end event notification

0 votes

Hi Cindy,

 

Unfortunately, there's no JS event for handover button. But if the handover page shares the same origin as the parent window, in the handover page, you can call an IIFE JavaScript function to notify our parent window like below:

(function(){ window.parent.postMessage('ESL:MESSAGE:SUCCESS:HANDOVER_URL', "*"); })();

You must use a source that shares the same origin as the parent window, because this source is used to establish the cross-window communication between the iFrame and the parent page. 

Once the redirect is triggered, the parent window can receive the post message sent from the hook link, and this message can be handled just like other notifications sent from OneSpan Sign. Below is a sample code:

function receiveMessage(event) {

var origin = event.origin || event.originalEvent.origin;

var data = event.data;

console.log(data, origin);

switch (data) {

case 'ESL:MESSAGE:SUCCESS:HANDOVER_URL':

// call your function here break;

default:

event.source.postMessage(data, origin)

break;

}

}

 

Duo


cindy | Posts: 380

Reply to: front-end event notification

0 votes

thanks for the information, I will let my client know. 

thanks,

Cindy


cindy | Posts: 380

Reply to: front-end event notification

0 votes

Hi Duo,

 

I have another question as my client is asking if during signing ceremony anything failed, does OSS sent event notification back to app? if not, how can the control back to app in case of any error during signing ceremony?

P.S my client is using iframe to launch OSS.

thanks,

Cindy

 

 


cindy | Posts: 380

Reply to: front-end event notification

0 votes

also if signing token is expired, how the calling app knows that? 


AlexJuvion | Posts: 12

Reply to: front-end event notification

0 votes

Great insights on front-end event notifications! For those working on related projects or academic research, you might find dissertation help UK helpful if you need professional support with your dissertation.


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off