posthog-js 1.19.0 → 1.19.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 +4 -0
- package/dist/array.js +4 -4
- package/dist/es.js +37 -2
- package/dist/module.js +37 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
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.19.
|
|
4
|
+
module.exports={name:"posthog-js",version:"1.19.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:"^9.2.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:"^27.5.1",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.1.2",sinon:"9.0.2",testcafe:"^1.17.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,testEnvironment:"jsdom"}};
|
|
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) {
|
|
@@ -25,9 +25,9 @@ module.exports={name:"posthog-js",version:"1.19.0",description:"Posthog-js allow
|
|
|
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_SERVER_SIDE=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",_="__mpr",a="__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 d="__timers";exports.EVENT_TIMERS_KEY=d;var f="$session_recording_enabled_server_side";exports.SESSION_RECORDING_ENABLED_SERVER_SIDE=f;var m="$sesid";exports.SESSION_ID=m;var l="$enabled_feature_flags",E=[s,o,i,p,n,_,a,c,h,u,d,f,m,l],y=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.logger.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=y,y.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(E,o)||(t[o]=s)}),t},y.prototype.load=function(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=e._.extend({},t))}},y.prototype.save=function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure)},y.prototype.remove=function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)},y.prototype.clear=function(){this.remove(),this.props={}},y.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)},y.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)},y.prototype.unregister=function(e){e in this.props&&(delete this.props[e],this.save())},y.prototype.update_campaign_params=function(){this.campaign_params_saved||(this.register(e._.info.campaignParams()),this.campaign_params_saved=!0)},y.prototype.update_search_keyword=function(t){this.register(e._.info.searchInfo(t))},y.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"})},y.prototype.get_referrer_info=function(){return e._.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},y.prototype.safe_merge=function(t){return e._.each(this.props,function(e,r){r in t||(t[r]=e)}),t},y.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)},y.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},y.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},y.prototype.get_cross_subdomain=function(){return this.cross_subdomain},y.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},y.prototype.set_event_timer=function(e,t){var r=this.props[d]||{};r[e]=t,this.props[d]=r,this.save()},y.prototype.remove_event_timer=function(t){var r=(this.props[d]||{})[t];return e._.isUndefined(r)||(delete this.props[d][t],this.save()),r};
|
|
27
27
|
},{"./utils":"FOZT","./storage":"KZ7Y"}],"vmk3":[function(require,module,exports) {
|
|
28
|
-
"use strict";
|
|
29
|
-
},{}],"Z2N4":[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"),
|
|
28
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.filterDataURLsFromLargeDataObjects=l,exports.truncateLargeConsoleLogs=u,exports.CONSOLE_LOG_PLUGIN_NAME=exports.replacementImageURI=void 0;var t=require("./sessionrecording");function a(t,a){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=e(t))||a&&t&&"number"==typeof t.length){r&&(t=r);var o=0,n=function(){};return{s:n,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:n}}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 l,i=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return i=t.done,t},e:function(t){u=!0,l=t},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw l}}}}function e(t,a){if(t){if("string"==typeof t)return r(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?r(t,a):void 0}}function r(t,a){(null==a||a>t.length)&&(a=t.length);for(var e=0,r=new Array(a);e<a;e++)r[e]=t[e];return r}function o(t){return(o="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)}var n="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJibGFjayIvPgo8cGF0aCBkPSJNOCAwSDE2TDAgMTZWOEw4IDBaIiBmaWxsPSIjMkQyRDJEIi8+CjxwYXRoIGQ9Ik0xNiA4VjE2SDhMMTYgOFoiIGZpbGw9IiMyRDJEMkQiLz4KPC9zdmc+Cg==";function l(t){if(t&&"object"===o(t)){var e=JSON.stringify(t);if(e.length>5e6){var r,l=a(e.matchAll(/data:([\w\/\-\.]+);(\w+),([^)"]*)/gim));try{for(l.s();!(r=l.n()).done;){var i=r.value;e="image/"===i[1].toLocaleLowerCase().slice(0,6)?e.replace(i[0],n):e.replace(i[0],"")}}catch(u){l.e(u)}finally{l.f()}}return JSON.parse(e)}return t}exports.replacementImageURI=n;var i="rrweb/console@1";function u(a){if(a&&"object"===o(a)&&a.type===t.PLUGIN_EVENT_TYPE&&"object"===o(a.data)&&a.data.plugin===i){a.data.payload.payload.length>10&&(a.data.payload.payload=a.data.payload.payload.slice(0,10),a.data.payload.payload.push("...[truncated]"));for(var e=[],r=0;r<a.data.payload.payload.length;r++)a.data.payload.payload[r].length>2e3?e.push(a.data.payload.payload[r].slice(0,2e3)+"...[truncated]"):e.push(a.data.payload.payload[r]);return a.data.payload.payload=e,a}return a}exports.CONSOLE_LOG_PLUGIN_NAME=i;
|
|
29
|
+
},{"./sessionrecording":"Z2N4"}],"Z2N4":[function(require,module,exports) {
|
|
30
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SessionRecording=exports.PLUGIN_EVENT_TYPE=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"),r=require("../posthog-persistence"),n=s(require("../config")),i=require("./sessionrecording-utils");function s(e){return e&&e.__esModule?e:{default:e}}function o(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 a(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){f(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 c(e,t){return h(e)||l(e,t)||d(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 d(e,t){if(e){if("string"==typeof e)return p(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)?p(e,t):void 0}}function p(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("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 f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(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 g(e,t,r){return t&&b(e.prototype,t),r&&b(e,r),e}var w="/e/",E=2;exports.FULL_SNAPSHOT_EVENT_TYPE=E;var v=4;exports.META_EVENT_TYPE=v;var S=3;exports.INCREMENTAL_SNAPSHOT_EVENT_TYPE=S;var y=3;exports.MUTATION_SOURCE_TYPE=y;var O=6;exports.PLUGIN_EVENT_TYPE=O;var R=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,this.receivedDecide=!1}return g(s,[{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled()?this.startCaptureAndTrySendingQueuedSnapshots():this.stopRecording()}},{key:"started",value:function(){return this.captureStarted}},{key:"stopRecording",value:function(){this.captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=null,this.captureStarted=!1)}},{key:"isRecordingEnabled",value:function(){var e=!!this.instance.get_property(r.SESSION_RECORDING_ENABLED_SERVER_SIDE),t=!this.instance.get_config("disable_session_recording");return e&&t}},{key:"afterDecideResponse",value:function(e){var t,n;(this.receivedDecide=!0,this.instance.persistence&&this.instance.persistence.register(f({},r.SESSION_RECORDING_ENABLED_SERVER_SIDE,!!e.sessionRecording)),null===(t=e.sessionRecording)||void 0===t?void 0:t.endpoint)&&(this.endpoint=null===(n=e.sessionRecording)||void 0===n?void 0:n.endpoint);this.startRecordingIfEnabled()}},{key:"startCaptureAndTrySendingQueuedSnapshots",value:function(){var e=this;this.receivedDecide&&(this.emit=!0,this.snapshots.forEach(function(t){return e._captureSnapshot(t)})),this._startCapture()}},{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="+n.default.LIB_VERSION,t._.bind(this._onScriptLoaded,this))))}},{key:"_updateWindowAndSessionIds",value:function(e){var t=this.instance.sessionManager.getSessionAndWindowId(e.timestamp||(new Date).getTime(),e),r=t.windowId,n=t.sessionId;this.windowId===r&&this.sessionId===n||-1!==[E,v].indexOf(e.type)||this.rrwebRecord.takeFullSnapshot(),this.windowId=r,this.sessionId=n}},{key:"_onScriptLoaded",value:function(){var e=this,t={blockClass:"ph-no-capture",blockSelector:null,ignoreClass:"ph-ignore-input",maskAllInputs:!1,maskInputOptions:{},maskInputFn:null,slimDOMOptions:{},collectFonts:!1};this.rrwebRecord=window.rrweb?window.rrweb.record:window.rrwebRecord;for(var r=this.instance.get_config("session_recording"),n=0,s=Object.entries(r||{});n<s.length;n++){var o=c(s[n],2),u=o[0],d=o[1];u in t&&(t[u]=d)}this.stopRrweb=this.rrwebRecord(a({emit:function(t){t=(0,i.truncateLargeConsoleLogs)((0,i.filterDataURLsFromLargeDataObjects)(t)),e._updateWindowAndSessionIds(t);var r={$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(r):e.snapshots.push(r)},plugins:window.rrwebConsoleRecord&&this.instance.get_config("enable_recording_console_log")?[window.rrwebConsoleRecord.getRecordConsolePlugin()]:[]},t)),this.instance._addCaptureHook(function(t){"$pageview"===t&&e.rrwebRecord.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===E}})}}]),s}();exports.SessionRecording=R;
|
|
31
31
|
},{"../autocapture-utils":"RYfg","../utils":"FOZT","../posthog-persistence":"MAdm","../config":"itQ5","./sessionrecording-utils":"vmk3"}],"auG7":[function(require,module,exports) {
|
|
32
32
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Decide=void 0;var e=require("./autocapture"),t=require("./utils");function n(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=r(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},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 r(e,t){if(e){if("string"==typeof e)return i(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)?i(e,t):void 0}}function i(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 o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(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 a(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),e}var c=function(){function r(e){o(this,r),this.instance=e,this.instance.decideEndpointWasHit=!1}return a(r,[{key:"call",value:function(){var e=this,n=JSON.stringify({token:this.instance.get_config("token"),distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups()}),r=t._.base64Encode(n);this.instance._send_request("".concat(this.instance.get_config("api_host"),"/decide/?v=2"),{data:r,verbose:!0},{method:"POST"},function(t){return e.parseDecideResponse(t)})}},{key:"parseDecideResponse",value:function(t){var r=this;if(0!==(null==t?void 0:t.status)){if(this.instance.decideEndpointWasHit=!0,!document||!document.body)return console.log("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){r.parseDecideResponse(t)},500);if(this.instance.toolbar.afterDecideResponse(t),this.instance.sessionRecording.afterDecideResponse(t),e.autocapture.afterDecideResponse(t,this.instance),this.instance.featureFlags.receivedFeatureFlags(t),t.supportedCompression){var i,o={},s=n(t.supportedCompression);try{for(s.s();!(i=s.n()).done;){o[i.value]=!0}}catch(a){s.e(a)}finally{s.f()}this.instance.compression=o}else this.instance.compression={}}else console.error("Failed to fetch feature flags from PostHog.")}}]),r}();exports.Decide=c;
|
|
33
33
|
},{"./autocapture":"gR3r","./utils":"FOZT"}],"ZEpJ":[function(require,module,exports) {
|
package/dist/es.js
CHANGED
|
@@ -863,7 +863,7 @@ var LZString = {
|
|
|
863
863
|
}
|
|
864
864
|
};
|
|
865
865
|
|
|
866
|
-
var version = "1.19.
|
|
866
|
+
var version = "1.19.1";
|
|
867
867
|
|
|
868
868
|
var Config$1 = {
|
|
869
869
|
DEBUG: false,
|
|
@@ -3723,12 +3723,47 @@ function filterDataURLsFromLargeDataObjects(data) {
|
|
|
3723
3723
|
|
|
3724
3724
|
return data;
|
|
3725
3725
|
}
|
|
3726
|
+
var CONSOLE_LOG_PLUGIN_NAME = 'rrweb/console@1'; // The name of the rr-web plugin that emits console logs
|
|
3727
|
+
// Console logs can be really large. This function truncates large logs
|
|
3728
|
+
// It's a simple function that just truncates long strings.
|
|
3729
|
+
// TODO: Ideally this function would have better handling of objects + lists,
|
|
3730
|
+
// so they could still be rendered in a pretty way after truncation.
|
|
3731
|
+
|
|
3732
|
+
function truncateLargeConsoleLogs(event) {
|
|
3733
|
+
var MAX_STRING_SIZE = 2000; // Maximum number of characters allowed in a string
|
|
3734
|
+
|
|
3735
|
+
var MAX_STRINGS_PER_LOG = 10; // A log can consist of multiple strings (e.g. consol.log('string1', 'string2'))
|
|
3736
|
+
|
|
3737
|
+
if (event && _typeof(event) === 'object' && event.type === PLUGIN_EVENT_TYPE && _typeof(event.data) === 'object' && event.data.plugin === CONSOLE_LOG_PLUGIN_NAME) {
|
|
3738
|
+
// Note: event.data.payload.payload comes from rr-web, and is an array of strings
|
|
3739
|
+
if (event.data.payload.payload.length > MAX_STRINGS_PER_LOG) {
|
|
3740
|
+
event.data.payload.payload = event.data.payload.payload.slice(0, MAX_STRINGS_PER_LOG);
|
|
3741
|
+
event.data.payload.payload.push('...[truncated]');
|
|
3742
|
+
}
|
|
3743
|
+
|
|
3744
|
+
var updatedPayload = [];
|
|
3745
|
+
|
|
3746
|
+
for (var i = 0; i < event.data.payload.payload.length; i++) {
|
|
3747
|
+
if (event.data.payload.payload[i].length > MAX_STRING_SIZE) {
|
|
3748
|
+
updatedPayload.push(event.data.payload.payload[i].slice(0, MAX_STRING_SIZE) + '...[truncated]');
|
|
3749
|
+
} else {
|
|
3750
|
+
updatedPayload.push(event.data.payload.payload[i]);
|
|
3751
|
+
}
|
|
3752
|
+
}
|
|
3753
|
+
|
|
3754
|
+
event.data.payload.payload = updatedPayload;
|
|
3755
|
+
return event;
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3758
|
+
return event;
|
|
3759
|
+
}
|
|
3726
3760
|
|
|
3727
3761
|
var BASE_ENDPOINT = '/e/';
|
|
3728
3762
|
var FULL_SNAPSHOT_EVENT_TYPE = 2;
|
|
3729
3763
|
var META_EVENT_TYPE = 4;
|
|
3730
3764
|
var INCREMENTAL_SNAPSHOT_EVENT_TYPE = 3;
|
|
3731
3765
|
var MUTATION_SOURCE_TYPE = 3;
|
|
3766
|
+
var PLUGIN_EVENT_TYPE = 6;
|
|
3732
3767
|
var SessionRecording = /*#__PURE__*/function () {
|
|
3733
3768
|
function SessionRecording(instance) {
|
|
3734
3769
|
_classCallCheck(this, SessionRecording);
|
|
@@ -3880,7 +3915,7 @@ var SessionRecording = /*#__PURE__*/function () {
|
|
|
3880
3915
|
|
|
3881
3916
|
this.stopRrweb = this.rrwebRecord(_objectSpread2({
|
|
3882
3917
|
emit: function emit(event) {
|
|
3883
|
-
event = filterDataURLsFromLargeDataObjects(event);
|
|
3918
|
+
event = truncateLargeConsoleLogs(filterDataURLsFromLargeDataObjects(event));
|
|
3884
3919
|
|
|
3885
3920
|
_this2._updateWindowAndSessionIds(event);
|
|
3886
3921
|
|
package/dist/module.js
CHANGED
|
@@ -865,7 +865,7 @@ var LZString = {
|
|
|
865
865
|
}
|
|
866
866
|
};
|
|
867
867
|
|
|
868
|
-
var version = "1.19.
|
|
868
|
+
var version = "1.19.1";
|
|
869
869
|
|
|
870
870
|
var Config$1 = {
|
|
871
871
|
DEBUG: false,
|
|
@@ -3725,12 +3725,47 @@ function filterDataURLsFromLargeDataObjects(data) {
|
|
|
3725
3725
|
|
|
3726
3726
|
return data;
|
|
3727
3727
|
}
|
|
3728
|
+
var CONSOLE_LOG_PLUGIN_NAME = 'rrweb/console@1'; // The name of the rr-web plugin that emits console logs
|
|
3729
|
+
// Console logs can be really large. This function truncates large logs
|
|
3730
|
+
// It's a simple function that just truncates long strings.
|
|
3731
|
+
// TODO: Ideally this function would have better handling of objects + lists,
|
|
3732
|
+
// so they could still be rendered in a pretty way after truncation.
|
|
3733
|
+
|
|
3734
|
+
function truncateLargeConsoleLogs(event) {
|
|
3735
|
+
var MAX_STRING_SIZE = 2000; // Maximum number of characters allowed in a string
|
|
3736
|
+
|
|
3737
|
+
var MAX_STRINGS_PER_LOG = 10; // A log can consist of multiple strings (e.g. consol.log('string1', 'string2'))
|
|
3738
|
+
|
|
3739
|
+
if (event && _typeof(event) === 'object' && event.type === PLUGIN_EVENT_TYPE && _typeof(event.data) === 'object' && event.data.plugin === CONSOLE_LOG_PLUGIN_NAME) {
|
|
3740
|
+
// Note: event.data.payload.payload comes from rr-web, and is an array of strings
|
|
3741
|
+
if (event.data.payload.payload.length > MAX_STRINGS_PER_LOG) {
|
|
3742
|
+
event.data.payload.payload = event.data.payload.payload.slice(0, MAX_STRINGS_PER_LOG);
|
|
3743
|
+
event.data.payload.payload.push('...[truncated]');
|
|
3744
|
+
}
|
|
3745
|
+
|
|
3746
|
+
var updatedPayload = [];
|
|
3747
|
+
|
|
3748
|
+
for (var i = 0; i < event.data.payload.payload.length; i++) {
|
|
3749
|
+
if (event.data.payload.payload[i].length > MAX_STRING_SIZE) {
|
|
3750
|
+
updatedPayload.push(event.data.payload.payload[i].slice(0, MAX_STRING_SIZE) + '...[truncated]');
|
|
3751
|
+
} else {
|
|
3752
|
+
updatedPayload.push(event.data.payload.payload[i]);
|
|
3753
|
+
}
|
|
3754
|
+
}
|
|
3755
|
+
|
|
3756
|
+
event.data.payload.payload = updatedPayload;
|
|
3757
|
+
return event;
|
|
3758
|
+
}
|
|
3759
|
+
|
|
3760
|
+
return event;
|
|
3761
|
+
}
|
|
3728
3762
|
|
|
3729
3763
|
var BASE_ENDPOINT = '/e/';
|
|
3730
3764
|
var FULL_SNAPSHOT_EVENT_TYPE = 2;
|
|
3731
3765
|
var META_EVENT_TYPE = 4;
|
|
3732
3766
|
var INCREMENTAL_SNAPSHOT_EVENT_TYPE = 3;
|
|
3733
3767
|
var MUTATION_SOURCE_TYPE = 3;
|
|
3768
|
+
var PLUGIN_EVENT_TYPE = 6;
|
|
3734
3769
|
var SessionRecording = /*#__PURE__*/function () {
|
|
3735
3770
|
function SessionRecording(instance) {
|
|
3736
3771
|
_classCallCheck(this, SessionRecording);
|
|
@@ -3882,7 +3917,7 @@ var SessionRecording = /*#__PURE__*/function () {
|
|
|
3882
3917
|
|
|
3883
3918
|
this.stopRrweb = this.rrwebRecord(_objectSpread2({
|
|
3884
3919
|
emit: function emit(event) {
|
|
3885
|
-
event = filterDataURLsFromLargeDataObjects(event);
|
|
3920
|
+
event = truncateLargeConsoleLogs(filterDataURLsFromLargeDataObjects(event));
|
|
3886
3921
|
|
|
3887
3922
|
_this2._updateWindowAndSessionIds(event);
|
|
3888
3923
|
|
package/package.json
CHANGED