Skip to content

Commit d361ae0

Browse files
authored
Merge pull request #519 from Countly/staging
Staging 24.4.1
2 parents fb102da + 198b790 commit d361ae0

File tree

13 files changed

+6279
-250
lines changed

13 files changed

+6279
-250
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
lib
1+
lib/countly.js
2+
lib/countly.min.js
23
plugin/boomerang/boomerang.min.js
34
examples/
45
node_modules

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
/node_modules/
2-
.vscode/*
3-
package-lock.json
4-
2+
.vscode/*

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 24.4.1
2+
- Added types for the SDK
3+
- Added a new method `set_id(newDeviceId)` for managing device ID changes according to the device ID Type
4+
5+
- Mitigated an issue that could have prevented automatic Device Traces to not show up in server
6+
17
## 24.4.0
28
! Minor breaking change ! For implementations using `salt` the browser compatability is tied to SubtleCrypto's `digest` method support
39

cypress/integration/bridge_utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function initMain(name, version) {
1616
}
1717

1818
const SDK_NAME = "javascript_native_web";
19-
const SDK_VERSION = "24.4.0";
19+
const SDK_VERSION = "24.4.1";
2020

2121
// tests
2222
describe("Bridged SDK Utilities Tests", () => {

cypress/integration/device_id_change.js

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ describe("Device ID change tests ", ()=>{
145145
});
146146
});
147147
});
148+
it("Check init time temp mode with set_id", () => {
149+
hp.haltAndClearStorage(() => {
150+
initMain(true); // init in offline mode
151+
testDeviceIdInReqs(() => {
152+
Countly.set_id("new ID");
153+
});
154+
});
155+
});
148156

149157
// ========================================
150158
// default init configuration tests
@@ -209,4 +217,60 @@ describe("Device ID change tests ", ()=>{
209217
});
210218
});
211219
});
212-
});
220+
});
221+
222+
describe("Set ID change tests ", () => {
223+
it("set_id should be non merge as there was dev provided id", () => {
224+
hp.haltAndClearStorage(() => {
225+
Countly.init({
226+
app_key: "YOUR_APP_KEY",
227+
url: "https://your.domain.count.ly",
228+
test_mode: true,
229+
debug: true,
230+
device_id: "old ID"
231+
});
232+
Countly.add_event(eventObj("1")); // record an event.
233+
cy.wait(500); // wait for the request to be sent
234+
cy.fetch_local_request_queue().then((eq) => {
235+
expect(eq[0].device_id).to.equal("old ID");
236+
Countly.set_id("new ID");
237+
Countly.add_event(eventObj("2")); // record another event
238+
cy.wait(500); // wait for the request to be sent
239+
cy.fetch_local_request_queue().then((eq2) => {
240+
expect(eq2.length).to.equal(3); // no merge request
241+
expect(eq2[0].device_id).to.equal("old ID");
242+
expect(eq2[0].events).to.contains("\"key\":\"1\"");
243+
expect(eq2[1].device_id).to.equal("new ID");
244+
expect(eq2[1].begin_session).to.equal(1);
245+
expect(eq2[2].device_id).to.equal("new ID");
246+
expect(eq2[2].events).to.contains("\"key\":\"2\"");
247+
});
248+
});
249+
});
250+
});
251+
it("set_id should be merge as there was sdk generated id", () => {
252+
hp.haltAndClearStorage(() => {
253+
initMain(false); // init normally
254+
Countly.add_event(eventObj("1")); // record an event.
255+
cy.wait(500); // wait for the request to be sent
256+
let generatedID;
257+
cy.fetch_local_request_queue().then((eq) => {
258+
cy.log(eq);
259+
generatedID = eq[0].device_id; // get the new id from first item in the queue
260+
Countly.set_id("new ID");
261+
Countly.add_event(eventObj("2")); // record another event
262+
cy.wait(500); // wait for the request to be sent
263+
cy.fetch_local_request_queue().then((eq2) => {
264+
cy.log(eq2);
265+
expect(eq2.length).to.equal(3); // merge request
266+
expect(eq2[0].device_id).to.equal(generatedID);
267+
expect(eq2[0].events).to.contains("\"key\":\"1\"");
268+
expect(eq2[1].device_id).to.equal("new ID");
269+
expect(eq2[1].old_device_id).to.equal(generatedID);
270+
expect(eq2[2].device_id).to.equal("new ID");
271+
expect(eq2[2].events).to.contains("\"key\":\"2\"");
272+
});
273+
});
274+
});
275+
});
276+
});

examples/Angular/countly.d.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

examples/Angular/main.ts

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { enableProdMode } from '@angular/core';
2-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3-
4-
import { AppModule } from './app/app.module';
5-
import { environment } from './environments/environment';
1+
import { bootstrapApplication } from '@angular/platform-browser';
2+
import { appConfig } from './app/app.config';
3+
import { AppComponent } from './app/app.component';
64

75
import Countly from 'countly-sdk-web';
86

@@ -17,15 +15,64 @@ if (COUNTLY_APP_KEY === "YOUR_APP_KEY" || COUNTLY_SERVER_KEY === "https://your.s
1715
// initializing countly with params
1816
Countly.init({
1917
app_key: COUNTLY_APP_KEY,
20-
url: COUNTLY_SERVER_KEY, //your server goes here
18+
url: COUNTLY_SERVER_KEY,
2119
debug: true
2220
});
21+
22+
// Automatic tracking
2323
Countly.track_sessions();
24+
Countly.track_clicks();
25+
Countly.track_links();
26+
Countly.track_forms();
27+
Countly.track_errors();
28+
Countly.track_scrolls();
29+
Countly.track_pageview();
2430

25-
if (environment.production) {
26-
enableProdMode();
31+
// Showing a feedback widget
32+
Countly.get_available_feedback_widgets(function (widgets, err) {
33+
console.log('Available feedback widgets:', widgets);
34+
if (widgets && widgets.length) {
35+
console.log('Presenting feedback widget:', widgets[0]);
36+
Countly.present_feedback_widget(widgets[0]); // Show the first widget
37+
}
38+
});
2739

28-
}
40+
// Reporting a feedback widget's result manually
41+
Countly.get_available_feedback_widgets(function (widgets, err) {
42+
console.log('Available feedback widgets:', widgets);
43+
if (widgets && widgets.length) {
44+
console.log('Reporting feedback widget:', widgets[0]);
45+
Countly.getFeedbackWidgetData(widgets[0], function (data, err) {
46+
console.log('Feedback widget data:', data);
47+
Countly.reportFeedbackWidgetManually(widgets[0], data, null); // Report the first widget's data as null
48+
});
49+
}
50+
});
51+
52+
// add a custom event
53+
Countly.add_event({
54+
key: "test",
55+
count: 1,
56+
dur: 50,
57+
sum: 0.99,
58+
segmentation: {
59+
"Country": "Germany",
60+
"Age": "28"
61+
}
62+
});
63+
64+
// send some user properties
65+
Countly.user_details({
66+
name: "John Doe",
67+
username: "johndoe",
68+
organization: "Countly",
69+
phone: "1234567890",
70+
picture: "https://path.to/picture",
71+
});
72+
73+
// set custom user property
74+
Countly.userData.set("key", "value");
75+
Countly.userData.save();
2976

30-
platformBrowserDynamic().bootstrapModule(AppModule)
31-
.catch(err => console.error(err));
77+
bootstrapApplication(AppComponent, appConfig)
78+
.catch((err) => console.error(err));

0 commit comments

Comments
 (0)