Initialize OnVoard object
Specify the following snippet once before you add any javascript API code so that OnVoard object is initialized.
<script>
(function() {
window.OnVoard = window.OnVoard || function() {
(window.OnVoard.q = window.OnVoard.q || []).push(arguments);
};
})();
</script>
Below are available methods for javascript API.
Show Panel
Use this to show reperks panel.
OnVoard('reperks_widget', 'showPanel');
Show panel and navigating to specific tabs.
OnVoard('reperks_widget', 'showPanel', 'store-rewards');
OnVoard('reperks_widget', 'showPanel', 'earning-points');
OnVoard('reperks_widget', 'showPanel', 'activities');
Hide Panel
Use this to hide reperks panel.
OnVoard('reperks_widget', 'hidePanel');
On Ready Event
Execute a callback function when reperks widget is loaded and ready.
const yourCallback = () => {
console.log("Reperks widget is ready");
};
OnVoard('reperks_widget', 'onReady', yourCallback);
Get Member Data
Retrieve member data.
const yourCallback = (memberData) => {
console.log(memberData);
};
OnVoard('reperks_widget', 'getMemberData', yourCallback);
Below is a sample for member data. External ID refers to customer's ID in ecommerce platform.
{
"id": "1111",
"external_id": "1111",
"contact_id": "1111",
"contact_email": "john@example.com",
"current_points": 2500,
"is_enrolled": true,
"dob": "1988-04-08T15:14:30.000Z"
}