Skip to content

Commit

Permalink
Merge pull request #295 from CleverTap/WEB-3310
Browse files Browse the repository at this point in the history
[WEB-3310] Fixed Inbox Open Not Working for SPA App
  • Loading branch information
kkyusuftk authored Nov 5, 2024
2 parents dcae8a1 + 8c2b7d6 commit 7b4e572
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file.

## [1.11.6] 04th Nov, 2024
- Fix for Checking Web Inbox when inbox Node becomes stale

## [1.11.5] 30th Oct, 2024
- Added support for personalisation in visual editor

Expand Down
12 changes: 11 additions & 1 deletion clevertap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clevertap.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clevertap.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clevertap-web-sdk",
"version": "1.11.5",
"version": "1.11.6",
"description": "",
"main": "clevertap.js",
"scripts": {
Expand Down
12 changes: 11 additions & 1 deletion src/modules/web-inbox/WebInbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ export class Inbox extends HTMLElement {
}
}
}
} else if (this.inboxSelector.contains(e.target) || this.isInboxOpen) {
} else if (this.checkForWebInbox(e) || this.isInboxOpen) {
if (this.isInboxFromFlutter) {
this.isInboxFromFlutter = false
} else {
Expand All @@ -387,6 +387,16 @@ export class Inbox extends HTMLElement {
}
})()

/**
* This function checks if the current Event Node is same as the already stored inboxSelector or the
* inboxSelector present in the document
*/
checkForWebInbox (e) {
const config = StorageManager.readFromLSorCookie(WEBINBOX_CONFIG) || {}
return this.inboxSelector.contains(e.target) ||
document.getElementById(config.inboxSelector).contains(e.target)
}

/**
* This function will be called every time when a message comes into the inbox viewport and it's visibility increases to 50% or drops below 50%
* If a msg is 50% visible in the UI, we need to mark the message as viewed in LS and raise notification viewed event
Expand Down

0 comments on commit 7b4e572

Please sign in to comment.