Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staging 24.11.2 #539

Merged
merged 4 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 24.11.2
- Added a new init method to set the interval of Content Zone's timer (Experimental!):
- `content_zone_timer_interval` to set the timer interval in `seconds`
- Mitigated an issue about Content's positioning (Experimental!)

## 24.11.1
- Deprecated `initializeRatingWidgets` method, use `feedback.showRating` instead.
- Deprecated `enableRatingWidgets` method, use `feedback.showRating` instead.
- Added an interface `content` for Content feature methods:
- `enterContentZone`, to start Content checks (Experimental!)
- `exitContentZone`, to stop Content checks (Experimental!)

## 24.11.0
- Mitigated an issue where SDK could try to send old stored offline mode data during init if `clear_stored_id` was true
- Mitigated an issue where the SDK could stayed on offline mode after the first init with `offline_mode` set to true
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/bridged_utils.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function initMain(name, version) {
}

const SDK_NAME = "javascript_native_web";
const SDK_VERSION = "24.11.0";
const SDK_VERSION = "24.11.2";

// tests
describe("Bridged SDK Utilities Tests", () => {
Expand Down
33 changes: 13 additions & 20 deletions cypress/e2e/sessions.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const dummyQueue = [
describe("Session tests ", () => {
it("Checks if session start, extension and ending works with a dummy queue", () => {
hp.haltAndClearStorage(() => {
// initialize countly
// initialize countly
initMain();
// begin session
Countly.begin_session();
Expand All @@ -50,7 +50,7 @@ describe("Session tests ", () => {
});
it("Checks if session start, extension and ending works", () => {
hp.haltAndClearStorage(() => {
// initialize countly
// initialize countly
initMain();
// begin session
Countly.begin_session();
Expand Down Expand Up @@ -97,9 +97,7 @@ describe("Browser session tests, auto", () => {
describe("Browser session tests, manual 1", () => {
it("Single sessions test with manual sessions", () => {
cy.visit("./cypress/fixtures/session_test_manual_1.html?use_session_cookie=true");
cy.contains("Start").click().wait(waitTime);
cy.contains("Event").click().wait(300);
cy.contains("End").click().wait(300);
cy.wait(waitTime + 1000);
cy.visit("./cypress/fixtures/base.html");
cy.fetch_local_request_queue(app_key).then((rq) => {
cy.log(rq);
Expand All @@ -109,10 +107,10 @@ describe("Browser session tests, manual 1", () => {
cy.check_session(rq[0], undefined, undefined, app_key);
// third object of the queue should be about session extension, also input the expected duration
cy.check_session(rq[2], 5, undefined, app_key);
// fourth object of the queue should be about event sent
cy.check_event(JSON.parse(rq[3].events)[0], eventObj, undefined, false);
// fifth object of the queue should be about session extension, also input the expected duration
cy.check_session(rq[4], 1, undefined, app_key);
cy.check_session(rq[3], 1, undefined, app_key);
// fourth object of the queue should be about event sent
cy.check_event(JSON.parse(rq[4].events)[0], eventObj, undefined, false);
});
});
});
Expand Down Expand Up @@ -160,12 +158,7 @@ describe("Browser session tests, auto, no cookie", () => {
describe("Browser session tests, manual 1, no cookie", () => {
it("Single bounce test with manual sessions with no cookies", () => {
cy.visit("./cypress/fixtures/session_test_manual_1.html");
cy.contains("Start").click();
cy.wait(waitTime);
cy.contains("Event").click();
cy.wait(300);
cy.contains("End").click();
cy.wait(300);
cy.wait(waitTime + 1000);
cy.visit("./cypress/fixtures/base.html");
cy.fetch_local_request_queue(app_key).then((rq) => {
cy.log(rq);
Expand All @@ -175,10 +168,10 @@ describe("Browser session tests, manual 1, no cookie", () => {
cy.check_session(rq[0], undefined, undefined, app_key);
// third object of the queue should be about session extension, also input the expected duration
cy.check_session(rq[2], 5, undefined, app_key);
// fourth object of the queue should be about event sent
cy.check_event(JSON.parse(rq[3].events)[0], eventObj, undefined, false);
// fifth object of the queue should be about session extension, also input the expected duration
cy.check_session(rq[4], 1, true, app_key);
cy.check_session(rq[3], 1, true, app_key);
// fourth object of the queue should be about event sent
cy.check_event(JSON.parse(rq[4].events)[0], eventObj, undefined, false);
});
});
});
Expand All @@ -205,7 +198,7 @@ describe("Browser session tests, manual 2, no cookie", () => {
describe("Check request related functions", () => {
it("Check if prepareRequest forms a proper request object", () => {
hp.haltAndClearStorage(() => {
// initialize countly
// initialize countly
initMain();
let reqObject = {};
Countly._internals.prepareRequest(reqObject);
Expand All @@ -215,7 +208,7 @@ describe("Check request related functions", () => {
});
it("Check if prepareRequest forms a proper request object from a bad one ", () => {
hp.haltAndClearStorage(() => {
// initialize countly
// initialize countly
initMain();
let reqObject = { app_key: null, device_id: null };
Countly._internals.prepareRequest(reqObject);
Expand All @@ -225,7 +218,7 @@ describe("Check request related functions", () => {
});
it("Check if prepareRequest forms a proper request object and not erase an extra value ", () => {
hp.haltAndClearStorage(() => {
// initialize countly
// initialize countly
initMain();
let reqObject = { extraKey: "value" };
Countly._internals.prepareRequest(reqObject);
Expand Down
52 changes: 22 additions & 30 deletions cypress/fixtures/session_test_manual_1.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,29 @@
const confObj = queryExtractor(window.location.search);

//initializing countly with params
Countly.init({
app_key: "YOUR_APP_KEY",
url: "https://your.domain.count.ly",
device_id: "manual_1",
session_update: 5,
test_mode: true,
use_session_cookie: confObj.use_session_cookie || false,
debug:true
})
Countly.init({
app_key: "YOUR_APP_KEY",
url: "https://your.domain.count.ly",
device_id: "manual_1",
session_update: 5,
test_mode: true,
use_session_cookie: confObj.use_session_cookie || false,
debug: true
})
Countly.begin_session();
setTimeout(() => {
Countly.add_event({
key: "buttonClick",
"segmentation": {
"id": "id"
}
});
Countly.end_session(undefined, true);
}, 7000);


</script>
</head>
<body>
<script type='text/javascript' >
function clickEvent(){
window.Countly.add_event({
key: "buttonClick",
"segmentation": {
"id": "id"
}
});
}
function start(){
Countly.begin_session();
}
function end(){
Countly.end_session(undefined, true);
}
</script>
<button type="button" onclick="clickEvent()">Event</button>
<button type="button" onclick="start()">Start</button>
<button type="button" onclick="end()">End</button>
<button type="button" onclick="windowClose()">Close</button>
</body>
</html>
</html>
82 changes: 0 additions & 82 deletions examples/example_opt_out.html

This file was deleted.

63 changes: 0 additions & 63 deletions examples/example_rating_widgets.html

This file was deleted.

16 changes: 16 additions & 0 deletions lib/countly.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,22 @@ declare module "countly-sdk-web" {
showRating(nameIDorTag?: string): void;
}

/**
* Content interface with convenience methods for content zones:
* - enterContentZone() - enters a content zone
* - exitContentZone() - exits a content zone
*/
const content: Content;
interface Content {
/**
* Enters content zone and checks and displays available content regularly
*/
enterContentZone(): void;
/**
* Exits content zone
*/
exitContentZone(): void;
}
/**
* This function retrieves all associated widget information (IDs, type, name etc in an array/list of objects) of your app
* @param {Function} callback - Callback function with two parameters, 1st for returned list, 2nd for error
Expand Down
Loading
Loading