posthog-js
Advanced tools
Comparing version 1.161.3 to 1.161.4
@@ -37,2 +37,3 @@ export declare const PEOPLE_DISTINCT_ID_KEY = "$people_distinct_id"; | ||
export declare const TOOLBAR_ID = "__POSTHOG_TOOLBAR__"; | ||
export declare const WEB_EXPERIMENTS = "$web_experiments"; | ||
export declare const PERSISTENCE_RESERVED_PROPERTIES: string[]; |
@@ -22,2 +22,3 @@ import { PostHogFeatureFlags } from './posthog-featureflags'; | ||
import { WebVitalsAutocapture } from './extensions/web-vitals'; | ||
import { WebExperiments } from './web-experiments'; | ||
import { PostHogExceptions } from './posthog-exceptions'; | ||
@@ -44,2 +45,3 @@ type OnlyValidKeys<T, Shape> = T extends Shape ? (Exclude<keyof T, keyof Shape> extends never ? T : never) : never; | ||
surveys: PostHogSurveys; | ||
experiments: WebExperiments; | ||
toolbar: Toolbar; | ||
@@ -46,0 +48,0 @@ exceptions: PostHogExceptions; |
@@ -138,2 +138,3 @@ import type { MaskInputOptions, SlimDOMOptions } from 'rrweb-snapshot'; | ||
disable_surveys: boolean; | ||
disable_web_experiments: boolean; | ||
/** If set, posthog-js will never load external scripts such as those needed for Session Replay or Surveys. */ | ||
@@ -372,5 +373,6 @@ disable_external_dependency_loading?: boolean; | ||
export type SnippetArrayItem = [method: string, ...args: any[]]; | ||
export type JsonType = string | number | boolean | null | { | ||
export type JsonRecord = { | ||
[key: string]: JsonType; | ||
} | Array<JsonType>; | ||
}; | ||
export type JsonType = string | number | boolean | null | JsonRecord | Array<JsonType>; | ||
/** A feature that isn't publicly available yet.*/ | ||
@@ -377,0 +379,0 @@ export interface EarlyAccessFeature { |
{ | ||
"name": "posthog-js", | ||
"version": "1.161.3", | ||
"version": "1.161.4", | ||
"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", |
@@ -37,2 +37,3 @@ export declare const PEOPLE_DISTINCT_ID_KEY = "$people_distinct_id"; | ||
export declare const TOOLBAR_ID = "__POSTHOG_TOOLBAR__"; | ||
export declare const WEB_EXPERIMENTS = "$web_experiments"; | ||
export declare const PERSISTENCE_RESERVED_PROPERTIES: string[]; |
@@ -42,2 +42,3 @@ /* | ||
export var TOOLBAR_ID = '__POSTHOG_TOOLBAR__'; | ||
export var WEB_EXPERIMENTS = '$web_experiments'; | ||
// These are properties that are reserved and will not be automatically included in events | ||
@@ -44,0 +45,0 @@ export var PERSISTENCE_RESERVED_PROPERTIES = [ |
@@ -22,2 +22,3 @@ import { PostHogFeatureFlags } from './posthog-featureflags'; | ||
import { WebVitalsAutocapture } from './extensions/web-vitals'; | ||
import { WebExperiments } from './web-experiments'; | ||
import { PostHogExceptions } from './posthog-exceptions'; | ||
@@ -44,2 +45,3 @@ type OnlyValidKeys<T, Shape> = T extends Shape ? (Exclude<keyof T, keyof Shape> extends never ? T : never) : never; | ||
surveys: PostHogSurveys; | ||
experiments: WebExperiments; | ||
toolbar: Toolbar; | ||
@@ -46,0 +48,0 @@ exceptions: PostHogExceptions; |
@@ -33,3 +33,3 @@ var __assign = (this && this.__assign) || function () { | ||
import { logger } from './utils/logger'; | ||
import { fetch, XMLHttpRequest, AbortController, navigator } from './utils/globals'; | ||
import { AbortController, fetch, navigator, XMLHttpRequest } from './utils/globals'; | ||
import { gzipSync, strToU8 } from 'fflate'; | ||
@@ -62,5 +62,7 @@ // eslint-disable-next-line compat/compat | ||
var gzipData = gzipSync(strToU8(JSON.stringify(data)), { mtime: 0 }); | ||
var blob = new Blob([gzipData], { type: CONTENT_TYPE_PLAIN }); | ||
return { | ||
contentType: CONTENT_TYPE_PLAIN, | ||
body: new Blob([gzipData], { type: CONTENT_TYPE_PLAIN }), | ||
body: blob, | ||
estimatedSize: blob.size, | ||
}; | ||
@@ -70,10 +72,14 @@ } | ||
var b64data = _base64Encode(JSON.stringify(data)); | ||
var encodedBody = encodeToDataString(b64data); | ||
return { | ||
contentType: CONTENT_TYPE_FORM, | ||
body: encodeToDataString(b64data), | ||
body: encodedBody, | ||
estimatedSize: new Blob([encodedBody]).size, | ||
}; | ||
} | ||
var jsonBody = JSON.stringify(data); | ||
return { | ||
contentType: CONTENT_TYPE_JSON, | ||
body: JSON.stringify(data), | ||
body: jsonBody, | ||
estimatedSize: new Blob([jsonBody]).size, | ||
}; | ||
@@ -121,3 +127,3 @@ }; | ||
var _a; | ||
var _b = (_a = encodePostData(options)) !== null && _a !== void 0 ? _a : {}, contentType = _b.contentType, body = _b.body; | ||
var _b = (_a = encodePostData(options)) !== null && _a !== void 0 ? _a : {}, contentType = _b.contentType, body = _b.body, estimatedSize = _b.estimatedSize; | ||
// eslint-disable-next-line compat/compat | ||
@@ -143,3 +149,10 @@ var headers = new Headers(); | ||
headers: headers, | ||
keepalive: options.method === 'POST', | ||
// if body is greater than 64kb, then fetch with keepalive will error | ||
// see 8:10:5 at https://fetch.spec.whatwg.org/#http-network-or-cache-fetch, | ||
// but we do want to set keepalive sometimes as it can help with success | ||
// when e.g. a page is being closed | ||
// so let's get the best of both worlds and only set keepalive for POST requests | ||
// where the body is less than 64kb | ||
// NB this is fetch keepalive and not http keepalive | ||
keepalive: options.method === 'POST' && (estimatedSize || 0) < 64 * 1024, | ||
body: body, | ||
@@ -146,0 +159,0 @@ signal: aborter === null || aborter === void 0 ? void 0 : aborter.signal, |
@@ -138,2 +138,3 @@ import type { MaskInputOptions, SlimDOMOptions } from 'rrweb-snapshot'; | ||
disable_surveys: boolean; | ||
disable_web_experiments: boolean; | ||
/** If set, posthog-js will never load external scripts such as those needed for Session Replay or Surveys. */ | ||
@@ -372,5 +373,6 @@ disable_external_dependency_loading?: boolean; | ||
export type SnippetArrayItem = [method: string, ...args: any[]]; | ||
export type JsonType = string | number | boolean | null | { | ||
export type JsonRecord = { | ||
[key: string]: JsonType; | ||
} | Array<JsonType>; | ||
}; | ||
export type JsonType = string | number | boolean | null | JsonRecord | Array<JsonType>; | ||
/** A feature that isn't publicly available yet.*/ | ||
@@ -377,0 +379,0 @@ export interface EarlyAccessFeature { |
{ | ||
"name": "posthog-js", | ||
"version": "1.161.3", | ||
"version": "1.161.4", | ||
"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 not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
8149124
358
26476