Skip to content

Commit

Permalink
Merge pull request #31 from Countly/11.4-fix
Browse files Browse the repository at this point in the history
Content multi fix
  • Loading branch information
turtledreams authored Jan 10, 2025
2 parents bbd0198 + 4f6915d commit 62b6499
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 24.11.4

* Mitigated an issue where `content` and `feedback` interfaces would not work with async multi instances.

## 24.11.3

* Added support for content resizing (Experimental!)
Expand Down
4 changes: 4 additions & 0 deletions cypress/fixtures/multi_instance.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@
Countly.q.push(["YOUR_APP_KEY3", "collect_from_forms"]);
Countly.q.push(["YOUR_APP_KEY3", "collect_from_facebook"]);
Countly.q.push(["YOUR_APP_KEY3", "opt_in"]);
Countly.q.push(["YOUR_APP_KEY3", "feedback.showNPS"]);
Countly.q.push(["YOUR_APP_KEY3", "content.enterContentZone"]);

//initialize fourth instance for another app asynchronously
Countly.q.push(["init", {
Expand Down Expand Up @@ -158,6 +160,8 @@
Countly.q.push(["YOUR_APP_KEY4", "collect_from_forms"]);
Countly.q.push(["YOUR_APP_KEY4", "collect_from_facebook"]);
Countly.q.push(["YOUR_APP_KEY4", "opt_in"]);
Countly.q.push(["YOUR_APP_KEY4", "feedback.showNPS"]);
Countly.q.push(["YOUR_APP_KEY4", "content.enterContentZone"]);
</script>
</head>
</html>
2 changes: 1 addition & 1 deletion modules/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ var healthCheckCounterEnum = Object.freeze({
errorMessage: "cly_hc_error_message",
});

var SDK_VERSION = "24.11.3";
var SDK_VERSION = "24.11.4";
var SDK_NAME = "javascript_native_web";

// Using this on document.referrer would return an array with 17 elements in it. The 12th element (array[11]) would be the path we are looking for. Others would be things like password and such (use https://regex101.com/ to check more)
Expand Down
13 changes: 13 additions & 0 deletions modules/CountlyClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -4223,12 +4223,25 @@ constructor(ob) {
if (typeof inst[req[arg]] === "function") {
inst[req[arg]].apply(inst, req.slice(arg + 1));
}
// Add interfaces you add to here for async queue to work
else if (req[arg].indexOf("userData.") === 0) {
var userdata = req[arg].replace("userData.", "");
if (typeof inst.userData[userdata] === "function") {
inst.userData[userdata].apply(inst, req.slice(arg + 1));
}
}
else if (req[arg].indexOf("content.") === 0) {
var contentMethod = req[arg].replace("content.", "");
if (typeof inst.content[contentMethod] === "function") {
inst.content[contentMethod].apply(inst, req.slice(arg + 1));
}
}
else if (req[arg].indexOf("feedback.") === 0) {
var feedbackMethod = req[arg].replace("feedback.", "");
if (typeof inst.feedback[feedbackMethod] === "function") {
inst.feedback[feedbackMethod].apply(inst, req.slice(arg + 1));
}
}
else if (typeof Countly[req[arg]] === "function") {
Countly[req[arg]].apply(Countly, req.slice(arg + 1));
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "countly-sdk-js",
"version": "24.11.3",
"version": "24.11.4",
"description": "Countly JavaScript SDK",
"type": "module",
"main": "Countly.js",
Expand Down

0 comments on commit 62b6499

Please sign in to comment.