front-end event notification
Friday, August 18, 2023 at 01:54pmHi 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
Reply to: front-end event notification
Friday, August 18, 2023 at 01:58pmI 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
Reply to: front-end event notification
Friday, August 18, 2023 at 02:00pmthey 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
Reply to: front-end event notification
Monday, August 21, 2023 at 10:17amHi 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
Reply to: front-end event notification
Monday, August 21, 2023 at 10:50amthanks Duo, I will refer to the post you posted.
Reply to: front-end event notification
Tuesday, August 22, 2023 at 03:45pmHi Duo,
if signer clicks handover button, is there front-end event listen to that? if so, what's the event name?
thanks,
Cindy
Reply to: front-end event notification
Tuesday, August 22, 2023 at 03:55pmHi 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
Reply to: front-end event notification
Tuesday, August 22, 2023 at 04:22pmthanks for the information, I will let my client know.
thanks,
Cindy
Reply to: front-end event notification
Thursday, September 14, 2023 at 01:13pmHi 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
Reply to: front-end event notification
Thursday, September 14, 2023 at 02:48pmalso if signing token is expired, how the calling app knows that?
Reply to: front-end event notification
Monday, August 12, 2024 at 07:23amGreat 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.