posthog-js
Advanced tools
Comparing version 1.146.3 to 1.147.0
@@ -24,5 +24,20 @@ import type { MaskInputOptions, SlimDOMOptions } from 'rrweb-snapshot'; | ||
* or regexes e.g. ['https://example.com', 'test.com/.*'] | ||
* this is useful when you want to autocapture on specific pages only | ||
* | ||
* if you set both url_allowlist and url_ignorelist, | ||
* we check the allowlist first and then the ignorelist. | ||
* the ignorelist can override the allowlist | ||
*/ | ||
url_allowlist?: (string | RegExp)[]; | ||
/** | ||
* List of URLs to not allow autocapture on, can be strings to match | ||
* or regexes e.g. ['https://example.com', 'test.com/.*'] | ||
* this is useful when you want to autocapture on most pages but not some specific ones | ||
* | ||
* if you set both url_allowlist and url_ignorelist, | ||
* we check the allowlist first and then the ignorelist. | ||
* the ignorelist can override the allowlist | ||
*/ | ||
url_ignorelist?: (string | RegExp)[]; | ||
/** | ||
* List of DOM events to allow autocapture on e.g. ['click', 'change', 'submit'] | ||
@@ -29,0 +44,0 @@ */ |
{ | ||
"name": "posthog-js", | ||
"version": "1.146.3", | ||
"version": "1.147.0", | ||
"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", |
@@ -46,2 +46,6 @@ var __assign = (this && this.__assign) || function () { | ||
} | ||
function checkForURLMatches(urlsList) { | ||
var url = window === null || window === void 0 ? void 0 : window.location.href; | ||
return !!(url && urlsList && urlsList.some(function (regex) { return url.match(regex); })); | ||
} | ||
/* | ||
@@ -240,8 +244,13 @@ * Get the className of an element, accounting for edge cases where element.className is an object | ||
if (autocaptureConfig === null || autocaptureConfig === void 0 ? void 0 : autocaptureConfig.url_allowlist) { | ||
var url_1 = window.location.href; | ||
var allowlist = autocaptureConfig.url_allowlist; | ||
if (allowlist && !allowlist.some(function (regex) { return url_1.match(regex); })) { | ||
// if the current URL is not in the allow list, don't capture | ||
if (!checkForURLMatches(autocaptureConfig.url_allowlist)) { | ||
return false; | ||
} | ||
} | ||
if (autocaptureConfig === null || autocaptureConfig === void 0 ? void 0 : autocaptureConfig.url_ignorelist) { | ||
// if the current URL is in the ignore list, don't capture | ||
if (checkForURLMatches(autocaptureConfig.url_ignorelist)) { | ||
return false; | ||
} | ||
} | ||
if (autocaptureConfig === null || autocaptureConfig === void 0 ? void 0 : autocaptureConfig.dom_event_allowlist) { | ||
@@ -248,0 +257,0 @@ var allowlist = autocaptureConfig.dom_event_allowlist; |
@@ -27,6 +27,7 @@ import { each, extend, includes, registerEvent } from './utils'; | ||
get: function () { | ||
var _a; | ||
var _a, _b; | ||
var config = isObject(this.instance.config.autocapture) ? this.instance.config.autocapture : {}; | ||
// precompile the regex | ||
config.url_allowlist = (_a = config.url_allowlist) === null || _a === void 0 ? void 0 : _a.map(function (url) { return new RegExp(url); }); | ||
config.url_ignorelist = (_b = config.url_ignorelist) === null || _b === void 0 ? void 0 : _b.map(function (url) { return new RegExp(url); }); | ||
return config; | ||
@@ -33,0 +34,0 @@ }, |
@@ -24,5 +24,20 @@ import type { MaskInputOptions, SlimDOMOptions } from 'rrweb-snapshot'; | ||
* or regexes e.g. ['https://example.com', 'test.com/.*'] | ||
* this is useful when you want to autocapture on specific pages only | ||
* | ||
* if you set both url_allowlist and url_ignorelist, | ||
* we check the allowlist first and then the ignorelist. | ||
* the ignorelist can override the allowlist | ||
*/ | ||
url_allowlist?: (string | RegExp)[]; | ||
/** | ||
* List of URLs to not allow autocapture on, can be strings to match | ||
* or regexes e.g. ['https://example.com', 'test.com/.*'] | ||
* this is useful when you want to autocapture on most pages but not some specific ones | ||
* | ||
* if you set both url_allowlist and url_ignorelist, | ||
* we check the allowlist first and then the ignorelist. | ||
* the ignorelist can override the allowlist | ||
*/ | ||
url_ignorelist?: (string | RegExp)[]; | ||
/** | ||
* List of DOM events to allow autocapture on e.g. ['click', 'change', 'submit'] | ||
@@ -29,0 +44,0 @@ */ |
{ | ||
"name": "posthog-js", | ||
"version": "1.146.3", | ||
"version": "1.147.0", | ||
"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 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
7868352
25154