Modal opened
This event is triggered when a modal is opened and becomes active and ready for interaction.
Event details
When the modalOpened event occurs, the received event.detail object includes the following properties:
ModalOpenedSdkEventProperties
readonly modalNameModalToken- Name of the modal that was opened
readonly typeMODAL_OPENED- Event type, always
"modalOpened"
Usage example
Ensure the SDK is ready before setting up the modalOpened event listener:
function onSdkReady() {
const eventName = window.gw.sdk.common.events.MODAL_OPENED;
window.gw.sdk.on(eventName, (event) => {
console.log(event.detail);
});
}
if (window.gw && window.gw.sdk) {
onSdkReady();
} else {
document.addEventListener("gwSdkReady", onSdkReady);
}
// Example output:
// {type: 'modalOpened', modalName: 'ReviewsFormModal'}
This code ensures that the SDK is ready before listening for the event, allowing you to respond as soon as a modal is opened.
Possible modalName values
ReviewsFormModalReviewsEditFormModalQuestionsFormModalRewardsJoinNowModalWidgetRewardsVerifyAccountModalWidgetRewardsCustomerRewardsModalWidgetRewardsWaysToEarnPageWidgetModalRewardsWaysToSpendPageWidgetModalRewardsAvailableRewardsPageWidgetModalSaveWishlistModalSaveForLaterModalAddToRegistryModalRegistryFormModalInstagramPostModalInstagramStoriesModalTiktokPostModal