posthog-js
Advanced tools
Comparing version 1.176.0 to 1.176.1
@@ -1,2 +0,2 @@ | ||
!function(){"use strict";const n="undefined"!=typeof window?window:void 0,o="undefined"!=typeof globalThis?globalThis:n,e=null==o?void 0:o.navigator,t=null==o?void 0:o.document;null==o||o.location,null==o||o.fetch,null!=o&&o.XMLHttpRequest&&"withCredentials"in new o.XMLHttpRequest&&o.XMLHttpRequest,null==o||o.AbortController,null==e||e.userAgent;const r=null!=n?n:{},i="[PostHog.js]",l={_log:function(o){if(n&&r.POSTHOG_DEBUG&&void 0!==n.console&&n.console){const r="__rrweb_original__"in n.console[o]?n.console[o].__rrweb_original__:n.console[o];for(var e=arguments.length,t=new Array(e>1?e-1:0),l=1;l<e;l++)t[l-1]=arguments[l];r(i,...t)}},info:function(){for(var n=arguments.length,o=new Array(n),e=0;e<n;e++)o[e]=arguments[e];l._log("log",...o)},warn:function(){for(var n=arguments.length,o=new Array(n),e=0;e<n;e++)o[e]=arguments[e];l._log("warn",...o)},error:function(){for(var n=arguments.length,o=new Array(n),e=0;e<n;e++)o[e]=arguments[e];l._log("error",...o)},critical:function(){for(var n=arguments.length,o=new Array(n),e=0;e<n;e++)o[e]=arguments[e];console.error(i,...o)},uninitializedWarning:n=>{l.error(`You must initialize PostHog before calling ${n}`)}},s=(n,o,e)=>{if(n.config.disable_external_dependency_loading)return l.warn(`${o} was requested but loading of external scripts is disabled.`),e("Loading of external scripts is disabled");const r=()=>{if(!t)return e("document not found");const n=t.createElement("script");n.type="text/javascript",n.crossOrigin="anonymous",n.src=o,n.onload=n=>e(void 0,n),n.onerror=n=>e(n);const r=t.querySelectorAll("body > script");var i;r.length>0?null===(i=r[0].parentNode)||void 0===i||i.insertBefore(n,r[0]):t.body.appendChild(n)};null!=t&&t.body?r():null==t||t.addEventListener("DOMContentLoaded",r)};r.__PosthogExtensions__=r.__PosthogExtensions__||{},r.__PosthogExtensions__.loadExternalDependency=(n,o,e)=>{let t=`/static/${o}.js?v=${n.version}`;if("toolbar"===o){const n=3e5;t=`${t}?&=${Math.floor(Date.now()/n)*n}`}const r=n.requestRouter.endpointFor("assets",t);s(n,r,e)},r.__PosthogExtensions__.loadSiteApp=(n,o,e)=>{const t=n.requestRouter.endpointFor("api",o);s(n,t,e)}}(); | ||
!function(){"use strict";const n="undefined"!=typeof window?window:void 0,o="undefined"!=typeof globalThis?globalThis:n,e=null==o?void 0:o.navigator,t=null==o?void 0:o.document;null==o||o.location,null==o||o.fetch,null!=o&&o.XMLHttpRequest&&"withCredentials"in new o.XMLHttpRequest&&o.XMLHttpRequest,null==o||o.AbortController,null==e||e.userAgent;const r=null!=n?n:{},i="[PostHog.js]",l={_log:function(o){if(n&&r.POSTHOG_DEBUG&&void 0!==n.console&&n.console){const r="__rrweb_original__"in n.console[o]?n.console[o].__rrweb_original__:n.console[o];for(var e=arguments.length,t=new Array(e>1?e-1:0),l=1;l<e;l++)t[l-1]=arguments[l];r(i,...t)}},info:function(){for(var n=arguments.length,o=new Array(n),e=0;e<n;e++)o[e]=arguments[e];l._log("log",...o)},warn:function(){for(var n=arguments.length,o=new Array(n),e=0;e<n;e++)o[e]=arguments[e];l._log("warn",...o)},error:function(){for(var n=arguments.length,o=new Array(n),e=0;e<n;e++)o[e]=arguments[e];l._log("error",...o)},critical:function(){for(var n=arguments.length,o=new Array(n),e=0;e<n;e++)o[e]=arguments[e];console.error(i,...o)},uninitializedWarning:n=>{l.error(`You must initialize PostHog before calling ${n}`)}},s=(n,o,e)=>{if(n.config.disable_external_dependency_loading)return l.warn(`${o} was requested but loading of external scripts is disabled.`),e("Loading of external scripts is disabled");const r=()=>{if(!t)return e("document not found");const n=t.createElement("script");n.type="text/javascript",n.crossOrigin="anonymous",n.src=o,n.onload=n=>e(void 0,n),n.onerror=n=>e(n);const r=t.querySelectorAll("body > script");var i;r.length>0?null===(i=r[0].parentNode)||void 0===i||i.insertBefore(n,r[0]):t.body.appendChild(n)};null!=t&&t.body?r():null==t||t.addEventListener("DOMContentLoaded",r)};r.__PosthogExtensions__=r.__PosthogExtensions__||{},r.__PosthogExtensions__.loadExternalDependency=(n,o,e)=>{let t=`/static/${o}.js?v=${n.version}`;if("toolbar"===o){const n=3e5;t=`${t}&t=${Math.floor(Date.now()/n)*n}`}const r=n.requestRouter.endpointFor("assets",t);s(n,r,e)},r.__PosthogExtensions__.loadSiteApp=(n,o,e)=>{const t=n.requestRouter.endpointFor("api",o);s(n,t,e)}}(); | ||
//# sourceMappingURL=external-scripts-loader.js.map |
{ | ||
"name": "posthog-js", | ||
"version": "1.176.0", | ||
"version": "1.176.1", | ||
"description": "Posthog-js allows you to automatically capture usage and send events to PostHog.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/PostHog/posthog-js", |
@@ -44,3 +44,3 @@ import { assignableWindow, document } from '../utils/globals'; | ||
var timestampToNearestFiveMinutes = Math.floor(Date.now() / fiveMinutesInMillis) * fiveMinutesInMillis; | ||
scriptUrlToLoad = "".concat(scriptUrlToLoad, "?&=").concat(timestampToNearestFiveMinutes); | ||
scriptUrlToLoad = "".concat(scriptUrlToLoad, "&t=").concat(timestampToNearestFiveMinutes); | ||
} | ||
@@ -47,0 +47,0 @@ var url = posthog.requestRouter.endpointFor('assets', scriptUrlToLoad); |
@@ -40,2 +40,9 @@ var __assign = (this && this.__assign) || function () { | ||
var CONTENT_TYPE_FORM = 'application/x-www-form-urlencoded'; | ||
var SIXTY_FOUR_KILOBYTES = 64 * 1024; | ||
/* | ||
fetch will fail if we request keepalive with a body greater than 64kb | ||
sets the threshold lower than that so that | ||
any overhead doesn't push over the threshold after checking here | ||
*/ | ||
var KEEP_ALIVE_THRESHOLD = SIXTY_FOUR_KILOBYTES * 0.8; | ||
export var extendURLParams = function (url, params) { | ||
@@ -153,3 +160,3 @@ var _a = __read(url.split('?'), 2), baseUrl = _a[0], search = _a[1]; | ||
// NB this is fetch keepalive and not http keepalive | ||
keepalive: options.method === 'POST' && (estimatedSize || 0) < 64 * 1024, | ||
keepalive: options.method === 'POST' && (estimatedSize || 0) < KEEP_ALIVE_THRESHOLD, | ||
body: body, | ||
@@ -156,0 +163,0 @@ signal: aborter === null || aborter === void 0 ? void 0 : aborter.signal, |
import { isNumber } from './type-utils'; | ||
import { logger } from './logger'; | ||
export function clampToRange(value, min, max, label) { | ||
if (min > max) { | ||
logger.warn('min cannot be greater than max.'); | ||
min = max; | ||
} | ||
if (!isNumber(value)) { | ||
@@ -5,0 +9,0 @@ label && logger.warn(label + ' must be a number. Defaulting to max value:' + max); |
{ | ||
"name": "posthog-js", | ||
"version": "1.176.0", | ||
"version": "1.176.1", | ||
"description": "Posthog-js allows you to automatically capture usage and send events to PostHog.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/PostHog/posthog-js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18161546
39970