countly-sdk-web 24.11.0 → 24.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 24.11.1
2
+ - Deprecated `initializeRatingWidgets` method, use `feedback.showRating` instead.
3
+ - Deprecated `enableRatingWidgets` method, use `feedback.showRating` instead.
4
+ - Added an interface `content` for Content feature methods:
5
+ - `enterContentZone`, to start Content checks (Experimental!)
6
+ - `exitContentZone`, to stop Content checks (Experimental!)
7
+
1
8
  ## 24.11.0
2
9
  - Mitigated an issue where SDK could try to send old stored offline mode data during init if `clear_stored_id` was true
3
10
  - Mitigated an issue where the SDK could stayed on offline mode after the first init with `offline_mode` set to true
@@ -15,7 +15,7 @@ function initMain(name, version) {
15
15
  }
16
16
 
17
17
  const SDK_NAME = "javascript_native_web";
18
- const SDK_VERSION = "24.11.0";
18
+ const SDK_VERSION = "24.11.1";
19
19
 
20
20
  // tests
21
21
  describe("Bridged SDK Utilities Tests", () => {
@@ -30,7 +30,7 @@ const dummyQueue = [
30
30
  describe("Session tests ", () => {
31
31
  it("Checks if session start, extension and ending works with a dummy queue", () => {
32
32
  hp.haltAndClearStorage(() => {
33
- // initialize countly
33
+ // initialize countly
34
34
  initMain();
35
35
  // begin session
36
36
  Countly.begin_session();
@@ -50,7 +50,7 @@ describe("Session tests ", () => {
50
50
  });
51
51
  it("Checks if session start, extension and ending works", () => {
52
52
  hp.haltAndClearStorage(() => {
53
- // initialize countly
53
+ // initialize countly
54
54
  initMain();
55
55
  // begin session
56
56
  Countly.begin_session();
@@ -97,9 +97,7 @@ describe("Browser session tests, auto", () => {
97
97
  describe("Browser session tests, manual 1", () => {
98
98
  it("Single sessions test with manual sessions", () => {
99
99
  cy.visit("./cypress/fixtures/session_test_manual_1.html?use_session_cookie=true");
100
- cy.contains("Start").click().wait(waitTime);
101
- cy.contains("Event").click().wait(300);
102
- cy.contains("End").click().wait(300);
100
+ cy.wait(waitTime + 1000);
103
101
  cy.visit("./cypress/fixtures/base.html");
104
102
  cy.fetch_local_request_queue(app_key).then((rq) => {
105
103
  cy.log(rq);
@@ -109,10 +107,10 @@ describe("Browser session tests, manual 1", () => {
109
107
  cy.check_session(rq[0], undefined, undefined, app_key);
110
108
  // third object of the queue should be about session extension, also input the expected duration
111
109
  cy.check_session(rq[2], 5, undefined, app_key);
112
- // fourth object of the queue should be about event sent
113
- cy.check_event(JSON.parse(rq[3].events)[0], eventObj, undefined, false);
114
110
  // fifth object of the queue should be about session extension, also input the expected duration
115
- cy.check_session(rq[4], 1, undefined, app_key);
111
+ cy.check_session(rq[3], 1, undefined, app_key);
112
+ // fourth object of the queue should be about event sent
113
+ cy.check_event(JSON.parse(rq[4].events)[0], eventObj, undefined, false);
116
114
  });
117
115
  });
118
116
  });
@@ -160,12 +158,7 @@ describe("Browser session tests, auto, no cookie", () => {
160
158
  describe("Browser session tests, manual 1, no cookie", () => {
161
159
  it("Single bounce test with manual sessions with no cookies", () => {
162
160
  cy.visit("./cypress/fixtures/session_test_manual_1.html");
163
- cy.contains("Start").click();
164
- cy.wait(waitTime);
165
- cy.contains("Event").click();
166
- cy.wait(300);
167
- cy.contains("End").click();
168
- cy.wait(300);
161
+ cy.wait(waitTime + 1000);
169
162
  cy.visit("./cypress/fixtures/base.html");
170
163
  cy.fetch_local_request_queue(app_key).then((rq) => {
171
164
  cy.log(rq);
@@ -175,10 +168,10 @@ describe("Browser session tests, manual 1, no cookie", () => {
175
168
  cy.check_session(rq[0], undefined, undefined, app_key);
176
169
  // third object of the queue should be about session extension, also input the expected duration
177
170
  cy.check_session(rq[2], 5, undefined, app_key);
178
- // fourth object of the queue should be about event sent
179
- cy.check_event(JSON.parse(rq[3].events)[0], eventObj, undefined, false);
180
171
  // fifth object of the queue should be about session extension, also input the expected duration
181
- cy.check_session(rq[4], 1, true, app_key);
172
+ cy.check_session(rq[3], 1, true, app_key);
173
+ // fourth object of the queue should be about event sent
174
+ cy.check_event(JSON.parse(rq[4].events)[0], eventObj, undefined, false);
182
175
  });
183
176
  });
184
177
  });
@@ -205,7 +198,7 @@ describe("Browser session tests, manual 2, no cookie", () => {
205
198
  describe("Check request related functions", () => {
206
199
  it("Check if prepareRequest forms a proper request object", () => {
207
200
  hp.haltAndClearStorage(() => {
208
- // initialize countly
201
+ // initialize countly
209
202
  initMain();
210
203
  let reqObject = {};
211
204
  Countly._internals.prepareRequest(reqObject);
@@ -215,7 +208,7 @@ describe("Check request related functions", () => {
215
208
  });
216
209
  it("Check if prepareRequest forms a proper request object from a bad one ", () => {
217
210
  hp.haltAndClearStorage(() => {
218
- // initialize countly
211
+ // initialize countly
219
212
  initMain();
220
213
  let reqObject = { app_key: null, device_id: null };
221
214
  Countly._internals.prepareRequest(reqObject);
@@ -225,7 +218,7 @@ describe("Check request related functions", () => {
225
218
  });
226
219
  it("Check if prepareRequest forms a proper request object and not erase an extra value ", () => {
227
220
  hp.haltAndClearStorage(() => {
228
- // initialize countly
221
+ // initialize countly
229
222
  initMain();
230
223
  let reqObject = { extraKey: "value" };
231
224
  Countly._internals.prepareRequest(reqObject);
@@ -22,37 +22,29 @@ console.error("cleared the storage");
22
22
  const confObj = queryExtractor(window.location.search);
23
23
 
24
24
  //initializing countly with params
25
- Countly.init({
26
- app_key: "YOUR_APP_KEY",
27
- url: "https://your.domain.count.ly",
28
- device_id: "manual_1",
29
- session_update: 5,
30
- test_mode: true,
31
- use_session_cookie: confObj.use_session_cookie || false,
32
- debug:true
33
- })
25
+ Countly.init({
26
+ app_key: "YOUR_APP_KEY",
27
+ url: "https://your.domain.count.ly",
28
+ device_id: "manual_1",
29
+ session_update: 5,
30
+ test_mode: true,
31
+ use_session_cookie: confObj.use_session_cookie || false,
32
+ debug: true
33
+ })
34
+ Countly.begin_session();
35
+ setTimeout(() => {
36
+ Countly.add_event({
37
+ key: "buttonClick",
38
+ "segmentation": {
39
+ "id": "id"
40
+ }
41
+ });
42
+ Countly.end_session(undefined, true);
43
+ }, 7000);
44
+
45
+
34
46
  </script>
35
47
  </head>
36
48
  <body>
37
- <script type='text/javascript' >
38
- function clickEvent(){
39
- window.Countly.add_event({
40
- key: "buttonClick",
41
- "segmentation": {
42
- "id": "id"
43
- }
44
- });
45
- }
46
- function start(){
47
- Countly.begin_session();
48
- }
49
- function end(){
50
- Countly.end_session(undefined, true);
51
- }
52
- </script>
53
- <button type="button" onclick="clickEvent()">Event</button>
54
- <button type="button" onclick="start()">Start</button>
55
- <button type="button" onclick="end()">End</button>
56
- <button type="button" onclick="windowClose()">Close</button>
57
49
  </body>
58
- </html>
50
+ </html>
package/lib/countly.d.ts CHANGED
@@ -483,6 +483,22 @@ declare module "countly-sdk-web" {
483
483
  showRating(nameIDorTag?: string): void;
484
484
  }
485
485
 
486
+ /**
487
+ * Content interface with convenience methods for content zones:
488
+ * - enterContentZone() - enters a content zone
489
+ * - exitContentZone() - exits a content zone
490
+ */
491
+ const content: Content;
492
+ interface Content {
493
+ /**
494
+ * Enters content zone and checks and displays available content regularly
495
+ */
496
+ enterContentZone(): void;
497
+ /**
498
+ * Exits content zone
499
+ */
500
+ exitContentZone(): void;
501
+ }
486
502
  /**
487
503
  * This function retrieves all associated widget information (IDs, type, name etc in an array/list of objects) of your app
488
504
  * @param {Function} callback - Callback function with two parameters, 1st for returned list, 2nd for error