posthog-js
Advanced tools
Comparing version 1.198.0 to 1.199.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,i=null==r?void 0:r.document,o=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(e){e.GZipJS="gzip-js",e.Base64="base64"}(a||(a={}));var u=Array.isArray,c=Object.prototype,p=c.hasOwnProperty,f=c.toString,d=u||function(e){return"[object Array]"===f.call(e)},g=e=>void 0===e,v=e=>null===e,h=e=>"[object Number]"==f.call(e),w={DEBUG:!1,LIB_VERSION:"1.198.0"},_=r=>{var n={_log:function(n){if(e&&l.POSTHOG_DEBUG&&!g(e.console)&&e.console){for(var t=("__rrweb_original__"in e.console[n]?e.console[n].__rrweb_original__:e.console[n]),i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];t(r,...o)}},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=>_("".concat(r," ").concat(e))};return n},m=_("[PostHog.js]"),b={};function $(e,r,t){if(d(e))if(n&&e.forEach===n)e.forEach(r,t);else if("length"in e&&e.length===+e.length)for(var i=0,o=e.length;i<o;i++)if(i in e&&r.call(t,e[i],i)===b)return}function y(e,r,n){if(!g(t=e)&&!v(t)){var t;if(d(e))return $(e,r,n);if((e=>e instanceof FormData)(e)){for(var i of e.entries())if(r.call(n,i[1],i[0])===b)return}else for(var o in e)if(p.call(e,o)&&r.call(n,e[o],o)===b)return}}var E=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 $(n,(function(r){for(var n in r)void 0!==r[n]&&(e[n]=r[n])})),e};function P(e,r){return-1!==e.indexOf(r)}var x=function(e){var r={};return y(e,(function(e,n){var t;t=e,"[object String]"==f.call(t)&&e.length>0&&(r[n]=e)})),r},O=function(e){return e.replace(/^\$/,"")},R=e=>{var r=null==i?void 0:i.createElement("a");return g(r)?null:(r.href=e,r)},S=function(e,r){for(var n,t=((e.split("#")[0]||"").split("?")[1]||"").split("&"),i=0;i<t.length;i++){var o=t[i].split("=");if(o[0]===r){n=o;break}}if(!d(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch(e){m.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},B="Mobile",I="iOS",A="Android",k="Tablet",j=A+" "+k,C="iPad",M="Apple",F=M+" Watch",T="Safari",D="BlackBerry",L="Samsung",z=L+"Browser",U=L+" Internet",W="Chrome",N=W+" OS",H=W+" "+I,X="Internet Explorer",V=X+" "+B,q="Opera",G=q+" Mini",K="Edge",Z="Microsoft "+K,Q="Firefox",J=Q+" "+I,Y="Nintendo",ee="PlayStation",re="Xbox",ne=A+" "+B,te=B+" "+T,ie="Windows",oe=ie+" Phone",ae="Nokia",se="Ouya",le="Generic",ue=le+" "+B.toLowerCase(),ce=le+" "+k.toLowerCase(),pe="Konqueror",fe="(\\d+(\\.\\d+)?)",de=new RegExp("Version/"+fe),ge=new RegExp(re,"i"),ve=new RegExp(ee+" \\w+","i"),he=new RegExp(Y+" \\w+","i"),we=new RegExp(D+"|PlayBook|BB10","i"),_e={"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 me=(e,r)=>r&&P(r,M)||function(e){return P(e,T)&&!P(e,W)&&!P(e,A)}(e),be=function(e,r){return r=r||"",P(e," OPR/")&&P(e,"Mini")?G:P(e," OPR/")?q:we.test(e)?D:P(e,"IE"+B)||P(e,"WPDesktop")?V:P(e,z)?U:P(e,K)||P(e,"Edg/")?Z:P(e,"FBIOS")?"Facebook "+B:P(e,"UCWEB")||P(e,"UCBrowser")?"UC Browser":P(e,"CriOS")?H:P(e,"CrMo")||P(e,W)?W:P(e,A)&&P(e,T)?ne:P(e,"FxiOS")?J:P(e.toLowerCase(),pe.toLowerCase())?pe:me(e,r)?P(e,B)?te:T:P(e,Q)?Q:P(e,"MSIE")||P(e,"Trident/")?X:P(e,"Gecko")?Q:""},$e={[V]:[new RegExp("rv:"+fe)],[Z]:[new RegExp(K+"?\\/"+fe)],[W]:[new RegExp("("+W+"|CrMo)\\/"+fe)],[H]:[new RegExp("CriOS\\/"+fe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+fe)],[T]:[de],[te]:[de],[q]:[new RegExp("(Opera|OPR)\\/"+fe)],[Q]:[new RegExp(Q+"\\/"+fe)],[J]:[new RegExp("FxiOS\\/"+fe)],[pe]:[new RegExp("Konqueror[:/]?"+fe,"i")],[D]:[new RegExp(D+" "+fe),de],[ne]:[new RegExp("android\\s"+fe,"i")],[U]:[new RegExp(z+"\\/"+fe)],[X]:[new RegExp("(rv:|MSIE )"+fe)],Mozilla:[new RegExp("rv:"+fe)]},ye=[[new RegExp(re+"; "+re+" (.*?)[);]","i"),e=>[re,e&&e[1]||""]],[new RegExp(Y,"i"),[Y,""]],[new RegExp(ee,"i"),[ee,""]],[we,[D,""]],[new RegExp(ie,"i"),(e,r)=>{if(/Phone/.test(r)||/WPDesktop/.test(r))return[oe,""];if(new RegExp(B).test(r)&&!/IEMobile\b/.test(r))return[ie+" "+B,""];var n=/Windows NT ([0-9.]+)/i.exec(r);if(n&&n[1]){var t=n[1],i=_e[t]||"";return/arm/i.test(r)&&(i="RT"),[ie,i]}return[ie,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var r=[e[3],e[4],e[5]||"0"];return[I,r.join(".")]}return[I,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var r="";return e&&e.length>=3&&(r=g(e[2])?e[3]:e[2]),["watchOS",r]}],[new RegExp("("+A+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+A+")","i"),e=>{if(e&&e[2]){var r=[e[2],e[3],e[4]||"0"];return[A,r.join(".")]}return[A,""]}],[/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/,[N,""]],[/Linux|debian/i,["Linux",""]]],Ee=function(e){return he.test(e)?Y:ve.test(e)?ee:ge.test(e)?re:new RegExp(se,"i").test(e)?se:new RegExp("("+oe+"|WPDesktop)","i").test(e)?oe:/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)?D:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ae,"i").test(e)?ae:/(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(B).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)?A:j:A:new RegExp("(pda|"+B+")","i").test(e)?ue:new RegExp(k,"i").test(e)&&!new RegExp(k+" pc","i").test(e)?ce:""},Pe="https?://(.*)",xe=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid","rdt_cid"],Oe=["$app_build","$app_name","$app_namespace","$app_version","$browser","$browser_version","$device_type","$current_url","$pathname","$os","$os_name","$os_version","$referring_domain","$referrer"],Re={campaignParams:function(e){return i?this._campaignParamsFromUrl(i.URL,e):{}},_campaignParamsFromUrl:function(e,r){var n=xe.concat(r||[]),t={};return y(n,(function(r){var n=S(e,r);t[r]=n||null})),t},_searchEngine:function(e){return e?0===e.search(Pe+"google.([^/?]*)")?"google":0===e.search(Pe+"bing.com")?"bing":0===e.search(Pe+"yahoo.com")?"yahoo":0===e.search(Pe+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var r=Re._searchEngine(e),n="yahoo"!=r?"q":"p",t={};if(!v(r)){t.$search_engine=r;var o=i?S(i.referrer,n):"";o.length&&(t.ph_keyword=o)}return t},searchInfo:function(){var e=null==i?void 0:i.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:be,browserVersion:function(e,r){var n=be(e,r),t=$e[n];if(g(t))return null;for(var i=0;i<t.length;i++){var o=t[i],a=e.match(o);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<ye.length;r++){var[n,t]=ye[r],i=n.exec(e),o=i&&("function"==typeof t?t(i,e):t);if(o)return o}return["",""]},device:Ee,deviceType:function(e){var r=Ee(e);return r===C||r===j||"Kobo"===r||"Kindle Fire"===r||r===ce?k:r===Y||r===re||r===ee||r===se?"Console":r===F?"Wearable":r?B:"Desktop"},referrer:function(){return(null==i?void 0:i.referrer)||"$direct"},referringDomain:function(){var e;return null!=i&&i.referrer&&(null===(e=R(i.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==o?void 0:o.href.substring(0,1e3)}},initialPersonPropsFromInfo:function(e){var r,{r:n,u:t}=e,i={$initial_referrer:n,$initial_referring_domain:null==n?void 0:"$direct"==n?"$direct":null===(r=R(n))||void 0===r?void 0:r.host};if(t){i.$initial_current_url=t;var o=R(t);i.$initial_host=null==o?void 0:o.host,i.$initial_pathname=null==o?void 0:o.pathname,y(this._campaignParamsFromUrl(t),(function(e,r){i["$initial_"+O(r)]=e}))}n&&y(this._searchInfoFromReferrer(n),(function(e,r){i["$initial_"+O(r)]=e}));return i},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},timezoneOffset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},properties:function(){if(!s)return{};var[r,n]=Re.os(s);return E(x({$os:r,$os_version:n,$browser:Re.browser(s,navigator.vendor),$device:Re.device(s),$device_type:Re.deviceType(s),$timezone:Re.timezone(),$timezone_offset:Re.timezoneOffset()}),{$current_url:null==o?void 0:o.href,$host:null==o?void 0:o.host,$pathname:null==o?void 0:o.pathname,$raw_user_agent:s.length>1e3?s.substring(0,997)+"...":s,$browser_version:Re.browserVersion(s,navigator.vendor),$browser_language:Re.browserLanguage(),$browser_language_prefix:Re.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]=Re.os(s);return E(x({$os:e,$os_version:r,$browser:Re.browser(s,navigator.vendor)}),{$browser_version:Re.browserVersion(s,navigator.vendor)})}};function Se(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 Be(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Se(Object(n),!0).forEach((function(r){Ie(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Se(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function Ie(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Ae(e,r,n,t,i){return h(e)?e>n?n:e<r?r:e:Ae(n,r,n)}function ke(e,r){return[...e||[],...d(r)?r:[r]]}function je(e,r){return(g(e)?1:e)*r}function Ce(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<Ae(100*r,0,100)}var Me=Object.freeze({__proto__:null,printAndDropEverything:e=>(console.log("Would have sent event:",e),null),sampleByDistinctId:function(e){return r=>r&&Ce(r.properties.distinct_id,e)?Be(Be({},r),{},{properties:Be(Be({},r.properties),{},{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null},sampleByEvent:function(e,r){return n=>{var t,i,o;return n?P(e,n.event)?100*Math.random()<Ae(100*r,0,100)?Be(Be({},n),{},{properties:Be(Be({},n.properties),{},{$sample_type:ke(null===(t=n.properties)||void 0===t?void 0:t.$sample_type,"sampleByEvent"),$sample_threshold:je(null===(i=n.properties)||void 0===i?void 0:i.$sample_threshold,r),$sampled_events:ke(null===(o=n.properties)||void 0===o?void 0:o.$sampled_events,e)})}):null:n:null}},sampleBySessionId:function(e){return r=>r&&Ce(r.properties.$session_id,e)?Be(Be({},r),{},{properties:Be(Be({},r.properties),{},{$sample_type:ke(r.properties.$sample_type,"sampleBySessionId"),$sample_threshold:je(r.properties.$sample_threshold,e)})}):null},setAllPersonProfilePropertiesAsPersonPropertiesForFlags:e=>{var r=E({},Re.properties(),Re.campaignParams(),Re.referrerInfo()),n={};y(r,(function(e,r){(P(xe,r)||P(Oe,r))&&(n[r]=e)})),e.setPersonPropertiesForFlags(n)}});l.posthogCustomizations=Me}(); | ||
!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,i=null==r?void 0:r.document,o=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(e){e.GZipJS="gzip-js",e.Base64="base64"}(a||(a={}));var u=Array.isArray,c=Object.prototype,p=c.hasOwnProperty,f=c.toString,d=u||function(e){return"[object Array]"===f.call(e)},g=e=>void 0===e,v=e=>null===e,h=e=>"[object Number]"==f.call(e),w={DEBUG:!1,LIB_VERSION:"1.199.0"},_=r=>{var n={_log:function(n){if(e&&l.POSTHOG_DEBUG&&!g(e.console)&&e.console){for(var t=("__rrweb_original__"in e.console[n]?e.console[n].__rrweb_original__:e.console[n]),i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];t(r,...o)}},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=>_("".concat(r," ").concat(e))};return n},m=_("[PostHog.js]"),b={};function $(e,r,t){if(d(e))if(n&&e.forEach===n)e.forEach(r,t);else if("length"in e&&e.length===+e.length)for(var i=0,o=e.length;i<o;i++)if(i in e&&r.call(t,e[i],i)===b)return}function y(e,r,n){if(!g(t=e)&&!v(t)){var t;if(d(e))return $(e,r,n);if((e=>e instanceof FormData)(e)){for(var i of e.entries())if(r.call(n,i[1],i[0])===b)return}else for(var o in e)if(p.call(e,o)&&r.call(n,e[o],o)===b)return}}var E=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 $(n,(function(r){for(var n in r)void 0!==r[n]&&(e[n]=r[n])})),e};function P(e,r){return-1!==e.indexOf(r)}var x=function(e){var r={};return y(e,(function(e,n){var t;t=e,"[object String]"==f.call(t)&&e.length>0&&(r[n]=e)})),r},O=function(e){return e.replace(/^\$/,"")},R=e=>{var r=null==i?void 0:i.createElement("a");return g(r)?null:(r.href=e,r)},S=function(e,r){for(var n,t=((e.split("#")[0]||"").split("?")[1]||"").split("&"),i=0;i<t.length;i++){var o=t[i].split("=");if(o[0]===r){n=o;break}}if(!d(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch(e){m.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},B="Mobile",I="iOS",A="Android",k="Tablet",j=A+" "+k,C="iPad",M="Apple",F=M+" Watch",T="Safari",D="BlackBerry",L="Samsung",z=L+"Browser",U=L+" Internet",W="Chrome",N=W+" OS",H=W+" "+I,X="Internet Explorer",V=X+" "+B,q="Opera",G=q+" Mini",K="Edge",Z="Microsoft "+K,Q="Firefox",J=Q+" "+I,Y="Nintendo",ee="PlayStation",re="Xbox",ne=A+" "+B,te=B+" "+T,ie="Windows",oe=ie+" Phone",ae="Nokia",se="Ouya",le="Generic",ue=le+" "+B.toLowerCase(),ce=le+" "+k.toLowerCase(),pe="Konqueror",fe="(\\d+(\\.\\d+)?)",de=new RegExp("Version/"+fe),ge=new RegExp(re,"i"),ve=new RegExp(ee+" \\w+","i"),he=new RegExp(Y+" \\w+","i"),we=new RegExp(D+"|PlayBook|BB10","i"),_e={"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 me=(e,r)=>r&&P(r,M)||function(e){return P(e,T)&&!P(e,W)&&!P(e,A)}(e),be=function(e,r){return r=r||"",P(e," OPR/")&&P(e,"Mini")?G:P(e," OPR/")?q:we.test(e)?D:P(e,"IE"+B)||P(e,"WPDesktop")?V:P(e,z)?U:P(e,K)||P(e,"Edg/")?Z:P(e,"FBIOS")?"Facebook "+B:P(e,"UCWEB")||P(e,"UCBrowser")?"UC Browser":P(e,"CriOS")?H:P(e,"CrMo")||P(e,W)?W:P(e,A)&&P(e,T)?ne:P(e,"FxiOS")?J:P(e.toLowerCase(),pe.toLowerCase())?pe:me(e,r)?P(e,B)?te:T:P(e,Q)?Q:P(e,"MSIE")||P(e,"Trident/")?X:P(e,"Gecko")?Q:""},$e={[V]:[new RegExp("rv:"+fe)],[Z]:[new RegExp(K+"?\\/"+fe)],[W]:[new RegExp("("+W+"|CrMo)\\/"+fe)],[H]:[new RegExp("CriOS\\/"+fe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+fe)],[T]:[de],[te]:[de],[q]:[new RegExp("(Opera|OPR)\\/"+fe)],[Q]:[new RegExp(Q+"\\/"+fe)],[J]:[new RegExp("FxiOS\\/"+fe)],[pe]:[new RegExp("Konqueror[:/]?"+fe,"i")],[D]:[new RegExp(D+" "+fe),de],[ne]:[new RegExp("android\\s"+fe,"i")],[U]:[new RegExp(z+"\\/"+fe)],[X]:[new RegExp("(rv:|MSIE )"+fe)],Mozilla:[new RegExp("rv:"+fe)]},ye=[[new RegExp(re+"; "+re+" (.*?)[);]","i"),e=>[re,e&&e[1]||""]],[new RegExp(Y,"i"),[Y,""]],[new RegExp(ee,"i"),[ee,""]],[we,[D,""]],[new RegExp(ie,"i"),(e,r)=>{if(/Phone/.test(r)||/WPDesktop/.test(r))return[oe,""];if(new RegExp(B).test(r)&&!/IEMobile\b/.test(r))return[ie+" "+B,""];var n=/Windows NT ([0-9.]+)/i.exec(r);if(n&&n[1]){var t=n[1],i=_e[t]||"";return/arm/i.test(r)&&(i="RT"),[ie,i]}return[ie,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var r=[e[3],e[4],e[5]||"0"];return[I,r.join(".")]}return[I,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var r="";return e&&e.length>=3&&(r=g(e[2])?e[3]:e[2]),["watchOS",r]}],[new RegExp("("+A+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+A+")","i"),e=>{if(e&&e[2]){var r=[e[2],e[3],e[4]||"0"];return[A,r.join(".")]}return[A,""]}],[/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/,[N,""]],[/Linux|debian/i,["Linux",""]]],Ee=function(e){return he.test(e)?Y:ve.test(e)?ee:ge.test(e)?re:new RegExp(se,"i").test(e)?se:new RegExp("("+oe+"|WPDesktop)","i").test(e)?oe:/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)?D:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ae,"i").test(e)?ae:/(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(B).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)?A:j:A:new RegExp("(pda|"+B+")","i").test(e)?ue:new RegExp(k,"i").test(e)&&!new RegExp(k+" pc","i").test(e)?ce:""},Pe="https?://(.*)",xe=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid","rdt_cid"],Oe=["$app_build","$app_name","$app_namespace","$app_version","$browser","$browser_version","$device_type","$current_url","$pathname","$os","$os_name","$os_version","$referring_domain","$referrer"],Re={campaignParams:function(e){return i?this._campaignParamsFromUrl(i.URL,e):{}},_campaignParamsFromUrl:function(e,r){var n=xe.concat(r||[]),t={};return y(n,(function(r){var n=S(e,r);t[r]=n||null})),t},_searchEngine:function(e){return e?0===e.search(Pe+"google.([^/?]*)")?"google":0===e.search(Pe+"bing.com")?"bing":0===e.search(Pe+"yahoo.com")?"yahoo":0===e.search(Pe+"duckduckgo.com")?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var r=Re._searchEngine(e),n="yahoo"!=r?"q":"p",t={};if(!v(r)){t.$search_engine=r;var o=i?S(i.referrer,n):"";o.length&&(t.ph_keyword=o)}return t},searchInfo:function(){var e=null==i?void 0:i.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:be,browserVersion:function(e,r){var n=be(e,r),t=$e[n];if(g(t))return null;for(var i=0;i<t.length;i++){var o=t[i],a=e.match(o);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<ye.length;r++){var[n,t]=ye[r],i=n.exec(e),o=i&&("function"==typeof t?t(i,e):t);if(o)return o}return["",""]},device:Ee,deviceType:function(e){var r=Ee(e);return r===C||r===j||"Kobo"===r||"Kindle Fire"===r||r===ce?k:r===Y||r===re||r===ee||r===se?"Console":r===F?"Wearable":r?B:"Desktop"},referrer:function(){return(null==i?void 0:i.referrer)||"$direct"},referringDomain:function(){var e;return null!=i&&i.referrer&&(null===(e=R(i.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==o?void 0:o.href.substring(0,1e3)}},initialPersonPropsFromInfo:function(e){var r,{r:n,u:t}=e,i={$initial_referrer:n,$initial_referring_domain:null==n?void 0:"$direct"==n?"$direct":null===(r=R(n))||void 0===r?void 0:r.host};if(t){i.$initial_current_url=t;var o=R(t);i.$initial_host=null==o?void 0:o.host,i.$initial_pathname=null==o?void 0:o.pathname,y(this._campaignParamsFromUrl(t),(function(e,r){i["$initial_"+O(r)]=e}))}n&&y(this._searchInfoFromReferrer(n),(function(e,r){i["$initial_"+O(r)]=e}));return i},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}},timezoneOffset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}},properties:function(){if(!s)return{};var[r,n]=Re.os(s);return E(x({$os:r,$os_version:n,$browser:Re.browser(s,navigator.vendor),$device:Re.device(s),$device_type:Re.deviceType(s),$timezone:Re.timezone(),$timezone_offset:Re.timezoneOffset()}),{$current_url:null==o?void 0:o.href,$host:null==o?void 0:o.host,$pathname:null==o?void 0:o.pathname,$raw_user_agent:s.length>1e3?s.substring(0,997)+"...":s,$browser_version:Re.browserVersion(s,navigator.vendor),$browser_language:Re.browserLanguage(),$browser_language_prefix:Re.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]=Re.os(s);return E(x({$os:e,$os_version:r,$browser:Re.browser(s,navigator.vendor)}),{$browser_version:Re.browserVersion(s,navigator.vendor)})}};function Se(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 Be(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Se(Object(n),!0).forEach((function(r){Ie(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Se(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function Ie(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Ae(e,r,n,t,i){return h(e)?e>n?n:e<r?r:e:Ae(n,r,n)}function ke(e,r){return[...e||[],...d(r)?r:[r]]}function je(e,r){return(g(e)?1:e)*r}function Ce(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<Ae(100*r,0,100)}var Me=Object.freeze({__proto__:null,printAndDropEverything:e=>(console.log("Would have sent event:",e),null),sampleByDistinctId:function(e){return r=>r&&Ce(r.properties.distinct_id,e)?Be(Be({},r),{},{properties:Be(Be({},r.properties),{},{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null},sampleByEvent:function(e,r){return n=>{var t,i,o;return n?P(e,n.event)?100*Math.random()<Ae(100*r,0,100)?Be(Be({},n),{},{properties:Be(Be({},n.properties),{},{$sample_type:ke(null===(t=n.properties)||void 0===t?void 0:t.$sample_type,"sampleByEvent"),$sample_threshold:je(null===(i=n.properties)||void 0===i?void 0:i.$sample_threshold,r),$sampled_events:ke(null===(o=n.properties)||void 0===o?void 0:o.$sampled_events,e)})}):null:n:null}},sampleBySessionId:function(e){return r=>r&&Ce(r.properties.$session_id,e)?Be(Be({},r),{},{properties:Be(Be({},r.properties),{},{$sample_type:ke(r.properties.$sample_type,"sampleBySessionId"),$sample_threshold:je(r.properties.$sample_threshold,e)})}):null},setAllPersonProfilePropertiesAsPersonPropertiesForFlags:e=>{var r=E({},Re.properties(),Re.campaignParams(),Re.referrerInfo()),n={};y(r,(function(e,r){(P(xe,r)||P(Oe,r))&&(n[r]=e)})),e.setPersonPropertiesForFlags(n)}});l.posthogCustomizations=Me}(); | ||
//# sourceMappingURL=customizations.full.js.map |
@@ -70,2 +70,3 @@ import { PostHogFeatureFlags } from './posthog-featureflags'; | ||
decideEndpointWasHit: boolean; | ||
receivedFlagValues: boolean; | ||
analyticsDefaultEndpoint: string; | ||
@@ -72,0 +73,0 @@ version: string; |
{ | ||
"name": "posthog-js", | ||
"version": "1.198.0", | ||
"version": "1.199.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", |
@@ -10,3 +10,3 @@ import { Compression } from './types'; | ||
// don't need to wait for `decide` to return if flags were provided on initialisation | ||
this.instance.decideEndpointWasHit = this.instance._hasBootstrappedFeatureFlags(); | ||
this.instance.receivedFlagValues = this.instance._hasBootstrappedFeatureFlags(); | ||
} | ||
@@ -105,2 +105,3 @@ Decide.prototype._loadRemoteConfigJs = function (cb) { | ||
} | ||
this.instance.decideEndpointWasHit = !errorsLoading; | ||
if (errorsLoading) { | ||
@@ -107,0 +108,0 @@ logger.error('Failed to fetch feature flags from PostHog.'); |
@@ -70,2 +70,3 @@ import { PostHogFeatureFlags } from './posthog-featureflags'; | ||
decideEndpointWasHit: boolean; | ||
receivedFlagValues: boolean; | ||
analyticsDefaultEndpoint: string; | ||
@@ -72,0 +73,0 @@ version: string; |
@@ -218,2 +218,3 @@ var __assign = (this && this.__assign) || function () { | ||
_this.receivedFeatureFlags((_a = response.json) !== null && _a !== void 0 ? _a : {}, errorsLoading); | ||
_this.instance.decideEndpointWasHit = !errorsLoading; | ||
// :TRICKY: Reload - start another request if queued! | ||
@@ -236,5 +237,5 @@ _this._startReloadTimer(); | ||
var _a; | ||
var _b; | ||
var _b, _c, _d, _e, _f; | ||
if (options === void 0) { options = {}; } | ||
if (!this.instance.decideEndpointWasHit && !(this.getFlags() && this.getFlags().length > 0)) { | ||
if (!this.instance.receivedFlagValues && !(this.getFlags() && this.getFlags().length > 0)) { | ||
logger.warn('getFeatureFlag for key "' + key + '" failed. Feature flags didn\'t load in time.'); | ||
@@ -255,3 +256,11 @@ return undefined; | ||
(_b = this.instance.persistence) === null || _b === void 0 ? void 0 : _b.register((_a = {}, _a[FLAG_CALL_REPORTED] = flagCallReported, _a)); | ||
this.instance.capture('$feature_flag_called', { $feature_flag: key, $feature_flag_response: flagValue }); | ||
this.instance.capture('$feature_flag_called', { | ||
$feature_flag: key, | ||
$feature_flag_response: flagValue, | ||
$feature_flag_payload: this.getFeatureFlagPayload(key) || null, | ||
$feature_flag_bootstrapped_response: ((_d = (_c = this.instance.config.bootstrap) === null || _c === void 0 ? void 0 : _c.featureFlags) === null || _d === void 0 ? void 0 : _d[key]) || null, | ||
$feature_flag_bootstrapped_payload: ((_f = (_e = this.instance.config.bootstrap) === null || _e === void 0 ? void 0 : _e.featureFlagPayloads) === null || _f === void 0 ? void 0 : _f[key]) || null, | ||
// If we haven't yet received a response from the /decide endpoint, we must have used the bootstrapped value | ||
$used_bootstrap_value: !this.instance.decideEndpointWasHit, | ||
}); | ||
} | ||
@@ -277,3 +286,3 @@ } | ||
if (options === void 0) { options = {}; } | ||
if (!this.instance.decideEndpointWasHit && !(this.getFlags() && this.getFlags().length > 0)) { | ||
if (!this.instance.receivedFlagValues && !(this.getFlags() && this.getFlags().length > 0)) { | ||
logger.warn('isFeatureEnabled for key "' + key + '" failed. Feature flags didn\'t load in time.'); | ||
@@ -294,3 +303,3 @@ return undefined; | ||
} | ||
this.instance.decideEndpointWasHit = true; | ||
this.instance.receivedFlagValues = true; | ||
var currentFlags = this.getFlagVariants(); | ||
@@ -351,3 +360,3 @@ var currentFlagPayloads = this.getFlagPayloads(); | ||
this.addFeatureFlagsHandler(callback); | ||
if (this.instance.decideEndpointWasHit) { | ||
if (this.instance.receivedFlagValues) { | ||
var _a = this._prepareFeatureFlagsForCallbacks(), flags = _a.flags, flagVariants = _a.flagVariants; | ||
@@ -354,0 +363,0 @@ callback(flags, flagVariants); |
{ | ||
"name": "posthog-js", | ||
"version": "1.198.0", | ||
"version": "1.199.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 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 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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19255328
43284