From 8f5b4e830003b50191c9ac293b51dd0aa33b33a1 Mon Sep 17 00:00:00 2001 From: turtledreams <62231246+turtledreams@users.noreply.github.com> Date: Wed, 11 May 2022 18:45:19 +0300 Subject: [PATCH] heatmap fix (lint) (#197) --- CHANGELOG.md | 3 ++ README.md | 2 +- lib/countly.js | 18 +++++----- lib/countly.min.js | 86 +++++++++++++++++++++++----------------------- package.json | 2 +- 5 files changed, 57 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca19a2dd..2da7e114 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 22.02.1 +- Fixed a bug where heatmap files were not loading + ## 22.02.0 - !! Major breaking change !! Device ID provided during the init will be ignored if a device ID was provided previously - Added a new init time flag which erases the previously stored device ID. This allows to set new device ID during init diff --git a/README.md b/README.md index 2c9c3f28..28eaf932 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ or Countly web SDK is available on CDNJS. Use either -[https://cdnjs.cloudflare.com/ajax/libs/countly-sdk-web/22.02.0/countly.min.js](https://cdnjs.cloudflare.com/ajax/libs/countly-sdk-web/22.02.0/countly.min.js) +[https://cdnjs.cloudflare.com/ajax/libs/countly-sdk-web/22.02.1/countly.min.js](https://cdnjs.cloudflare.com/ajax/libs/countly-sdk-web/22.02.1/countly.min.js) or diff --git a/lib/countly.js b/lib/countly.js index 82b00fc9..7faa55e3 100644 --- a/lib/countly.js +++ b/lib/countly.js @@ -157,7 +157,7 @@ */ Countly.onload = Countly.onload || []; - var SDK_VERSION = "22.02.0"; + var SDK_VERSION = "22.02.1"; var SDK_NAME = "javascript_native_web"; var urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/; @@ -4258,15 +4258,15 @@ var loaded; fileRef.setAttribute(attr, type); fileRef.setAttribute(src, data); + var callbackFunction = function() { + if (!loaded) { + callback(); + } + loaded = true; + }; if (callback) { - fileRef.onreadystatechange = function() { - fileRef.onload = function() { - if (!loaded) { - callback(); - } - loaded = true; - }; - }; + fileRef.onreadystatechange = callbackFunction(); + fileRef.onload = callbackFunction(); } document.getElementsByTagName("head")[0].appendChild(fileRef); } diff --git a/lib/countly.min.js b/lib/countly.min.js index 427af835..aa67eb95 100644 --- a/lib/countly.min.js +++ b/lib/countly.min.js @@ -1,81 +1,81 @@ (function(n,ea){"function"===typeof define&&define.amd?define([],function(){return ea(n.Countly)}):"object"===typeof module&&module.exports?module.exports=ea(n.Countly):n.Countly=ea(n.Countly)})("undefined"!==typeof window?window:this,function(n){function ea(h){var r=[];if("undefined"!==typeof h.options)for(var t=0;t=h?pa++:pa=h;return pa}function v(h,r,t){if(r&&Object.keys(r).length){if("undefined"!==typeof r[h])return r[h]}else if("undefined"!==typeof n[h])return n[h];return t}function Ca(h,r,t){for(var z in n.i)n.i[z].tracking_crashes&&n.i[z].recordError(h,r,t)}function Qa(h){var r=[],t;for(t in h)r.push(t+ -"="+encodeURIComponent(h[t]));return r.join("&")}function Da(h){return"/"===h.substr(h.length-1)?h.substr(0,h.length-1):h}function ja(h,r){for(var t={},z,I=0;Iz){var P={},F=0,W;for(W in h)F +"="+encodeURIComponent(h[t]));return r.join("&")}function Da(h){return"/"===h.substr(h.length-1)?h.substr(0,h.length-1):h}function ja(h,r){for(var t={},z,I=0;Iz){var X={},F=0,U;for(U in h)F r&&(I=h.substring(0,r),z(g.DEBUG,t+", Key: [ "+h+" ] is longer than accepted length. It will be truncated."));return I}function Ea(h){"undefined"===typeof h.pageY&&"number"===typeof h.clientX&&document.documentElement&&(h.pageX=h.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,h.pageY=h.clientY+document.body.scrollTop+document.documentElement.scrollTop);return h}function qa(){var h=document;return Math.max(Math.max(h.body.scrollHeight,h.documentElement.scrollHeight),Math.max(h.body.offsetHeight, h.documentElement.offsetHeight),Math.max(h.body.clientHeight,h.documentElement.clientHeight))}function Fa(){var h=document;return Math.max(Math.max(h.body.scrollWidth,h.documentElement.scrollWidth),Math.max(h.body.offsetWidth,h.documentElement.offsetWidth),Math.max(h.body.clientWidth,h.documentElement.clientWidth))}function Ra(){var h=document;return Math.min(Math.min(h.body.clientHeight,h.documentElement.clientHeight),Math.min(h.body.offsetHeight,h.documentElement.offsetHeight),window.innerHeight)} -function Sa(h,r,t,z,I,S){var N=document.createElement(h),P;N.setAttribute(r,t);N.setAttribute(z,I);S&&(N.onreadystatechange=function(){N.onload=function(){P||S();P=!0}});document.getElementsByTagName("head")[0].appendChild(N)}function Ta(h,r){Sa("script","type","text/javascript","src",h,r)}function ra(h,r){Sa("link","rel","stylesheet","href",h,r)}function Ua(){var h=document.getElementById("cly-loader");if(!h){var r=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style"); -t.type="text/css";t.styleSheet?t.styleSheet.cssText="#cly-loader {height: 4px; width: 100%; position: absolute; z-index: 99999; overflow: hidden; background-color: #fff; top:0px; left:0px;}#cly-loader:before{display: block; position: absolute; content: ''; left: -200px; width: 200px; height: 4px; background-color: #2EB52B; animation: cly-loading 2s linear infinite;}@keyframes cly-loading { from {left: -200px; width: 30%;} 50% {width: 30%;} 70% {width: 70%;} 80% { left: 50%;} 95% {left: 120%;} to {left: 100%;}}": +function Sa(h,r,t,z,I,Q){h=document.createElement(h);var W;h.setAttribute(r,t);h.setAttribute(z,I);Q&&(W||Q(),h.onreadystatechange=void 0,h.onload=void 0);document.getElementsByTagName("head")[0].appendChild(h)}function Ta(h,r){Sa("script","type","text/javascript","src",h,r)}function ra(h,r){Sa("link","rel","stylesheet","href",h,r)}function Ua(){var h=document.getElementById("cly-loader");if(!h){var r=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type= +"text/css";t.styleSheet?t.styleSheet.cssText="#cly-loader {height: 4px; width: 100%; position: absolute; z-index: 99999; overflow: hidden; background-color: #fff; top:0px; left:0px;}#cly-loader:before{display: block; position: absolute; content: ''; left: -200px; width: 200px; height: 4px; background-color: #2EB52B; animation: cly-loading 2s linear infinite;}@keyframes cly-loading { from {left: -200px; width: 30%;} 50% {width: 30%;} 70% {width: 70%;} 80% { left: 50%;} 95% {left: 120%;} to {left: 100%;}}": t.appendChild(document.createTextNode("#cly-loader {height: 4px; width: 100%; position: absolute; z-index: 99999; overflow: hidden; background-color: #fff; top:0px; left:0px;}#cly-loader:before{display: block; position: absolute; content: ''; left: -200px; width: 200px; height: 4px; background-color: #2EB52B; animation: cly-loading 2s linear infinite;}@keyframes cly-loading { from {left: -200px; width: 30%;} 50% {width: 30%;} 70% {width: 70%;} 80% { left: 50%;} 95% {left: 120%;} to {left: 100%;}}")); r.appendChild(t);h=document.createElement("div");h.setAttribute("id","cly-loader");document.body.onload=function(){if(!n.showLoaderProtection)try{document.body.appendChild(h)}catch(z){}}}h.style.display="block"}function Va(){n.showLoaderProtection=!0;var h=document.getElementById("cly-loader");h&&(h.style.display="none")}if("undefined"===typeof window)console.error("Not running in browser");else{n=n||{};n.features="sessions events views scrolls clicks forms crashes attribution users star-rating location apm feedback remote-config".split(" "); var g={ERROR:"[ERROR] ",WARNING:"[WARNING] ",INFO:"[INFO] ",DEBUG:"[DEBUG] ",VERBOSE:"[VERBOSE] "};n.q=n.q||[];n.onload=n.onload||[];var Wa=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?::([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?::([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,hb=/(CountlySiteBot|nuhk|Googlebot|GoogleSecurityScanner|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver|bingbot|Google Web Preview|Mediapartners-Google|AdsBot-Google|Baiduspider|Ezooms|YahooSeeker|AltaVista|AVSearch|Mercator|Scooter|InfoSeek|Ultraseek|Lycos|Wget|YandexBot|Yandex|YaDirectFetcher|SiteBot|Exabot|AhrefsBot|MJ12bot|TurnitinBot|magpie-crawler|Nutch Crawler|CMS Crawler|rogerbot|Domnutch|ssearch_bot|XoviBot|netseer|digincore|fr-crawler|wesee|AliasIO|contxbot|PingdomBot|BingPreview|HeadlessChrome)/; -n.CountlyClass=function(h){function r(a){if(f.ignore_visitor)c(g.ERROR,"Adding event failed. Possible bot or user opt out");else if(a.key){a.count||(a.count=1);a.key=w(a.key,f.maxKeyLength,"add_cly_event",c);a.segmentation=R(a.segmentation,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"add_cly_event",c);var b=ja(a,["key","count","sum","dur","segmentation"]);b.timestamp=Ba();var d=new Date;b.hour=d.getHours();b.dow=d.getDay();H.push(b);m("cly_event",H);c(g.INFO,"Successfully adding event: ", +n.CountlyClass=function(h){function r(a){if(f.ignore_visitor)c(g.ERROR,"Adding event failed. Possible bot or user opt out");else if(a.key){a.count||(a.count=1);a.key=w(a.key,f.maxKeyLength,"add_cly_event",c);a.segmentation=P(a.segmentation,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"add_cly_event",c);var b=ja(a,["key","count","sum","dur","segmentation"]);b.timestamp=Ba();var d=new Date;b.hour=d.getHours();b.dow=d.getDay();H.push(b);m("cly_event",H);c(g.INFO,"Successfully adding event: ", a)}else c(g.ERROR,"Adding event failed. Event must have a key property")}function t(){f.ignore_prefetch&&"undefined"!==typeof document.visibilityState&&"prerender"===document.visibilityState&&(f.ignore_visitor=!0);f.ignore_bots&&hb.test(navigator.userAgent)&&(f.ignore_visitor=!0)}function z(a,b){if(document.getElementById("countly-feedback-sticker-"+a._id))c(g.ERROR,"Widget with same ID exists");else try{var d=document.createElement("div");d.className="countly-iframe-wrapper";d.id="countly-iframe-wrapper-"+ -a._id;var k=document.createElement("span");k.className="countly-feedback-close-icon";k.id="countly-feedback-close-icon-"+a._id;k.innerText="x";var l=document.createElement("iframe");l.name="countly-feedback-iframe";l.id="countly-feedback-iframe";l.src=f.url+"/feedback?widget_id="+a._id+"&app_key="+f.app_key+"&device_id="+f.device_id+"&sdk_version=22.02.0";document.body.appendChild(d);d.appendChild(k);d.appendChild(l);x(document.getElementById("countly-feedback-close-icon-"+a._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+ +a._id;var k=document.createElement("span");k.className="countly-feedback-close-icon";k.id="countly-feedback-close-icon-"+a._id;k.innerText="x";var l=document.createElement("iframe");l.name="countly-feedback-iframe";l.id="countly-feedback-iframe";l.src=f.url+"/feedback?widget_id="+a._id+"&app_key="+f.app_key+"&device_id="+f.device_id+"&sdk_version=22.02.1";document.body.appendChild(d);d.appendChild(k);d.appendChild(l);x(document.getElementById("countly-feedback-close-icon-"+a._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+ a._id).style.display="none";document.getElementById("cfbg").style.display="none"});if(b){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.id="feedback-sticker-svg";e.setAttribute("aria-hidden","true");e.setAttribute("data-prefix","far");e.setAttribute("data-icon","grin");e.setAttribute("class","svg-inline--fa fa-grin fa-w-16");e.setAttribute("role","img");e.setAttribute("xmlns","http://www.w3.org/2000/svg");e.setAttribute("viewBox","0 0 496 512");var p=document.createElementNS("http://www.w3.org/2000/svg", "path");p.id="smileyPathInStickerSvg";p.setAttribute("fill","white");p.setAttribute("d","M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm105.6-151.4c-25.9 8.3-64.4 13.1-105.6 13.1s-79.6-4.8-105.6-13.1c-9.9-3.1-19.4 5.4-17.7 15.3 7.9 47.1 71.3 80 123.3 80s115.3-32.9 123.3-80c1.6-9.8-7.7-18.4-17.7-15.3zM168 240c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32z"); var q=document.createElement("span");q.innerText=a.trigger_button_text;var u=document.createElement("div");u.style.color=7>a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color;u.style.backgroundColor=7>a.trigger_bg_color.length?"#"+a.trigger_bg_color:a.trigger_bg_color;u.className="countly-feedback-sticker "+a.trigger_position+"-"+a.trigger_size;u.id="countly-feedback-sticker-"+a._id;e.appendChild(p);u.appendChild(e);u.appendChild(q);document.body.appendChild(u);var A=document.getElementById("smileyPathInStickerSvg"); -A&&(A.style.fill=7>a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color);x(document.getElementById("countly-feedback-sticker-"+a._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+a._id).style.display="block";document.getElementById("cfbg").style.display="block"})}else document.getElementById("countly-iframe-wrapper-"+a._id).style.display="block",document.getElementById("cfbg").style.display="block"}catch(O){c(g.ERROR,"Somethings went wrong while element injecting process: "+ -O)}}function I(){var a;if("undefined"!==typeof f.onload&&0Xa&&E.shift(),E.push(a),m("cly_queue",E,!0)):c(g.ERROR,"app_key or device_id is missing ",f.app_key,f.device_id)} -function W(){I();if(f.test_mode||f.ignore_visitor)sa=!1,c(g.WARNING,"User opt_out, no heartbeat");else{sa=!0;var a=0;if(ta&&"undefined"!==typeof n.q&&0Ya&&(f.session_duration(a-aa),aa=a));0Ia&&(ua=!1,a=E[0],c(g.DEBUG,"Processing request",a),m("cly_queue",E,!0),f.tests||ha("send_request_queue",f.url+Za,a,function(p,q){c(g.DEBUG,"Request Finished",q,p);p? -(Ia=C()+$a,c(g.ERROR,"Request error: ",p)):E.shift();m("cly_queue",E,!0);ua=!0},!1));setTimeout(W,ab)}}function fa(){var a=m("cly_id");return a?(D=m("cly_id_type"),a):Pa()}function va(){var a=JSON.parse(JSON.stringify(f.metrics||{}));a._app_version=a._app_version||f.app_version;a._ua=a._ua||navigator.userAgent;if(screen.width){var b=screen.width?parseInt(screen.width):0,d=screen.height?parseInt(screen.height):0;if(0!==b&&0!==d){if(navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&window.devicePixelRatio)b= +A&&(A.style.fill=7>a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color);x(document.getElementById("countly-feedback-sticker-"+a._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+a._id).style.display="block";document.getElementById("cfbg").style.display="block"})}else document.getElementById("countly-iframe-wrapper-"+a._id).style.display="block",document.getElementById("cfbg").style.display="block"}catch(N){c(g.ERROR,"Somethings went wrong while element injecting process: "+ +N)}}function I(){var a;if("undefined"!==typeof f.onload&&0Xa&&E.shift(),E.push(a),m("cly_queue",E,!0)):c(g.ERROR,"app_key or device_id is missing ",f.app_key,f.device_id)} +function U(){I();if(f.test_mode||f.ignore_visitor)sa=!1,c(g.WARNING,"User opt_out, no heartbeat");else{sa=!0;var a=0;if(ta&&"undefined"!==typeof n.q&&0Ya&&(f.session_duration(a-aa),aa=a));0Ia&&(ua=!1,a=E[0],c(g.DEBUG,"Processing request",a),m("cly_queue",E,!0),f.tests||ha("send_request_queue",f.url+Za,a,function(p,q){c(g.DEBUG,"Request Finished",q,p);p? +(Ia=C()+$a,c(g.ERROR,"Request error: ",p)):E.shift();m("cly_queue",E,!0);ua=!0},!1));setTimeout(U,ab)}}function fa(){var a=m("cly_id");return a?(D=m("cly_id_type"),a):Pa()}function va(){var a=JSON.parse(JSON.stringify(f.metrics||{}));a._app_version=a._app_version||f.app_version;a._ua=a._ua||navigator.userAgent;if(screen.width){var b=screen.width?parseInt(screen.width):0,d=screen.height?parseInt(screen.height):0;if(0!==b&&0!==d){if(navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&window.devicePixelRatio)b= Math.round(b*window.devicePixelRatio),d=Math.round(d*window.devicePixelRatio);else if(90===Math.abs(window.orientation)){var k=b;b=d;d=k}a._resolution=a._resolution||""+b+"x"+d}}window.devicePixelRatio&&(a._density=a._density||window.devicePixelRatio);b=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;"undefined"!==typeof b&&(a._locale=a._locale||b);if("undefined"!==typeof document.referrer&&document.referrer.length&&(b=Wa.exec(document.referrer))&&b[11]&& -b[11]!==window.location.hostname){b=!1;if(X&&X.length)for(d=0;da))return c(g.ERROR,"Http response status code is not within the expected range: "+a),!1;try{var d=JSON.parse(b);return"[object Object]"!==Object.prototype.toString.call(d)?(c(g.ERROR,"Http response is not JSON Object"),!1):!!d.result}catch(k){return c(g.ERROR,"Http response is not JSON: "+k),!1}}function bb(a,b){if(!(200<=a&&300>a))return c(g.ERROR, -"Http response status code is not within the expected range: "+a),!1;try{var d=JSON.parse(b);return"[object Object]"===Object.prototype.toString.call(d)||Array.isArray(d)?!0:(c(g.ERROR,"Http response is not JSON Object nor JSON Array"),!1)}catch(k){return c(g.ERROR,"Http response is not JSON: "+k),!1}}function db(a){m("cly_token",a)}function m(a,b,d,k){function l(q,u,A){var O=new Date;O.setTime(O.getTime()+864E5*A);A="; expires="+O.toGMTString();document.cookie=q+"="+u+A+"; path=/"}function e(q){q+= -"=";for(var u=document.cookie.split(";"),A=0,O=u.length;Awindow.innerHeight?"landscape":"portrait")}})};this.report_conversion=function(a,b){c(g.WARNING,"report_conversion, Deprecated function call! Use 'recordDirectAttribution' in place of this call. Call will be redirected now!");this.recordDirectAttribution(a,b)};this.recordDirectAttribution=function(a,b){c(g.INFO,"recordDirectAttribution, Recording the attribution for campaign ID: ["+a+"] and the user ID: ["+ b+"]");this.check_consent("attribution")&&(a=a||m("cly_cmp_id")||"cly_organic",b=b||m("cly_cmp_uid"),a&&b?F({campaign_id:a,campaign_user:b}):a&&F({campaign_id:a}))};this.user_details=function(a){c(g.INFO,"user_details, Trying to add user details: ",a);this.check_consent("users")&&(a.name=w(a.name,f.maxValueSize,"user_details",c),a.username=w(a.username,f.maxValueSize,"user_details",c),a.email=w(a.email,f.maxValueSize,"user_details",c),a.organization=w(a.organization,f.maxValueSize,"user_details", -c),a.phone=w(a.phone,f.maxValueSize,"user_details",c),a.picture=w(a.picture,4096,"user_details",c),a.gender=w(a.gender,f.maxValueSize,"user_details",c),a.byear=w(a.byear,f.maxValueSize,"user_details",c),a.custom=R(a.custom,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"user_details",c),F({user_details:JSON.stringify(ja(a,"name username email organization phone picture gender byear custom".split(" ")))}))};var Q={},V=function(a,b,d){f.check_consent("users")&&(Q[a]||(Q[a]={}),"$push"===d||"$pull"=== -d||"$addToSet"===d?(Q[a][d]||(Q[a][d]=[]),Q[a][d].push(b)):Q[a][d]=b)};this.userData={set:function(a,b){c(g.INFO,"set, Setting user's custom property value: ["+b+"] under the key: ["+a+"]");a=w(a,f.maxKeyLength,"userData set",c);b=w(b,f.maxValueSize,"userData set",c);Q[a]=b},unset:function(a){c(g.INFO,"unset, Resetting user's custom property with key: ["+a+"] ");Q[a]=""},set_once:function(a,b){c(g.INFO,"set_once, Setting user's unique custom property value: ["+b+"] under the key: ["+a+"] ");a=w(a, -f.maxKeyLength,"userData set_once",c);b=w(b,f.maxValueSize,"userData set_once",c);V(a,b,"$setOnce")},increment:function(a){c(g.INFO,"increment, Increasing user's custom property value under the key: ["+a+"] by one");a=w(a,f.maxKeyLength,"userData increment",c);V(a,1,"$inc")},increment_by:function(a,b){c(g.INFO,"increment_by, Increasing user's custom property value under the key: ["+a+"] by: ["+b+"]");a=w(a,f.maxKeyLength,"userData increment_by",c);b=w(b,f.maxValueSize,"userData increment_by",c);V(a, -b,"$inc")},multiply:function(a,b){c(g.INFO,"multiply, Multiplying user's custom property value under the key: ["+a+"] by: ["+b+"]");a=w(a,f.maxKeyLength,"userData multiply",c);b=w(b,f.maxValueSize,"userData multiply",c);V(a,b,"$mul")},max:function(a,b){c(g.INFO,"max, Saving user's maximum custom property value compared to the value: ["+b+"] under the key: ["+a+"]");a=w(a,f.maxKeyLength,"userData max",c);b=w(b,f.maxValueSize,"userData max",c);V(a,b,"$max")},min:function(a,b){c(g.INFO,"min, Saving user's minimum custom property value compared to the value: ["+ -b+"] under the key: ["+a+"]");a=w(a,f.maxKeyLength,"userData min",c);b=w(b,f.maxValueSize,"userData min",c);V(a,b,"$min")},push:function(a,b){c(g.INFO,"push, Pushing a value: ["+b+"] under the key: ["+a+"] to user's custom property array");a=w(a,f.maxKeyLength,"userData push",c);b=w(b,f.maxValueSize,"userData push",c);V(a,b,"$push")},push_unique:function(a,b){c(g.INFO,"push_unique, Pushing a unique value: ["+b+"] under the key: ["+a+"] to user's custom property array");a=w(a,f.maxKeyLength,"userData push_unique", -c);b=w(b,f.maxValueSize,"userData push_unique",c);V(a,b,"$addToSet")},pull:function(a,b){c(g.INFO,"pull, Removing the value: ["+b+"] under the key: ["+a+"] from user's custom property array");V(a,b,"$pull")},save:function(){c(g.INFO,"save, Saving changes to user's custom property");f.check_consent("users")&&F({user_details:JSON.stringify({custom:Q})});Q={}}};this.report_trace=function(a){c(g.INFO,"report_trace, Reporting performance trace");if(this.check_consent("apm")){for(var b="type name stz etz apm_metrics apm_attr".split(" "), -d=0;d=f.maxBreadcrumbCount;)ca.shift(),c(g.WARNING,"add_log, Reached maximum crashLogs size. Will erase the oldest one."); ca.push(a)}};this.fetch_remote_config=function(a,b,d){c(g.INFO,"fetch_remote_config, Fetching remote config");if(this.check_consent("remote-config")){var k={method:"fetch_remote_config"};this.check_consent("sessions")&&(k.metrics=JSON.stringify(va()));a&&(d||"function"!==typeof a?Array.isArray(a)&&a.length&&(c(g.INFO,"fetch_remote_config, Keys to fetch: [ "+a+" ]"),k.keys=JSON.stringify(a)):(d=a,a=null));b&&((c(g.INFO,"fetch_remote_config, Keys to omit: [ "+b+" ]"),d||"function"!==typeof b)?Array.isArray(b)&& -b.length&&(k.omit_keys=JSON.stringify(b)):(d=b,b=null));P(k);ha("fetch_remote_config",this.url+Ja,k,function(l,e,p){if(l)c(g.ERROR,"fetch_remote_config, An error occurred: "+l);else{try{var q=JSON.parse(p);if(k.keys||k.omit_keys)for(var u in q)L[u]=q[u];else L=q;m("cly_remote_configs",L)}catch(A){c(g.ERROR,"fetch_remote_config, Had an issue while parsing the response: "+A)}"function"===typeof d&&(c(g.INFO,"fetch_remote_config, Callback function is provided"),d(l,L))}},!0)}else c(g.ERROR,"fetch_remote_config, Remote config requires explicit consent"), -"function"===typeof d&&d(Error("Remote config requires explicit consent"),L)};this.get_remote_config=function(a){c(g.INFO,"get_remote_config, Getting remote config");return"undefined"!==typeof a?L[a]:L};this.stop_time=function(){c(g.INFO,"stop_time, Stopping tracking duration");Z&&(Z=!1,La=C()-aa,la=C()-ka)};this.start_time=function(){c(g.INFO,"start_time, Starting tracking duration");Z||(Z=!0,aa=C()-La,ka=C()-la,la=0,N())};this.track_sessions=function(){function a(){document[d]||!document.hasFocus()? +b.length&&(k.omit_keys=JSON.stringify(b)):(d=b,b=null));X(k);ha("fetch_remote_config",this.url+Ja,k,function(l,e,p){if(l)c(g.ERROR,"fetch_remote_config, An error occurred: "+l);else{try{var q=JSON.parse(p);if(k.keys||k.omit_keys)for(var u in q)L[u]=q[u];else L=q;m("cly_remote_configs",L)}catch(A){c(g.ERROR,"fetch_remote_config, Had an issue while parsing the response: "+A)}"function"===typeof d&&(c(g.INFO,"fetch_remote_config, Callback function is provided"),d(l,L))}},!0)}else c(g.ERROR,"fetch_remote_config, Remote config requires explicit consent"), +"function"===typeof d&&d(Error("Remote config requires explicit consent"),L)};this.get_remote_config=function(a){c(g.INFO,"get_remote_config, Getting remote config");return"undefined"!==typeof a?L[a]:L};this.stop_time=function(){c(g.INFO,"stop_time, Stopping tracking duration");Z&&(Z=!1,La=C()-aa,la=C()-ka)};this.start_time=function(){c(g.INFO,"start_time, Starting tracking duration");Z||(Z=!0,aa=C()-La,ka=C()-la,la=0,W())};this.track_sessions=function(){function a(){document[d]||!document.hasFocus()? f.stop_time():f.start_time()}function b(){oa>=Ma&&f.start_time();oa=0}c(g.INFO,"track_session, Starting tracking user session");this.begin_session();this.start_time();x(window,"beforeunload",function(){f.end_session()});var d="hidden";x(window,"focus",a);x(window,"blur",a);x(window,"pageshow",a);x(window,"pagehide",a);"onfocusin"in document&&(x(window,"focusin",a),x(window,"focusout",a));d in document?document.addEventListener("visibilitychange",a):"mozHidden"in document?(d="mozHidden",document.addEventListener("mozvisibilitychange", -a)):"webkitHidden"in document?(d="webkitHidden",document.addEventListener("webkitvisibilitychange",a)):"msHidden"in document&&(d="msHidden",document.addEventListener("msvisibilitychange",a));x(window,"mousemove",b);x(window,"click",b);x(window,"keydown",b);x(window,"scroll",b);setInterval(function(){oa++;oa>=Ma&&f.stop_time()},6E4)};this.track_pageview=function(a,b,d){c(g.INFO,"track_pageview, Starting to track page views");S();a=w(a,f.maxKeyLength,"track_pageview",c);d=R(d,f.maxKeyLength,f.maxValueSize, +a)):"webkitHidden"in document?(d="webkitHidden",document.addEventListener("webkitvisibilitychange",a)):"msHidden"in document&&(d="msHidden",document.addEventListener("msvisibilitychange",a));x(window,"mousemove",b);x(window,"click",b);x(window,"keydown",b);x(window,"scroll",b);setInterval(function(){oa++;oa>=Ma&&f.stop_time()},6E4)};this.track_pageview=function(a,b,d){c(g.INFO,"track_pageview, Starting to track page views");Q();a=w(a,f.maxKeyLength,"track_pageview",c);d=P(d,f.maxKeyLength,f.maxValueSize, f.maxSegmentationValues,"track_pageview",c);a&&Array.isArray(a)&&(b=a,a=null);a||(a=this.getViewName());if(void 0===a||""===a)c(g.ERROR,"track_pageview, No page name to track (it is either undefined or empty string). No page view can be tracked.");else if(null===a)c(g.ERROR,"track_pageview, View name returned as null. Page view will be ignored.");else{if(b&&b.length)for(var k=0;k