Referrals Window API
The Referrals Window API exposes public functions that can be called to setup or make configuration changes to referral to be displayed on the page.
Properties
This is a list of all properties that can be set on the window API.
window.okeReferralsApi.appStatus
The current load state of the Referrals widget on site.
'notRequested'
- no load for the referrals app has been attempted.
'requested'
- The referrals app initialisation has commenced.
'loaded'
- The app has been loaded and is ready to interact with whether the widget is visible or not.
'notRequested' | 'requested' | 'loaded'
window.okeReferralsApi.isEmbedded
A boolean
value to indicate whether there is a Referrals Widget in the page markup as opposite to one that would be invoked as a pop-over/modal component.
true
| false
window.okeReferralsApi.isModalOpen
A boolean
value to indicate whether there is an open Referrals Widget in pop-over/modal component.
true
| false
Functions
openModal
Opens the Referrals Widget as a modal/pop-over on a given page. If a Referrals Widget is already embedded on the current page, the page will scroll down to the embedded Referrals Widget.
Example Usage
Properties
Before calling openModal
, you should check that window.okeReferralsApi.appStatus
is loaded
closeModal
Closes an open Referrals Widget modal/pop-over on a given page. If a Referrals Widget is already embedded on the current page this action won't do anything as there is no modal/pop-over to close.
Example Usage
Binding A Referrals Modal Open Action To An Element
We give merchants/engineers the ability to add a data
attribute to elements within the DOM.
When the Okendo App Embed is enabled and the data
attribute is present, any click on that given element will open a Referrals modal/pop-over.
Example Usage
Last updated