Closed ivan-rino closed 1 year ago
Hi @Ivan-rino. It looks like your onMessage
function returns for non-ControlMessages before ever subscribing to the dismissed event. If you change that line to the below, it should work as expected.
if (inAppMessage instanceof braze.ControlMessage) {
return;
}
Hi @wesleyorbin, thanks for the reply. Sorry about the sample code, I copied it wrong, I just edited it correctly. I removed completely the condition and didn't worked neither, same behaviour, only the X button of the modal triggers the dismissed event.
Hi @Ivan-rino. I can't reproduce on my side. Clicking the close button, clicking outside of the message, and pressing the Esc key all log a dismissed event. Clicking the message itself or the message buttons will log click events rather than dismissal events. Is there a specific use case that isn't working for you?
Hi @wesleyorbin,
The issue happens with a button with the default Close message action.
Please take a look to the logs attached and you can observe that is a modal with 2 buttons, one with an URL action that works fine, and the dismiss one that with the Close message action that doesn't trigger the onMessageClose callback:
1: InAppMessageButtonbackgroundColor: 14474465borderColor: 4292664545clickAction: "NONE"id: 1lt: u {Pe: {…}}nl: truetext: "Dismiss"textColor: 4294967295uri: undefined[[Prototype]]:
Thanks!
@Ivan-rino The built-in UI will log a button click rather than a dismissal in this scenario since all button clicks close the message. You will be able to see analytics on which buttons have been clicked on the dashboard.
Hi @wesleyorbin,
Based on your suggestion then I will handle all the button clicks as if they always closed the message.
Thanks!
Braze Web SDK Version
4.4.0
Integration Method
NPM
Browser
Edge
Steps To Reproduce
Expected Behavior
onMessageClose function is called when the in-app message is closed from a button with the default Close message action.
Actual Incorrect Behavior
onMessageClose function is not called when the in-app message is closed from a button with the default Close message action.
Verbose Logs
Additional Information
Closing the in-app message with the default X close button calls fine to the onClose callback as expected.