Skip to content

Commit d4cc4a8

Browse files
committed
11.3 update
1 parent a81d981 commit d4cc4a8

File tree

7 files changed

+1548
-680
lines changed

7 files changed

+1548
-680
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 24.11.3
2+
3+
- Added support for content resizing (Experimental!)
4+
- Mitigated an issue where device ID type was assigned wrongly when SDK was generating an ID after stored device ID was cleared.
5+
- Mitigated an issue where device ID type of initially generated requests were not correctly reassigned after offline mode.
6+
17
## 24.11.2
28
- Added a new init method to set the interval of Content Zone's timer (Experimental!):
39
- `content_zone_timer_interval` to set the timer interval in `seconds`

cypress/e2e/bridged_utils.cy.js

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

1717
const SDK_NAME = "javascript_native_web";
18-
const SDK_VERSION = "24.11.2";
18+
const SDK_VERSION = "24.11.3";
1919

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

cypress/e2e/device_id_init_scenarios.cy.js

Lines changed: 1329 additions & 517 deletions
Large diffs are not rendered by default.

lib/countly.js

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
statusCode: "cly_hc_status_code",
210210
errorMessage: "cly_hc_error_message"
211211
});
212-
var SDK_VERSION = "24.11.2";
212+
var SDK_VERSION = "24.11.3";
213213
var SDK_NAME = "javascript_native_web";
214214

215215
// 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)
@@ -1176,6 +1176,7 @@
11761176
_classPrivateFieldGet2(_removeValueFromStorage, _this).call(_this, "cly_id");
11771177
_classPrivateFieldGet2(_removeValueFromStorage, _this).call(_this, "cly_id_type");
11781178
_classPrivateFieldGet2(_removeValueFromStorage, _this).call(_this, "cly_session");
1179+
tempIdModeWasEnabled = false;
11791180
}
11801181

