Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
mprew97 committed Jul 23, 2024
1 parent d6ae7b5 commit f655fd3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/inapp/inapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
paintIFrame,
paintOverlay,
setCloseButtonPosition,
sortInAppMessages,
trackMessagesDelivered,
wrapWithIFrame
} from './utils';
Expand Down Expand Up @@ -616,6 +617,30 @@ export function getInAppMessages(
*/
return response;
}
/* otherwise, they're choosing to show the messages automatically */

/*
if the user passed the flag to automatically paint the in-app messages
to the DOM, start a timer and show each in-app message upon close + timer countdown
However there are 3 conditions in which to not show a message:
1. _read_ key is truthy
2. _trigger.type_ key is "never" (deliver silently is checked)
3. HTML body is blank
so first filter out unwanted messages and sort them
*/
clearMessages();
parsedMessages = sortInAppMessages(
filterHiddenInAppMessages(response.data.inAppMessages)
) as InAppMessage[];

return paintMessageToDOM().then(() => ({
...response,
data: {
inAppMessages: parsedMessages
}
}));
}),
pauseMessageStream: () => {
if (timer) {
Expand Down

0 comments on commit f655fd3

Please sign in to comment.