Events

HTML5 native events dispatched to the window object

Widget events are directly dispatched to the window object, so to listen for them simply create event listeners on it. Currently the only two events are

  • FF_CHECK_RESULT: fired on every check result, after "Verify my identity" is clicked.
  • FF_EXTERNAL_IDV_CHECK_COMPLETED: fired when onfido external idv is completed.
window.addEventListener("FF_CHECK_RESULT", ((e: CustomEvent) => {
    console.log(e.detail);
  }) as EventListener);
  window.addEventListener("FF_EXTERNAL_IDV_CHECK_COMPLETED", ((e: CustomEvent) => {
    console.log(e.detail);
  }) as EventListener);

Both events contain useful data, included on the event object's detail field (e.detail).

For FF_CHECK_RESULT, e.detail is

  • checkSummary: object with check results and issues found,
  • resultSlug: one of
    • success // final
    • pending-success // final
    • too-many-tries // final
    • no-match // will loop
    • partial-match // will loop
  • nextViewSlug: might be the same values as "resultSlug", but also "external-idv" if widget is configured for it,
  • applicant: applicant object with personal information, including the applicant's entity id which can be used with our API calls,
  • documents: array with all documents and document checks for this applicant,
  • attemptCount: how many times has the user attempt checks on this instance of the widget so far,
  • maxAttemptCount: max attempt count configured,
  • externalIdv: is external idv activated per configuration,
  • isCheckingAddress: are addresses activated per configuration,
  • isCheckingIDs: are documents activated per configuration,

For FF_EXTERNAL_IDV_CHECK_COMPLETED, e.detail is much simpler. It only includes:

  • applicant: applicant object with personal information, including the applicant's entity id which can be used with our API calls,
  • documents: array with all documents and document checks for this applicant,

Did this page help you?