posthog-js
Advanced tools
Comparing version 1.216.1 to 1.217.0
@@ -1,2 +0,2 @@ | ||
!function(){"use strict";var e="undefined"!=typeof window?window:void 0,r="undefined"!=typeof globalThis?globalThis:e,n=Array.prototype.forEach,t=null==r?void 0:r.navigator,o=null==r?void 0:r.document,i=null==r?void 0:r.location;null==r||r.fetch,null!=r&&r.XMLHttpRequest&&"withCredentials"in new r.XMLHttpRequest&&r.XMLHttpRequest,null==r||r.AbortController;var a,s=null==t?void 0:t.userAgent,l=null!=e?e:{};function u(e,r){return-1!==e.indexOf(r)}!function(e){e.GZipJS="gzip-js",e.Base64="base64"}(a||(a={}));var c=function(e){return e.replace(/^\$/,"")},p=Array.isArray,f=Object.prototype,d=f.hasOwnProperty,g=f.toString,v=p||function(e){return"[object Array]"===g.call(e)},h=e=>void 0===e,m=e=>null===e,_=e=>"[object Number]"==g.call(e),w={DEBUG:!1,LIB_VERSION:"1.216.1"},b=r=>{var n={_log:function(n){if(e&&l.POSTHOG_DEBUG&&!h(e.console)&&e.console){for(var t=("__rrweb_original__"in e.console[n]?e.console[n].__rrweb_original__:e.console[n]),o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];t(r,...i)}},info:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];n._log("log",...r)},warn:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];n._log("warn",...r)},error:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];n._log("error",...r)},critical:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];console.error(r,...n)},uninitializedWarning:e=>{n.error("You must initialize PostHog before calling ".concat(e))},createLogger:e=>b("".concat(r," ").concat(e))};return n},P=b("[PostHog.js]"),$={};function y(e,r,t){if(v(e))if(n&&e.forEach===n)e.forEach(r,t);else if("length"in e&&e.length===+e.length)for(var o=0,i=e.length;o<i;o++)if(o in e&&r.call(t,e[o],o)===$)return}function E(e,r,n){if(!h(t=e)&&!m(t)){var t;if(v(e))return y(e,r,n);if((e=>e instanceof FormData)(e)){for(var o of e.entries())if(r.call(n,o[1],o[0])===$)return}else for(var i in e)if(d.call(e,i)&&r.call(n,e[i],i)===$)return}}var x=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return y(n,(function(r){for(var n in r)void 0!==r[n]&&(e[n]=r[n])})),e},O=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return y(n,(function(r){y(r,(function(r){e.push(r)}))})),e},R=function(e){var r={};return E(e,(function(e,n){var t;t=e,"[object String]"==g.call(t)&&e.length>0&&(r[n]=e)})),r},k=e=>{var r=null==o?void 0:o.createElement("a");return h(r)?null:(r.href=e,r)},S=function(e,r){for(var n,t=((e.split("#")[0]||"").split("?")[1]||"").split("&"),o=0;o<t.length;o++){var i=t[o].split("=");if(i[0]===r){n=i;break}}if(!v(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch(e){P.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},B=function(e,r,n){if(!e||!r||!r.length)return e;for(var t=e.split("#"),o=t[0]||"",i=t[1],a=o.split("?"),s=a[1],l=a[0],u=(s||"").split("&"),c=[],p=0;p<u.length;p++){var f=u[p].split("=");v(f)&&(r.includes(f[0])?c.push(f[0]+"="+n):c.push(u[p]))}var d=l;return null!=s&&(d+="?"+c.join("&")),null!=i&&(d+="#"+i),d},D="Mobile",A="iOS",I="Android",j="Tablet",T=I+" "+j,C="iPad",M="Apple",F=M+" Watch",L="Safari",z="BlackBerry",U="Samsung",W=U+"Browser",N=U+" Internet",H="Chrome",X=H+" OS",V=H+" "+A,q="Internet Explorer",G=q+" "+D,K="Opera",Z=K+" Mini",Q="Edge",J="Microsoft "+Q,Y="Firefox",ee=Y+" "+A,re="Nintendo",ne="PlayStation",te="Xbox",oe=I+" "+D,ie=D+" "+L,ae="Windows",se=ae+" Phone",le="Nokia",ue="Ouya",ce="Generic",pe=ce+" "+D.toLowerCase(),fe=ce+" "+j.toLowerCase(),de="Konqueror",ge="(\\d+(\\.\\d+)?)",ve=new RegExp("Version/"+ge),he=new RegExp(te,"i"),me=new RegExp(ne+" \\w+","i"),_e=new RegExp(re+" \\w+","i"),we=new RegExp(z+"|PlayBook|BB10","i"),be={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var Pe=(e,r)=>r&&u(r,M)||function(e){return u(e,L)&&!u(e,H)&&!u(e,I)}(e),$e=function(e,r){return r=r||"",u(e," OPR/")&&u(e,"Mini")?Z:u(e," OPR/")?K:we.test(e)?z:u(e,"IE"+D)||u(e,"WPDesktop")?G:u(e,W)?N:u(e,Q)||u(e,"Edg/")?J:u(e,"FBIOS")?"Facebook "+D:u(e,"UCWEB")||u(e,"UCBrowser")?"UC Browser":u(e,"CriOS")?V:u(e,"CrMo")||u(e,H)?H:u(e,I)&&u(e,L)?oe:u(e,"FxiOS")?ee:u(e.toLowerCase(),de.toLowerCase())?de:Pe(e,r)?u(e,D)?ie:L:u(e,Y)?Y:u(e,"MSIE")||u(e,"Trident/")?q:u(e,"Gecko")?Y:""},ye={[G]:[new RegExp("rv:"+ge)],[J]:[new RegExp(Q+"?\\/"+ge)],[H]:[new RegExp("("+H+"|CrMo)\\/"+ge)],[V]:[new RegExp("CriOS\\/"+ge)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ge)],[L]:[ve],[ie]:[ve],[K]:[new RegExp("(Opera|OPR)\\/"+ge)],[Y]:[new RegExp(Y+"\\/"+ge)],[ee]:[new RegExp("FxiOS\\/"+ge)],[de]:[new RegExp("Konqueror[:/]?"+ge,"i")],[z]:[new RegExp(z+" "+ge),ve],[oe]:[new RegExp("android\\s"+ge,"i")],[N]:[new RegExp(W+"\\/"+ge)],[q]:[new RegExp("(rv:|MSIE )"+ge)],Mozilla:[new RegExp("rv:"+ge)]},Ee=[[new RegExp(te+"; "+te+" (.*?)[);]","i"),e=>[te,e&&e[1]||""]],[new RegExp(re,"i"),[re,""]],[new RegExp(ne,"i"),[ne,""]],[we,[z,""]],[new RegExp(ae,"i"),(e,r)=>{if(/Phone/.test(r)||/WPDesktop/.test(r))return[se,""];if(new RegExp(D).test(r)&&!/IEMobile\b/.test(r))return[ae+" "+D,""];var n=/Windows NT ([0-9.]+)/i.exec(r);if(n&&n[1]){var t=n[1],o=be[t]||"";return/arm/i.test(r)&&(o="RT"),[ae,o]}return[ae,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var r=[e[3],e[4],e[5]||"0"];return[A,r.join(".")]}return[A,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var r="";return e&&e.length>=3&&(r=h(e[2])?e[3]:e[2]),["watchOS",r]}],[new RegExp("("+I+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+I+")","i"),e=>{if(e&&e[2]){var r=[e[2],e[3],e[4]||"0"];return[I,r.join(".")]}return[I,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var r=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];r[1]=n.join(".")}return r}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[X,""]],[/Linux|debian/i,["Linux",""]]],xe=function(e){return _e.test(e)?re:me.test(e)?ne:he.test(e)?te:new RegExp(ue,"i").test(e)?ue:new RegExp("("+se+"|WPDesktop)","i").test(e)?se:/iPad/.test(e)?C:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?F:we.test(e)?z:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(le,"i").test(e)?le:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(D).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?I:T:I:new RegExp("(pda|"+D+")","i").test(e)?pe:new RegExp(j,"i").test(e)&&!new RegExp(j+" pc","i").test(e)?fe:""},Oe="https?://(.*)",Re=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],ke=O(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Re),Se=["$app_build","$app_name","$app_namespace","$app_version","$browser","$browser_version","$device_type","$current_url","$pathname","$os","$os_name","$os_version","$referring_domain","$referrer"],Be="<masked>",De={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:r,customPersonalDataProperties:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!o)return{};var t=r?O([],Re,n||[]):[];return this._campaignParamsFromUrl(B(o.URL,t,Be),e)},_campaignParamsFromUrl:function(e,r){var n=ke.concat(r||[]),t={};return E(n,(function(r){var n=S(e,r);t[r]=n||null})),t},_searchEngine:function(e){return e?0===e.search(Oe+"google.([^/?]*)")?"google":0===e.search(Oe+"bing.com")?"bing":0===e.search(Oe+"yahoo.com")?"yahoo":0===e.search(Oe+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var r=De._searchEngine(e),n="yahoo"!=r?"q":"p",t={};if(!m(r)){t.$search_engine=r;var i=o?S(o.referrer,n):"";i.length&&(t.ph_keyword=i)}return t},searchInfo:function(){var e=null==o?void 0:o.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:$e,browserVersion:function(e,r){var n=$e(e,r),t=ye[n];if(h(t))return null;for(var o=0;o<t.length;o++){var i=t[o],a=e.match(i);if(a)return parseFloat(a[a.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var e=this.browserLanguage();return"string"==typeof e?e.split("-")[0]:void 0},os:function(e){for(var r=0;r<Ee.length;r++){var[n,t]=Ee[r],o=n.exec(e),i=o&&("function"==typeof t?t(o,e):t);if(i)return i}return["",""]},device:xe,deviceType:function(e){var r=xe(e);return r===C||r===T||"Kobo"===r||"Kindle Fire"===r||r===fe?j:r===re||r===te||r===ne||r===ue?"Console":r===F?"Wearable":r?D:"Desktop"},referrer:function(){return(null==o?void 0:o.referrer)||"$direct"},referringDomain:function(){var e;return null!=o&&o.referrer&&(null===(e=k(o.referrer))||void 0===e?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer().substring(0,1e3),u:null==i?void 0:i.href.substring(0,1e3)}},initialPersonPropsFromInfo:function(e){var r,{r:n,u:t}=e,o={$initial_referrer:n,$initial_referring_domain:null==n?void 0:"$direct"==n?"$direct":null===(r=k(n))||void 0===r?void 0:r.host};if(t){o.$initial_current_url=t;var i=k(t);o.$initial_host=null==i?void 0:i.host,o.$initial_pathname=null==i?void 0:i.pathname,E(this._campaignParamsFromUrl(t),(function(e,r){o["$initial_"+c(r)]=e}))}n&&E(this._searchInfoFromReferrer(n),(function(e,r){o["$initial_"+c(r)]=e}));return o},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},timezoneOffset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},properties:function(){var{maskPersonalDataProperties:r,customPersonalDataProperties:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!s)return{};var t=r?O([],Re,n||[]):[],[o,a]=De.os(s);return x(R({$os:o,$os_version:a,$browser:De.browser(s,navigator.vendor),$device:De.device(s),$device_type:De.deviceType(s),$timezone:De.timezone(),$timezone_offset:De.timezoneOffset()}),{$current_url:B(null==i?void 0:i.href,t,Be),$host:null==i?void 0:i.host,$pathname:null==i?void 0:i.pathname,$raw_user_agent:s.length>1e3?s.substring(0,997)+"...":s,$browser_version:De.browserVersion(s,navigator.vendor),$browser_language:De.browserLanguage(),$browser_language_prefix:De.browserLanguagePrefix(),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:"web",$lib_version:w.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!s)return{};var[e,r]=De.os(s);return x(R({$os:e,$os_version:r,$browser:De.browser(s,navigator.vendor)}),{$browser_version:De.browserVersion(s,navigator.vendor)})}};function Ae(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function Ie(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Ae(Object(n),!0).forEach((function(r){je(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ae(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function je(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Te(e,r,n,t,o){return _(e)?e>n?n:e<r?r:e:Te(n,r,n)}function Ce(e,r){return[...e||[],...v(r)?r:[r]]}function Me(e,r){return(h(e)?1:e)*r}function Fe(e,r){return function(e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return Math.abs(r)}(e)%100<Te(100*r,0,100)}var Le=Object.freeze({__proto__:null,printAndDropEverything:e=>(console.log("Would have sent event:",e),null),sampleByDistinctId:function(e){return r=>r&&Fe(r.properties.distinct_id,e)?Ie(Ie({},r),{},{properties:Ie(Ie({},r.properties),{},{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null},sampleByEvent:function(e,r){return n=>{var t,o,i;return n?u(e,n.event)?100*Math.random()<Te(100*r,0,100)?Ie(Ie({},n),{},{properties:Ie(Ie({},n.properties),{},{$sample_type:Ce(null===(t=n.properties)||void 0===t?void 0:t.$sample_type,"sampleByEvent"),$sample_threshold:Me(null===(o=n.properties)||void 0===o?void 0:o.$sample_threshold,r),$sampled_events:Ce(null===(i=n.properties)||void 0===i?void 0:i.$sampled_events,e)})}):null:n:null}},sampleBySessionId:function(e){return r=>r&&Fe(r.properties.$session_id,e)?Ie(Ie({},r),{},{properties:Ie(Ie({},r.properties),{},{$sample_type:Ce(r.properties.$sample_type,"sampleBySessionId"),$sample_threshold:Me(r.properties.$sample_threshold,e)})}):null},setAllPersonProfilePropertiesAsPersonPropertiesForFlags:e=>{var r=x({},De.properties({maskPersonalDataProperties:e.config.mask_personal_data_properties,customPersonalDataProperties:e.config.custom_personal_data_properties}),De.campaignParams({customTrackedParams:e.config.custom_campaign_params,maskPersonalDataProperties:e.config.mask_personal_data_properties,customPersonalDataProperties:e.config.custom_personal_data_properties}),De.referrerInfo()),n={};E(r,(function(e,r){(u(ke,r)||u(Se,r))&&(n[r]=e)})),e.setPersonPropertiesForFlags(n)}});l.posthogCustomizations=Le}(); | ||
!function(){"use strict";var e="undefined"!=typeof window?window:void 0,r="undefined"!=typeof globalThis?globalThis:e,n=Array.prototype.forEach,t=null==r?void 0:r.navigator,o=null==r?void 0:r.document,i=null==r?void 0:r.location;null==r||r.fetch,null!=r&&r.XMLHttpRequest&&"withCredentials"in new r.XMLHttpRequest&&r.XMLHttpRequest,null==r||r.AbortController;var a,s=null==t?void 0:t.userAgent,l=null!=e?e:{};function u(e,r){return-1!==e.indexOf(r)}!function(e){e.GZipJS="gzip-js",e.Base64="base64"}(a||(a={}));var c=function(e){return e.replace(/^\$/,"")},p=Array.isArray,f=Object.prototype,d=f.hasOwnProperty,g=f.toString,v=p||function(e){return"[object Array]"===g.call(e)},h=e=>void 0===e,m=e=>null===e,_=e=>"[object Number]"==g.call(e),w={DEBUG:!1,LIB_VERSION:"1.217.0"},b=r=>{var n={_log:function(n){if(e&&l.POSTHOG_DEBUG&&!h(e.console)&&e.console){for(var t=("__rrweb_original__"in e.console[n]?e.console[n].__rrweb_original__:e.console[n]),o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];t(r,...i)}},info:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];n._log("log",...r)},warn:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];n._log("warn",...r)},error:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];n._log("error",...r)},critical:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];console.error(r,...n)},uninitializedWarning:e=>{n.error("You must initialize PostHog before calling ".concat(e))},createLogger:e=>b("".concat(r," ").concat(e))};return n},P=b("[PostHog.js]"),$={};function y(e,r,t){if(v(e))if(n&&e.forEach===n)e.forEach(r,t);else if("length"in e&&e.length===+e.length)for(var o=0,i=e.length;o<i;o++)if(o in e&&r.call(t,e[o],o)===$)return}function E(e,r,n){if(!h(t=e)&&!m(t)){var t;if(v(e))return y(e,r,n);if((e=>e instanceof FormData)(e)){for(var o of e.entries())if(r.call(n,o[1],o[0])===$)return}else for(var i in e)if(d.call(e,i)&&r.call(n,e[i],i)===$)return}}var x=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return y(n,(function(r){for(var n in r)void 0!==r[n]&&(e[n]=r[n])})),e},O=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return y(n,(function(r){y(r,(function(r){e.push(r)}))})),e},R=function(e){var r={};return E(e,(function(e,n){var t;t=e,"[object String]"==g.call(t)&&e.length>0&&(r[n]=e)})),r},k=e=>{var r=null==o?void 0:o.createElement("a");return h(r)?null:(r.href=e,r)},S=function(e,r){for(var n,t=((e.split("#")[0]||"").split("?")[1]||"").split("&"),o=0;o<t.length;o++){var i=t[o].split("=");if(i[0]===r){n=i;break}}if(!v(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch(e){P.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},B=function(e,r,n){if(!e||!r||!r.length)return e;for(var t=e.split("#"),o=t[0]||"",i=t[1],a=o.split("?"),s=a[1],l=a[0],u=(s||"").split("&"),c=[],p=0;p<u.length;p++){var f=u[p].split("=");v(f)&&(r.includes(f[0])?c.push(f[0]+"="+n):c.push(u[p]))}var d=l;return null!=s&&(d+="?"+c.join("&")),null!=i&&(d+="#"+i),d},D="Mobile",A="iOS",I="Android",j="Tablet",T=I+" "+j,C="iPad",M="Apple",F=M+" Watch",L="Safari",z="BlackBerry",U="Samsung",W=U+"Browser",N=U+" Internet",H="Chrome",X=H+" OS",V=H+" "+A,q="Internet Explorer",G=q+" "+D,K="Opera",Z=K+" Mini",Q="Edge",J="Microsoft "+Q,Y="Firefox",ee=Y+" "+A,re="Nintendo",ne="PlayStation",te="Xbox",oe=I+" "+D,ie=D+" "+L,ae="Windows",se=ae+" Phone",le="Nokia",ue="Ouya",ce="Generic",pe=ce+" "+D.toLowerCase(),fe=ce+" "+j.toLowerCase(),de="Konqueror",ge="(\\d+(\\.\\d+)?)",ve=new RegExp("Version/"+ge),he=new RegExp(te,"i"),me=new RegExp(ne+" \\w+","i"),_e=new RegExp(re+" \\w+","i"),we=new RegExp(z+"|PlayBook|BB10","i"),be={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var Pe=(e,r)=>r&&u(r,M)||function(e){return u(e,L)&&!u(e,H)&&!u(e,I)}(e),$e=function(e,r){return r=r||"",u(e," OPR/")&&u(e,"Mini")?Z:u(e," OPR/")?K:we.test(e)?z:u(e,"IE"+D)||u(e,"WPDesktop")?G:u(e,W)?N:u(e,Q)||u(e,"Edg/")?J:u(e,"FBIOS")?"Facebook "+D:u(e,"UCWEB")||u(e,"UCBrowser")?"UC Browser":u(e,"CriOS")?V:u(e,"CrMo")||u(e,H)?H:u(e,I)&&u(e,L)?oe:u(e,"FxiOS")?ee:u(e.toLowerCase(),de.toLowerCase())?de:Pe(e,r)?u(e,D)?ie:L:u(e,Y)?Y:u(e,"MSIE")||u(e,"Trident/")?q:u(e,"Gecko")?Y:""},ye={[G]:[new RegExp("rv:"+ge)],[J]:[new RegExp(Q+"?\\/"+ge)],[H]:[new RegExp("("+H+"|CrMo)\\/"+ge)],[V]:[new RegExp("CriOS\\/"+ge)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ge)],[L]:[ve],[ie]:[ve],[K]:[new RegExp("(Opera|OPR)\\/"+ge)],[Y]:[new RegExp(Y+"\\/"+ge)],[ee]:[new RegExp("FxiOS\\/"+ge)],[de]:[new RegExp("Konqueror[:/]?"+ge,"i")],[z]:[new RegExp(z+" "+ge),ve],[oe]:[new RegExp("android\\s"+ge,"i")],[N]:[new RegExp(W+"\\/"+ge)],[q]:[new RegExp("(rv:|MSIE )"+ge)],Mozilla:[new RegExp("rv:"+ge)]},Ee=[[new RegExp(te+"; "+te+" (.*?)[);]","i"),e=>[te,e&&e[1]||""]],[new RegExp(re,"i"),[re,""]],[new RegExp(ne,"i"),[ne,""]],[we,[z,""]],[new RegExp(ae,"i"),(e,r)=>{if(/Phone/.test(r)||/WPDesktop/.test(r))return[se,""];if(new RegExp(D).test(r)&&!/IEMobile\b/.test(r))return[ae+" "+D,""];var n=/Windows NT ([0-9.]+)/i.exec(r);if(n&&n[1]){var t=n[1],o=be[t]||"";return/arm/i.test(r)&&(o="RT"),[ae,o]}return[ae,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var r=[e[3],e[4],e[5]||"0"];return[A,r.join(".")]}return[A,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var r="";return e&&e.length>=3&&(r=h(e[2])?e[3]:e[2]),["watchOS",r]}],[new RegExp("("+I+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+I+")","i"),e=>{if(e&&e[2]){var r=[e[2],e[3],e[4]||"0"];return[I,r.join(".")]}return[I,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var r=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];r[1]=n.join(".")}return r}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[X,""]],[/Linux|debian/i,["Linux",""]]],xe=function(e){return _e.test(e)?re:me.test(e)?ne:he.test(e)?te:new RegExp(ue,"i").test(e)?ue:new RegExp("("+se+"|WPDesktop)","i").test(e)?se:/iPad/.test(e)?C:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?F:we.test(e)?z:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(le,"i").test(e)?le:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(D).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?I:T:I:new RegExp("(pda|"+D+")","i").test(e)?pe:new RegExp(j,"i").test(e)&&!new RegExp(j+" pc","i").test(e)?fe:""},Oe="https?://(.*)",Re=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],ke=O(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Re),Se=["$app_build","$app_name","$app_namespace","$app_version","$browser","$browser_version","$device_type","$current_url","$pathname","$os","$os_name","$os_version","$referring_domain","$referrer"],Be="<masked>",De={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:r,customPersonalDataProperties:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!o)return{};var t=r?O([],Re,n||[]):[];return this._campaignParamsFromUrl(B(o.URL,t,Be),e)},_campaignParamsFromUrl:function(e,r){var n=ke.concat(r||[]),t={};return E(n,(function(r){var n=S(e,r);t[r]=n||null})),t},_searchEngine:function(e){return e?0===e.search(Oe+"google.([^/?]*)")?"google":0===e.search(Oe+"bing.com")?"bing":0===e.search(Oe+"yahoo.com")?"yahoo":0===e.search(Oe+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var r=De._searchEngine(e),n="yahoo"!=r?"q":"p",t={};if(!m(r)){t.$search_engine=r;var i=o?S(o.referrer,n):"";i.length&&(t.ph_keyword=i)}return t},searchInfo:function(){var e=null==o?void 0:o.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:$e,browserVersion:function(e,r){var n=$e(e,r),t=ye[n];if(h(t))return null;for(var o=0;o<t.length;o++){var i=t[o],a=e.match(i);if(a)return parseFloat(a[a.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var e=this.browserLanguage();return"string"==typeof e?e.split("-")[0]:void 0},os:function(e){for(var r=0;r<Ee.length;r++){var[n,t]=Ee[r],o=n.exec(e),i=o&&("function"==typeof t?t(o,e):t);if(i)return i}return["",""]},device:xe,deviceType:function(e){var r=xe(e);return r===C||r===T||"Kobo"===r||"Kindle Fire"===r||r===fe?j:r===re||r===te||r===ne||r===ue?"Console":r===F?"Wearable":r?D:"Desktop"},referrer:function(){return(null==o?void 0:o.referrer)||"$direct"},referringDomain:function(){var e;return null!=o&&o.referrer&&(null===(e=k(o.referrer))||void 0===e?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer().substring(0,1e3),u:null==i?void 0:i.href.substring(0,1e3)}},initialPersonPropsFromInfo:function(e){var r,{r:n,u:t}=e,o={$initial_referrer:n,$initial_referring_domain:null==n?void 0:"$direct"==n?"$direct":null===(r=k(n))||void 0===r?void 0:r.host};if(t){o.$initial_current_url=t;var i=k(t);o.$initial_host=null==i?void 0:i.host,o.$initial_pathname=null==i?void 0:i.pathname,E(this._campaignParamsFromUrl(t),(function(e,r){o["$initial_"+c(r)]=e}))}n&&E(this._searchInfoFromReferrer(n),(function(e,r){o["$initial_"+c(r)]=e}));return o},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},timezoneOffset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},properties:function(){var{maskPersonalDataProperties:r,customPersonalDataProperties:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!s)return{};var t=r?O([],Re,n||[]):[],[o,a]=De.os(s);return x(R({$os:o,$os_version:a,$browser:De.browser(s,navigator.vendor),$device:De.device(s),$device_type:De.deviceType(s),$timezone:De.timezone(),$timezone_offset:De.timezoneOffset()}),{$current_url:B(null==i?void 0:i.href,t,Be),$host:null==i?void 0:i.host,$pathname:null==i?void 0:i.pathname,$raw_user_agent:s.length>1e3?s.substring(0,997)+"...":s,$browser_version:De.browserVersion(s,navigator.vendor),$browser_language:De.browserLanguage(),$browser_language_prefix:De.browserLanguagePrefix(),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:"web",$lib_version:w.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!s)return{};var[e,r]=De.os(s);return x(R({$os:e,$os_version:r,$browser:De.browser(s,navigator.vendor)}),{$browser_version:De.browserVersion(s,navigator.vendor)})}};function Ae(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function Ie(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Ae(Object(n),!0).forEach((function(r){je(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ae(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function je(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Te(e,r,n,t,o){return _(e)?e>n?n:e<r?r:e:Te(n,r,n)}function Ce(e,r){return[...e||[],...v(r)?r:[r]]}function Me(e,r){return(h(e)?1:e)*r}function Fe(e,r){return function(e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return Math.abs(r)}(e)%100<Te(100*r,0,100)}var Le=Object.freeze({__proto__:null,printAndDropEverything:e=>(console.log("Would have sent event:",e),null),sampleByDistinctId:function(e){return r=>r&&Fe(r.properties.distinct_id,e)?Ie(Ie({},r),{},{properties:Ie(Ie({},r.properties),{},{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null},sampleByEvent:function(e,r){return n=>{var t,o,i;return n?u(e,n.event)?100*Math.random()<Te(100*r,0,100)?Ie(Ie({},n),{},{properties:Ie(Ie({},n.properties),{},{$sample_type:Ce(null===(t=n.properties)||void 0===t?void 0:t.$sample_type,"sampleByEvent"),$sample_threshold:Me(null===(o=n.properties)||void 0===o?void 0:o.$sample_threshold,r),$sampled_events:Ce(null===(i=n.properties)||void 0===i?void 0:i.$sampled_events,e)})}):null:n:null}},sampleBySessionId:function(e){return r=>r&&Fe(r.properties.$session_id,e)?Ie(Ie({},r),{},{properties:Ie(Ie({},r.properties),{},{$sample_type:Ce(r.properties.$sample_type,"sampleBySessionId"),$sample_threshold:Me(r.properties.$sample_threshold,e)})}):null},setAllPersonProfilePropertiesAsPersonPropertiesForFlags:e=>{var r=x({},De.properties({maskPersonalDataProperties:e.config.mask_personal_data_properties,customPersonalDataProperties:e.config.custom_personal_data_properties}),De.campaignParams({customTrackedParams:e.config.custom_campaign_params,maskPersonalDataProperties:e.config.mask_personal_data_properties,customPersonalDataProperties:e.config.custom_personal_data_properties}),De.referrerInfo()),n={};E(r,(function(e,r){(u(ke,r)||u(Se,r))&&(n[r]=e)})),e.setPersonPropertiesForFlags(n)}});l.posthogCustomizations=Le}(); | ||
//# sourceMappingURL=customizations.full.js.map |
@@ -6,3 +6,2 @@ import { PostHog } from '../../posthog-core'; | ||
remoteEnabled: boolean | undefined; | ||
private originalOnUnhandledRejectionHandler; | ||
private unwrapOnError; | ||
@@ -12,4 +11,3 @@ private unwrapUnhandledRejection; | ||
get isEnabled(): boolean; | ||
get isCapturing(): boolean; | ||
get hasHandlers(): ((this: WindowEventHandlers, ev: PromiseRejectionEvent) => any) | undefined; | ||
get hasHandlers(): boolean; | ||
startIfEnabled(): void; | ||
@@ -16,0 +14,0 @@ private loadScript; |
@@ -654,2 +654,8 @@ import { PostHog } from './posthog-core'; | ||
/** | ||
* Determines whether to capture exceptions. | ||
* | ||
* @default undefined | ||
*/ | ||
capture_exceptions?: boolean; | ||
/** | ||
* Determines whether to disable scroll properties. | ||
@@ -656,0 +662,0 @@ * These allow you to keep track of how far down someone scrolled in your website. |
{ | ||
"name": "posthog-js", | ||
"version": "1.216.1", | ||
"version": "1.217.0", | ||
"description": "Posthog-js allows you to automatically capture usage and send events to PostHog.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/PostHog/posthog-js", |
@@ -6,3 +6,2 @@ import { PostHog } from '../../posthog-core'; | ||
remoteEnabled: boolean | undefined; | ||
private originalOnUnhandledRejectionHandler; | ||
private unwrapOnError; | ||
@@ -12,4 +11,3 @@ private unwrapUnhandledRejection; | ||
get isEnabled(): boolean; | ||
get isCapturing(): boolean; | ||
get hasHandlers(): ((this: WindowEventHandlers, ev: PromiseRejectionEvent) => any) | undefined; | ||
get hasHandlers(): boolean; | ||
startIfEnabled(): void; | ||
@@ -16,0 +14,0 @@ private loadScript; |
import { assignableWindow, window } from '../../utils/globals'; | ||
import { createLogger } from '../../utils/logger'; | ||
import { EXCEPTION_CAPTURE_ENABLED_SERVER_SIDE } from '../../constants'; | ||
import { isBoolean, isUndefined } from '../../utils/type-utils'; | ||
var logger = createLogger('[ExceptionAutocapture]'); | ||
@@ -9,6 +10,5 @@ var ExceptionObserver = /** @class */ (function () { | ||
var _a; | ||
this.originalOnUnhandledRejectionHandler = undefined; | ||
this.startCapturing = function () { | ||
var _a, _b, _c, _d; | ||
if (!window || !_this.isEnabled || _this.hasHandlers || _this.isCapturing) { | ||
if (!window || !_this.isEnabled || _this.hasHandlers) { | ||
return; | ||
@@ -38,2 +38,5 @@ } | ||
var _a; | ||
if (isBoolean(this.instance.config.capture_exceptions)) { | ||
return this.instance.config.capture_exceptions; | ||
} | ||
return (_a = this.remoteEnabled) !== null && _a !== void 0 ? _a : false; | ||
@@ -44,13 +47,5 @@ }, | ||
}); | ||
Object.defineProperty(ExceptionObserver.prototype, "isCapturing", { | ||
get: function () { | ||
var _a; | ||
return !!((_a = window === null || window === void 0 ? void 0 : window.onerror) === null || _a === void 0 ? void 0 : _a.__POSTHOG_INSTRUMENTED__); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ExceptionObserver.prototype, "hasHandlers", { | ||
get: function () { | ||
return this.originalOnUnhandledRejectionHandler || this.unwrapOnError; | ||
return !isUndefined(this.unwrapOnError); | ||
}, | ||
@@ -61,3 +56,3 @@ enumerable: false, | ||
ExceptionObserver.prototype.startIfEnabled = function () { | ||
if (this.isEnabled && !this.isCapturing) { | ||
if (this.isEnabled && !this.hasHandlers) { | ||
logger.info('enabled, starting...'); | ||
@@ -83,3 +78,5 @@ this.loadScript(this.startCapturing); | ||
(_a = this.unwrapOnError) === null || _a === void 0 ? void 0 : _a.call(this); | ||
this.unwrapOnError = undefined; | ||
(_b = this.unwrapUnhandledRejection) === null || _b === void 0 ? void 0 : _b.call(this); | ||
this.unwrapUnhandledRejection = undefined; | ||
}; | ||
@@ -86,0 +83,0 @@ ExceptionObserver.prototype.onRemoteConfig = function (response) { |
@@ -654,2 +654,8 @@ import { PostHog } from './posthog-core'; | ||
/** | ||
* Determines whether to capture exceptions. | ||
* | ||
* @default undefined | ||
*/ | ||
capture_exceptions?: boolean; | ||
/** | ||
* Determines whether to disable scroll properties. | ||
@@ -656,0 +662,0 @@ * These allow you to keep track of how far down someone scrolled in your website. |
{ | ||
"name": "posthog-js", | ||
"version": "1.216.1", | ||
"version": "1.217.0", | ||
"description": "Posthog-js allows you to automatically capture usage and send events to PostHog.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/PostHog/posthog-js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20345242
47546