|
209 | 209 | statusCode: "cly_hc_status_code",
|
210 | 210 | errorMessage: "cly_hc_error_message"
|
211 | 211 | });
|
212 |
| - var SDK_VERSION = "24.11.2"; |
| 212 | + var SDK_VERSION = "24.11.3"; |
213 | 213 | var SDK_NAME = "javascript_native_web";
|
214 | 214 |
|
215 | 215 | // 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 | 1176 | _classPrivateFieldGet2(_removeValueFromStorage, _this).call(_this, "cly_id");
|
1177 | 1177 | _classPrivateFieldGet2(_removeValueFromStorage, _this).call(_this, "cly_id_type");
|
1178 | 1178 | _classPrivateFieldGet2(_removeValueFromStorage, _this).call(_this, "cly_session");
|
| 1179 | + tempIdModeWasEnabled = false; |
1179 | 1180 | }
|
1180 | 1181 |
|
1181 | 1182 | // init configuration is printed out here:
|
|
1520 | 1521 | localStorage.setItem("cly_testLocal", true);
|
1521 | 1522 | // clean up test
|
1522 | 1523 | 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"); |
1523 | 1540 | } catch (e) {
|
1524 | 1541 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.ERROR, "halt, Local storage test failed, will fallback to cookies");
|
1525 | 1542 | _classPrivateFieldSet2(_lsSupport, _this, false);
|
|
1744 | 1761 | }
|
1745 | 1762 | });
|
1746 | 1763 | _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 | + } |
1747 | 1768 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.INFO, "enable_offline_mode, Enabling offline mode");
|
1748 | 1769 | // clear consents
|
1749 | 1770 | _this.remove_consent_internal(Countly.features, false);
|
1750 | 1771 | _classPrivateFieldSet2(_offlineMode, _this, true);
|
1751 | 1772 | _this.device_id = "[CLY]_temp_id";
|
1752 |
| - _this.device_id = _this.device_id; |
1753 | 1773 | _classPrivateFieldSet2(_deviceIdType, _this, DeviceIdTypeInternalEnums.TEMPORARY_ID);
|
1754 | 1774 | });
|
1755 | 1775 | _defineProperty(this, "disable_offline_mode", function (device_id) {
|
|
1761 | 1781 | _classPrivateFieldSet2(_offlineMode, _this, false);
|
1762 | 1782 | if (device_id && _this.device_id !== device_id) {
|
1763 | 1783 | _this.device_id = device_id;
|
1764 |
| - _this.device_id = _this.device_id; |
1765 | 1784 | _classPrivateFieldSet2(_deviceIdType, _this, DeviceIdTypeInternalEnums.DEVELOPER_SUPPLIED);
|
1766 | 1785 | _classPrivateFieldGet2(_setValueInStorage, _this).call(_this, "cly_id", _this.device_id);
|
1767 | 1786 | _classPrivateFieldGet2(_setValueInStorage, _this).call(_this, "cly_id_type", DeviceIdTypeInternalEnums.DEVELOPER_SUPPLIED);
|
|
1771 | 1790 | if (_this.device_id === "[CLY]_temp_id") {
|
1772 | 1791 | _this.device_id = generateUUID();
|
1773 | 1792 | }
|
1774 |
| - _this.device_id = _this.device_id; |
1775 | 1793 | if (_this.device_id !== _classPrivateFieldGet2(_getValueFromStorage, _this).call(_this, "cly_id")) {
|
1776 | 1794 | _classPrivateFieldGet2(_setValueInStorage, _this).call(_this, "cly_id", _this.device_id);
|
1777 | 1795 | _classPrivateFieldGet2(_setValueInStorage, _this).call(_this, "cly_id_type", DeviceIdTypeInternalEnums.SDK_GENERATED);
|
|
1782 | 1800 | for (var i = 0; i < _classPrivateFieldGet2(_requestQueue, _this).length; i++) {
|
1783 | 1801 | if (_classPrivateFieldGet2(_requestQueue, _this)[i].device_id === "[CLY]_temp_id") {
|
1784 | 1802 | _classPrivateFieldGet2(_requestQueue, _this)[i].device_id = _this.device_id;
|
| 1803 | + _classPrivateFieldGet2(_requestQueue, _this)[i].t = _classPrivateFieldGet2(_deviceIdType, _this); |
1785 | 1804 | needResync = true;
|
1786 | 1805 | }
|
1787 | 1806 | }
|
|
4027 | 4046 | wrapper.appendChild(iframe);
|
4028 | 4047 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "present_feedback_widget, Appended the iframe");
|
4029 | 4048 | add_event_listener(window, "message", function (e) {
|
4030 |
| - _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "present_feedback_widget, Received message from widget with origin: [" + e.origin + "] and data: [" + e.data + "]"); |
4031 | 4049 | var data = {};
|
4032 | 4050 | try {
|
4033 | 4051 | data = JSON.parse(e.data);
|
|
4036 | 4054 | }
|
4037 | 4055 | if (data.close !== true) {
|
4038 | 4056 | // to not mix with content we check against true value
|
4039 |
| - _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "present_feedback_widget, These are not the closing signals you are looking for"); |
| 4057 | + // this.#log(logLevelEnums.DEBUG, "present_feedback_widget, These are not the closing signals you are looking for"); |
| 4058 | + // silent ignore |
4040 | 4059 | return;
|
4041 | 4060 | }
|
| 4061 | + _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "present_feedback_widget, Received message from widget with origin: [" + e.origin + "] and data: [" + e.data + "]"); |
4042 | 4062 | document.getElementById("countly-" + feedbackWidgetFamily + "-wrapper-" + presentableFeedback._id).style.display = "none";
|
4043 | 4063 | document.getElementById("csbg").style.display = "none";
|
4044 | 4064 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "present_feedback_widget, Closed the widget");
|
|
4372 | 4392 | window.addEventListener('message', function (event) {
|
4373 | 4393 | _classPrivateFieldGet2(_interpretContentMessage, _this).call(_this, event);
|
4374 | 4394 | });
|
| 4395 | + var resizeTimeout; |
| 4396 | + window.addEventListener('resize', function () { |
| 4397 | + clearTimeout(resizeTimeout); |
| 4398 | + resizeTimeout = setTimeout(function () { |
| 4399 | + var width = window.innerWidth; |
| 4400 | + var height = window.innerHeight; |
| 4401 | + var iframe = document.getElementById(_classPrivateFieldGet2(_contentIframeID, _this)); |
| 4402 | + iframe.contentWindow.postMessage({ |
| 4403 | + type: 'resize', |
| 4404 | + width: width, |
| 4405 | + height: height |
| 4406 | + }, '*'); |
| 4407 | + }, 200); |
| 4408 | + }); |
4375 | 4409 | }, true);
|
4376 | 4410 | });
|
4377 | 4411 | _classPrivateFieldInitSpec(this, _displayContent, function (content) {
|
|
4399 | 4433 | document.body.appendChild(iframe);
|
4400 | 4434 | });
|
4401 | 4435 | _classPrivateFieldInitSpec(this, _interpretContentMessage, function (messageEvent) {
|
4402 |
| - _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "sendContentRequest, Received message from: [" + messageEvent.origin + "] with data: [" + JSON.stringify(messageEvent.data) + "]"); |
4403 | 4436 | if (messageEvent.origin !== _this.url) {
|
4404 |
| - _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.ERROR, "sendContentRequest, Received message from invalid origin"); |
| 4437 | + // this.#log(logLevelEnums.ERROR, "sendContentRequest, Received message from invalid origin"); |
| 4438 | + // silent ignore |
4405 | 4439 | return;
|
4406 | 4440 | }
|
| 4441 | + _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "sendContentRequest, Received message from: [" + messageEvent.origin + "] with data: [" + JSON.stringify(messageEvent.data) + "]"); |
4407 | 4442 | var _messageEvent$data = messageEvent.data,
|
4408 | 4443 | close = _messageEvent$data.close,
|
4409 | 4444 | link = _messageEvent$data.link,
|
4410 |
| - event = _messageEvent$data.event; |
| 4445 | + event = _messageEvent$data.event, |
| 4446 | + resize_me = _messageEvent$data.resize_me; |
4411 | 4447 | if (event) {
|
4412 |
| - _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "sendContentRequest, Received event: [" + event + "]"); |
| 4448 | + _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "sendContentRequest, Received event"); |
4413 | 4449 | if (close === 1) {
|
4414 |
| - _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "sendContentRequest, Closing content frame for event: [" + event + "]"); |
| 4450 | + _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "sendContentRequest, Closing content frame for event"); |
4415 | 4451 | _classPrivateFieldGet2(_closeContentFrame, _this).call(_this);
|
4416 | 4452 | }
|
4417 | 4453 | if (!Array.isArray(event)) {
|
|
4435 | 4471 | window.open(link, "_blank");
|
4436 | 4472 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "sendContentRequest, Opened link in new tab: [".concat(link, "]"));
|
4437 | 4473 | }
|
| 4474 | + if (resize_me) { |
| 4475 | + _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "sendContentRequest, Resizing iframe"); |
| 4476 | + var resInfo = _classPrivateFieldGet2(_getResolution, _this).call(_this, true); |
| 4477 | + var dimensionToUse = resize_me.p; |
| 4478 | + if (resInfo.width >= resInfo.height) { |
| 4479 | + dimensionToUse = resize_me.l; |
| 4480 | + } |
| 4481 | + var iframe = document.getElementById(_classPrivateFieldGet2(_contentIframeID, _this)); |
| 4482 | + iframe.style.left = dimensionToUse.x + "px"; |
| 4483 | + iframe.style.top = dimensionToUse.y + "px"; |
| 4484 | + iframe.style.width = dimensionToUse.w + "px"; |
| 4485 | + iframe.style.height = dimensionToUse.h + "px"; |
| 4486 | + } |
4438 | 4487 | if (close === 1) {
|
4439 | 4488 | _classPrivateFieldGet2(_closeContentFrame, _this).call(_this);
|
4440 | 4489 | }
|
|
0 commit comments