posthog-js 1.161.3 → 1.161.4

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/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-js",
3
- "version": "1.161.3",
3
+ "version": "1.161.4",
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",
@@ -34,4 +34,5 @@ export declare const INITIAL_REFERRER_INFO = "$initial_referrer_info";
34
34
  export declare const INITIAL_PERSON_INFO = "$initial_person_info";
35
35
  export declare const ENABLE_PERSON_PROCESSING = "$epp";
36
36
  export declare const TOOLBAR_ID = "__POSTHOG_TOOLBAR__";
37
+ export declare const WEB_EXPERIMENTS = "$web_experiments";
37
38
  export declare const PERSISTENCE_RESERVED_PROPERTIES: string[];
@@ -39,6 +39,7 @@ export var INITIAL_REFERRER_INFO = '$initial_referrer_info';
39
39
  export var INITIAL_PERSON_INFO = '$initial_person_info';
40
40
  export var ENABLE_PERSON_PROCESSING = '$epp';
41
41
  export var TOOLBAR_ID = '__POSTHOG_TOOLBAR__';
42
+ export var WEB_EXPERIMENTS = '$web_experiments';
42
43
  // These are properties that are reserved and will not be automatically included in events
43
44
  export var PERSISTENCE_RESERVED_PROPERTIES = [
44
45
  PEOPLE_DISTINCT_ID_KEY,
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,mBAAmB;AAEnB,0FAA0F;AAC1F,MAAM,CAAC,IAAM,sBAAsB,GAAG,qBAAqB,CAAA;AAC3D,MAAM,CAAC,IAAM,WAAW,GAAG,aAAa,CAAA;AACxC,MAAM,CAAC,IAAM,YAAY,GAAG,SAAS,CAAA;AACrC,MAAM,CAAC,IAAM,gBAAgB,GAAG,SAAS,CAAA;AACzC,MAAM,CAAC,IAAM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B,CAAA;AAC3D,MAAM,CAAC,IAAM,kBAAkB,GAAG,qBAAqB,CAAA;AAEvD,kHAAkH;AAClH,MAAM,CAAC,IAAM,uBAAuB,GAAG,0BAA0B,CAAA;AACjE,kHAAkH;AAClH,MAAM,CAAC,IAAM,qBAAqB,GAAG,wBAAwB,CAAA;AAC7D,MAAM,CAAC,IAAM,mBAAmB,GAAG,sBAAsB,CAAA;AACzD,MAAM,CAAC,IAAM,wBAAwB,GAAG,MAAM,CAAA;AAC9C,MAAM,CAAC,IAAM,UAAU,GAAG,qBAAqB,CAAA;AAE/C,0FAA0F;AAC1F,MAAM,CAAC,IAAM,+BAA+B,GAAG;IAC3C,sBAAsB;IACtB,YAAY;IACZ,gBAAgB;IAChB,gBAAgB;IAChB,qCAAqC;IACrC,4BAA4B;IAC5B,UAAU;IACV,qBAAqB;IACrB,UAAU;IACV,iCAAiC;IACjC,2BAA2B;IAC3B,4BAA4B;IAC5B,OAAO;IACP,kBAAkB;IAClB,oBAAoB;IACpB,kBAAkB;IAClB,uBAAuB;IACvB,qBAAqB;IACrB,wBAAwB;CAC3B,CAAA","sourcesContent":["/*\n * Constants\n */\n\n/* PROPERTY KEYS */\n\n// This key is deprecated, but we want to check for it to see whether aliasing is allowed.\nexport const PEOPLE_DISTINCT_ID_KEY = '$people_distinct_id'\nexport const DISTINCT_ID = 'distinct_id'\nexport const ALIAS_ID_KEY = '__alias'\nexport const CAMPAIGN_IDS_KEY = '__cmpns'\nexport const EVENT_TIMERS_KEY = '__timers'\nexport const AUTOCAPTURE_DISABLED_SERVER_SIDE = '$autocapture_disabled_server_side'\nexport const HEATMAPS_ENABLED_SERVER_SIDE = '$heatmaps_enabled_server_side'\nexport const EXCEPTION_CAPTURE_ENABLED_SERVER_SIDE = '$exception_capture_enabled_server_side'\nexport const EXCEPTION_CAPTURE_ENDPOINT_SUFFIX = '$exception_capture_endpoint_suffix'\nexport const WEB_VITALS_ENABLED_SERVER_SIDE = '$web_vitals_enabled_server_side'\nexport const WEB_VITALS_ALLOWED_METRICS = '$web_vitals_allowed_metrics'\nexport const SESSION_RECORDING_ENABLED_SERVER_SIDE = '$session_recording_enabled_server_side'\nexport const CONSOLE_LOG_RECORDING_ENABLED_SERVER_SIDE = '$console_log_recording_enabled_server_side'\nexport const SESSION_RECORDING_NETWORK_PAYLOAD_CAPTURE = '$session_recording_network_payload_capture'\nexport const SESSION_RECORDING_CANVAS_RECORDING = '$session_recording_canvas_recording'\nexport const SESSION_RECORDING_SAMPLE_RATE = '$replay_sample_rate'\nexport const SESSION_RECORDING_MINIMUM_DURATION = '$replay_minimum_duration'\nexport const SESSION_ID = '$sesid'\nexport const SESSION_RECORDING_IS_SAMPLED = '$session_is_sampled'\nexport const ENABLED_FEATURE_FLAGS = '$enabled_feature_flags'\nexport const PERSISTENCE_EARLY_ACCESS_FEATURES = '$early_access_features'\nexport const STORED_PERSON_PROPERTIES_KEY = '$stored_person_properties'\nexport const STORED_GROUP_PROPERTIES_KEY = '$stored_group_properties'\nexport const SURVEYS = '$surveys'\nexport const SURVEYS_ACTIVATED = '$surveys_activated'\nexport const FLAG_CALL_REPORTED = '$flag_call_reported'\nexport const USER_STATE = '$user_state'\nexport const CLIENT_SESSION_PROPS = '$client_session_props'\nexport const CAPTURE_RATE_LIMIT = '$capture_rate_limit'\n\n/** @deprecated Delete this when INITIAL_PERSON_INFO has been around for long enough to ignore backwards compat */\nexport const INITIAL_CAMPAIGN_PARAMS = '$initial_campaign_params'\n/** @deprecated Delete this when INITIAL_PERSON_INFO has been around for long enough to ignore backwards compat */\nexport const INITIAL_REFERRER_INFO = '$initial_referrer_info'\nexport const INITIAL_PERSON_INFO = '$initial_person_info'\nexport const ENABLE_PERSON_PROCESSING = '$epp'\nexport const TOOLBAR_ID = '__POSTHOG_TOOLBAR__'\n\n// These are properties that are reserved and will not be automatically included in events\nexport const PERSISTENCE_RESERVED_PROPERTIES = [\n PEOPLE_DISTINCT_ID_KEY,\n ALIAS_ID_KEY,\n CAMPAIGN_IDS_KEY,\n EVENT_TIMERS_KEY,\n SESSION_RECORDING_ENABLED_SERVER_SIDE,\n HEATMAPS_ENABLED_SERVER_SIDE,\n SESSION_ID,\n ENABLED_FEATURE_FLAGS,\n USER_STATE,\n PERSISTENCE_EARLY_ACCESS_FEATURES,\n STORED_GROUP_PROPERTIES_KEY,\n STORED_PERSON_PROPERTIES_KEY,\n SURVEYS,\n FLAG_CALL_REPORTED,\n CLIENT_SESSION_PROPS,\n CAPTURE_RATE_LIMIT,\n INITIAL_CAMPAIGN_PARAMS,\n INITIAL_REFERRER_INFO,\n ENABLE_PERSON_PROCESSING,\n]\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,mBAAmB;AAEnB,0FAA0F;AAC1F,MAAM,CAAC,IAAM,sBAAsB,GAAG,qBAAqB,CAAA;AAC3D,MAAM,CAAC,IAAM,WAAW,GAAG,aAAa,CAAA;AACxC,MAAM,CAAC,IAAM,YAAY,GAAG,SAAS,CAAA;AACrC,MAAM,CAAC,IAAM,gBAAgB,GAAG,SAAS,CAAA;AACzC,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAU,CAAA;AAC1C,MAAM,CAAC,IAAM,gCAAgC,GAAG,mCAAmC,CAAA;AACnF,MAAM,CAAC,IAAM,4BAA4B,GAAG,+BAA+B,CAAA;AAC3E,MAAM,CAAC,IAAM,qCAAqC,GAAG,wCAAwC,CAAA;AAC7F,MAAM,CAAC,IAAM,iCAAiC,GAAG,oCAAoC,CAAA;AACrF,MAAM,CAAC,IAAM,8BAA8B,GAAG,iCAAiC,CAAA;AAC/E,MAAM,CAAC,IAAM,0BAA0B,GAAG,6BAA6B,CAAA;AACvE,MAAM,CAAC,IAAM,qCAAqC,GAAG,wCAAwC,CAAA;AAC7F,MAAM,CAAC,IAAM,yCAAyC,GAAG,4CAA4C,CAAA;AACrG,MAAM,CAAC,IAAM,yCAAyC,GAAG,4CAA4C,CA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ChB,gBAAgB;IAChB,qCAAqC;IACrC,4BAA4B;IAC5B,UAAU;IACV,qBAAqB;IACrB,UAAU;IACV,iCAAiC;IACjC,2BAA2B;IAC3B,4BAA4B;IAC5B,OAAO;IACP,kBAAkB;IAClB,oBAAoB;IACpB,kBAAkB;IAClB,uBAAuB;IACvB,qBAAqB;IACrB,wBAAwB;CAC3B,CAAA","sourcesContent":["/*\n * Constants\n */\n\n/* PROPERTY KEYS */\n\n// This key is deprecated, but we want to check for it to see whether aliasing is allowed.\nexport const PEOPLE_DISTINCT_ID_KEY = '$people_distinct_id'\nexport const DISTINCT_ID = 'distinct_id'\nexport const ALIAS_ID_KEY = '__alias'\nexport const CAMPAIGN_IDS_KEY = '__cmpns'\nexport const EVENT_TIMERS_KEY = '__timers'\nexport const AUTOCAPTURE_DISABLED_SERVER_SIDE = '$autocapture_disabled_server_side'\nexport const HEATMAPS_ENABLED_SERVER_SIDE = '$heatmaps_enabled_server_side'\nexport const EXCEPTION_CAPTURE_ENABLED_SERVER_SIDE = '$exception_capture_enabled_server_side'\nexport const EXCEPTION_CAPTURE_ENDPOINT_SUFFIX = '$exception_capture_endpoint_suffix'\nexport const WEB_VITALS_ENABLED_SERVER_SIDE = '$web_vitals_enabled_server_side'\nexport const WEB_VITALS_ALLOWED_METRICS = '$web_vitals_allowed_metrics'\nexport const SESSION_RECORDING_ENABLED_SERVER_SIDE = '$session_recording_enabled_server_side'\nexport const CONSOLE_LOG_RECORDING_ENABLED_SERVER_SIDE = '$console_log_recording_enabled_server_side'\nexport const SESSION_RECORDING_NETWORK_PAYLOAD_CAPTURE = '$session_recording_network_payload_capture'\nexport const SESSION_RECORDING_CANVAS_RECORDING = '$session_recording_canvas_recording'\nexport const SESSION_RECORDING_SAMPLE_RATE = '$replay_sample_rate'\nexport const SESSION_RECORDING_MINIMUM_DURATION = '$replay_minimum_duration'\nexport const SESSION_ID = '$sesid'\nexport const SESSION_RECORDING_IS_SAMPLED = '$session_is_sampled'\nexport const ENABLED_FEATURE_FLAGS = '$enabled_feature_flags'\nexport const PERSISTENCE_EARLY_ACCESS_FEATURES = '$early_access_features'\nexport const STORED_PERSON_PROPERTIES_KEY = '$stored_person_properties'\nexport const STORED_GROUP_PROPERTIES_KEY = '$stored_group_properties'\nexport const SURVEYS = '$surveys'\nexport const SURVEYS_ACTIVATED = '$surveys_activated'\nexport const FLAG_CALL_REPORTED = '$flag_call_reported'\nexport const USER_STATE = '$user_state'\nexport const CLIENT_SESSION_PROPS = '$client_session_props'\nexport const CAPTURE_RATE_LIMIT = '$capture_rate_limit'\n\n/** @deprecated Delete this when INITIAL_PERSON_INFO has been around for long enough to ignore backwards compat */\nexport const INITIAL_CAMPAIGN_PARAMS = '$initial_campaign_params'\n/** @deprecated Delete this when INITIAL_PERSON_INFO has been around for long enough to ignore backwards compat */\nexport const INITIAL_REFERRER_INFO = '$initial_referrer_info'\nexport const INITIAL_PERSON_INFO = '$initial_person_info'\nexport const ENABLE_PERSON_PROCESSING = '$epp'\nexport const TOOLBAR_ID = '__POSTHOG_TOOLBAR__'\n\nexport const WEB_EXPERIMENTS = '$web_experiments'\n\n// These are properties that are reserved and will not be automatically included in events\nexport const PERSISTENCE_RESERVED_PROPERTIES = [\n PEOPLE_DISTINCT_ID_KEY,\n ALIAS_ID_KEY,\n CAMPAIGN_IDS_KEY,\n EVENT_TIMERS_KEY,\n SESSION_RECORDING_ENABLED_SERVER_SIDE,\n HEATMAPS_ENABLED_SERVER_SIDE,\n SESSION_ID,\n ENABLED_FEATURE_FLAGS,\n USER_STATE,\n PERSISTENCE_EARLY_ACCESS_FEATURES,\n STORED_GROUP_PROPERTIES_KEY,\n STORED_PERSON_PROPERTIES_KEY,\n SURVEYS,\n FLAG_CALL_REPORTED,\n CLIENT_SESSION_PROPS,\n CAPTURE_RATE_LIMIT,\n INITIAL_CAMPAIGN_PARAMS,\n INITIAL_REFERRER_INFO,\n ENABLE_PERSON_PROCESSING,\n]\n"]}
@@ -19,6 +19,7 @@ import { Autocapture } from './autocapture';
19
19
  import { ConsentManager } from './consent';
20
20
  import { ExceptionObserver } from './extensions/exception-autocapture';
21
21
  import { WebVitalsAutocapture } from './extensions/web-vitals';
22
+ import { WebExperiments } from './web-experiments';
22
23
  import { PostHogExceptions } from './posthog-exceptions';
23
24
  type OnlyValidKeys<T, Shape> = T extends Shape ? (Exclude<keyof T, keyof Shape> extends never ? T : never) : never;
24
25
  export declare const defaultConfig: () => PostHogConfig;
@@ -40,6 +41,7 @@ export declare class PostHog {
40
41
  pageViewManager: PageViewManager;
41
42
  featureFlags: PostHogFeatureFlags;
42
43
  surveys: PostHogSurveys;
44
+ experiments: WebExperiments;
43
45
  toolbar: Toolbar;
44
46
  exceptions: PostHogExceptions;
45
47
  consent: ConsentManager;
@@ -69,6 +69,7 @@ import { TracingHeaders } from './extensions/tracing-headers';
69
69
  import { ConsentManager } from './consent';
70
70
  import { ExceptionObserver } from './extensions/exception-autocapture';
71
71
  import { WebVitalsAutocapture } from './extensions/web-vitals';
72
+ import { WebExperiments } from './web-experiments';
72
73
  import { PostHogExceptions } from './posthog-exceptions';
73
74
  var instances = {};
74
75
  // some globals for comparisons
@@ -107,6 +108,7 @@ export var defaultConfig = function () {
107
108
  upgrade: false,
108
109
  disable_session_recording: false,
109
110
  disable_persistence: false,
111
+ disable_web_experiments: true, // disabled in beta.
110
112
  disable_surveys: false,
111
113
  enable_recording_console_log: undefined, // When undefined, it falls back to the server-side setting
112
114
  secure_cookie: ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.protocol) === 'https:',
@@ -220,6 +222,7 @@ var PostHog = /** @class */ (function () {
220
222
  this.scrollManager = new ScrollManager(this);
221
223
  this.pageViewManager = new PageViewManager(this);
222
224
  this.surveys = new PostHogSurveys(this);
225
+ this.experiments = new WebExperiments(this);
223
226
  this.exceptions = new PostHogExceptions(this);
224
227
  this.rateLimiter = new RateLimiter(this);
225
228
  this.requestRouter = new RequestRouter(this);
@@ -406,7 +409,7 @@ var PostHog = /** @class */ (function () {
406
409
  };
407
410
  // Private methods
408
411
  PostHog.prototype._afterDecideResponse = function (response) {
409
- var _a, _b, _c, _d, _e, _f, _g, _h;
412
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
410
413
  this.compression = undefined;
411
414
  if (response.supportedCompression && !this.config.disable_compression) {
412
415
  this.compression = includes(response['supportedCompression'], Compression.GZipJS)
@@ -421,10 +424,11 @@ var PostHog = /** @class */ (function () {
421
424
  (_b = this.sessionRecording) === null || _b === void 0 ? void 0 : _b.afterDecideResponse(response);
422
425
  (_c = this.autocapture) === null || _c === void 0 ? void 0 : _c.afterDecideResponse(response);
423
426
  (_d = this.heatmaps) === null || _d === void 0 ? void 0 : _d.afterDecideResponse(response);
424
- (_e = this.surveys) === null || _e === void 0 ? void 0 : _e.afterDecideResponse(response);
425
- (_f = this.webVitalsAutocapture) === null || _f === void 0 ? void 0 : _f.afterDecideResponse(response);
426
- (_g = this.exceptions) === null || _g === void 0 ? void 0 : _g.afterDecideResponse(response);
427
- (_h = this.exceptionObserver) === null || _h === void 0 ? void 0 : _h.afterDecideResponse(response);
427
+ (_e = this.experiments) === null || _e === void 0 ? void 0 : _e.afterDecideResponse(response);
428
+ (_f = this.surveys) === null || _f === void 0 ? void 0 : _f.afterDecideResponse(response);
429
+ (_g = this.webVitalsAutocapture) === null || _g === void 0 ? void 0 : _g.afterDecideResponse(response);
430
+ (_h = this.exceptions) === null || _h === void 0 ? void 0 : _h.afterDecideResponse(response);
431
+ (_j = this.exceptionObserver) === null || _j === void 0 ? void 0 : _j.afterDecideResponse(response);
428
432
  };
429
433
  PostHog.prototype._loaded = function () {
430
434
  var _this = this;