posthog-js 1.16.0 → 1.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.16.1 - 2021-11-02
2
+
3
+ - Add window_id and session_id to all events (#326)
4
+
1
5
  ## 1.16.0 - 2021-10-28
2
6
 
3
7
  - Group analytics support (#325)
package/dist/array.js CHANGED
@@ -1,7 +1,7 @@
1
1
  parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"zdbk":[function(require,module,exports) {
2
2
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LZString=void 0;var o=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",n={};function t(o,r){if(!n[o]){n[o]={};for(var e=0;e<o.length;e++)n[o][o.charAt(e)]=e}return n[o][r]}var s={compressToBase64:function(o){if(null==o)return"";var e=s._compress(o,6,function(o){return r.charAt(o)});switch(e.length%4){default:case 0:return e;case 1:return e+"===";case 2:return e+"==";case 3:return e+"="}},decompressFromBase64:function(o){return null==o?"":""==o?null:s._decompress(o.length,32,function(e){return t(r,o.charAt(e))})},compressToUTF16:function(r){return null==r?"":s._compress(r,15,function(r){return o(r+32)})+" "},decompressFromUTF16:function(o){return null==o?"":""==o?null:s._decompress(o.length,16384,function(r){return o.charCodeAt(r)-32})},compressToUint8Array:function(o){for(var r=s.compress(o),e=new Uint8Array(2*r.length),n=0,t=r.length;n<t;n++){var i=r.charCodeAt(n);e[2*n]=i>>>8,e[2*n+1]=i%256}return e},decompressFromUint8Array:function(r){if(null==r)return s.decompress(r);for(var e=new Array(r.length/2),n=0,t=e.length;n<t;n++)e[n]=256*r[2*n]+r[2*n+1];var i=[];return e.forEach(function(r){i.push(o(r))}),s.decompress(i.join(""))},compressToEncodedURIComponent:function(o){return null==o?"":s._compress(o,6,function(o){return e.charAt(o)})},decompressFromEncodedURIComponent:function(o){return null==o?"":""==o?null:(o=o.replace(/ /g,"+"),s._decompress(o.length,32,function(r){return t(e,o.charAt(r))}))},compress:function(r){return s._compress(r,16,function(r){return o(r)})},_compress:function(o,r,e){if(null==o)return"";var n,t,s,i={},p={},c="",a="",u="",l=2,f=3,h=2,d=[],m=0,v=0;for(s=0;s<o.length;s+=1)if(c=o.charAt(s),Object.prototype.hasOwnProperty.call(i,c)||(i[c]=f++,p[c]=!0),a=u+c,Object.prototype.hasOwnProperty.call(i,a))u=a;else{if(Object.prototype.hasOwnProperty.call(p,u)){if(u.charCodeAt(0)<256){for(n=0;n<h;n++)m<<=1,v==r-1?(v=0,d.push(e(m)),m=0):v++;for(t=u.charCodeAt(0),n=0;n<8;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1}else{for(t=1,n=0;n<h;n++)m=m<<1|t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t=0;for(t=u.charCodeAt(0),n=0;n<16;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete p[u]}else for(t=i[u],n=0;n<h;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++),i[a]=f++,u=String(c)}if(""!==u){if(Object.prototype.hasOwnProperty.call(p,u)){if(u.charCodeAt(0)<256){for(n=0;n<h;n++)m<<=1,v==r-1?(v=0,d.push(e(m)),m=0):v++;for(t=u.charCodeAt(0),n=0;n<8;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1}else{for(t=1,n=0;n<h;n++)m=m<<1|t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t=0;for(t=u.charCodeAt(0),n=0;n<16;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete p[u]}else for(t=i[u],n=0;n<h;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++)}for(t=2,n=0;n<h;n++)m=m<<1|1&t,v==r-1?(v=0,d.push(e(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==r-1){d.push(e(m));break}v++}return d.join("")},decompress:function(o){return null==o?"":""==o?null:s._decompress(o.length,32768,function(r){return o.charCodeAt(r)})},_decompress:function(r,e,n){var t,s,i,p,c,a,u,l=[],f=4,h=4,d=3,m="",v=[],w={val:n(0),position:e,index:1};for(t=0;t<3;t+=1)l[t]=t;for(i=0,c=Math.pow(2,2),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;switch(i){case 0:for(i=0,c=Math.pow(2,8),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;u=o(i);break;case 1:for(i=0,c=Math.pow(2,16),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;u=o(i);break;case 2:return""}for(l[3]=u,s=u,v.push(u);;){if(w.index>r)return"";for(i=0,c=Math.pow(2,d),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;switch(u=i){case 0:for(i=0,c=Math.pow(2,8),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;l[h++]=o(i),u=h-1,f--;break;case 1:for(i=0,c=Math.pow(2,16),a=1;a!=c;)p=w.val&w.position,w.position>>=1,0==w.position&&(w.position=e,w.val=n(w.index++)),i|=(p>0?1:0)*a,a<<=1;l[h++]=o(i),u=h-1,f--;break;case 2:return v.join("")}if(0==f&&(f=Math.pow(2,d),d++),l[u])m=l[u];else{if(u!==h)return null;m=s+s.charAt(0)}v.push(m),l[h++]=s+m.charAt(0),s=m,0==--f&&(f=Math.pow(2,d),d++)}}};exports.LZString=s;
3
3
  },{}],"EHrm":[function(require,module,exports) {
4
- module.exports={name:"posthog-js",version:"1.16.0",description:"Posthog-js allows you to automatically capture usage and send events to PostHog.",repository:"https://github.com/PostHog/posthog-js",author:"hey@posthog.com",license:"MIT",scripts:{start:"parcel watch src/loader-globals.js --out-file dist/array.js",serve:"parcel serve src/loader-globals.js --port 3001 --out-file dist/array.js",build:"yarn build-array && yarn build-module && yarn build-es-module && yarn process-types && yarn build-react","build-array":"parcel build src/loader-globals.js --out-file dist/array.js --no-source-maps","build-module":"rollup -i src/loader-module.js -f cjs -o dist/module.js -c rollup.config.js","build-es-module":"rollup -i src/loader-module.js -f es -o dist/es.js -c rollup.config.js","build-react":"cd react; yarn; yarn build;","process-types":"mkdir -p dist; eslint src --ext .ts -c .eslintrc.ts.js --fix && tsc && cp -f src/*.d.ts dist/",lint:"eslint src --fix",prepublishOnly:"yarn lint && yarn test && yarn build && yarn test-react",test:"jest src","test-react":"cd react; yarn test","test-watch":"jest --watch src",cypress:"cypress open"},main:"dist/module.js",module:"dist/es.js",files:["dist/*","react/dist/*"],dependencies:{"@sentry/types":"^6.11.0",fflate:"^0.4.1","rrweb-snapshot":"^1.1.7"},devDependencies:{"@babel/core":"7.12.10","@babel/preset-env":"7.12.11","@rollup/plugin-babel":"^5.2.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^8.1.0","@typescript-eslint/eslint-plugin":"^3.5.0","@typescript-eslint/parser":"^3.5.0","babel-eslint":"10.1.0","babel-jest":"^26.6.3",cypress:"^6.1.0",eslint:"7.3.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react":"^7.21.5","eslint-plugin-react-hooks":"^4.2.0","fast-check":"^2.17.0",given2:"^2.1.7",husky:"^4.2.5",jest:"^26.1.0",jsdom:"16.2.2","jsdom-global":"3.0.2","lint-staged":"^10.2.11",localStorage:"1.0.4","node-fetch":"^2.6.1",parcel:"^1.12.4","posthog-js":"link:.",prettier:"^2.0.5",rollup:"^2.18.2",rrweb:"^1.0.3",sinon:"9.0.2",testcafe:"^1.10.1","testcafe-browser-provider-browserstack":"^1.13.2-alpha.1",typescript:"^3.9.6"},husky:{hooks:{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx,js,json}":"prettier --write","*.{ts,tsx}":["eslint -c .eslintrc.ts.js --fix","tsc --noEmit --esModuleInterop --jsx react"]},jest:{testPathIgnorePatterns:["/node_modules/","/cypress/","/react/","/test_data/"],moduleFileExtensions:["js","json"],setupFilesAfterEnv:["given2/setup"],clearMocks:!0}};
4
+ module.exports={name:"posthog-js",version:"1.16.1",description:"Posthog-js allows you to automatically capture usage and send events to PostHog.",repository:"https://github.com/PostHog/posthog-js",author:"hey@posthog.com",license:"MIT",scripts:{start:"parcel watch src/loader-globals.js --out-file dist/array.js",serve:"parcel serve src/loader-globals.js --port 3001 --out-file dist/array.js",build:"yarn build-array && yarn build-module && yarn build-es-module && yarn process-types && yarn build-react","build-array":"parcel build src/loader-globals.js --out-file dist/array.js --no-source-maps","build-module":"rollup -i src/loader-module.js -f cjs -o dist/module.js -c rollup.config.js","build-es-module":"rollup -i src/loader-module.js -f es -o dist/es.js -c rollup.config.js","build-react":"cd react; yarn; yarn build;","process-types":"mkdir -p dist; eslint src --ext .ts -c .eslintrc.ts.js --fix && tsc && cp -f src/*.d.ts dist/",lint:"eslint src --fix",prepublishOnly:"yarn lint && yarn test && yarn build && yarn test-react",test:"jest src","test-react":"cd react; yarn test","test-watch":"jest --watch src",cypress:"cypress open"},main:"dist/module.js",module:"dist/es.js",files:["dist/*","react/dist/*"],dependencies:{"@sentry/types":"^6.11.0",fflate:"^0.4.1","rrweb-snapshot":"^1.1.7"},devDependencies:{"@babel/core":"7.12.10","@babel/preset-env":"7.12.11","@rollup/plugin-babel":"^5.2.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^8.1.0","@typescript-eslint/eslint-plugin":"^3.5.0","@typescript-eslint/parser":"^3.5.0","babel-eslint":"10.1.0","babel-jest":"^26.6.3",cypress:"^6.1.0",eslint:"7.3.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react":"^7.21.5","eslint-plugin-react-hooks":"^4.2.0","fast-check":"^2.17.0",given2:"^2.1.7",husky:"^4.2.5",jest:"^26.1.0",jsdom:"16.2.2","jsdom-global":"3.0.2","lint-staged":"^10.2.11",localStorage:"1.0.4","node-fetch":"^2.6.1",parcel:"^1.12.4","posthog-js":"link:.",prettier:"^2.0.5",rollup:"^2.18.2",rrweb:"^1.0.3",sinon:"9.0.2",testcafe:"^1.10.1","testcafe-browser-provider-browserstack":"^1.13.2-alpha.1",typescript:"^3.9.6"},husky:{hooks:{"pre-commit":"lint-staged"}},"lint-staged":{"*.{ts,tsx,js,json}":"prettier --write","*.{ts,tsx}":["eslint -c .eslintrc.ts.js --fix","tsc --noEmit --esModuleInterop --jsx react"]},jest:{testPathIgnorePatterns:["/node_modules/","/cypress/","/react/","/test_data/"],moduleFileExtensions:["js","json"],setupFilesAfterEnv:["given2/setup"],clearMocks:!0}};
5
5
  },{}],"itQ5":[function(require,module,exports) {
6
6
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("../package.json"),r={DEBUG:!1,LIB_VERSION:e.version},t=r;exports.default=t;
7
7
  },{"../package.json":"EHrm"}],"FOZT":[function(require,module,exports) {
@@ -13,7 +13,7 @@ module.exports={name:"posthog-js",version:"1.16.0",description:"Posthog-js allow
13
13
  },{}],"gR3r":[function(require,module,exports) {
14
14
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.autocapture=void 0;var e=require("./utils"),t=require("./autocapture-utils"),n=r(require("./extensions/rageclick"));function r(e){return e&&e.__esModule?e:{default:e}}var i={_initializedTokens:[],_previousElementSibling:function(e){if(e.previousElementSibling)return e.previousElementSibling;do{e=e.previousSibling}while(e&&!(0,t.isElementNode)(e));return e},_getPropertiesFromElement:function(n,r,i){var o=n.tagName.toLowerCase(),a={tag_name:o};t.usefulElements.indexOf(o)>-1&&!i&&(a.$el_text=(0,t.getSafeText)(n));var s=(0,t.getClassName)(n);s.length>0&&(a.classes=s.split(" ").filter(function(e){return""!==e})),e._.each(n.attributes,function(e){(0,t.isSensitiveElement)(n)&&-1===["name","id","class"].indexOf(e.name)||r||!(0,t.shouldCaptureValue)(e.value)||(0,t.isAngularContentAttr)(e.name)||(a["attr__"+e.name]=e.value)});for(var u=1,c=1,l=n;l=this._previousElementSibling(l);)u++,l.tagName===n.tagName&&c++;return a.nth_child=u,a.nth_of_type=c,a},_getDefaultProperties:function(e){return{$event_type:e,$ce_version:1}},_extractCustomPropertyValue:function(n){var r=[];return e._.each(document.querySelectorAll(n.css_selector),function(e){var n;["input","select"].indexOf(e.tagName.toLowerCase())>-1?n=e.value:e.textContent&&(n=e.textContent),(0,t.shouldCaptureValue)(n)&&r.push(n)}),r.join(", ")},_getCustomProperties:function(n){var r={};return e._.each(this._customProperties,function(i){e._.each(i.event_selectors,function(o){var a=document.querySelectorAll(o);e._.each(a,function(o){e._.includes(n,o)&&(0,t.shouldCaptureElement)(o)&&(r[i.name]=this._extractCustomPropertyValue(i))},this)},this)},this),r},_getEventTarget:function(e){return void 0===e.target?e.srcElement:e.target.shadowRoot?e.composedPath()[0]:e.target},_captureEvent:function(n,r){var i=this._getEventTarget(n);if((0,t.isTextNode)(i)&&(i=i.parentNode),"click"===n.type&&this.rageclicks.click(n.clientX,n.clientY,(new Date).getTime()),(0,t.shouldCaptureDomEvent)(i,n)){for(var o=[i],a=i;a.parentNode&&!(0,t.isTag)(a,"body");)11!==a.parentNode.nodeType?(o.push(a.parentNode),a=a.parentNode):(o.push(a.parentNode.host),a=a.parentNode.host);var s,u=[],c=!1;if(e._.each(o,function(n){var i=(0,t.shouldCaptureElement)(n);"a"===n.tagName.toLowerCase()&&(s=n.getAttribute("href"),s=i&&(0,t.shouldCaptureValue)(s)&&s);var o=(0,t.getClassName)(n).split(" ");e._.includes(o,"ph-no-capture")&&(c=!0),u.push(this._getPropertiesFromElement(n,r.get_config("mask_all_element_attributes"),r.get_config("mask_all_text")))},this),r.get_config("mask_all_text")||(u[0].$el_text=(0,t.getSafeText)(i)),s&&(u[0].attr__href=s),c)return!1;var l=e._.extend(this._getDefaultProperties(n.type),{$elements:u},this._getCustomProperties(o));return r.capture("$autocapture",l),!0}},_navigate:function(e){window.location.href=e},_addDomEventHandlers:function(t){var n=e._.bind(function(e){e=e||window.event,this._captureEvent(e,t)},this);e._.register_event(document,"submit",n,!1,!0),e._.register_event(document,"change",n,!1,!0),e._.register_event(document,"click",n,!1,!0)},_customProperties:{},init:function(e){this.rageclicks=new n.default(e)},afterDecideResponse:function(e,t){var n=t.get_config("token");this._initializedTokens.indexOf(n)>-1?console.log('autocapture already initialized for token "'+n+'"'):(this._initializedTokens.push(n),e&&e.config&&!0===e.config.enable_collect_everything&&t.get_config("autocapture")?(e.custom_properties&&(this._customProperties=e.custom_properties),this._addDomEventHandlers(t)):t.__autocapture_enabled=!1)},enabledForProject:function(t,n,r){n=e._.isUndefined(n)?10:n,r=e._.isUndefined(r)?10:r;for(var i=0,o=0;o<t.length;o++)i+=t.charCodeAt(o);return i%n<r},isBrowserSupported:function(){return e._.isFunction(document.querySelectorAll)}};exports.autocapture=i,e._.bind_instance_methods(i),e._.safewrap_instance_methods(i);
15
15
  },{"./utils":"FOZT","./autocapture-utils":"RYfg","./extensions/rageclick":"Oszc"}],"KZ7Y":[function(require,module,exports) {
16
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.memoryStore=exports.localPlusCookieStore=exports.localStore=exports.cookieStore=void 0;var e=require("./utils");function r(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function t(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(r){o(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var n=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,c={get:function(e){try{for(var r=e+"=",t=document.cookie.split(";"),o=0;o<t.length;o++){for(var n=t[o];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(r))return decodeURIComponent(n.substring(r.length,n.length))}}catch(c){}return null},parse:function(e){var r;try{r=JSON.parse(c.get(e))||{}}catch(t){}return r},set:function(e,r,t,o,c){try{var i="",a="",u="";if(o){var s=document.location.hostname.match(n),l=s?s[0]:"";i=l?"; domain=."+l:""}if(t){var p=new Date;p.setTime(p.getTime()+24*t*60*60*1e3),a="; expires="+p.toGMTString()}c&&(u="; secure");var f=e+"="+encodeURIComponent(JSON.stringify(r))+a+"; path=/"+i+u;return document.cookie=f,f}catch(d){return}},remove:function(e,r){try{c.set(e,"",-1,r)}catch(t){return}}};exports.cookieStore=c;var i=null,a={is_supported:function(){if(null!==i)return i;var r=!0;if(window)try{var t="__mplssupport__";a.set(t,"xyz"),'"xyz"'!==a.get(t)&&(r=!1),a.remove(t)}catch(o){r=!1}else r=!1;return r||e.console.error("localStorage unsupported; falling back to cookie store"),i=r,r},error:function(r){e.console.error("localStorage error: "+r)},get:function(e){try{return window.localStorage.getItem(e)}catch(r){a.error(r)}return null},parse:function(e){try{return JSON.parse(a.get(e))||{}}catch(r){}return null},set:function(e,r){try{window.localStorage.setItem(e,JSON.stringify(r))}catch(t){a.error(t)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(r){a.error(r)}}};exports.localStore=a;var u=t(t({},a),{},{parse:function(r){try{var t={};try{(t=c.parse(r)||{}).distinct_id&&c.set(r,{distinct_id:t.distinct_id})}catch(n){}var o=e._.extend(t,JSON.parse(a.get(r)||"{}"));return a.set(r,o),o}catch(n){}return null},set:function(e,r){try{a.set(e,r),r.distinct_id&&c.set(e,{distinct_id:r.distinct_id})}catch(t){a.error(t)}},remove:function(e){try{window.localStorage.removeItem(e),c.remove(e)}catch(r){a.error(r)}}});exports.localPlusCookieStore=u;var s={},l={is_supported:function(){return!0},error:function(r){e.console.error("memoryStorage error: "+r)},parse:function(e){return s[e]||null},set:function(e,r){s[e]=r},remove:function(e){delete s[e]}};exports.memoryStore=l;
16
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sessionStore=exports.memoryStore=exports.localPlusCookieStore=exports.localStore=exports.cookieStore=void 0;var e=require("./utils");function r(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function t(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(r){o(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var n=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,s={get:function(e){try{for(var r=e+"=",t=document.cookie.split(";"),o=0;o<t.length;o++){for(var n=t[o];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(r))return decodeURIComponent(n.substring(r.length,n.length))}}catch(s){}return null},parse:function(e){var r;try{r=JSON.parse(s.get(e))||{}}catch(t){}return r},set:function(e,r,t,o,s){try{var i="",c="",u="";if(o){var a=document.location.hostname.match(n),l=a?a[0]:"";i=l?"; domain=."+l:""}if(t){var p=new Date;p.setTime(p.getTime()+24*t*60*60*1e3),c="; expires="+p.toGMTString()}s&&(u="; secure");var f=e+"="+encodeURIComponent(JSON.stringify(r))+c+"; path=/"+i+u;return document.cookie=f,f}catch(g){return}},remove:function(e,r){try{s.set(e,"",-1,r)}catch(t){return}}};exports.cookieStore=s;var i=null,c={is_supported:function(){if(null!==i)return i;var r=!0;if(window)try{var t="__mplssupport__";c.set(t,"xyz"),'"xyz"'!==c.get(t)&&(r=!1),c.remove(t)}catch(o){r=!1}else r=!1;return r||e.console.error("localStorage unsupported; falling back to cookie store"),i=r,r},error:function(r){e.console.error("localStorage error: "+r)},get:function(e){try{return window.localStorage.getItem(e)}catch(r){c.error(r)}return null},parse:function(e){try{return JSON.parse(c.get(e))||{}}catch(r){}return null},set:function(e,r){try{window.localStorage.setItem(e,JSON.stringify(r))}catch(t){c.error(t)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(r){c.error(r)}}};exports.localStore=c;var u=t(t({},c),{},{parse:function(r){try{var t={};try{(t=s.parse(r)||{}).distinct_id&&s.set(r,{distinct_id:t.distinct_id})}catch(n){}var o=e._.extend(t,JSON.parse(c.get(r)||"{}"));return c.set(r,o),o}catch(n){}return null},set:function(e,r){try{c.set(e,r),r.distinct_id&&s.set(e,{distinct_id:r.distinct_id})}catch(t){c.error(t)}},remove:function(e){try{window.localStorage.removeItem(e),s.remove(e)}catch(r){c.error(r)}}});exports.localPlusCookieStore=u;var a={},l={is_supported:function(){return!0},error:function(r){e.console.error("memoryStorage error: "+r)},parse:function(e){return a[e]||null},set:function(e,r){a[e]=r},remove:function(e){delete a[e]}};exports.memoryStore=l;var p={sessionStorageSupported:null,is_supported:function(){if(null!==p.sessionStorageSupported)return p.sessionStorageSupported;if(p.sessionStorageSupported=!0,window)try{var e="__support__";p.set(e,"xyz"),'"xyz"'!==p.get(e)&&(p.sessionStorageSupported=!1),p.remove(e)}catch(r){p.sessionStorageSupported=!1}else p.sessionStorageSupported=!1;return p.sessionStorageSupported},error:function(r){Config.DEBUG&&e.console.error("sessionStorage error: ",r)},get:function(e){try{return window.sessionStorage.getItem(e)}catch(r){p.error(r)}return null},parse:function(e){try{return JSON.parse(p.get(e))||null}catch(r){}return null},set:function(e,r){try{window.sessionStorage.setItem(e,JSON.stringify(r))}catch(t){p.error(t)}},remove:function(e){try{window.sessionStorage.removeItem(e)}catch(r){p.error(r)}}};exports.sessionStore=p;
17
17
  },{"./utils":"FOZT"}],"rxSh":[function(require,module,exports) {
18
18
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.optIn=r,exports.optOut=n,exports.hasOptedIn=i,exports.hasOptedOut=c,exports.addOptOutCheckPostHogLib=u,exports.addOptOutCheckPostHogPeople=s,exports.clearOptInOut=p;var t=require("./utils"),e=require("./storage"),o="__ph_opt_in_out_";function r(t,e){d(!0,t,e)}function n(t,e){d(!1,t,e)}function i(t,e){return"1"===f(t,e)}function c(t,e){return!!_(e)||"0"===f(t,e)}function u(t,e){return h(t,function(t){return this.get_config(t)},e)}function s(t,e){return h(t,function(t){return this._get_config(t)},e)}function p(t,e){a(e=e||{}).remove(l(t,e),!!e.crossSubdomainCookie,e.cookieDomain)}function a(t){return"localStorage"===(t=t||{}).persistenceType?e.localStore:"localStorage+cookie"===t.persistenceType?e.localPlusCookieStore:e.cookieStore}function l(t,e){return((e=e||{}).persistencePrefix||o)+t}function f(t,e){return a(e).get(l(t,e))}function _(e){if(e&&e.respectDnt){var o=e&&e.window||t.window,r=o.navigator||{},n=!1;return t._.each([r.doNotTrack,r.msDoNotTrack,o.doNotTrack],function(e){t._.includes([!0,1,"1","yes"],e)&&(n=!0)}),n}return!1}function d(e,o,r){t._.isString(o)&&o.length?(a(r=r||{}).set(l(o,r),e?1:0,t._.isNumber(r.cookieExpiration)?r.cookieExpiration:null,!!r.crossSubdomainCookie,!!r.secureCookie,!!r.crossSiteCookie,r.cookieDomain),r.capture&&e&&r.capture(r.captureEventName||"$opt_in",r.captureProperties,{send_immediately:!0})):console.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function h(t,e,o){return function(){var r=!1;try{var n=e.call(this,"token"),i=e.call(this,"respect_dnt"),u=e.call(this,"opt_out_capturing_persistence_type"),s=e.call(this,"opt_out_capturing_cookie_prefix"),p=e.call(this,"window");n&&(r=c(n,{respectDnt:i,persistenceType:u,persistencePrefix:s,window:p}))}catch(l){o||console.error("Unexpected error when checking capturing opt-out status: "+l)}if(!r)return t.apply(this,arguments);var a=arguments[arguments.length-1];"function"==typeof a&&a(0)}}
19
19
  },{"./utils":"FOZT","./storage":"KZ7Y"}],"os8r":[function(require,module,exports) {
@@ -24,13 +24,11 @@ module.exports={name:"posthog-js",version:"1.16.0",description:"Posthog-js allow
24
24
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PostHogFeatureFlags=exports.parseFeatureFlagDecideResponse=void 0;var e=require("./utils");function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}var n=function(e,t){var a=e.featureFlags;if(a)if(Array.isArray(a)){var r={};if(a)for(var n=0;n<a.length;n++)r[a[n]]=!0;t&&t.register({$active_feature_flags:a,$enabled_feature_flags:r})}else t&&t.register({$active_feature_flags:Object.keys(a||{}),$enabled_feature_flags:a||{}});else t&&(t.unregister("$active_feature_flags"),t.unregister("$enabled_feature_flags"))};exports.parseFeatureFlagDecideResponse=n;var i=function(){function a(e){t(this,a),this.instance=e,this._override_warning=!1,this.flagCallReported={},this.featureFlagEventHandlers=[]}return r(a,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var t=this.instance.get_property("$enabled_feature_flags"),a=this.instance.get_property("$override_feature_flags");if(!a)return t||{};for(var r=e._.extend({},t),n=Object.keys(a),i=0;i<n.length;i++)!1===a[n[i]]?delete r[n[i]]:r[n[i]]=a[n[i]];return this._override_warning||(console.warn("[PostHog] Overriding feature flags!",{enabledFlags:t,overriddenFlags:a,finalFlags:r}),this._override_warning=!0),r}},{key:"reloadFeatureFlags",value:function(){var t=this,a=this.instance.get_config("token"),r=JSON.stringify({token:a,distinct_id:this.instance.get_distinct_id()}),i=e._.base64Encode(r);this.instance._send_request(this.instance.get_config("api_host")+"/decide/?v=2",{data:i},{method:"POST"},this.instance._prepare_callback(function(e){n(e,t.instance.persistence),t.receivedFeatureFlags()}))}},{key:"getFeatureFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.getFlags())return console.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time."),!1;var a=this.getFlagVariants()[e];return!t.send_event&&"send_event"in t||this.flagCallReported[e]||(this.flagCallReported[e]=!0,this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:a})),a}},{key:"isFeatureEnabled",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.getFlags()?!!this.getFeatureFlag(e,t):(console.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time."),!1)}},{key:"addFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers.push(e)}},{key:"receivedFeatureFlags",value:function(){var e=this.getFlags(),t=this.getFlagVariants();this.featureFlagEventHandlers.forEach(function(a){return a(e,t)})}},{key:"override",value:function(e){if(this._override_warning=!1,!1===e)this.instance.persistence.unregister("$override_feature_flags");else if(Array.isArray(e)){for(var t={},a=0;a<e.length;a++)t[e[a]]=!0;this.instance.persistence.register({$override_feature_flags:t})}else this.instance.persistence.register({$override_feature_flags:e})}}]),a}();exports.PostHogFeatureFlags=i;
25
25
  },{"./utils":"FOZT"}],"MAdm":[function(require,module,exports) {
26
26
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SESSION_ID=exports.SESSION_RECORDING_ENABLED=exports.EVENT_TIMERS_KEY=exports.CAMPAIGN_IDS_KEY=exports.ALIAS_ID_KEY=exports.PEOPLE_DISTINCT_ID_KEY=exports.SET_ONCE_QUEUE_KEY=exports.SET_QUEUE_KEY=exports.PostHogPersistence=void 0;var e=require("./utils"),t=require("./storage");function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var s="__mps";exports.SET_QUEUE_KEY=s;var o="__mpso";exports.SET_ONCE_QUEUE_KEY=o;var i="__mpus",p="__mpa",n="__mpap",a="__mpr",_="__mpu",c="$people_distinct_id";exports.PEOPLE_DISTINCT_ID_KEY=c;var h="__alias";exports.ALIAS_ID_KEY=h;var u="__cmpns";exports.CAMPAIGN_IDS_KEY=u;var f="__timers";exports.EVENT_TIMERS_KEY=f;var d="$session_recording_enabled";exports.SESSION_RECORDING_ENABLED=d;var m="$sesid";exports.SESSION_ID=m;var l="$enabled_feature_flags",y=[s,o,i,p,n,a,_,c,h,u,f,d,m,l],E=function(r){var s="";r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),this.props={},this.campaign_params_saved=!1,r.persistence_name?this.name="ph_"+r.persistence_name:this.name="ph_"+s+"_posthog";var o=r.persistence;"cookie"!==o&&-1===o.indexOf("localStorage")&&"memory"!==o&&(e.console.critical("Unknown persistence type "+o+"; falling back to cookie"),o=r.persistence="cookie"),"localStorage"===o&&t.localStore.is_supported()?this.storage=t.localStore:"localStorage+cookie"===o&&t.localPlusCookieStore.is_supported()?this.storage=t.localPlusCookieStore:this.storage="memory"===o?t.memoryStore:t.cookieStore,this.load(),this.update_config(r),this.save()};exports.PostHogPersistence=E,E.prototype.properties=function(){var t={};return e._.each(this.props,function(s,o){if(o===l&&"object"===r(s))for(var i=Object.keys(s),p=0;p<i.length;p++)t["$feature/".concat(i[p])]=s[i[p]];else e._.include(y,o)||(t[o]=s)}),t},E.prototype.load=function(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=e._.extend({},t))}},E.prototype.save=function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure)},E.prototype.remove=function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)},E.prototype.clear=function(){this.remove(),this.props={}},E.prototype.register_once=function(t,r,s){return!!e._.isObject(t)&&(void 0===r&&(r="None"),this.expire_days=void 0===s?this.default_expiry:s,e._.each(t,function(e,t){this.props.hasOwnProperty(t)&&this.props[t]!==r||(this.props[t]=e)},this),this.save(),!0)},E.prototype.register=function(t,r){return!!e._.isObject(t)&&(this.expire_days=void 0===r?this.default_expiry:r,e._.extend(this.props,t),this.save(),!0)},E.prototype.unregister=function(e){e in this.props&&(delete this.props[e],this.save())},E.prototype.update_campaign_params=function(){this.campaign_params_saved||(this.register(e._.info.campaignParams()),this.campaign_params_saved=!0)},E.prototype.update_search_keyword=function(t){this.register(e._.info.searchInfo(t))},E.prototype.update_referrer_info=function(t){this.register_once({$initial_referrer:t||"$direct",$initial_referring_domain:e._.info.referringDomain(t)||"$direct"},""),this.register({$referrer:t||this.props.$referrer||"$direct",$referring_domain:e._.info.referringDomain(t)||this.props.$referring_domain||"$direct"})},E.prototype.get_referrer_info=function(){return e._.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},E.prototype.safe_merge=function(t){return e._.each(this.props,function(e,r){r in t||(t[r]=e)}),t},E.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},E.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},E.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},E.prototype.get_cross_subdomain=function(){return this.cross_subdomain},E.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},E.prototype.set_event_timer=function(e,t){var r=this.props[f]||{};r[e]=t,this.props[f]=r,this.save()},E.prototype.remove_event_timer=function(t){var r=(this.props[f]||{})[t];return e._.isUndefined(r)||(delete this.props[f][t],this.save()),r};
27
- },{"./utils":"FOZT","./storage":"KZ7Y"}],"vjIe":[function(require,module,exports) {
28
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var r=require("../posthog-persistence"),e=require("../utils");function t(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function n(r,e){return l(r)||u(r,e)||i(r,e)||o()}function o(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(r,e){if(r){if("string"==typeof r)return a(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(r,e):void 0}}function a(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function u(r,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var t=[],n=!0,o=!1,i=void 0;try{for(var a,u=r[Symbol.iterator]();!(n=(a=u.next()).done)&&(t.push(a.value),!e||t.length!==e);n=!0);}catch(l){o=!0,i=l}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return t}}function l(r){if(Array.isArray(r))return r}var s=18e5,c=function(o,i){var a=n(o.props[r.SESSION_ID]||[0,null],2),u=a[0],l=a[1],c=!1;return Math.abs(i-u)>s&&(l=e._.UUID(),c=!0),o.register(t({},r.SESSION_ID,[i,l])),{isNewSessionId:c,sessionId:l}};exports.default=c;
29
- },{"../posthog-persistence":"MAdm","../utils":"FOZT"}],"vmk3":[function(require,module,exports) {
27
+ },{"./utils":"FOZT","./storage":"KZ7Y"}],"vmk3":[function(require,module,exports) {
30
28
  "use strict";function t(t,r){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=e(t))||r&&t&&"number"==typeof t.length){n&&(t=n);var o=0,a=function(){};return{s:a,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return l=t.done,t},e:function(t){u=!0,i=t},f:function(){try{l||null==n.return||n.return()}finally{if(u)throw i}}}}function e(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.filterDataURLsFromLargeDataObjects=a,exports.replacementImageURI=void 0;var o="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNOCAwSDE2TDAgMTZWOEw4IDBaIiBmaWxsPSIjMkQyRDJEIi8+CjxwYXRoIGQ9Ik0xNiA4VjE2SDhMMTYgOFoiIGZpbGw9IiMyRDJEMkQiLz4KPC9zdmc+Cg==";function a(e){if(e&&"object"===n(e)){var r=JSON.stringify(e);if(r.length>5e6){var a,i=t(r.matchAll(/data:([\w\/\-\.]+);(\w+),([^)"]*)/gim));try{for(i.s();!(a=i.n()).done;){var l=a.value;r="image/"===l[1].toLocaleLowerCase().slice(0,6)?r.replace(l[0],o):r.replace(l[0],"")}}catch(u){i.e(u)}finally{i.f()}}return JSON.parse(r)}return e}exports.replacementImageURI=o;
31
29
  },{}],"Z2N4":[function(require,module,exports) {
32
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SessionRecording=void 0;var e=require("../autocapture-utils"),t=require("../utils"),r=require("../posthog-persistence"),n=o(require("./sessionid")),i=o(require("../config")),s=require("./sessionrecording-utils");function o(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach(function(t){b(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function u(e,t){return h(e)||f(e,t)||l(e,t)||p()}function p(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(n=(o=a.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(c){i=!0,s=c}finally{try{n||null==a.return||a.return()}finally{if(i)throw s}}return r}}function h(e){if(Array.isArray(e))return e}function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _(e,t,r){return t&&y(e.prototype,t),r&&y(e,r),e}var v="/e/",w=function(){function o(e){g(this,o),this.instance=e,this.captureStarted=!1,this.snapshots=[],this.emit=!1,this.endpoint=v,this.stopRrweb=null}return _(o,[{key:"startRecordingIfEnabled",value:function(){this.instance.get_property(r.SESSION_RECORDING_ENABLED)&&!this.instance.get_config("disable_session_recording")&&this._startCapture()}},{key:"started",value:function(){return this.captureStarted}},{key:"stopRecording",value:function(){this.captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=null,this.captureStarted=!1)}},{key:"afterDecideResponse",value:function(e){var t=!this.instance.get_config("disable_session_recording")&&!!e.sessionRecording;this.instance.persistence&&this.instance.persistence.register(b({},r.SESSION_RECORDING_ENABLED,t)),t&&(e.sessionRecording.endpoint&&(this.endpoint=e.sessionRecording.endpoint),this.submitRecordings())}},{key:"submitRecordings",value:function(){var e=this;this.emit=!0,this._startCapture(),this.snapshots.forEach(function(t){return e._captureSnapshot(t)})}},{key:"_startCapture",value:function(){void 0!==Object.assign&&(this.captureStarted||this.instance.get_config("disable_session_recording")||(this.captureStarted=!0,(0,e.loadScript)(this.instance.get_config("api_host")+"/static/recorder.js?v="+i.default.LIB_VERSION,t._.bind(this._onScriptLoaded,this))))}},{key:"_onScriptLoaded",value:function(){for(var e=this,t={blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1},r=this.instance.get_config("session_recording"),i=0,o=Object.entries(r||{});i<o.length;i++){var a=u(o[i],2),p=a[0],l=a[1];p in t&&(t[p]=l)}this.stopRrweb=window.rrweb.record(c({emit:function(t){t=(0,s.filterDataURLsFromLargeDataObjects)(t);var r=(0,n.default)(e.instance.persistence,t.timestamp);r.isNewSessionId&&-1===[2,4].indexOf(t.type)&&window.rrweb.record.takeFullSnapshot();var i={$snapshot_data:t,$session_id:r.sessionId};e.instance._captureMetrics.incr("rrweb-record"),e.instance._captureMetrics.incr("rrweb-record-".concat(t.type)),e.emit?e._captureSnapshot(i):e.snapshots.push(i)}},t)),this.instance._addCaptureHook(function(e){"$pageview"===e&&window.rrweb.record.addCustomEvent("$pageview",{href:window.location.href})})}},{key:"_captureSnapshot",value:function(e){this.instance.capture("$snapshot",e,{transport:"XHR",method:"POST",endpoint:this.endpoint,_forceCompression:!0,_noTruncate:!0,_batchKey:"sessionRecording",_metrics:{rrweb_full_snapshot:2===e.$snapshot_data.type}})}}]),o}();exports.SessionRecording=w;
33
- },{"../autocapture-utils":"RYfg","../utils":"FOZT","../posthog-persistence":"MAdm","./sessionid":"vjIe","../config":"itQ5","./sessionrecording-utils":"vmk3"}],"auG7":[function(require,module,exports) {
30
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SessionRecording=exports.MUTATION_SOURCE_TYPE=exports.INCREMENTAL_SNAPSHOT_EVENT_TYPE=exports.META_EVENT_TYPE=exports.FULL_SNAPSHOT_EVENT_TYPE=void 0;var e=require("../autocapture-utils"),t=require("../utils"),n=require("../posthog-persistence"),r=s(require("../config")),i=require("./sessionrecording-utils");function s(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t){return h(e)||l(e,t)||p(e,t)||u()}function u(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(c){i=!0,s=c}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}}function h(e){if(Array.isArray(e))return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),e}var w="/e/",y=2;exports.FULL_SNAPSHOT_EVENT_TYPE=y;var v=4;exports.META_EVENT_TYPE=v;var S=3;exports.INCREMENTAL_SNAPSHOT_EVENT_TYPE=S;var E=3;exports.MUTATION_SOURCE_TYPE=E;var O=function(){function s(e){_(this,s),this.instance=e,this.captureStarted=!1,this.snapshots=[],this.emit=!1,this.endpoint=w,this.stopRrweb=null,this.windowId=null,this.sessionId=null}return g(s,[{key:"startRecordingIfEnabled",value:function(){this.instance.get_property(n.SESSION_RECORDING_ENABLED)&&!this.instance.get_config("disable_session_recording")&&this._startCapture()}},{key:"started",value:function(){return this.captureStarted}},{key:"stopRecording",value:function(){this.captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=null,this.captureStarted=!1)}},{key:"afterDecideResponse",value:function(e){var t=!this.instance.get_config("disable_session_recording")&&!!e.sessionRecording;this.instance.persistence&&this.instance.persistence.register(f({},n.SESSION_RECORDING_ENABLED,t)),t&&(e.sessionRecording.endpoint&&(this.endpoint=e.sessionRecording.endpoint),this.submitRecordings())}},{key:"submitRecordings",value:function(){var e=this;this.emit=!0,this._startCapture(),this.snapshots.forEach(function(t){return e._captureSnapshot(t)})}},{key:"_startCapture",value:function(){void 0!==Object.assign&&(this.captureStarted||this.instance.get_config("disable_session_recording")||(this.captureStarted=!0,(0,e.loadScript)(this.instance.get_config("api_host")+"/static/recorder.js?v="+r.default.LIB_VERSION,t._.bind(this._onScriptLoaded,this))))}},{key:"_updateWindowAndSessionIds",value:function(e){var t=this.instance._sessionIdManager.getSessionAndWindowId(e.timestamp||(new Date).getTime(),e),n=t.windowId,r=t.sessionId;this.windowId===n&&this.sessionId===r||-1!==[y,v].indexOf(e.type)||window.rrweb.record.takeFullSnapshot(),this.windowId=n,this.sessionId=r}},{key:"_onScriptLoaded",value:function(){for(var e=this,t={blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1},n=this.instance.get_config("session_recording"),r=0,s=Object.entries(n||{});r<s.length;r++){var o=c(s[r],2),u=o[0],p=o[1];u in t&&(t[u]=p)}this.stopRrweb=window.rrweb.record(a({emit:function(t){t=(0,i.filterDataURLsFromLargeDataObjects)(t),e._updateWindowAndSessionIds(t);var n={$snapshot_data:t,$session_id:e.sessionId,$window_id:e.windowId};e.instance._captureMetrics.incr("rrweb-record"),e.instance._captureMetrics.incr("rrweb-record-".concat(t.type)),e.emit?e._captureSnapshot(n):e.snapshots.push(n)}},t)),this.instance._addCaptureHook(function(e){"$pageview"===e&&window.rrweb.record.addCustomEvent("$pageview",{href:window.location.href})})}},{key:"_captureSnapshot",value:function(e){this.instance.capture("$snapshot",e,{transport:"XHR",method:"POST",endpoint:this.endpoint,_forceCompression:!0,_noTruncate:!0,_batchKey:"sessionRecording",_metrics:{rrweb_full_snapshot:e.$snapshot_data.type===y}})}}]),s}();exports.SessionRecording=O;
31
+ },{"../autocapture-utils":"RYfg","../utils":"FOZT","../posthog-persistence":"MAdm","../config":"itQ5","./sessionrecording-utils":"vmk3"}],"auG7":[function(require,module,exports) {
34
32
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Decide=void 0;var e=require("./autocapture"),t=require("./utils"),n=require("./posthog-featureflags");function r(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=i(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}function i(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}var u=function(){function i(e){s(this,i),this.instance=e}return c(i,[{key:"call",value:function(){var e=this,n=JSON.stringify({token:this.instance.get_config("token"),distinct_id:this.instance.get_distinct_id()}),r=t._.base64Encode(n);this.instance._send_request("".concat(this.instance.get_config("api_host"),"/decide/?v=2"),{data:r},{method:"POST"},function(t){return e.parseDecideResponse(t)})}},{key:"parseDecideResponse",value:function(t){var i=this;if(!document||!document.body)return console.log("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){i.parseDecideResponse(t)},500);if(this.instance.toolbar.afterDecideResponse(t),this.instance.sessionRecording.afterDecideResponse(t),e.autocapture.afterDecideResponse(t,this.instance),(0,n.parseFeatureFlagDecideResponse)(t,this.instance.persistence),t.supportedCompression){var o,s={},a=r(t.supportedCompression);try{for(a.s();!(o=a.n()).done;){s[o.value]=!0}}catch(c){a.e(c)}finally{a.f()}this.instance.compression=s}else this.instance.compression={}}}]),i}();exports.Decide=u;
35
33
  },{"./autocapture":"gR3r","./utils":"FOZT","./posthog-featureflags":"aVqC"}],"ZEpJ":[function(require,module,exports) {
36
34
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Toolbar=void 0;var e=require("../autocapture-utils"),t=require("../utils");function o(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function n(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,o){return t&&a(e.prototype,t),o&&a(e,o),e}var c=function(){function o(e){i(this,o),this.instance=e}return s(o,[{key:"afterDecideResponse",value:function(e){var t=e.editorParams||(e.toolbarVersion?{toolbarVersion:e.toolbarVersion}:{});e.isAuthenticated&&t.toolbarVersion&&0===t.toolbarVersion.indexOf("toolbar")&&(this._loadEditor(r(r({},t),{},{apiURL:this.instance.get_config("api_host")})),this.instance.set_config({debug:!0}))}},{key:"maybeLoadEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,o=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.history;try{if(!o){try{window.localStorage.setItem("test","test"),window.localStorage.removeItem("test")}catch(s){return!1}o=window.localStorage}var n,i=t._.getHashParam(e.hash,"__posthog")||t._.getHashParam(e.hash,"state"),a=i?JSON.parse(decodeURIComponent(i)):null;return a&&("mpeditor"===a.action||"ph_authorize"===a.action)?(n=a)&&Object.keys(n).length>0&&(o.setItem("_postHogEditorParams",JSON.stringify(n)),a.desiredHash?e.hash=a.desiredHash:r?r.replaceState("",document.title,e.pathname+e.search):e.hash=""):delete(n=JSON.parse(o.getItem("_postHogEditorParams")||"{}")).userIntent,n.apiURL=this.instance.get_config("api_host"),!(!n.token||this.instance.get_config("token")!==n.token)&&(this._loadEditor(n),!0)}catch(c){return!1}}},{key:"_loadEditor",value:function(o){var r=this;if(!window._postHogToolbarLoaded){window._postHogToolbarLoaded=!0;var n=o.jsURL||o.apiURL||this.instance.get_config("api_host"),i=n+(n.endsWith("/")?"":"/")+"static/toolbar.js?_ts="+(new Date).getTime();return(0,e.loadScript)(i,function(){window.ph_load_editor(o,r.instance)}),t._.register_event(window,"turbolinks:load",function(){window._postHogToolbarLoaded=!1,r._loadEditor(o)}),!0}return!1}}]),o}();exports.Toolbar=c;
@@ -48,8 +46,10 @@ module.exports={name:"posthog-js",version:"1.16.0",description:"Posthog-js allow
48
46
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.xhr=exports.encodePostData=void 0;var e=require("./utils");function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?t(Object(o),!0).forEach(function(t){n(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=function e(t,r){if(r.blob&&t.buffer)return new Blob([t.buffer],{type:"text/plain"});if(r.sendBeacon||r.blob){var n=e(t,{method:"POST"});return new Blob([n],{type:"application/x-www-form-urlencoded"})}if("POST"!==r.method)return null;var o,s;return o=Array.isArray(t)||(s=t,"[object Uint8Array]"===Object.prototype.toString.call(s))?"data="+encodeURIComponent(t):"data="+encodeURIComponent(t.data),t.compression&&(o+="&compression="+t.compression),o};exports.encodePostData=o;var s=function(t){var n=t.url,s=t.data,a=t.headers,i=t.options,c=t.captureMetrics,u=t.callback,p=t.retriesPerformedSoFar,l=t.retryQueue,d=t.onXHRError,f=new XMLHttpRequest;f.open(i.method,n,!0);var b=o(s,i);c.incr("_send_request"),c.incr("_send_request_inflight");var y=c.startRequest(r({data_size:e._.isString(s)?s.length:b.length,endpoint:n.slice(n.length-2)},i._metrics));e._.each(a,function(e,t){f.setRequestHeader(t,e)}),"POST"!==i.method||i.blob||f.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),f.withCredentials=!0,f.onreadystatechange=function(){if(4===f.readyState){c.incr("xhr-response"),c.incr("xhr-response-".concat(f.status)),c.decr("_send_request_inflight");var t=c.finishRequest(y);if(200===f.status){if(u){var o;try{o=JSON.parse(f.responseText)}catch(b){return void e.console.error(b)}u(o)}}else"function"==typeof d&&d(f),[401,403,404,500].indexOf(f.status)<0&&l.enqueue({url:n,data:s,options:i,headers:a,retriesPerformedSoFar:(p||0)+1,callback:u}),c.markRequestFailed(r(r({},t),{},{type:"non_200",status:f.status,statusText:f.statusText})),u&&(i.verbose?u({status:0,error:error}):u(0))}},f.send(b)};exports.xhr=s;
49
47
  },{"./utils":"FOZT"}],"ennf":[function(require,module,exports) {
50
48
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RetryQueue=void 0;var e=require("./base-request-queue"),t=require("./send-request");function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=a(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return u=e.done,e},e:function(e){c=!0,i=e},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw i}}}}function a(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),e}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=d();return function(){var r,n=w(e);if(t){var o=w(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return b(this,r)}}function b(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?v(e):t}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var O=function(r){y(i,e.RequestQueueScaffold);var n=h(i);function i(e,t){var r;return l(this,i),(r=n.call(this)).captureMetrics=e,r.isPolling=!1,r.queue=[],r.areWeOnline=!0,r.onXHRError=t,"onLine"in window.navigator&&(r.areWeOnline=window.navigator.onLine,window.addEventListener("online",function(){r._handleWeAreNowOnline()}),window.addEventListener("offline",function(){r.areWeOnline=!1})),r}return s(i,[{key:"enqueue",value:function(e){var t=e.retriesPerformedSoFar||0;if(!(t>=10)){var r=3e3*Math.pow(2,t),n=new Date(Date.now()+r);console.warn("Enqueued failed request for retry in ".concat(r)),this.queue.push({retryAt:n,requestData:e}),this.isPolling||(this.isPolling=!0,this.poll())}}},{key:"poll",value:function(){var e=this;clearTimeout(this._poller),this._poller=setTimeout(function(){e.areWeOnline&&e.queue.length>0&&e.flush(),e.poll()},this._pollInterval)}},{key:"flush",value:function(){var e=new Date(Date.now()),t=this.queue.filter(function(t){return t.retryAt<e});if(t.length>0){this.queue=this.queue.filter(function(t){return t.retryAt>=e});var r,n=u(t);try{for(n.s();!(r=n.n()).done;){var o=r.value.requestData;this._executeXhrRequest(o)}}catch(i){n.e(i)}finally{n.f()}}}},{key:"unload",value:function(){clearTimeout(this._poller);var e,r=u(this.queue);try{for(r.s();!(e=r.n()).done;){var n=e.value.requestData,i=n.url,a=n.data,c=n.options;window.navigator.sendBeacon(i,(0,t.encodePostData)(a,o(o({},c),{},{sendBeacon:!0})))}}catch(l){r.e(l)}finally{r.f()}this.queue=[]}},{key:"_executeXhrRequest",value:function(e){var r=e.url,n=e.data,o=e.options,i=e.headers,u=e.callback,a=e.retriesPerformedSoFar;(0,t.xhr)({url:r,data:n||{},options:o||{},headers:i||{},retriesPerformedSoFar:a||0,callback:u,captureMetrics:this.captureMetrics,retryQueue:this,onXHRError:this.onXHRError})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),i}();exports.RetryQueue=O;
51
- },{"./base-request-queue":"ae0g","./send-request":"tOu2"}],"ok3T":[function(require,module,exports) {
52
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.init_from_snippet=Q,exports.init_as_module=N,exports.PostHogLib=void 0;var e,t,o=require("./lz-string"),r=m(require("./config")),i=require("./utils"),n=require("./autocapture"),s=require("./posthog-people"),p=require("./posthog-featureflags"),a=require("./posthog-persistence"),c=require("./extensions/sessionrecording"),_=require("./decide"),u=require("./extensions/toolbar"),d=require("./gdpr-utils"),g=require("./storage"),l=require("./request-queue"),h=require("./capture-metrics"),f=require("./compression"),y=require("./send-request"),b=require("./retry-queue");function m(e){return e&&e.__esModule?e:{default:e}}function v(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function w(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?v(Object(o),!0).forEach(function(t){k(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):v(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function k(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function q(e,t){return O(e)||F(e,t)||S(e,t)||P()}function P(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function S(e,t){if(e){if("string"==typeof e)return x(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?x(e,t):void 0}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function F(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var o=[],r=!0,i=!1,n=void 0;try{for(var s,p=e[Symbol.iterator]();!(r=(s=p.next()).done)&&(o.push(s.value),!t||o.length!==t);r=!0);}catch(a){i=!0,n=a}finally{try{r||null==p.return||p.return()}finally{if(i)throw n}}return o}}function O(e){if(Array.isArray(e))return e}var E=0,$=1,H=function(){},j={},I="posthog",A=i.window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,R=!A&&-1===i.userAgent.indexOf("MSIE")&&-1===i.userAgent.indexOf("Mozilla"),D=function(){return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",autocapture:!0,rageclick:!1,cross_subdomain_cookie:-1===i.document.location.hostname.indexOf("herokuapp.com"),persistence:"cookie",persistence_name:"",cookie_name:"",loaded:function(){},store_google:!0,save_referrer:!0,test:!1,verbose:!1,img:!1,capture_pageview:!0,debug:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:"https:"===i.window.location.protocol,ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,property_blacklist:[],sanitize_properties:null,xhr_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,on_xhr_error:function(e){var t="Bad HTTP status: "+e.status+" "+e.statusText;i.console.error(t)},_onCapture:function(){},_capture_metrics:!1}},M=function(){};exports.PostHogLib=M;var L=function(o,a,d){var g,l=d===I?t:t[d];if(l&&e===E)g=l;else{if(l&&!i._.isArray(l))return void i.console.error("You have already initialized "+d);g=new M}if(g._init(o,a,d),g.people=new s.PostHogPeople,g.people._init(g),g.featureFlags=new p.PostHogFeatureFlags(g),g.feature_flags=g.featureFlags,g.toolbar=new u.Toolbar(g),g.toolbar.maybeLoadEditor(),g.sessionRecording=new c.SessionRecording(g),g.sessionRecording.startRecordingIfEnabled(),g.__autocapture_enabled=g.get_config("autocapture"),g.get_config("autocapture")){n.autocapture.enabledForProject(g.get_config("token"),100,100)?n.autocapture.isBrowserSupported()?n.autocapture.init(g):(g.__autocapture_enabled=!1,i.console.log("Disabling Automatic Event Collection because this browser is not supported")):(g.__autocapture_enabled=!1,i.console.log("Not in active bucket: disabling Automatic Event Collection."))}return g.get_config("advanced_disable_decide")||new _.Decide(g).call(),r.default.DEBUG=r.default.DEBUG||g.get_config("debug"),!i._.isUndefined(l)&&i._.isArray(l)&&(g._execute_array.call(g.people,l.people),g._execute_array(l)),g};M.prototype.init=function(e,o,r){if(i._.isUndefined(r))i.console.error("You must name your new library: init(token, config, name)");else{if(r!==I){var n=L(e,o,r);return t[r]=n,n._loaded(),n}i.console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}},M.prototype._init=function(e,t,o){this.__loaded=!0,this.config={},this._triggered_notifs=[],this.compression={},this.set_config(i._.extend({},D(),t,{name:o,token:e,callback_fn:(o===I?o:I+"."+o)+"._jsc"})),this._jsc=function(){},this._captureMetrics=new h.CaptureMetrics(this.get_config("_capture_metrics"),i._.bind(this.capture,this)),this._requestQueue=new l.RequestQueue(this._captureMetrics,i._.bind(this._handle_queued_event,this)),this._retryQueue=new b.RetryQueue(this._captureMetrics,this.get_config("on_xhr_error")),this.__captureHooks=[],this.__request_queue=[],this.persistence=new a.PostHogPersistence(this.config),this._gdpr_init();var r=i._.UUID();this.get_distinct_id()||this.register_once({distinct_id:r,$device_id:r},""),i.window.addEventListener&&i.window.addEventListener("unload",this._handle_unload.bind(this))},M.prototype._loaded=function(){this.get_config("loaded")(this),this._start_queue_if_opted_in(),this.get_config("capture_pageview")&&this.capture("$pageview",{},{send_instantly:!0})},M.prototype._start_queue_if_opted_in=function(){this.has_opted_out_capturing()||this.get_config("request_batching")&&this._requestQueue.poll()},M.prototype._dom_loaded=function(){this.has_opted_out_capturing()||i._.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__request_queue,this._start_queue_if_opted_in()},M.prototype._prepare_callback=function(e,t){if(i._.isUndefined(e))return null;if(A){return function(o){e(o,t)}}var o=this._jsc,r=""+Math.floor(1e8*Math.random()),n=this.get_config("callback_fn")+"["+r+"]";return o[r]=function(i){delete o[r],e(i,t)},n},M.prototype._handle_unload=function(){this.get_config("request_batching")?(this.get_config("capture_pageview")&&this.capture("$pageleave"),this.get_config("_capture_metrics")&&(this._requestQueue.updateUnloadMetrics(),this.capture("$capture_metrics",this._captureMetrics.metrics),this._captureMetrics.captureInProgressRequests()),this._requestQueue.unload(),this._retryQueue.unload()):this.get_config("capture_pageview")&&this.capture("$pageleave",null,{transport:"sendbeacon"})},M.prototype._handle_queued_event=function(e,t,o){var r=JSON.stringify(t);this.__compress_and_send_json_request(e,r,o||j,H)},M.prototype.__compress_and_send_json_request=function(e,t,o,r){var i=q((0,f.compressData)((0,f.decideCompression)(this.compression),t,o),2),n=i[0],s=i[1];this._send_request(e,n,s,r)},M.prototype._send_request=function(e,t,o,r){if(R)this.__request_queue.push(arguments);else{var n={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")};o=i._.extend(n,o||{}),A||(o.method="GET");var s=i.window.navigator.sendBeacon&&"sendbeacon"===o.transport.toLowerCase(),p=o.urlQueryArgs||{};p.ip=this.get_config("ip")?1:0,p._=(new Date).getTime().toString();var a=e.indexOf("?")>-1?"&":"?";if(e+=a+i._.HTTPBuildQuery(p),i._.isObject(t)&&this.get_config("img")){var c=i.document.createElement("img");c.src=e,i.document.body.appendChild(c)}else if(s)i.window.navigator.sendBeacon(e,(0,y.encodePostData)(t,w(w({},o),{},{sendBeacon:!0})));else if(A)try{(0,y.xhr)({url:e,data:t,headers:this.get_config("xhr_headers"),options:o,captureMetrics:this._captureMetrics,callback:r,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onXHRError:this.get_config("on_xhr_error")})}catch(d){i.console.error(d)}else{var _=i.document.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var u=i.document.getElementsByTagName("script")[0];u.parentNode.insertBefore(_,u)}}},M.prototype._execute_array=function(e){var t,o=[],r=[],n=[];i._.each(e,function(e){e&&(t=e[0],i._.isArray(t)?n.push(e):"function"==typeof e?e.call(this):i._.isArray(e)&&"alias"===t?o.push(e):i._.isArray(e)&&-1!==t.indexOf("capture")&&"function"==typeof this[t]?n.push(e):r.push(e))},this);var s=function(e,t){i._.each(e,function(e){if(i._.isArray(e[0])){var o=t;i._.each(e,function(e){o=o[e[0]].apply(o,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};s(o,this),s(r,this),s(n,this)},M.prototype.push=function(e){this._execute_array([e])},M.prototype.capture=(0,d.addOptOutCheckPostHogLib)(function(e,t,o){if(this.__loaded){this._captureMetrics.incr("capture"),"$snapshot"===e&&this._captureMetrics.incr("snapshot");var r=(o=o||j).transport;if(r&&(o.transport=r),i._.isUndefined(e)||"string"!=typeof e)i.console.error("No event name provided to posthog.capture");else if(!i._.isBlockedUA(i.userAgent)){var n=this.persistence.remove_event_timer(e);this.persistence.update_search_keyword(i.document.referrer),this.get_config("store_google")&&this.persistence.update_campaign_params(),this.get_config("save_referrer")&&this.persistence.update_referrer_info(i.document.referrer);var s={event:e,properties:this._calculate_event_properties(e,t,n)};"$identify"===e&&o.$set&&(s.$set=o.$set),s=i._.copyAndTruncateStrings(s,o._noTruncate?null:this.get_config("properties_string_max_length")),this.get_config("debug")&&i.console.log("PostHog.js send",s);var p=JSON.stringify(s),a=this.get_config("api_host")+(o.endpoint||"/e/"),c=o!==j;return!this.get_config("request_batching")||c&&!o._batchKey||o.send_instantly?this.__compress_and_send_json_request(a,p,o):(s.timestamp=new Date,this._requestQueue.enqueue(a,s,o)),this._invokeCaptureHooks(e,s),s}}}),M.prototype._addCaptureHook=function(e){this.__captureHooks.push(e)},M.prototype._invokeCaptureHooks=function(e,t){this.config._onCapture(e,t),i._.each(this.__captureHooks,function(t){return t(e)})},M.prototype._calculate_event_properties=function(e,t,o){var r=t||{};if(r.token=this.get_config("token"),"$snapshot"===e){var n=this.persistence.properties();return r.distinct_id=n.distinct_id,r}if(!i._.isUndefined(o)){var s=(new Date).getTime()-o;r.$duration=parseFloat((s/1e3).toFixed(3))}r=i._.extend({},i._.info.properties(),this.persistence.properties(),r);var p=this.get_config("property_blacklist");i._.isArray(p)?i._.each(p,function(e){delete r[e]}):i.console.error("Invalid value for property_blacklist config: "+p);var a=this.get_config("sanitize_properties");return a&&(r=a(r,e)),r},M.prototype.register=function(e,t){this.persistence.register(e,t)},M.prototype.register_once=function(e,t,o){this.persistence.register_once(e,t,o)},M.prototype.unregister=function(e){this.persistence.unregister(e)},M.prototype._register_single=function(e,t){var o={};o[e]=t,this.register(o)},M.prototype.getFeatureFlag=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.featureFlags.getFeatureFlag(e,t)},M.prototype.isFeatureEnabled=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.featureFlags.isFeatureEnabled(e,t)},M.prototype.reloadFeatureFlags=function(){return this.featureFlags.reloadFeatureFlags()},M.prototype.onFeatureFlags=function(e){this.featureFlags.addFeatureFlagsHandler(e),e(this.featureFlags.getFlags(),this.featureFlags.getFlagVariants())},M.prototype.identify=function(e,t,o){if(e){this._captureMetrics.incr("identify");var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==r&&e!==this.get_property(a.ALIAS_ID_KEY)&&(this.unregister(a.ALIAS_ID_KEY),this.register({distinct_id:e})),e===r||this.get_property("$device_id")&&r!==this.get_property("$device_id")?(t&&this.people.set(t),o&&this.people.set_once(o)):this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{}},{$set_once:o||{}}),this.reloadFeatureFlags()}else i.console.error("Unique user id has not been set in posthog.identify")},M.prototype.group=function(e,t,o){if(e&&t){this._captureMetrics.incr("group");var r=this.getGroups();this.register({$groups:w(w({},r),{},k({},e,t))}),o&&this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:o})}else i.console.error("posthog.group requires a group type and group key")},M.prototype.reset=function(e){var t=this.get_property("$device_id");this.persistence.clear();var o=i._.UUID();this.register_once({distinct_id:o,$device_id:e?o:t},"")},M.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},M.prototype.getGroups=function(){return this.get_property("$groups")||{}},M.prototype.alias=function(e,t){if(e===this.get_property(a.PEOPLE_DISTINCT_ID_KEY))return i.console.critical("Attempting to create alias for existing People user - aborting."),-2;var o=this;return i._.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(a.ALIAS_ID_KEY,e),this.capture("$create_alias",{alias:e,distinct_id:t},function(){o.identify(e)})):(i.console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},M.prototype.set_config=function(e){var t=w({},this.config);i._.isObject(e)&&(i._.extend(this.config,e),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),g.localStore.is_supported()&&"true"===g.localStore.get("ph_debug")&&(this.config.debug=!0),r.default.DEBUG=r.default.DEBUG||this.get_config("debug"),this.sessionRecording&&void 0!==e.disable_session_recording&&t.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))},M.prototype.startSessionRecording=function(){this.set_config({disable_session_recording:!1})},M.prototype.stopSessionRecording=function(){this.set_config({disable_session_recording:!0})},M.prototype.sessionRecordingStarted=function(){return this.sessionRecording.started()},M.prototype.get_config=function(e){return this.config[e]},M.prototype.get_property=function(e){return this.persistence.props[e]},M.prototype.toString=function(){var e=this.get_config("name");return e!==I&&(e=I+"."+e),e},M.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_capturing_persistence_type")&&g.localStore.is_supported()&&(!this.has_opted_in_capturing()&&this.has_opted_in_capturing({persistence_type:"cookie"})&&this.opt_in_capturing({enable_persistence:!1}),!this.has_opted_out_capturing()&&this.has_opted_out_capturing({persistence_type:"cookie"})&&this.opt_out_capturing({clear_persistence:!1}),this.clear_opt_in_out_capturing({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_capturing()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_capturing()||!this.get_config("opt_out_capturing_by_default")&&!g.cookieStore.get("ph_optout")||(g.cookieStore.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},M.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t)},M.prototype._gdpr_call_func=function(e,t){return t=i._.extend({capture:i._.bind(this.capture,this),persistence_type:this.get_config("opt_out_capturing_persistence_type"),cookie_prefix:this.get_config("opt_out_capturing_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),secure_cookie:this.get_config("secure_cookie")},t),g.localStore.is_supported()||"localStorage"!==t.persistence_type||(t.persistence_type="cookie"),e(this.get_config("token"),{capture:t.capture,captureEventName:t.capture_event_name,captureProperties:t.capture_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieExpiration:t.cookie_expiration,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie})},M.prototype.opt_in_capturing=function(e){e=i._.extend({enable_persistence:!0},e),this._gdpr_call_func(d.optIn,e),this._gdpr_update_persistence(e)},M.prototype.opt_out_capturing=function(e){e=i._.extend({clear_persistence:!0},e),this._gdpr_call_func(d.optOut,e),this._gdpr_update_persistence(e)},M.prototype.has_opted_in_capturing=function(e){return this._gdpr_call_func(d.hasOptedIn,e)},M.prototype.has_opted_out_capturing=function(e){return this._gdpr_call_func(d.hasOptedOut,e)},M.prototype.clear_opt_in_out_capturing=function(e){e=i._.extend({enable_persistence:!0},e),this._gdpr_call_func(d.clearOptInOut,e),this._gdpr_update_persistence(e)},M.prototype.sentry_integration=function(e,t,o,r){this.name="posthog-js",this.setupOnce=function(i){i(function(i){if("error"!==i.level||!e.__loaded)return i;i.tags||(i.tags={}),i.tags["PostHog URL"]=e.config.api_host+"/person/"+e.get_distinct_id();var n={$sentry_event_id:i.event_id,$sentry_exception:i.exception};return t&&o&&(n.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+o+"&query="+i.event_id),e.capture("$exception",n),i})}},M.prototype.debug=function(e){!1===e?(i.window.console.log("You've disabled debug mode."),localStorage&&localStorage.setItem("ph_debug",void 0),this.set_config({debug:!1})):(i.window.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))},M.prototype.decodeLZ64=o.LZString.decompressFromBase64,M.prototype.init=M.prototype.init,M.prototype.reset=M.prototype.reset,M.prototype.capture=M.prototype.capture,M.prototype.register=M.prototype.register,M.prototype.register_once=M.prototype.register_once,M.prototype.unregister=M.prototype.unregister,M.prototype.identify=M.prototype.identify,M.prototype.group=M.prototype.group,M.prototype.alias=M.prototype.alias,M.prototype.set_config=M.prototype.set_config,M.prototype.get_config=M.prototype.get_config,M.prototype.get_property=M.prototype.get_property,M.prototype.get_distinct_id=M.prototype.get_distinct_id,M.prototype.toString=M.prototype.toString,M.prototype.opt_out_captureing=M.prototype.opt_out_captureing,M.prototype.opt_in_captureing=M.prototype.opt_in_captureing,M.prototype.has_opted_out_captureing=M.prototype.has_opted_out_captureing,M.prototype.has_opted_in_captureing=M.prototype.has_opted_in_captureing,M.prototype.clear_opt_in_out_captureing=M.prototype.clear_opt_in_out_captureing,M.prototype.opt_out_capturing=M.prototype.opt_out_capturing,M.prototype.opt_in_capturing=M.prototype.opt_in_capturing,M.prototype.has_opted_out_capturing=M.prototype.has_opted_out_capturing,M.prototype.has_opted_in_capturing=M.prototype.has_opted_in_capturing,M.prototype.clear_opt_in_out_capturing=M.prototype.clear_opt_in_out_capturing,M.prototype.getFeatureFlag=M.prototype.getFeatureFlag,M.prototype.isFeatureEnabled=M.prototype.isFeatureEnabled,M.prototype.reloadFeatureFlags=M.prototype.reloadFeatureFlags,M.prototype.onFeatureFlags=M.prototype.onFeatureFlags,M.prototype.decodeLZ64=M.prototype.decodeLZ64,M.prototype.SentryIntegration=M.prototype.sentry_integration,M.prototype.debug=M.prototype.debug,M.prototype.LIB_VERSION=r.default.LIB_VERSION,M.prototype.startSessionRecording=M.prototype.startSessionRecording,M.prototype.stopSessionRecording=M.prototype.stopSessionRecording,M.prototype.sessionRecordingStarted=M.prototype.sessionRecordingStarted,a.PostHogPersistence.prototype.properties=a.PostHogPersistence.prototype.properties,a.PostHogPersistence.prototype.update_search_keyword=a.PostHogPersistence.prototype.update_search_keyword,a.PostHogPersistence.prototype.update_referrer_info=a.PostHogPersistence.prototype.update_referrer_info,a.PostHogPersistence.prototype.get_cross_subdomain=a.PostHogPersistence.prototype.get_cross_subdomain,a.PostHogPersistence.prototype.clear=a.PostHogPersistence.prototype.clear,i._.safewrap_class(M,["identify"]);var C={},U=function(){i._.each(C,function(e,o){o!==I&&(t[o]=e)}),t._=i._},T=function(){t.init=function(o,r,n){if(n)return t[n]||(t[n]=C[n]=L(o,r,n),t[n]._loaded()),t[n];var s=t;C[I]?s=C[I]:o&&((s=L(o,r,I))._loaded(),C[I]=s),t=s,e===$&&(i.window[I]=t),U()}},B=function(){function e(){e.done||(e.done=!0,R=!1,i._.each(C,function(e){e._dom_loaded()}))}if(i.document.addEventListener)"complete"===i.document.readyState?e():i.document.addEventListener("DOMContentLoaded",e,!1);else if(i.document.attachEvent){i.document.attachEvent("onreadystatechange",e);var t=!1;try{t=null===i.window.frameElement}catch(o){}i.document.documentElement.doScroll&&t&&function t(){try{i.document.documentElement.doScroll("left")}catch(o){return void setTimeout(t,1)}e()}()}i._.register_event(i.window,"load",e,!0)};function Q(){e=$,i._.isUndefined(i.window.posthog)&&(i.window.posthog=[]),(t=i.window.posthog).__loaded||t.config&&t.persistence?i.console.error("PostHog library has already been downloaded at least once."):(i._.each(t._i,function(e){e&&i._.isArray(e)&&(C[e[e.length-1]]=L.apply(this,e))}),T(),t.init(),i._.each(C,function(e){e._loaded()}),B())}function N(){return e=E,t=new M,T(),t.init(),B(),t}
53
- },{"./lz-string":"zdbk","./config":"itQ5","./utils":"FOZT","./autocapture":"gR3r","./posthog-people":"ecEG","./posthog-featureflags":"aVqC","./posthog-persistence":"MAdm","./extensions/sessionrecording":"Z2N4","./decide":"auG7","./extensions/toolbar":"ZEpJ","./gdpr-utils":"rxSh","./storage":"KZ7Y","./request-queue":"Je4H","./capture-metrics":"TeHW","./compression":"Ie9M","./send-request":"tOu2","./retry-queue":"ennf"}],"e2xX":[function(require,module,exports) {
49
+ },{"./base-request-queue":"ae0g","./send-request":"tOu2"}],"tci7":[function(require,module,exports) {
50
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SessionIdManager=void 0;var e=require("./extensions/sessionrecording"),t=require("./posthog-persistence"),n=require("./storage"),i=require("./utils");function r(e,t){return u(e)||d(e,t)||o(e,t)||s()}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function d(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],i=!0,r=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);i=!0);}catch(d){r=!0,s=d}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return n}}function u(e){if(Array.isArray(e))return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),e}var p=18e5,f=function(){function s(e,t){c(this,s),this.persistence=t,e.persistence_name?this.window_id_storage_key="ph_"+e.persistence_name+"_window_id":this.window_id_storage_key="ph_"+e.token+"_window_id"}return _(s,[{key:"_setWindowId",value:function(e){e!==this.windowId&&(this.windowId=e,!this.persistence.disabled&&n.sessionStore.is_supported()&&n.sessionStore.set(this.window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this.windowId?this.windowId:!this.persistence.disabled&&n.sessionStore.is_supported()?n.sessionStore.parse(this.window_id_storage_key):null}},{key:"_setSessionId",value:function(e,n){e===this.sessionId&&n===this.timestamp||(this.timestamp=n,this.sessionId=e,this.persistence.register(l({},t.SESSION_ID,[n,e])))}},{key:"_getSessionId",value:function(){return this.sessionId&&this.timestamp?[this.timestamp,this.sessionId]:this.persistence.props[t.SESSION_ID]||[0,null]}},{key:"getSessionAndWindowId",value:function(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=!(s&&s.type===e.INCREMENTAL_SNAPSHOT_EVENT_TYPE&&(null===(t=s.data)||void 0===t?void 0:t.source)===e.MUTATION_SOURCE_TYPE);n=n||(new Date).getTime();var a=r(this._getSessionId(),2),d=a[0],u=a[1],l=this._getWindowId();!u||o&&Math.abs(n-d)>p?(u=i._.UUID(),l=i._.UUID()):l||(l=i._.UUID());var c=0===d||o?n:d;return this._setWindowId(l),this._setSessionId(u,c),{sessionId:u,windowId:l}}}]),s}();exports.SessionIdManager=f;
51
+ },{"./extensions/sessionrecording":"Z2N4","./posthog-persistence":"MAdm","./storage":"KZ7Y","./utils":"FOZT"}],"ok3T":[function(require,module,exports) {
52
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.init_from_snippet=N,exports.init_as_module=Y,exports.PostHogLib=void 0;var e,t,o=require("./lz-string"),r=v(require("./config")),i=require("./utils"),n=require("./autocapture"),s=require("./posthog-people"),p=require("./posthog-featureflags"),a=require("./posthog-persistence"),c=require("./extensions/sessionrecording"),_=require("./decide"),u=require("./extensions/toolbar"),d=require("./gdpr-utils"),g=require("./storage"),l=require("./request-queue"),h=require("./capture-metrics"),f=require("./compression"),y=require("./send-request"),b=require("./retry-queue"),m=require("./sessionid");function v(e){return e&&e.__esModule?e:{default:e}}function w(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function k(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?w(Object(o),!0).forEach(function(t){q(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):w(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function q(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function S(e,t){return E(e)||O(e,t)||x(e,t)||P()}function P(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function x(e,t){if(e){if("string"==typeof e)return F(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?F(e,t):void 0}}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function O(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var o=[],r=!0,i=!1,n=void 0;try{for(var s,p=e[Symbol.iterator]();!(r=(s=p.next()).done)&&(o.push(s.value),!t||o.length!==t);r=!0);}catch(a){i=!0,n=a}finally{try{r||null==p.return||p.return()}finally{if(i)throw n}}return o}}function E(e){if(Array.isArray(e))return e}var I=0,$=1,H=function(){},j={},A="posthog",R=i.window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,M=!R&&-1===i.userAgent.indexOf("MSIE")&&-1===i.userAgent.indexOf("Mozilla"),D=function(){return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",autocapture:!0,rageclick:!1,cross_subdomain_cookie:-1===i.document.location.hostname.indexOf("herokuapp.com"),persistence:"cookie",persistence_name:"",cookie_name:"",loaded:function(){},store_google:!0,save_referrer:!0,test:!1,verbose:!1,img:!1,capture_pageview:!0,debug:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:"https:"===i.window.location.protocol,ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,property_blacklist:[],sanitize_properties:null,xhr_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,on_xhr_error:function(e){var t="Bad HTTP status: "+e.status+" "+e.statusText;i.console.error(t)},_onCapture:function(){},_capture_metrics:!1}},L=function(){};exports.PostHogLib=L;var C=function(o,a,d){var g,l=d===A?t:t[d];if(l&&e===I)g=l;else{if(l&&!i._.isArray(l))return void i.console.error("You have already initialized "+d);g=new L}if(g._init(o,a,d),g.people=new s.PostHogPeople,g.people._init(g),g.featureFlags=new p.PostHogFeatureFlags(g),g.feature_flags=g.featureFlags,g.toolbar=new u.Toolbar(g),g.toolbar.maybeLoadEditor(),g.sessionRecording=new c.SessionRecording(g),g.sessionRecording.startRecordingIfEnabled(),g.__autocapture_enabled=g.get_config("autocapture"),g.get_config("autocapture")){n.autocapture.enabledForProject(g.get_config("token"),100,100)?n.autocapture.isBrowserSupported()?n.autocapture.init(g):(g.__autocapture_enabled=!1,i.console.log("Disabling Automatic Event Collection because this browser is not supported")):(g.__autocapture_enabled=!1,i.console.log("Not in active bucket: disabling Automatic Event Collection."))}return g.get_config("advanced_disable_decide")||new _.Decide(g).call(),r.default.DEBUG=r.default.DEBUG||g.get_config("debug"),!i._.isUndefined(l)&&i._.isArray(l)&&(g._execute_array.call(g.people,l.people),g._execute_array(l)),g};L.prototype.init=function(e,o,r){if(i._.isUndefined(r))i.console.error("You must name your new library: init(token, config, name)");else{if(r!==A){var n=C(e,o,r);return t[r]=n,n._loaded(),n}i.console.error("You must initialize the main posthog object right after you include the PostHog js snippet")}},L.prototype._init=function(e,t,o){this.__loaded=!0,this.config={},this._triggered_notifs=[],this.compression={},this.set_config(i._.extend({},D(),t,{name:o,token:e,callback_fn:(o===A?o:A+"."+o)+"._jsc"})),this._jsc=function(){},this._captureMetrics=new h.CaptureMetrics(this.get_config("_capture_metrics"),i._.bind(this.capture,this)),this._requestQueue=new l.RequestQueue(this._captureMetrics,i._.bind(this._handle_queued_event,this)),this._retryQueue=new b.RetryQueue(this._captureMetrics,this.get_config("on_xhr_error")),this.__captureHooks=[],this.__request_queue=[],this.persistence=new a.PostHogPersistence(this.config),this._sessionIdManager=new m.SessionIdManager(this.config,this.persistence),this._gdpr_init();var r=i._.UUID();this.get_distinct_id()||this.register_once({distinct_id:r,$device_id:r},""),i.window.addEventListener&&i.window.addEventListener("unload",this._handle_unload.bind(this))},L.prototype._loaded=function(){this.get_config("loaded")(this),this._start_queue_if_opted_in(),this.get_config("capture_pageview")&&this.capture("$pageview",{},{send_instantly:!0})},L.prototype._start_queue_if_opted_in=function(){this.has_opted_out_capturing()||this.get_config("request_batching")&&this._requestQueue.poll()},L.prototype._dom_loaded=function(){this.has_opted_out_capturing()||i._.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__request_queue,this._start_queue_if_opted_in()},L.prototype._prepare_callback=function(e,t){if(i._.isUndefined(e))return null;if(R){return function(o){e(o,t)}}var o=this._jsc,r=""+Math.floor(1e8*Math.random()),n=this.get_config("callback_fn")+"["+r+"]";return o[r]=function(i){delete o[r],e(i,t)},n},L.prototype._handle_unload=function(){this.get_config("request_batching")?(this.get_config("capture_pageview")&&this.capture("$pageleave"),this.get_config("_capture_metrics")&&(this._requestQueue.updateUnloadMetrics(),this.capture("$capture_metrics",this._captureMetrics.metrics),this._captureMetrics.captureInProgressRequests()),this._requestQueue.unload(),this._retryQueue.unload()):this.get_config("capture_pageview")&&this.capture("$pageleave",null,{transport:"sendbeacon"})},L.prototype._handle_queued_event=function(e,t,o){var r=JSON.stringify(t);this.__compress_and_send_json_request(e,r,o||j,H)},L.prototype.__compress_and_send_json_request=function(e,t,o,r){var i=S((0,f.compressData)((0,f.decideCompression)(this.compression),t,o),2),n=i[0],s=i[1];this._send_request(e,n,s,r)},L.prototype._send_request=function(e,t,o,r){if(M)this.__request_queue.push(arguments);else{var n={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")};o=i._.extend(n,o||{}),R||(o.method="GET");var s=i.window.navigator.sendBeacon&&"sendbeacon"===o.transport.toLowerCase(),p=o.urlQueryArgs||{};p.ip=this.get_config("ip")?1:0,p._=(new Date).getTime().toString();var a=e.indexOf("?")>-1?"&":"?";if(e+=a+i._.HTTPBuildQuery(p),i._.isObject(t)&&this.get_config("img")){var c=i.document.createElement("img");c.src=e,i.document.body.appendChild(c)}else if(s)i.window.navigator.sendBeacon(e,(0,y.encodePostData)(t,k(k({},o),{},{sendBeacon:!0})));else if(R)try{(0,y.xhr)({url:e,data:t,headers:this.get_config("xhr_headers"),options:o,captureMetrics:this._captureMetrics,callback:r,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onXHRError:this.get_config("on_xhr_error")})}catch(d){i.console.error(d)}else{var _=i.document.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var u=i.document.getElementsByTagName("script")[0];u.parentNode.insertBefore(_,u)}}},L.prototype._execute_array=function(e){var t,o=[],r=[],n=[];i._.each(e,function(e){e&&(t=e[0],i._.isArray(t)?n.push(e):"function"==typeof e?e.call(this):i._.isArray(e)&&"alias"===t?o.push(e):i._.isArray(e)&&-1!==t.indexOf("capture")&&"function"==typeof this[t]?n.push(e):r.push(e))},this);var s=function(e,t){i._.each(e,function(e){if(i._.isArray(e[0])){var o=t;i._.each(e,function(e){o=o[e[0]].apply(o,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};s(o,this),s(r,this),s(n,this)},L.prototype.push=function(e){this._execute_array([e])},L.prototype.capture=(0,d.addOptOutCheckPostHogLib)(function(e,t,o){if(this.__loaded){this._captureMetrics.incr("capture"),"$snapshot"===e&&this._captureMetrics.incr("snapshot");var r=(o=o||j).transport;if(r&&(o.transport=r),i._.isUndefined(e)||"string"!=typeof e)i.console.error("No event name provided to posthog.capture");else if(!i._.isBlockedUA(i.userAgent)){var n=this.persistence.remove_event_timer(e);this.persistence.update_search_keyword(i.document.referrer),this.get_config("store_google")&&this.persistence.update_campaign_params(),this.get_config("save_referrer")&&this.persistence.update_referrer_info(i.document.referrer);var s={event:e,properties:this._calculate_event_properties(e,t,n)};"$identify"===e&&o.$set&&(s.$set=o.$set),s=i._.copyAndTruncateStrings(s,o._noTruncate?null:this.get_config("properties_string_max_length")),this.get_config("debug")&&i.console.log("PostHog.js send",s);var p=JSON.stringify(s),a=this.get_config("api_host")+(o.endpoint||"/e/"),c=o!==j;return!this.get_config("request_batching")||c&&!o._batchKey||o.send_instantly?this.__compress_and_send_json_request(a,p,o):(s.timestamp=new Date,this._requestQueue.enqueue(a,s,o)),this._invokeCaptureHooks(e,s),s}}}),L.prototype._addCaptureHook=function(e){this.__captureHooks.push(e)},L.prototype._invokeCaptureHooks=function(e,t){this.config._onCapture(e,t),i._.each(this.__captureHooks,function(t){return t(e)})},L.prototype._calculate_event_properties=function(e,t,o){var r=t||{};if(r.token=this.get_config("token"),"$snapshot"===e){var n=this.persistence.properties();return r.distinct_id=n.distinct_id,r}if(!i._.isUndefined(o)){var s=(new Date).getTime()-o;r.$duration=parseFloat((s/1e3).toFixed(3))}if(this._sessionIdManager){var p=this._sessionIdManager.getSessionAndWindowId(),a=p.sessionId,c=p.windowId;r.$session_id=a,r.$window_id=c}r=i._.extend({},i._.info.properties(),this.persistence.properties(),r);var _=this.get_config("property_blacklist");i._.isArray(_)?i._.each(_,function(e){delete r[e]}):i.console.error("Invalid value for property_blacklist config: "+_);var u=this.get_config("sanitize_properties");return u&&(r=u(r,e)),r},L.prototype.register=function(e,t){this.persistence.register(e,t)},L.prototype.register_once=function(e,t,o){this.persistence.register_once(e,t,o)},L.prototype.unregister=function(e){this.persistence.unregister(e)},L.prototype._register_single=function(e,t){var o={};o[e]=t,this.register(o)},L.prototype.getFeatureFlag=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.featureFlags.getFeatureFlag(e,t)},L.prototype.isFeatureEnabled=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.featureFlags.isFeatureEnabled(e,t)},L.prototype.reloadFeatureFlags=function(){return this.featureFlags.reloadFeatureFlags()},L.prototype.onFeatureFlags=function(e){this.featureFlags.addFeatureFlagsHandler(e),e(this.featureFlags.getFlags(),this.featureFlags.getFlagVariants())},L.prototype.identify=function(e,t,o){if(e){this._captureMetrics.incr("identify");var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==r&&e!==this.get_property(a.ALIAS_ID_KEY)&&(this.unregister(a.ALIAS_ID_KEY),this.register({distinct_id:e})),e===r||this.get_property("$device_id")&&r!==this.get_property("$device_id")?(t&&this.people.set(t),o&&this.people.set_once(o)):this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{}},{$set_once:o||{}}),this.reloadFeatureFlags()}else i.console.error("Unique user id has not been set in posthog.identify")},L.prototype.group=function(e,t,o){if(e&&t){this._captureMetrics.incr("group");var r=this.getGroups();this.register({$groups:k(k({},r),{},q({},e,t))}),o&&this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:o})}else i.console.error("posthog.group requires a group type and group key")},L.prototype.reset=function(e){var t=this.get_property("$device_id");this.persistence.clear();var o=i._.UUID();this.register_once({distinct_id:o,$device_id:e?o:t},"")},L.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},L.prototype.getGroups=function(){return this.get_property("$groups")||{}},L.prototype.alias=function(e,t){if(e===this.get_property(a.PEOPLE_DISTINCT_ID_KEY))return i.console.critical("Attempting to create alias for existing People user - aborting."),-2;var o=this;return i._.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(a.ALIAS_ID_KEY,e),this.capture("$create_alias",{alias:e,distinct_id:t},function(){o.identify(e)})):(i.console.error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},L.prototype.set_config=function(e){var t=k({},this.config);i._.isObject(e)&&(i._.extend(this.config,e),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),g.localStore.is_supported()&&"true"===g.localStore.get("ph_debug")&&(this.config.debug=!0),r.default.DEBUG=r.default.DEBUG||this.get_config("debug"),this.sessionRecording&&void 0!==e.disable_session_recording&&t.disable_session_recording!==e.disable_session_recording&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled()))},L.prototype.startSessionRecording=function(){this.set_config({disable_session_recording:!1})},L.prototype.stopSessionRecording=function(){this.set_config({disable_session_recording:!0})},L.prototype.sessionRecordingStarted=function(){return this.sessionRecording.started()},L.prototype.get_config=function(e){return this.config[e]},L.prototype.get_property=function(e){return this.persistence.props[e]},L.prototype.toString=function(){var e=this.get_config("name");return e!==A&&(e=A+"."+e),e},L.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_capturing_persistence_type")&&g.localStore.is_supported()&&(!this.has_opted_in_capturing()&&this.has_opted_in_capturing({persistence_type:"cookie"})&&this.opt_in_capturing({enable_persistence:!1}),!this.has_opted_out_capturing()&&this.has_opted_out_capturing({persistence_type:"cookie"})&&this.opt_out_capturing({clear_persistence:!1}),this.clear_opt_in_out_capturing({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_capturing()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_capturing()||!this.get_config("opt_out_capturing_by_default")&&!g.cookieStore.get("ph_optout")||(g.cookieStore.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},L.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t)},L.prototype._gdpr_call_func=function(e,t){return t=i._.extend({capture:i._.bind(this.capture,this),persistence_type:this.get_config("opt_out_capturing_persistence_type"),cookie_prefix:this.get_config("opt_out_capturing_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),secure_cookie:this.get_config("secure_cookie")},t),g.localStore.is_supported()||"localStorage"!==t.persistence_type||(t.persistence_type="cookie"),e(this.get_config("token"),{capture:t.capture,captureEventName:t.capture_event_name,captureProperties:t.capture_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieExpiration:t.cookie_expiration,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie})},L.prototype.opt_in_capturing=function(e){e=i._.extend({enable_persistence:!0},e),this._gdpr_call_func(d.optIn,e),this._gdpr_update_persistence(e)},L.prototype.opt_out_capturing=function(e){e=i._.extend({clear_persistence:!0},e),this._gdpr_call_func(d.optOut,e),this._gdpr_update_persistence(e)},L.prototype.has_opted_in_capturing=function(e){return this._gdpr_call_func(d.hasOptedIn,e)},L.prototype.has_opted_out_capturing=function(e){return this._gdpr_call_func(d.hasOptedOut,e)},L.prototype.clear_opt_in_out_capturing=function(e){e=i._.extend({enable_persistence:!0},e),this._gdpr_call_func(d.clearOptInOut,e),this._gdpr_update_persistence(e)},L.prototype.sentry_integration=function(e,t,o,r){this.name="posthog-js",this.setupOnce=function(i){i(function(i){if("error"!==i.level||!e.__loaded)return i;i.tags||(i.tags={}),i.tags["PostHog URL"]=e.config.api_host+"/person/"+e.get_distinct_id();var n={$sentry_event_id:i.event_id,$sentry_exception:i.exception};return t&&o&&(n.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+o+"&query="+i.event_id),e.capture("$exception",n),i})}},L.prototype.debug=function(e){!1===e?(i.window.console.log("You've disabled debug mode."),localStorage&&localStorage.setItem("ph_debug",void 0),this.set_config({debug:!1})):(i.window.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))},L.prototype.decodeLZ64=o.LZString.decompressFromBase64,L.prototype.init=L.prototype.init,L.prototype.reset=L.prototype.reset,L.prototype.capture=L.prototype.capture,L.prototype.register=L.prototype.register,L.prototype.register_once=L.prototype.register_once,L.prototype.unregister=L.prototype.unregister,L.prototype.identify=L.prototype.identify,L.prototype.group=L.prototype.group,L.prototype.alias=L.prototype.alias,L.prototype.set_config=L.prototype.set_config,L.prototype.get_config=L.prototype.get_config,L.prototype.get_property=L.prototype.get_property,L.prototype.get_distinct_id=L.prototype.get_distinct_id,L.prototype.toString=L.prototype.toString,L.prototype.opt_out_captureing=L.prototype.opt_out_captureing,L.prototype.opt_in_captureing=L.prototype.opt_in_captureing,L.prototype.has_opted_out_captureing=L.prototype.has_opted_out_captureing,L.prototype.has_opted_in_captureing=L.prototype.has_opted_in_captureing,L.prototype.clear_opt_in_out_captureing=L.prototype.clear_opt_in_out_captureing,L.prototype.opt_out_capturing=L.prototype.opt_out_capturing,L.prototype.opt_in_capturing=L.prototype.opt_in_capturing,L.prototype.has_opted_out_capturing=L.prototype.has_opted_out_capturing,L.prototype.has_opted_in_capturing=L.prototype.has_opted_in_capturing,L.prototype.clear_opt_in_out_capturing=L.prototype.clear_opt_in_out_capturing,L.prototype.getFeatureFlag=L.prototype.getFeatureFlag,L.prototype.isFeatureEnabled=L.prototype.isFeatureEnabled,L.prototype.reloadFeatureFlags=L.prototype.reloadFeatureFlags,L.prototype.onFeatureFlags=L.prototype.onFeatureFlags,L.prototype.decodeLZ64=L.prototype.decodeLZ64,L.prototype.SentryIntegration=L.prototype.sentry_integration,L.prototype.debug=L.prototype.debug,L.prototype.LIB_VERSION=r.default.LIB_VERSION,L.prototype.startSessionRecording=L.prototype.startSessionRecording,L.prototype.stopSessionRecording=L.prototype.stopSessionRecording,L.prototype.sessionRecordingStarted=L.prototype.sessionRecordingStarted,a.PostHogPersistence.prototype.properties=a.PostHogPersistence.prototype.properties,a.PostHogPersistence.prototype.update_search_keyword=a.PostHogPersistence.prototype.update_search_keyword,a.PostHogPersistence.prototype.update_referrer_info=a.PostHogPersistence.prototype.update_referrer_info,a.PostHogPersistence.prototype.get_cross_subdomain=a.PostHogPersistence.prototype.get_cross_subdomain,a.PostHogPersistence.prototype.clear=a.PostHogPersistence.prototype.clear,i._.safewrap_class(L,["identify"]);var U={},T=function(){i._.each(U,function(e,o){o!==A&&(t[o]=e)}),t._=i._},B=function(){t.init=function(o,r,n){if(n)return t[n]||(t[n]=U[n]=C(o,r,n),t[n]._loaded()),t[n];var s=t;U[A]?s=U[A]:o&&((s=C(o,r,A))._loaded(),U[A]=s),t=s,e===$&&(i.window[A]=t),T()}},Q=function(){function e(){e.done||(e.done=!0,M=!1,i._.each(U,function(e){e._dom_loaded()}))}if(i.document.addEventListener)"complete"===i.document.readyState?e():i.document.addEventListener("DOMContentLoaded",e,!1);else if(i.document.attachEvent){i.document.attachEvent("onreadystatechange",e);var t=!1;try{t=null===i.window.frameElement}catch(o){}i.document.documentElement.doScroll&&t&&function t(){try{i.document.documentElement.doScroll("left")}catch(o){return void setTimeout(t,1)}e()}()}i._.register_event(i.window,"load",e,!0)};function N(){e=$,i._.isUndefined(i.window.posthog)&&(i.window.posthog=[]),(t=i.window.posthog).__loaded||t.config&&t.persistence?i.console.error("PostHog library has already been downloaded at least once."):(i._.each(t._i,function(e){e&&i._.isArray(e)&&(U[e[e.length-1]]=C.apply(this,e))}),B(),t.init(),i._.each(U,function(e){e._loaded()}),Q())}function Y(){return e=I,t=new L,B(),t.init(),Q(),t}
53
+ },{"./lz-string":"zdbk","./config":"itQ5","./utils":"FOZT","./autocapture":"gR3r","./posthog-people":"ecEG","./posthog-featureflags":"aVqC","./posthog-persistence":"MAdm","./extensions/sessionrecording":"Z2N4","./decide":"auG7","./extensions/toolbar":"ZEpJ","./gdpr-utils":"rxSh","./storage":"KZ7Y","./request-queue":"Je4H","./capture-metrics":"TeHW","./compression":"Ie9M","./send-request":"tOu2","./retry-queue":"ennf","./sessionid":"tci7"}],"e2xX":[function(require,module,exports) {
54
54
  "use strict";var r=require("./posthog-core");(0,r.init_from_snippet)();
55
55
  },{"./posthog-core":"ok3T"}]},{},["e2xX"], null)
package/dist/es.js CHANGED
@@ -863,9 +863,9 @@ var LZString = {
863
863
  }
864
864
  };
865
865
 
866
- var version = "1.16.0";
866
+ var version = "1.16.1";
867
867
 
868
- var Config = {
868
+ var Config$1 = {
869
869
  DEBUG: false,
870
870
  LIB_VERSION: version
871
871
  };
@@ -903,7 +903,7 @@ var _ = {
903
903
  var console$1 = {
904
904
  /** @type {function(...*)} */
905
905
  log: function log() {
906
- if (Config.DEBUG && !_.isUndefined(window.console) && window.console) {
906
+ if (Config$1.DEBUG && !_.isUndefined(window.console) && window.console) {
907
907
  try {
908
908
  window.console.log.apply(window.console, arguments);
909
909
  } catch (err) {
@@ -916,7 +916,7 @@ var console$1 = {
916
916
 
917
917
  /** @type {function(...*)} */
918
918
  error: function error() {
919
- if (Config.DEBUG && !_.isUndefined(window.console) && window.console) {
919
+ if (Config$1.DEBUG && !_.isUndefined(window.console) && window.console) {
920
920
  var args = ['PostHog error:'].concat(Array.prototype.slice.call(arguments));
921
921
 
922
922
  try {
@@ -1140,7 +1140,7 @@ _.safewrap = function (f) {
1140
1140
  } catch (e) {
1141
1141
  console$1.critical('Implementation error. Please turn on debug and contact support@posthog.com.');
1142
1142
 
1143
- if (Config.DEBUG) {
1143
+ if (Config$1.DEBUG) {
1144
1144
  console$1.critical(e);
1145
1145
  }
1146
1146
  }
@@ -1734,7 +1734,7 @@ _.info = {
1734
1734
  $viewport_height: window.innerHeight,
1735
1735
  $viewport_width: window.innerWidth,
1736
1736
  $lib: 'web',
1737
- $lib_version: Config.LIB_VERSION,
1737
+ $lib_version: Config$1.LIB_VERSION,
1738
1738
  $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10),
1739
1739
  $time: _.timestamp() / 1000 // epoch time in seconds
1740
1740
 
@@ -2537,6 +2537,73 @@ var memoryStore = {
2537
2537
  remove: function remove(name) {
2538
2538
  delete memoryStorage[name];
2539
2539
  }
2540
+ }; // Storage that only lasts the length of a tab/window. Survives page refreshes
2541
+
2542
+ var sessionStore = {
2543
+ sessionStorageSupported: null,
2544
+ is_supported: function is_supported() {
2545
+ if (sessionStore.sessionStorageSupported !== null) {
2546
+ return sessionStore.sessionStorageSupported;
2547
+ }
2548
+
2549
+ sessionStore.sessionStorageSupported = true;
2550
+
2551
+ if (window) {
2552
+ try {
2553
+ var key = '__support__',
2554
+ val = 'xyz';
2555
+ sessionStore.set(key, val);
2556
+
2557
+ if (sessionStore.get(key) !== '"xyz"') {
2558
+ sessionStore.sessionStorageSupported = false;
2559
+ }
2560
+
2561
+ sessionStore.remove(key);
2562
+ } catch (err) {
2563
+ sessionStore.sessionStorageSupported = false;
2564
+ }
2565
+ } else {
2566
+ sessionStore.sessionStorageSupported = false;
2567
+ }
2568
+
2569
+ return sessionStore.sessionStorageSupported;
2570
+ },
2571
+ error: function error(msg) {
2572
+ if (Config.DEBUG) {
2573
+ console$1.error('sessionStorage error: ', msg);
2574
+ }
2575
+ },
2576
+ get: function get(name) {
2577
+ try {
2578
+ return window.sessionStorage.getItem(name);
2579
+ } catch (err) {
2580
+ sessionStore.error(err);
2581
+ }
2582
+
2583
+ return null;
2584
+ },
2585
+ parse: function parse(name) {
2586
+ try {
2587
+ return JSON.parse(sessionStore.get(name)) || null;
2588
+ } catch (err) {// noop
2589
+ }
2590
+
2591
+ return null;
2592
+ },
2593
+ set: function set(name, value) {
2594
+ try {
2595
+ window.sessionStorage.setItem(name, JSON.stringify(value));
2596
+ } catch (err) {
2597
+ sessionStore.error(err);
2598
+ }
2599
+ },
2600
+ remove: function remove(name) {
2601
+ try {
2602
+ window.sessionStorage.removeItem(name);
2603
+ } catch (err) {
2604
+ sessionStore.error(err);
2605
+ }
2606
+ }
2540
2607
  };
2541
2608
 
2542
2609
  /**
@@ -3512,28 +3579,6 @@ PostHogPersistence.prototype.remove_event_timer = function (event_name) {
3512
3579
  return timestamp;
3513
3580
  };
3514
3581
 
3515
- var SESSION_CHANGE_THRESHOLD = 30 * 60 * 1000; // 30 mins
3516
-
3517
- var sessionIdGenerator = (function (persistence, timestamp) {
3518
- var _ref = persistence['props'][SESSION_ID] || [0, null],
3519
- _ref2 = _slicedToArray(_ref, 2),
3520
- lastTimestamp = _ref2[0],
3521
- sessionId = _ref2[1];
3522
-
3523
- var isNewSessionId = false;
3524
-
3525
- if (Math.abs(timestamp - lastTimestamp) > SESSION_CHANGE_THRESHOLD) {
3526
- sessionId = _.UUID();
3527
- isNewSessionId = true;
3528
- }
3529
-
3530
- persistence.register(_defineProperty({}, SESSION_ID, [timestamp, sessionId]));
3531
- return {
3532
- isNewSessionId: isNewSessionId,
3533
- sessionId: sessionId
3534
- };
3535
- });
3536
-
3537
3582
  var replacementImageURI = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNOCAwSDE2TDAgMTZWOEw4IDBaIiBmaWxsPSIjMkQyRDJEIi8+CjxwYXRoIGQ9Ik0xNiA4VjE2SDhMMTYgOFoiIGZpbGw9IiMyRDJEMkQiLz4KPC9zdmc+Cg==';
3538
3583
  /*
3539
3584
  * Check whether a data payload is nearing 5mb. If it is, it checks the data for
@@ -3585,6 +3630,10 @@ function filterDataURLsFromLargeDataObjects(data) {
3585
3630
  }
3586
3631
 
3587
3632
  var BASE_ENDPOINT = '/e/';
3633
+ var FULL_SNAPSHOT_EVENT_TYPE = 2;
3634
+ var META_EVENT_TYPE = 4;
3635
+ var INCREMENTAL_SNAPSHOT_EVENT_TYPE = 3;
3636
+ var MUTATION_SOURCE_TYPE = 3;
3588
3637
  var SessionRecording = /*#__PURE__*/function () {
3589
3638
  function SessionRecording(instance) {
3590
3639
  _classCallCheck(this, SessionRecording);
@@ -3595,6 +3644,8 @@ var SessionRecording = /*#__PURE__*/function () {
3595
3644
  this.emit = false;
3596
3645
  this.endpoint = BASE_ENDPOINT;
3597
3646
  this.stopRrweb = null;
3647
+ this.windowId = null;
3648
+ this.sessionId = null;
3598
3649
  }
3599
3650
 
3600
3651
  _createClass(SessionRecording, [{
@@ -3664,9 +3715,24 @@ var SessionRecording = /*#__PURE__*/function () {
3664
3715
 
3665
3716
  if (!this.captureStarted && !this.instance.get_config('disable_session_recording')) {
3666
3717
  this.captureStarted = true;
3667
- loadScript(this.instance.get_config('api_host') + '/static/recorder.js?v=' + Config.LIB_VERSION, _.bind(this._onScriptLoaded, this));
3718
+ loadScript(this.instance.get_config('api_host') + '/static/recorder.js?v=' + Config$1.LIB_VERSION, _.bind(this._onScriptLoaded, this));
3668
3719
  }
3669
3720
  }
3721
+ }, {
3722
+ key: "_updateWindowAndSessionIds",
3723
+ value: function _updateWindowAndSessionIds(event) {
3724
+ var _this$instance$_sessi = this.instance._sessionIdManager.getSessionAndWindowId(event.timestamp || new Date().getTime(), event),
3725
+ windowId = _this$instance$_sessi.windowId,
3726
+ sessionId = _this$instance$_sessi.sessionId; // Event types FullSnapshot and Meta mean we're already in the process of sending a full snapshot
3727
+
3728
+
3729
+ if ((this.windowId !== windowId || this.sessionId !== sessionId) && [FULL_SNAPSHOT_EVENT_TYPE, META_EVENT_TYPE].indexOf(event.type) === -1) {
3730
+ window.rrweb.record.takeFullSnapshot();
3731
+ }
3732
+
3733
+ this.windowId = windowId;
3734
+ this.sessionId = sessionId;
3735
+ }
3670
3736
  }, {
3671
3737
  key: "_onScriptLoaded",
3672
3738
  value: function _onScriptLoaded() {
@@ -3699,23 +3765,20 @@ var SessionRecording = /*#__PURE__*/function () {
3699
3765
  }
3700
3766
 
3701
3767
  this.stopRrweb = window.rrweb.record(_objectSpread2({
3702
- emit: function emit(data) {
3703
- data = filterDataURLsFromLargeDataObjects(data);
3704
- var sessionIdObject = sessionIdGenerator(_this2.instance.persistence, data.timestamp); // Data type 2 and 4 are FullSnapshot and Meta and they mean we're already
3705
- // in the process of sending a full snapshot
3768
+ emit: function emit(event) {
3769
+ event = filterDataURLsFromLargeDataObjects(event);
3706
3770
 
3707
- if (sessionIdObject.isNewSessionId && [2, 4].indexOf(data.type) === -1) {
3708
- window.rrweb.record.takeFullSnapshot();
3709
- }
3771
+ _this2._updateWindowAndSessionIds(event);
3710
3772
 
3711
3773
  var properties = {
3712
- $snapshot_data: data,
3713
- $session_id: sessionIdObject.sessionId
3774
+ $snapshot_data: event,
3775
+ $session_id: _this2.sessionId,
3776
+ $window_id: _this2.windowId
3714
3777
  };
3715
3778
 
3716
3779
  _this2.instance._captureMetrics.incr('rrweb-record');
3717
3780
 
3718
- _this2.instance._captureMetrics.incr("rrweb-record-".concat(data.type));
3781
+ _this2.instance._captureMetrics.incr("rrweb-record-".concat(event.type));
3719
3782
 
3720
3783
  if (_this2.emit) {
3721
3784
  _this2._captureSnapshot(properties);
@@ -3746,7 +3809,7 @@ var SessionRecording = /*#__PURE__*/function () {
3746
3809
  _noTruncate: true,
3747
3810
  _batchKey: 'sessionRecording',
3748
3811
  _metrics: {
3749
- rrweb_full_snapshot: properties.$snapshot_data.type === 2
3812
+ rrweb_full_snapshot: properties.$snapshot_data.type === FULL_SNAPSHOT_EVENT_TYPE
3750
3813
  }
3751
3814
  });
3752
3815
  }
@@ -5316,6 +5379,112 @@ var RetryQueue = /*#__PURE__*/function (_RequestQueueScaffold) {
5316
5379
  return RetryQueue;
5317
5380
  }(RequestQueueScaffold);
5318
5381
 
5382
+ var SESSION_CHANGE_THRESHOLD = 30 * 60 * 1000; // 30 mins
5383
+
5384
+ var SessionIdManager = /*#__PURE__*/function () {
5385
+ function SessionIdManager(config, persistence) {
5386
+ _classCallCheck(this, SessionIdManager);
5387
+
5388
+ this.persistence = persistence;
5389
+
5390
+ if (config['persistence_name']) {
5391
+ this.window_id_storage_key = 'ph_' + config['persistence_name'] + '_window_id';
5392
+ } else {
5393
+ this.window_id_storage_key = 'ph_' + config['token'] + '_window_id';
5394
+ }
5395
+ } // Note: this tries to store the windowId in sessionStorage. SessionStorage is unique to the current window/tab,
5396
+ // and persists page loads/reloads. So it's uniquely suited for storing the windowId. This function also respects
5397
+ // when persistence is disabled (by user config) and when sessionStorage is not supported (it *should* be supported on all browsers),
5398
+ // and in that case, it falls back to memory (which sadly, won't persist page loads)
5399
+
5400
+
5401
+ _createClass(SessionIdManager, [{
5402
+ key: "_setWindowId",
5403
+ value: function _setWindowId(windowId) {
5404
+ if (windowId !== this.windowId) {
5405
+ this.windowId = windowId;
5406
+
5407
+ if (!this.persistence.disabled && sessionStore.is_supported()) {
5408
+ sessionStore.set(this.window_id_storage_key, windowId);
5409
+ }
5410
+ }
5411
+ }
5412
+ }, {
5413
+ key: "_getWindowId",
5414
+ value: function _getWindowId() {
5415
+ if (this.windowId) {
5416
+ return this.windowId;
5417
+ }
5418
+
5419
+ if (!this.persistence.disabled && sessionStore.is_supported()) {
5420
+ return sessionStore.parse(this.window_id_storage_key);
5421
+ }
5422
+
5423
+ return null;
5424
+ } // Note: 'this.persistence.register' can be disabled in the config.
5425
+ // In that case, this works by storing sessionId and the timestamp in memory.
5426
+
5427
+ }, {
5428
+ key: "_setSessionId",
5429
+ value: function _setSessionId(sessionId, timestamp) {
5430
+ if (sessionId !== this.sessionId || timestamp !== this.timestamp) {
5431
+ this.timestamp = timestamp;
5432
+ this.sessionId = sessionId;
5433
+ this.persistence.register(_defineProperty({}, SESSION_ID, [timestamp, sessionId]));
5434
+ }
5435
+ }
5436
+ }, {
5437
+ key: "_getSessionId",
5438
+ value: function _getSessionId() {
5439
+ if (this.sessionId && this.timestamp) {
5440
+ return [this.timestamp, this.sessionId];
5441
+ }
5442
+
5443
+ return this.persistence['props'][SESSION_ID] || [0, null];
5444
+ }
5445
+ }, {
5446
+ key: "getSessionAndWindowId",
5447
+ value: function getSessionAndWindowId() {
5448
+ var _recordingEvent$data;
5449
+
5450
+ var timestamp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
5451
+ var recordingEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
5452
+ // Some recording events are triggered by non-user events (e.g. "X minutes ago" text updating on the screen).
5453
+ // We don't want to update the session and window ids in these cases. These events are designated by event
5454
+ // type -> incremental update, and source -> mutation.
5455
+ var isUserInteraction = !(recordingEvent && recordingEvent.type === INCREMENTAL_SNAPSHOT_EVENT_TYPE && ((_recordingEvent$data = recordingEvent.data) === null || _recordingEvent$data === void 0 ? void 0 : _recordingEvent$data.source) === MUTATION_SOURCE_TYPE);
5456
+ timestamp = timestamp || new Date().getTime();
5457
+
5458
+ var _this$_getSessionId = this._getSessionId(),
5459
+ _this$_getSessionId2 = _slicedToArray(_this$_getSessionId, 2),
5460
+ lastTimestamp = _this$_getSessionId2[0],
5461
+ sessionId = _this$_getSessionId2[1];
5462
+
5463
+ var windowId = this._getWindowId();
5464
+
5465
+ if (!sessionId || isUserInteraction && Math.abs(timestamp - lastTimestamp) > SESSION_CHANGE_THRESHOLD) {
5466
+ sessionId = _.UUID();
5467
+ windowId = _.UUID();
5468
+ } else if (!windowId) {
5469
+ windowId = _.UUID();
5470
+ }
5471
+
5472
+ var newTimestamp = lastTimestamp === 0 || isUserInteraction ? timestamp : lastTimestamp;
5473
+
5474
+ this._setWindowId(windowId);
5475
+
5476
+ this._setSessionId(sessionId, newTimestamp);
5477
+
5478
+ return {
5479
+ sessionId: sessionId,
5480
+ windowId: windowId
5481
+ };
5482
+ }
5483
+ }]);
5484
+
5485
+ return SessionIdManager;
5486
+ }();
5487
+
5319
5488
  /*
5320
5489
  SIMPLE STYLE GUIDE:
5321
5490
 
@@ -5479,7 +5648,7 @@ var create_mplib = function create_mplib(token, config, name) {
5479
5648
  // global debug to be true
5480
5649
 
5481
5650
 
5482
- Config.DEBUG = Config.DEBUG || instance.get_config('debug'); // if target is not defined, we called init after the lib already
5651
+ Config$1.DEBUG = Config$1.DEBUG || instance.get_config('debug'); // if target is not defined, we called init after the lib already
5483
5652
  // loaded, so there won't be an array of things to execute
5484
5653
 
5485
5654
  if (!_.isUndefined(target) && _.isArray(target)) {
@@ -5556,6 +5725,7 @@ PostHogLib.prototype._init = function (token, config, name) {
5556
5725
  this.__captureHooks = [];
5557
5726
  this.__request_queue = [];
5558
5727
  this['persistence'] = new PostHogPersistence(this['config']);
5728
+ this['_sessionIdManager'] = new SessionIdManager(this['config'], this['persistence']);
5559
5729
 
5560
5730
  this._gdpr_init();
5561
5731
 
@@ -5947,6 +6117,15 @@ PostHogLib.prototype._calculate_event_properties = function (event_name, event_p
5947
6117
  if (!_.isUndefined(start_timestamp)) {
5948
6118
  var duration_in_ms = new Date().getTime() - start_timestamp;
5949
6119
  properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3));
6120
+ }
6121
+
6122
+ if (this._sessionIdManager) {
6123
+ var _this$_sessionIdManag = this._sessionIdManager.getSessionAndWindowId(),
6124
+ sessionId = _this$_sessionIdManag.sessionId,
6125
+ windowId = _this$_sessionIdManag.windowId;
6126
+
6127
+ properties['$session_id'] = sessionId;
6128
+ properties['$window_id'] = windowId;
5950
6129
  } // note: extend writes to the first object, so lets make sure we
5951
6130
  // don't write to the persistence properties object and info
5952
6131
  // properties object by passing in a new object
@@ -6462,7 +6641,7 @@ PostHogLib.prototype.set_config = function (config) {
6462
6641
  this['config']['debug'] = true;
6463
6642
  }
6464
6643
 
6465
- Config.DEBUG = Config.DEBUG || this.get_config('debug');
6644
+ Config$1.DEBUG = Config$1.DEBUG || this.get_config('debug');
6466
6645
 
6467
6646
  if (this.sessionRecording && typeof config.disable_session_recording !== 'undefined') {
6468
6647
  if (oldConfig.disable_session_recording !== config.disable_session_recording) {
@@ -6874,7 +7053,7 @@ PostHogLib.prototype['onFeatureFlags'] = PostHogLib.prototype.onFeatureFlags;
6874
7053
  PostHogLib.prototype['decodeLZ64'] = PostHogLib.prototype.decodeLZ64;
6875
7054
  PostHogLib.prototype['SentryIntegration'] = PostHogLib.prototype.sentry_integration;
6876
7055
  PostHogLib.prototype['debug'] = PostHogLib.prototype.debug;
6877
- PostHogLib.prototype['LIB_VERSION'] = Config.LIB_VERSION;
7056
+ PostHogLib.prototype['LIB_VERSION'] = Config$1.LIB_VERSION;
6878
7057
  PostHogLib.prototype['startSessionRecording'] = PostHogLib.prototype.startSessionRecording;
6879
7058
  PostHogLib.prototype['stopSessionRecording'] = PostHogLib.prototype.stopSessionRecording;
6880
7059
  PostHogLib.prototype['sessionRecordingStarted'] = PostHogLib.prototype.sessionRecordingStarted; // PostHogPersistence Exports
package/dist/module.js CHANGED
@@ -865,9 +865,9 @@ var LZString = {
865
865
  }
866
866
  };
867
867
 
868
- var version = "1.16.0";
868
+ var version = "1.16.1";
869
869
 
870
- var Config = {
870
+ var Config$1 = {
871
871
  DEBUG: false,
872
872
  LIB_VERSION: version
873
873
  };
@@ -905,7 +905,7 @@ var _ = {
905
905
  var console$1 = {
906
906
  /** @type {function(...*)} */
907
907
  log: function log() {
908
- if (Config.DEBUG && !_.isUndefined(window.console) && window.console) {
908
+ if (Config$1.DEBUG && !_.isUndefined(window.console) && window.console) {
909
909
  try {
910
910
  window.console.log.apply(window.console, arguments);
911
911
  } catch (err) {
@@ -918,7 +918,7 @@ var console$1 = {
918
918
 
919
919
  /** @type {function(...*)} */
920
920
  error: function error() {
921
- if (Config.DEBUG && !_.isUndefined(window.console) && window.console) {
921
+ if (Config$1.DEBUG && !_.isUndefined(window.console) && window.console) {
922
922
  var args = ['PostHog error:'].concat(Array.prototype.slice.call(arguments));
923
923
 
924
924
  try {
@@ -1142,7 +1142,7 @@ _.safewrap = function (f) {
1142
1142
  } catch (e) {
1143
1143
  console$1.critical('Implementation error. Please turn on debug and contact support@posthog.com.');
1144
1144
 
1145
- if (Config.DEBUG) {
1145
+ if (Config$1.DEBUG) {
1146
1146
  console$1.critical(e);
1147
1147
  }
1148
1148
  }
@@ -1736,7 +1736,7 @@ _.info = {
1736
1736
  $viewport_height: window.innerHeight,
1737
1737
  $viewport_width: window.innerWidth,
1738
1738
  $lib: 'web',
1739
- $lib_version: Config.LIB_VERSION,
1739
+ $lib_version: Config$1.LIB_VERSION,
1740
1740
  $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10),
1741
1741
  $time: _.timestamp() / 1000 // epoch time in seconds
1742
1742
 
@@ -2539,6 +2539,73 @@ var memoryStore = {
2539
2539
  remove: function remove(name) {
2540
2540
  delete memoryStorage[name];
2541
2541
  }
2542
+ }; // Storage that only lasts the length of a tab/window. Survives page refreshes
2543
+
2544
+ var sessionStore = {
2545
+ sessionStorageSupported: null,
2546
+ is_supported: function is_supported() {
2547
+ if (sessionStore.sessionStorageSupported !== null) {
2548
+ return sessionStore.sessionStorageSupported;
2549
+ }
2550
+
2551
+ sessionStore.sessionStorageSupported = true;
2552
+
2553
+ if (window) {
2554
+ try {
2555
+ var key = '__support__',
2556
+ val = 'xyz';
2557
+ sessionStore.set(key, val);
2558
+
2559
+ if (sessionStore.get(key) !== '"xyz"') {
2560
+ sessionStore.sessionStorageSupported = false;
2561
+ }
2562
+
2563
+ sessionStore.remove(key);
2564
+ } catch (err) {
2565
+ sessionStore.sessionStorageSupported = false;
2566
+ }
2567
+ } else {
2568
+ sessionStore.sessionStorageSupported = false;
2569
+ }
2570
+
2571
+ return sessionStore.sessionStorageSupported;
2572
+ },
2573
+ error: function error(msg) {
2574
+ if (Config.DEBUG) {
2575
+ console$1.error('sessionStorage error: ', msg);
2576
+ }
2577
+ },
2578
+ get: function get(name) {
2579
+ try {
2580
+ return window.sessionStorage.getItem(name);
2581
+ } catch (err) {
2582
+ sessionStore.error(err);
2583
+ }
2584
+
2585
+ return null;
2586
+ },
2587
+ parse: function parse(name) {
2588
+ try {
2589
+ return JSON.parse(sessionStore.get(name)) || null;
2590
+ } catch (err) {// noop
2591
+ }
2592
+
2593
+ return null;
2594
+ },
2595
+ set: function set(name, value) {
2596
+ try {
2597
+ window.sessionStorage.setItem(name, JSON.stringify(value));
2598
+ } catch (err) {
2599
+ sessionStore.error(err);
2600
+ }
2601
+ },
2602
+ remove: function remove(name) {
2603
+ try {
2604
+ window.sessionStorage.removeItem(name);
2605
+ } catch (err) {
2606
+ sessionStore.error(err);
2607
+ }
2608
+ }
2542
2609
  };
2543
2610
 
2544
2611
  /**
@@ -3514,28 +3581,6 @@ PostHogPersistence.prototype.remove_event_timer = function (event_name) {
3514
3581
  return timestamp;
3515
3582
  };
3516
3583
 
3517
- var SESSION_CHANGE_THRESHOLD = 30 * 60 * 1000; // 30 mins
3518
-
3519
- var sessionIdGenerator = (function (persistence, timestamp) {
3520
- var _ref = persistence['props'][SESSION_ID] || [0, null],
3521
- _ref2 = _slicedToArray(_ref, 2),
3522
- lastTimestamp = _ref2[0],
3523
- sessionId = _ref2[1];
3524
-
3525
- var isNewSessionId = false;
3526
-
3527
- if (Math.abs(timestamp - lastTimestamp) > SESSION_CHANGE_THRESHOLD) {
3528
- sessionId = _.UUID();
3529
- isNewSessionId = true;
3530
- }
3531
-
3532
- persistence.register(_defineProperty({}, SESSION_ID, [timestamp, sessionId]));
3533
- return {
3534
- isNewSessionId: isNewSessionId,
3535
- sessionId: sessionId
3536
- };
3537
- });
3538
-
3539
3584
  var replacementImageURI = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNOCAwSDE2TDAgMTZWOEw4IDBaIiBmaWxsPSIjMkQyRDJEIi8+CjxwYXRoIGQ9Ik0xNiA4VjE2SDhMMTYgOFoiIGZpbGw9IiMyRDJEMkQiLz4KPC9zdmc+Cg==';
3540
3585
  /*
3541
3586
  * Check whether a data payload is nearing 5mb. If it is, it checks the data for
@@ -3587,6 +3632,10 @@ function filterDataURLsFromLargeDataObjects(data) {
3587
3632
  }
3588
3633
 
3589
3634
  var BASE_ENDPOINT = '/e/';
3635
+ var FULL_SNAPSHOT_EVENT_TYPE = 2;
3636
+ var META_EVENT_TYPE = 4;
3637
+ var INCREMENTAL_SNAPSHOT_EVENT_TYPE = 3;
3638
+ var MUTATION_SOURCE_TYPE = 3;
3590
3639
  var SessionRecording = /*#__PURE__*/function () {
3591
3640
  function SessionRecording(instance) {
3592
3641
  _classCallCheck(this, SessionRecording);
@@ -3597,6 +3646,8 @@ var SessionRecording = /*#__PURE__*/function () {
3597
3646
  this.emit = false;
3598
3647
  this.endpoint = BASE_ENDPOINT;
3599
3648
  this.stopRrweb = null;
3649
+ this.windowId = null;
3650
+ this.sessionId = null;
3600
3651
  }
3601
3652
 
3602
3653
  _createClass(SessionRecording, [{
@@ -3666,9 +3717,24 @@ var SessionRecording = /*#__PURE__*/function () {
3666
3717
 
3667
3718
  if (!this.captureStarted && !this.instance.get_config('disable_session_recording')) {
3668
3719
  this.captureStarted = true;
3669
- loadScript(this.instance.get_config('api_host') + '/static/recorder.js?v=' + Config.LIB_VERSION, _.bind(this._onScriptLoaded, this));
3720
+ loadScript(this.instance.get_config('api_host') + '/static/recorder.js?v=' + Config$1.LIB_VERSION, _.bind(this._onScriptLoaded, this));
3670
3721
  }
3671
3722
  }
3723
+ }, {
3724
+ key: "_updateWindowAndSessionIds",
3725
+ value: function _updateWindowAndSessionIds(event) {
3726
+ var _this$instance$_sessi = this.instance._sessionIdManager.getSessionAndWindowId(event.timestamp || new Date().getTime(), event),
3727
+ windowId = _this$instance$_sessi.windowId,
3728
+ sessionId = _this$instance$_sessi.sessionId; // Event types FullSnapshot and Meta mean we're already in the process of sending a full snapshot
3729
+
3730
+
3731
+ if ((this.windowId !== windowId || this.sessionId !== sessionId) && [FULL_SNAPSHOT_EVENT_TYPE, META_EVENT_TYPE].indexOf(event.type) === -1) {
3732
+ window.rrweb.record.takeFullSnapshot();
3733
+ }
3734
+
3735
+ this.windowId = windowId;
3736
+ this.sessionId = sessionId;
3737
+ }
3672
3738
  }, {
3673
3739
  key: "_onScriptLoaded",
3674
3740
  value: function _onScriptLoaded() {
@@ -3701,23 +3767,20 @@ var SessionRecording = /*#__PURE__*/function () {
3701
3767
  }
3702
3768
 
3703
3769
  this.stopRrweb = window.rrweb.record(_objectSpread2({
3704
- emit: function emit(data) {
3705
- data = filterDataURLsFromLargeDataObjects(data);
3706
- var sessionIdObject = sessionIdGenerator(_this2.instance.persistence, data.timestamp); // Data type 2 and 4 are FullSnapshot and Meta and they mean we're already
3707
- // in the process of sending a full snapshot
3770
+ emit: function emit(event) {
3771
+ event = filterDataURLsFromLargeDataObjects(event);
3708
3772
 
3709
- if (sessionIdObject.isNewSessionId && [2, 4].indexOf(data.type) === -1) {
3710
- window.rrweb.record.takeFullSnapshot();
3711
- }
3773
+ _this2._updateWindowAndSessionIds(event);
3712
3774
 
3713
3775
  var properties = {
3714
- $snapshot_data: data,
3715
- $session_id: sessionIdObject.sessionId
3776
+ $snapshot_data: event,
3777
+ $session_id: _this2.sessionId,
3778
+ $window_id: _this2.windowId
3716
3779
  };
3717
3780
 
3718
3781
  _this2.instance._captureMetrics.incr('rrweb-record');
3719
3782
 
3720
- _this2.instance._captureMetrics.incr("rrweb-record-".concat(data.type));
3783
+ _this2.instance._captureMetrics.incr("rrweb-record-".concat(event.type));
3721
3784
 
3722
3785
  if (_this2.emit) {
3723
3786
  _this2._captureSnapshot(properties);
@@ -3748,7 +3811,7 @@ var SessionRecording = /*#__PURE__*/function () {
3748
3811
  _noTruncate: true,
3749
3812
  _batchKey: 'sessionRecording',
3750
3813
  _metrics: {
3751
- rrweb_full_snapshot: properties.$snapshot_data.type === 2
3814
+ rrweb_full_snapshot: properties.$snapshot_data.type === FULL_SNAPSHOT_EVENT_TYPE
3752
3815
  }
3753
3816
  });
3754
3817
  }
@@ -5318,6 +5381,112 @@ var RetryQueue = /*#__PURE__*/function (_RequestQueueScaffold) {
5318
5381
  return RetryQueue;
5319
5382
  }(RequestQueueScaffold);
5320
5383
 
5384
+ var SESSION_CHANGE_THRESHOLD = 30 * 60 * 1000; // 30 mins
5385
+
5386
+ var SessionIdManager = /*#__PURE__*/function () {
5387
+ function SessionIdManager(config, persistence) {
5388
+ _classCallCheck(this, SessionIdManager);
5389
+
5390
+ this.persistence = persistence;
5391
+
5392
+ if (config['persistence_name']) {
5393
+ this.window_id_storage_key = 'ph_' + config['persistence_name'] + '_window_id';
5394
+ } else {
5395
+ this.window_id_storage_key = 'ph_' + config['token'] + '_window_id';
5396
+ }
5397
+ } // Note: this tries to store the windowId in sessionStorage. SessionStorage is unique to the current window/tab,
5398
+ // and persists page loads/reloads. So it's uniquely suited for storing the windowId. This function also respects
5399
+ // when persistence is disabled (by user config) and when sessionStorage is not supported (it *should* be supported on all browsers),
5400
+ // and in that case, it falls back to memory (which sadly, won't persist page loads)
5401
+
5402
+
5403
+ _createClass(SessionIdManager, [{
5404
+ key: "_setWindowId",
5405
+ value: function _setWindowId(windowId) {
5406
+ if (windowId !== this.windowId) {
5407
+ this.windowId = windowId;
5408
+
5409
+ if (!this.persistence.disabled && sessionStore.is_supported()) {
5410
+ sessionStore.set(this.window_id_storage_key, windowId);
5411
+ }
5412
+ }
5413
+ }
5414
+ }, {
5415
+ key: "_getWindowId",
5416
+ value: function _getWindowId() {
5417
+ if (this.windowId) {
5418
+ return this.windowId;
5419
+ }
5420
+
5421
+ if (!this.persistence.disabled && sessionStore.is_supported()) {
5422
+ return sessionStore.parse(this.window_id_storage_key);
5423
+ }
5424
+
5425
+ return null;
5426
+ } // Note: 'this.persistence.register' can be disabled in the config.
5427
+ // In that case, this works by storing sessionId and the timestamp in memory.
5428
+
5429
+ }, {
5430
+ key: "_setSessionId",
5431
+ value: function _setSessionId(sessionId, timestamp) {
5432
+ if (sessionId !== this.sessionId || timestamp !== this.timestamp) {
5433
+ this.timestamp = timestamp;
5434
+ this.sessionId = sessionId;
5435
+ this.persistence.register(_defineProperty({}, SESSION_ID, [timestamp, sessionId]));
5436
+ }
5437
+ }
5438
+ }, {
5439
+ key: "_getSessionId",
5440
+ value: function _getSessionId() {
5441
+ if (this.sessionId && this.timestamp) {
5442
+ return [this.timestamp, this.sessionId];
5443
+ }
5444
+
5445
+ return this.persistence['props'][SESSION_ID] || [0, null];
5446
+ }
5447
+ }, {
5448
+ key: "getSessionAndWindowId",
5449
+ value: function getSessionAndWindowId() {
5450
+ var _recordingEvent$data;
5451
+
5452
+ var timestamp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
5453
+ var recordingEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
5454
+ // Some recording events are triggered by non-user events (e.g. "X minutes ago" text updating on the screen).
5455
+ // We don't want to update the session and window ids in these cases. These events are designated by event
5456
+ // type -> incremental update, and source -> mutation.
5457
+ var isUserInteraction = !(recordingEvent && recordingEvent.type === INCREMENTAL_SNAPSHOT_EVENT_TYPE && ((_recordingEvent$data = recordingEvent.data) === null || _recordingEvent$data === void 0 ? void 0 : _recordingEvent$data.source) === MUTATION_SOURCE_TYPE);
5458
+ timestamp = timestamp || new Date().getTime();
5459
+
5460
+ var _this$_getSessionId = this._getSessionId(),
5461
+ _this$_getSessionId2 = _slicedToArray(_this$_getSessionId, 2),
5462
+ lastTimestamp = _this$_getSessionId2[0],
5463
+ sessionId = _this$_getSessionId2[1];
5464
+
5465
+ var windowId = this._getWindowId();
5466
+
5467
+ if (!sessionId || isUserInteraction && Math.abs(timestamp - lastTimestamp) > SESSION_CHANGE_THRESHOLD) {
5468
+ sessionId = _.UUID();
5469
+ windowId = _.UUID();
5470
+ } else if (!windowId) {
5471
+ windowId = _.UUID();
5472
+ }
5473
+
5474
+ var newTimestamp = lastTimestamp === 0 || isUserInteraction ? timestamp : lastTimestamp;
5475
+
5476
+ this._setWindowId(windowId);
5477
+
5478
+ this._setSessionId(sessionId, newTimestamp);
5479
+
5480
+ return {
5481
+ sessionId: sessionId,
5482
+ windowId: windowId
5483
+ };
5484
+ }
5485
+ }]);
5486
+
5487
+ return SessionIdManager;
5488
+ }();
5489
+
5321
5490
  /*
5322
5491
  SIMPLE STYLE GUIDE:
5323
5492
 
@@ -5481,7 +5650,7 @@ var create_mplib = function create_mplib(token, config, name) {
5481
5650
  // global debug to be true
5482
5651
 
5483
5652
 
5484
- Config.DEBUG = Config.DEBUG || instance.get_config('debug'); // if target is not defined, we called init after the lib already
5653
+ Config$1.DEBUG = Config$1.DEBUG || instance.get_config('debug'); // if target is not defined, we called init after the lib already
5485
5654
  // loaded, so there won't be an array of things to execute
5486
5655
 
5487
5656
  if (!_.isUndefined(target) && _.isArray(target)) {
@@ -5558,6 +5727,7 @@ PostHogLib.prototype._init = function (token, config, name) {
5558
5727
  this.__captureHooks = [];
5559
5728
  this.__request_queue = [];
5560
5729
  this['persistence'] = new PostHogPersistence(this['config']);
5730
+ this['_sessionIdManager'] = new SessionIdManager(this['config'], this['persistence']);
5561
5731
 
5562
5732
  this._gdpr_init();
5563
5733
 
@@ -5949,6 +6119,15 @@ PostHogLib.prototype._calculate_event_properties = function (event_name, event_p
5949
6119
  if (!_.isUndefined(start_timestamp)) {
5950
6120
  var duration_in_ms = new Date().getTime() - start_timestamp;
5951
6121
  properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3));
6122
+ }
6123
+
6124
+ if (this._sessionIdManager) {
6125
+ var _this$_sessionIdManag = this._sessionIdManager.getSessionAndWindowId(),
6126
+ sessionId = _this$_sessionIdManag.sessionId,
6127
+ windowId = _this$_sessionIdManag.windowId;
6128
+
6129
+ properties['$session_id'] = sessionId;
6130
+ properties['$window_id'] = windowId;
5952
6131
  } // note: extend writes to the first object, so lets make sure we
5953
6132
  // don't write to the persistence properties object and info
5954
6133
  // properties object by passing in a new object
@@ -6464,7 +6643,7 @@ PostHogLib.prototype.set_config = function (config) {
6464
6643
  this['config']['debug'] = true;
6465
6644
  }
6466
6645
 
6467
- Config.DEBUG = Config.DEBUG || this.get_config('debug');
6646
+ Config$1.DEBUG = Config$1.DEBUG || this.get_config('debug');
6468
6647
 
6469
6648
  if (this.sessionRecording && typeof config.disable_session_recording !== 'undefined') {
6470
6649
  if (oldConfig.disable_session_recording !== config.disable_session_recording) {
@@ -6876,7 +7055,7 @@ PostHogLib.prototype['onFeatureFlags'] = PostHogLib.prototype.onFeatureFlags;
6876
7055
  PostHogLib.prototype['decodeLZ64'] = PostHogLib.prototype.decodeLZ64;
6877
7056
  PostHogLib.prototype['SentryIntegration'] = PostHogLib.prototype.sentry_integration;
6878
7057
  PostHogLib.prototype['debug'] = PostHogLib.prototype.debug;
6879
- PostHogLib.prototype['LIB_VERSION'] = Config.LIB_VERSION;
7058
+ PostHogLib.prototype['LIB_VERSION'] = Config$1.LIB_VERSION;
6880
7059
  PostHogLib.prototype['startSessionRecording'] = PostHogLib.prototype.startSessionRecording;
6881
7060
  PostHogLib.prototype['stopSessionRecording'] = PostHogLib.prototype.stopSessionRecording;
6882
7061
  PostHogLib.prototype['sessionRecordingStarted'] = PostHogLib.prototype.sessionRecordingStarted; // PostHogPersistence Exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-js",
3
- "version": "1.16.0",
3
+ "version": "1.16.1",
4
4
  "description": "Posthog-js allows you to automatically capture usage and send events to PostHog.",
5
5
  "repository": "https://github.com/PostHog/posthog-js",
6
6
  "author": "hey@posthog.com",