|
209 | 209 | statusCode: "cly_hc_status_code", |
210 | 210 | errorMessage: "cly_hc_error_message" |
211 | 211 | }); |
212 | | - var SDK_VERSION = "24.11.1"; |
| 212 | + var SDK_VERSION = "24.11.2"; |
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) |
|
899 | 899 | var _contentEndPoint = /*#__PURE__*/new WeakMap(); |
900 | 900 | var _inContentZone = /*#__PURE__*/new WeakMap(); |
901 | 901 | var _contentZoneTimer = /*#__PURE__*/new WeakMap(); |
| 902 | + var _contentZoneTimerInterval = /*#__PURE__*/new WeakMap(); |
902 | 903 | var _contentIframeID = /*#__PURE__*/new WeakMap(); |
903 | 904 | var _initialize = /*#__PURE__*/new WeakMap(); |
904 | 905 | var _updateConsent = /*#__PURE__*/new WeakMap(); |
|
1014 | 1015 | _classPrivateFieldInitSpec(this, _contentEndPoint, void 0); |
1015 | 1016 | _classPrivateFieldInitSpec(this, _inContentZone, void 0); |
1016 | 1017 | _classPrivateFieldInitSpec(this, _contentZoneTimer, void 0); |
| 1018 | + _classPrivateFieldInitSpec(this, _contentZoneTimerInterval, void 0); |
1017 | 1019 | _classPrivateFieldInitSpec(this, _contentIframeID, void 0); |
1018 | 1020 | /** |
1019 | 1021 | * Initialize the Countly |
|
1071 | 1073 | _this.hcWarningCount = _classPrivateFieldGet2(_getValueFromStorage, _this).call(_this, healthCheckCounterEnum.warningCount) || 0; |
1072 | 1074 | _this.hcStatusCode = _classPrivateFieldGet2(_getValueFromStorage, _this).call(_this, healthCheckCounterEnum.statusCode) || -1; |
1073 | 1075 | _this.hcErrorMessage = _classPrivateFieldGet2(_getValueFromStorage, _this).call(_this, healthCheckCounterEnum.errorMessage) || ""; |
| 1076 | + _classPrivateFieldSet2(_contentZoneTimerInterval, _this, getConfig("content_zone_timer_interval", ob, null)); |
| 1077 | + if (_classPrivateFieldGet2(_contentZoneTimerInterval, _this)) { |
| 1078 | + _classPrivateFieldSet2(_contentTimeInterval, _this, Math.max(_classPrivateFieldGet2(_contentZoneTimerInterval, _this), 15) * 1000); |
| 1079 | + } |
1074 | 1080 | if (_classPrivateFieldGet2(_maxCrashLogs, _this) && !_this.maxBreadcrumbCount) { |
1075 | 1081 | _this.maxBreadcrumbCount = _classPrivateFieldGet2(_maxCrashLogs, _this); |
1076 | 1082 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.WARNING, "initialize, 'maxCrashLogs' is deprecated. Use 'maxBreadcrumbCount' instead!"); |
|
1257 | 1263 | if (_classPrivateFieldGet2(_remoteConfigs, _this)) { |
1258 | 1264 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "initialize, stored remote configs:[" + JSON.stringify(_classPrivateFieldGet2(_remoteConfigs, _this)) + "]"); |
1259 | 1265 | } |
| 1266 | + if (_classPrivateFieldGet2(_contentZoneTimerInterval, _this)) { |
| 1267 | + _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "initialize, content_zone_timer_interval:[" + _classPrivateFieldGet2(_contentZoneTimerInterval, _this) + "]"); |
| 1268 | + } |
1260 | 1269 | // functions, if provided, would be printed as true without revealing their content |
1261 | 1270 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "initialize, 'getViewName' callback override provided:[" + (_this.getViewName !== Countly.getViewName) + "]"); |
1262 | 1271 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "initialize, 'getSearchQuery' callback override provided:[" + (_this.getSearchQuery !== Countly.getSearchQuery) + "]"); |
|
4327 | 4336 | }); |
4328 | 4337 | _classPrivateFieldInitSpec(this, _prepareContentRequest, function () { |
4329 | 4338 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "prepareContentRequest, forming content request"); |
4330 | | - var resInfo = _classPrivateFieldGet2(_getResolution, _this).call(_this); |
| 4339 | + var resInfo = _classPrivateFieldGet2(_getResolution, _this).call(_this, true); |
4331 | 4340 | var resToSend = { |
4332 | 4341 | l: {}, |
4333 | 4342 | p: {} |
4334 | 4343 | }; |
4335 | | - resToSend.l.w = resInfo.width; |
4336 | | - resToSend.l.h = resInfo.height; |
4337 | | - resToSend.p.w = resInfo.height; |
4338 | | - resToSend.p.h = resInfo.width; |
| 4344 | + var lWidthPHeight = Math.max(resInfo.width, resInfo.height); |
| 4345 | + var lHeightPWidth = Math.min(resInfo.width, resInfo.height); |
| 4346 | + resToSend.l.w = lWidthPHeight; |
| 4347 | + resToSend.l.h = lHeightPWidth; |
| 4348 | + resToSend.p.w = lHeightPWidth; |
| 4349 | + resToSend.p.h = lWidthPHeight; |
4339 | 4350 | var local = navigator.language || navigator.browserLanguage || navigator.systemLanguage || navigator.userLanguage; |
4340 | 4351 | var language = local.split('-')[0]; |
4341 | 4352 | var params = { |
|
4374 | 4385 | iframe.id = _classPrivateFieldGet2(_contentIframeID, _this); |
4375 | 4386 | iframe.src = response.html; |
4376 | 4387 | iframe.style.position = "absolute"; |
4377 | | - iframe.style.left = response.geo.l.x + "px"; |
4378 | | - iframe.style.top = response.geo.l.y + "px"; |
4379 | | - iframe.style.width = response.geo.l.w + "px"; |
4380 | | - iframe.style.height = response.geo.l.h + "px"; |
| 4388 | + var dimensionToUse = response.geo.p; |
| 4389 | + var resInfo = _classPrivateFieldGet2(_getResolution, _this).call(_this, true); |
| 4390 | + if (resInfo.width >= resInfo.height) { |
| 4391 | + dimensionToUse = response.geo.l; |
| 4392 | + } |
| 4393 | + iframe.style.left = dimensionToUse.x + "px"; |
| 4394 | + iframe.style.top = dimensionToUse.y + "px"; |
| 4395 | + iframe.style.width = dimensionToUse.w + "px"; |
| 4396 | + iframe.style.height = dimensionToUse.h + "px"; |
4381 | 4397 | iframe.style.border = "none"; |
4382 | 4398 | iframe.style.zIndex = "999999"; |
4383 | 4399 | document.body.appendChild(iframe); |
|
4859 | 4875 | }); |
4860 | 4876 | /** |
4861 | 4877 | * returns the resolution of the device |
4862 | | - * @param {bool} getAvailable - get available resolution |
| 4878 | + * @param {bool} getViewPort - get viewport |
4863 | 4879 | * @returns {object} resolution object: {width: 1920, height: 1080, orientation: 0} |
4864 | 4880 | */ |
4865 | | - _classPrivateFieldInitSpec(this, _getResolution, function (getAvailable) { |
| 4881 | + _classPrivateFieldInitSpec(this, _getResolution, function (getViewPort) { |
4866 | 4882 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "Getting the resolution of the device"); |
4867 | 4883 | if (!isBrowser || !screen) { |
4868 | 4884 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "No screen available"); |
4869 | 4885 | return null; |
4870 | 4886 | } |
4871 | 4887 | var width = screen.width ? parseInt(screen.width) : 0; |
4872 | 4888 | var height = screen.height ? parseInt(screen.height) : 0; |
4873 | | - if (getAvailable) { |
4874 | | - width = screen.availWidth ? parseInt(screen.availWidth) : width; |
4875 | | - height = screen.availHeight ? parseInt(screen.availHeight) : height; |
| 4889 | + if (getViewPort) { |
| 4890 | + var viewportWidth = window.innerWidth; |
| 4891 | + var viewportHeight = window.innerHeight; |
| 4892 | + var layoutWidth = document.documentElement.clientWidth; |
| 4893 | + var layoutHeight = document.documentElement.clientHeight; |
| 4894 | + var visibleWidth = Math.min(viewportWidth, layoutWidth); |
| 4895 | + var visibleHeight = Math.min(viewportHeight, layoutHeight); |
| 4896 | + width = visibleWidth ? parseInt(visibleWidth) : width; |
| 4897 | + height = visibleHeight ? parseInt(visibleHeight) : height; |
4876 | 4898 | } |
4877 | 4899 | if (width === 0 || height === 0) { |
4878 | 4900 | _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.DEBUG, "Screen width or height is non existent"); |
4879 | 4901 | return null; |
4880 | 4902 | } |
4881 | 4903 | var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform); |
4882 | 4904 | if (iOS && window.devicePixelRatio) { |
| 4905 | + _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.VERBOSE, "Mobile Mac device detected, adjusting resolution"); |
4883 | 4906 | // ios provides dips, need to multiply |
4884 | 4907 | width = Math.round(width * window.devicePixelRatio); |
4885 | 4908 | height = Math.round(height * window.devicePixelRatio); |
4886 | | - } else { |
4887 | | - if (Math.abs(screen.orientation.angle) === 90) { |
4888 | | - // we have landscape orientation |
4889 | | - // switch values for all except ios |
4890 | | - var temp = width; |
4891 | | - width = height; |
4892 | | - height = temp; |
4893 | | - } |
| 4909 | + } |
| 4910 | + if (Math.abs(screen.orientation.angle) === 90) { |
| 4911 | + _classPrivateFieldGet2(_log, _this).call(_this, logLevelEnums.VERBOSE, "Screen is in landscape mode, adjusting resolution"); |
| 4912 | + var temp = width; |
| 4913 | + width = height; |
| 4914 | + height = temp; |
4894 | 4915 | } |
4895 | 4916 | return { |
4896 | 4917 | width: width, |
|
0 commit comments