posthog-js 1.130.2 → 1.131.0
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/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/es.js +1 -1
- package/dist/es.js.map +1 -1
- package/dist/lib/src/posthog-core.d.ts +1 -0
- package/dist/lib/src/types.d.ts +1 -1
- package/dist/module.d.ts +2 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/lib/package.json +5 -2
- package/lib/src/config.js +1 -1
- package/lib/src/config.js.map +1 -1
- package/lib/src/posthog-core.d.ts +1 -0
- package/lib/src/posthog-core.js +7 -3
- package/lib/src/posthog-core.js.map +1 -1
- package/lib/src/types.d.ts +1 -1
- package/lib/src/types.js.map +1 -1
- package/package.json +5 -2
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthog-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.131.0",
|
|
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",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"test:functional": "jest functional_tests",
|
|
21
21
|
"test-watch": "jest --watch src",
|
|
22
22
|
"cypress": "cypress open",
|
|
23
|
-
"prepare": "husky install"
|
|
23
|
+
"prepare": "husky install",
|
|
24
|
+
"deprecate-old-versions": "node scripts/deprecate-old-versions.mjs"
|
|
24
25
|
},
|
|
25
26
|
"main": "dist/module.js",
|
|
26
27
|
"module": "dist/es.js",
|
|
@@ -58,8 +59,10 @@
|
|
|
58
59
|
"@typescript-eslint/parser": "^6.19.0",
|
|
59
60
|
"babel-eslint": "10.1.0",
|
|
60
61
|
"babel-jest": "^26.6.3",
|
|
62
|
+
"compare-versions": "^6.1.0",
|
|
61
63
|
"cypress": "13.6.3",
|
|
62
64
|
"cypress-localstorage-commands": "^2.2.5",
|
|
65
|
+
"date-fns": "^3.6.0",
|
|
63
66
|
"eslint": "8.56.0",
|
|
64
67
|
"eslint-config-posthog-js": "link:eslint-rules",
|
|
65
68
|
"eslint-config-prettier": "^8.5.0",
|
package/lib/src/config.js
CHANGED
package/lib/src/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,8BAA8B;AAC9B,gEAAgE;AAChE,IAAM,MAAM,GAAG;IACX,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,OAAO;CACvB,CAAA;AAED,eAAe,MAAM,CAAA","sourcesContent":["import { version } from '../package.json'\n\n// overridden in posthog-core,\n// e.g. Config.DEBUG = Config.DEBUG || instance.config.debug\nconst Config = {\n DEBUG: false,\n LIB_VERSION: version,\n}\n\nexport default Config\n"]}
|
|
@@ -598,6 +598,7 @@ export declare class PostHog {
|
|
|
598
598
|
toString(): string;
|
|
599
599
|
_isIdentified(): boolean;
|
|
600
600
|
_hasPersonProcessing(): boolean;
|
|
601
|
+
_shouldCapturePageleave(): boolean;
|
|
601
602
|
/**
|
|
602
603
|
* Enables person processing if possible, returns true if it does so or already enabled, false otherwise
|
|
603
604
|
*
|
package/lib/src/posthog-core.js
CHANGED
|
@@ -97,7 +97,7 @@ export var defaultConfig = function () {
|
|
|
97
97
|
custom_blocked_useragents: [],
|
|
98
98
|
save_referrer: true,
|
|
99
99
|
capture_pageview: true,
|
|
100
|
-
capture_pageleave:
|
|
100
|
+
capture_pageleave: 'if_capture_pageview',
|
|
101
101
|
debug: (location && isString(location === null || location === void 0 ? void 0 : location.search) && location.search.indexOf('__posthog_debug=true') !== -1) || false,
|
|
102
102
|
verbose: false,
|
|
103
103
|
cookie_expiration: 365,
|
|
@@ -451,12 +451,12 @@ var PostHog = /** @class */ (function () {
|
|
|
451
451
|
PostHog.prototype._handle_unload = function () {
|
|
452
452
|
var _a, _b;
|
|
453
453
|
if (!this.config.request_batching) {
|
|
454
|
-
if (this.
|
|
454
|
+
if (this._shouldCapturePageleave()) {
|
|
455
455
|
this.capture('$pageleave', null, { transport: 'sendBeacon' });
|
|
456
456
|
}
|
|
457
457
|
return;
|
|
458
458
|
}
|
|
459
|
-
if (this.
|
|
459
|
+
if (this._shouldCapturePageleave()) {
|
|
460
460
|
this.capture('$pageleave');
|
|
461
461
|
}
|
|
462
462
|
(_a = this._requestQueue) === null || _a === void 0 ? void 0 : _a.unload();
|
|
@@ -1586,6 +1586,10 @@ var PostHog = /** @class */ (function () {
|
|
|
1586
1586
|
!((_b = (_a = this.persistence) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b[ALIAS_ID_KEY]) &&
|
|
1587
1587
|
!((_d = (_c = this.persistence) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d[ENABLE_PERSON_PROCESSING])));
|
|
1588
1588
|
};
|
|
1589
|
+
PostHog.prototype._shouldCapturePageleave = function () {
|
|
1590
|
+
return (this.config.capture_pageleave === true ||
|
|
1591
|
+
(this.config.capture_pageleave === 'if_capture_pageview' && this.config.capture_pageview));
|
|
1592
|
+
};
|
|
1589
1593
|
/**
|
|
1590
1594
|
* Enables person processing if possible, returns true if it does so or already enabled, false otherwise
|
|
1591
1595
|
*
|