11811182
// init configuration is printed out here:
@@ -1520,6 +1521,22 @@
15201521
localStorage.setItem("cly_testLocal", true);
15211522
// clean up test
15221523
localStorage.removeItem("cly_testLocal");
1524+
localStorage.removeItem("cly_old_token");
1525+
localStorage.removeItem("cly_cmp_id");
1526+
localStorage.removeItem("cly_cmp_uid");
1527+
localStorage.removeItem("cly_id");
1528+
localStorage.removeItem("cly_id_type");
1529+
localStorage.removeItem("cly_queue");
1530+
localStorage.removeItem("cly_session");
1531+
localStorage.removeItem("cly_remote_configs");
1532+
localStorage.removeItem("cly_event");
1533+
localStorage.removeItem("cly_ignore");
1534+
localStorage.removeItem("cly_fb_widgets");
1535+
localStorage.removeItem("cly_token");
1536+
localStorage.removeItem("cly_hc_error_count");
1537+
localStorage.removeItem("cly_hc_warning_count");
1538+
localStorage.removeItem("cly_hc_status_code");
1539+
localStorage.removeItem("cly_hc_error_message");
15231540
} catch (e) {
15241541
_classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.ERROR, "halt, Local storage test failed, will fallback to cookies");
15251542
_classPrivateFieldSet2(_lsSupport, _this, false);
@@ -1744,12 +1761,15 @@
17441761
}
17451762
});
17461763
_defineProperty(this, "enable_offline_mode", function () {
1764+
if (_classPrivateFieldGet2(_offlineMode, _this)) {
1765+
_classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.WARNING, "enable_offline_mode, Countly is already in offline mode.");
1766+
return;
1767+
}
17471768
_classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.INFO, "enable_offline_mode, Enabling offline mode");
17481769
// clear consents
17491770
_this.remove_consent_internal(Countly.features, false);
17501771
_classPrivateFieldSet2(_offlineMode, _this, true);
17511772
_this.device_id = "[CLY]_temp_id";
1752-
_this.device_id = _this.device_id;
17531773
_classPrivateFieldSet2(_deviceIdType, _this, DeviceIdTypeInternalEnums.TEMPORARY_ID);
17541774
});
17551775
_defineProperty(this, "disable_offline_mode", function (device_id) {
@@ -1761,7 +1781,6 @@
17611781
_classPrivateFieldSet2(_offlineMode, _this, false);
17621782
if (device_id && _this.device_id !== device_id) {
17631783
_this.device_id = device_id;
1764-
_this.device_id = _this.device_id;
17651784
_classPrivateFieldSet2(_deviceIdType, _this, DeviceIdTypeInternalEnums.DEVELOPER_SUPPLIED);
17661785
_classPrivateFieldGet2(_setValueInStorage, _this).call(_this, "cly_id", _this.device_id);
17671786
_classPrivateFieldGet2(_setValueInStorage, _this).call(_this, "cly_id_type", DeviceIdTypeInternalEnums.DEVELOPER_SUPPLIED);
@@ -1771,7 +1790,6 @@
17711790
if (_this.device_id === "[CLY]_temp_id") {
17721791
_this.device_id = generateUUID();
17731792
}
1774-
_this.device_id = _this.device_id;
17751793
if (_this.device_id !== _classPrivateFieldGet2(_getValueFromStorage, _this).call(_this, "cly_id")) {
17761794
_classPrivateFieldGet2(_setValueInStorage, _this).call(_this, "cly_id", _this.device_id);
17771795
_classPrivateFieldGet2(_setValueInStorage, _this).call(_this, "cly_id_type", DeviceIdTypeInternalEnums.SDK_GENERATED);
@@ -1782,6 +1800,7 @@
17821800
for (var i = 0; i < _classPrivateFieldGet2(_requestQueue, _this).length; i++) {
17831801
if (_classPrivateFieldGet2(_requestQueue, _this)[i].device_id === "[CLY]_temp_id") {
17841802
_classPrivateFieldGet2(_requestQueue, _this)[i].device_id = _this.device_id;
1803+
_classPrivateFieldGet2(_requestQueue, _this)[i].t = _classPrivateFieldGet2(_deviceIdType, _this);
17851804
needResync = true;
17861805
}
17871806
}
@@ -4372,6 +4391,20 @@
43724391
window.addEventListener('message', function (event) {
43734392
_classPrivateFieldGet2(_interpretContentMessage, _this).call(_this, event);
43744393
});
4394+
var resizeTimeout;
4395+
window.addEventListener('resize', function () {
4396+
clearTimeout(resizeTimeout);
4397+
resizeTimeout = setTimeout(function () {
4398+
var width = window.innerWidth;
4399+
var height = window.innerHeight;
4400+
var iframe = document.getElementById(_classPrivateFieldGet2(_contentIframeID, _this));
4401+
iframe.contentWindow.postMessage({
4402+
type: 'resize',
4403+
width: width,
4404+
height: height
4405+
}, '*');
4406+
}, 200);
4407+
});
43754408
}, true);
43764409
});
43774410
_classPrivateFieldInitSpec(this, _displayContent, function (content) {
@@ -4407,7 +4440,8 @@
44074440
var _messageEvent$data = messageEvent.data,
44084441
close = _messageEvent$data.close,
44094442
link = _messageEvent$data.link,
4410-
event = _messageEvent$data.event;
4443+
event = _messageEvent$data.event,
4444+
resize_me = _messageEvent$data.resize_me;
44114445
if (event) {
44124446
_classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "sendContentRequest, Received event: [" + event + "]");
44134447
if (close === 1) {
@@ -4435,6 +4469,19 @@
44354469
window.open(link, "_blank");
44364470
_classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "sendContentRequest, Opened link in new tab: [".concat(link, "]"));
44374471
}
4472+
if (resize_me) {
4473+
_classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "sendContentRequest, Resizing iframe");
4474+
var resInfo = _classPrivateFieldGet2(_getResolution, _this).call(_this, true);
4475+
var dimensionToUse = resize_me.p;
4476+
if (resInfo.width >= resInfo.height) {
4477+
dimensionToUse = resize_me.l;
4478+
}
4479+
var iframe = document.getElementById(_classPrivateFieldGet2(_contentIframeID, _this));
4480+
iframe.style.left = dimensionToUse.x + "px";
4481+
iframe.style.top = dimensionToUse.y + "px";
4482+
iframe.style.width = dimensionToUse.w + "px";
4483+
iframe.style.height = dimensionToUse.h + "px";
4484+
}
44384485
if (close === 1) {
44394486
_classPrivateFieldGet2(_closeContentFrame, _this).call(_this);
44404487
}

0 commit comments

Comments
 (0)