@posthog/browser 0.0.0 → 0.1.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/ARCHITECTURE.md +559 -0
- package/LICENSE +417 -0
- package/README.md +286 -28
- package/dist/analytics-buffer.d.ts +4 -0
- package/dist/analytics-buffer.js +200 -0
- package/dist/analytics-buffer.mjs +162 -0
- package/dist/analytics-delivery.d.ts +3 -0
- package/dist/analytics-delivery.js +231 -0
- package/dist/analytics-delivery.mjs +193 -0
- package/dist/analytics-internal.d.ts +64 -0
- package/dist/analytics-internal.js +52 -0
- package/dist/analytics-internal.mjs +5 -0
- package/dist/analytics-options.d.ts +14 -0
- package/dist/analytics-options.js +18 -0
- package/dist/analytics-options.mjs +1 -0
- package/dist/analytics.d.ts +5 -0
- package/dist/analytics.js +42 -0
- package/dist/analytics.mjs +4 -0
- package/dist/autocapture-options.d.ts +32 -0
- package/dist/autocapture-options.js +49 -0
- package/dist/autocapture-options.mjs +11 -0
- package/dist/autocapture.d.ts +5 -0
- package/dist/autocapture.js +108 -0
- package/dist/autocapture.mjs +70 -0
- package/dist/automatic-analytics.d.ts +3 -0
- package/dist/automatic-analytics.js +44 -0
- package/dist/automatic-analytics.mjs +6 -0
- package/dist/automatic-surveys.d.ts +2 -0
- package/dist/automatic-surveys.js +41 -0
- package/dist/automatic-surveys.mjs +3 -0
- package/dist/bot-filter.d.ts +2 -0
- package/dist/bot-filter.js +87 -0
- package/dist/bot-filter.mjs +49 -0
- package/dist/browser-client.d.ts +30 -0
- package/dist/browser-client.js +18 -0
- package/dist/browser-client.mjs +1 -0
- package/dist/capture-summary.d.ts +3 -0
- package/dist/capture-summary.js +63 -0
- package/dist/capture-summary.mjs +22 -0
- package/dist/capture-v1.d.ts +105 -0
- package/dist/capture-v1.js +781 -0
- package/dist/capture-v1.mjs +722 -0
- package/dist/core.d.ts +7 -0
- package/dist/core.js +49 -0
- package/dist/core.mjs +5 -0
- package/dist/event-buffer.d.ts +41 -0
- package/dist/event-buffer.js +158 -0
- package/dist/event-buffer.mjs +120 -0
- package/dist/extensions/registry.d.ts +16 -0
- package/dist/extensions/registry.js +128 -0
- package/dist/extensions/registry.mjs +90 -0
- package/dist/flags-internal.d.ts +8 -0
- package/dist/flags-internal.js +18 -0
- package/dist/flags-internal.mjs +1 -0
- package/dist/flags-options.d.ts +22 -0
- package/dist/flags-options.js +18 -0
- package/dist/flags-options.mjs +1 -0
- package/dist/flags-token.d.ts +15 -0
- package/dist/flags-token.js +40 -0
- package/dist/flags-token.mjs +2 -0
- package/dist/flags.d.ts +6 -0
- package/dist/flags.js +163 -0
- package/dist/flags.mjs +122 -0
- package/dist/id.d.ts +1 -0
- package/dist/id.js +61 -0
- package/dist/id.mjs +23 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +119 -0
- package/dist/index.mjs +75 -0
- package/dist/lane.d.ts +57 -0
- package/dist/lane.js +363 -0
- package/dist/lane.mjs +325 -0
- package/dist/logger.d.ts +4 -0
- package/dist/logger.js +57 -0
- package/dist/logger.mjs +19 -0
- package/dist/logs-internal.d.ts +7 -0
- package/dist/logs-internal.js +18 -0
- package/dist/logs-internal.mjs +1 -0
- package/dist/logs-options.d.ts +11 -0
- package/dist/logs-options.js +57 -0
- package/dist/logs-options.mjs +19 -0
- package/dist/logs.d.ts +6 -0
- package/dist/logs.js +140 -0
- package/dist/logs.mjs +102 -0
- package/dist/named-error.d.ts +7 -0
- package/dist/named-error.js +49 -0
- package/dist/named-error.mjs +11 -0
- package/dist/posthog.d.ts +3 -0
- package/dist/posthog.js +823 -0
- package/dist/posthog.mjs +785 -0
- package/dist/rate-limiter.d.ts +19 -0
- package/dist/rate-limiter.js +89 -0
- package/dist/rate-limiter.mjs +51 -0
- package/dist/remote-config.d.ts +3 -0
- package/dist/remote-config.js +47 -0
- package/dist/remote-config.mjs +9 -0
- package/dist/request.d.ts +14 -0
- package/dist/request.js +130 -0
- package/dist/request.mjs +89 -0
- package/dist/state.d.ts +82 -0
- package/dist/state.js +625 -0
- package/dist/state.mjs +581 -0
- package/dist/surveys-extension.d.ts +9 -0
- package/dist/surveys-extension.js +272 -0
- package/dist/surveys-extension.mjs +234 -0
- package/dist/surveys-internal.d.ts +12 -0
- package/dist/surveys-internal.js +18 -0
- package/dist/surveys-internal.mjs +1 -0
- package/dist/surveys-options.d.ts +18 -0
- package/dist/surveys-options.js +42 -0
- package/dist/surveys-options.mjs +4 -0
- package/dist/surveys.d.ts +7 -0
- package/dist/surveys.js +48 -0
- package/dist/surveys.mjs +7 -0
- package/dist/types.d.ts +114 -0
- package/dist/types.js +18 -0
- package/dist/types.mjs +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +40 -0
- package/dist/version.mjs +2 -0
- package/package.json +89 -8
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
const MAX_ANALYTICS_BYTES = 8388608;
|
|
31
|
+
const MAX_ANALYTICS_BATCH_EVENTS = 100;
|
|
32
|
+
const Analytics = 'analytics';
|
|
33
|
+
const isAnalyticsExtension = (extension)=>extension.name === Analytics;
|
|
34
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
35
|
+
Analytics: Analytics,
|
|
36
|
+
MAX_ANALYTICS_BATCH_EVENTS: MAX_ANALYTICS_BATCH_EVENTS,
|
|
37
|
+
MAX_ANALYTICS_BYTES: MAX_ANALYTICS_BYTES,
|
|
38
|
+
isAnalyticsExtension: isAnalyticsExtension
|
|
39
|
+
});
|
|
40
|
+
exports.Analytics = __webpack_exports__.Analytics;
|
|
41
|
+
exports.MAX_ANALYTICS_BATCH_EVENTS = __webpack_exports__.MAX_ANALYTICS_BATCH_EVENTS;
|
|
42
|
+
exports.MAX_ANALYTICS_BYTES = __webpack_exports__.MAX_ANALYTICS_BYTES;
|
|
43
|
+
exports.isAnalyticsExtension = __webpack_exports__.isAnalyticsExtension;
|
|
44
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
45
|
+
"Analytics",
|
|
46
|
+
"MAX_ANALYTICS_BATCH_EVENTS",
|
|
47
|
+
"MAX_ANALYTICS_BYTES",
|
|
48
|
+
"isAnalyticsExtension"
|
|
49
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
50
|
+
Object.defineProperty(exports, '__esModule', {
|
|
51
|
+
value: true
|
|
52
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const MAX_ANALYTICS_BYTES = 8388608;
|
|
2
|
+
const MAX_ANALYTICS_BATCH_EVENTS = 100;
|
|
3
|
+
const Analytics = 'analytics';
|
|
4
|
+
const isAnalyticsExtension = (extension)=>extension.name === Analytics;
|
|
5
|
+
export { Analytics, MAX_ANALYTICS_BATCH_EVENTS, MAX_ANALYTICS_BYTES, isAnalyticsExtension };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Scheduling options shared by automatic and explicitly composed analytics delivery. */
|
|
2
|
+
export interface AnalyticsOptions {
|
|
3
|
+
/** Number of queued events that triggers delivery. Defaults to 20; clamped to the V1 limit of 100. */
|
|
4
|
+
flushAt?: number;
|
|
5
|
+
/** Maximum delay in milliseconds before queued events are delivered. Defaults to 3000; 0 disables it. */
|
|
6
|
+
flushInterval?: number;
|
|
7
|
+
}
|
|
8
|
+
export type LoadStrategy = 'lazy' | 'eager';
|
|
9
|
+
/** Automatic analytics loading configured by the default package entrypoint. */
|
|
10
|
+
export interface AutomaticAnalyticsOptions extends AnalyticsOptions {
|
|
11
|
+
/** Load after the first admitted event, or while the client initializes. Defaults to `lazy`. */
|
|
12
|
+
load?: LoadStrategy;
|
|
13
|
+
}
|
|
14
|
+
export type AnalyticsConfiguration = false | AutomaticAnalyticsOptions;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Extension } from '@posthog/browser-common';
|
|
2
|
+
import type { AnalyticsOptions } from './analytics-options';
|
|
3
|
+
export type { AnalyticsOptions } from './analytics-options';
|
|
4
|
+
/** Creates analytics with its buffer and Capture V1 delivery statically included. */
|
|
5
|
+
export declare const analytics: (options?: AnalyticsOptions) => Extension;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
analytics: ()=>analytics
|
|
32
|
+
});
|
|
33
|
+
const external_analytics_buffer_js_namespaceObject = require("./analytics-buffer.js");
|
|
34
|
+
const external_analytics_delivery_js_namespaceObject = require("./analytics-delivery.js");
|
|
35
|
+
const analytics = (options = {})=>(0, external_analytics_buffer_js_namespaceObject.createAnalyticsExtension)(options, void 0, external_analytics_delivery_js_namespaceObject.createAnalyticsDelivery);
|
|
36
|
+
exports.analytics = __webpack_exports__.analytics;
|
|
37
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
38
|
+
"analytics"
|
|
39
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
40
|
+
Object.defineProperty(exports, '__esModule', {
|
|
41
|
+
value: true
|
|
42
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AutocaptureConfig } from '@posthog/types';
|
|
2
|
+
export interface RageclickOptions {
|
|
3
|
+
cssSelectorIgnorelist?: string[];
|
|
4
|
+
contentIgnorelist?: boolean | string[];
|
|
5
|
+
ignoreTextSelection?: boolean;
|
|
6
|
+
thresholdPx?: number;
|
|
7
|
+
clickCount?: number;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface AutocaptureOptions {
|
|
11
|
+
urlAllowlist?: AutocaptureConfig['url_allowlist'];
|
|
12
|
+
urlIgnorelist?: AutocaptureConfig['url_ignorelist'];
|
|
13
|
+
domEventAllowlist?: AutocaptureConfig['dom_event_allowlist'];
|
|
14
|
+
elementAllowlist?: AutocaptureConfig['element_allowlist'];
|
|
15
|
+
cssSelectorAllowlist?: string[];
|
|
16
|
+
/** Replaces the default .ph-no-autocapture and [data-ph-no-autocapture] exclusions. */
|
|
17
|
+
cssSelectorIgnorelist?: string[];
|
|
18
|
+
elementAttributeIgnorelist?: string[];
|
|
19
|
+
/** Capture cut/copy/paste interactions. Defaults to false; paste text is never captured. */
|
|
20
|
+
captureCopiedText?: boolean;
|
|
21
|
+
/** Defaults to false. Sensitive controls and values remain excluded independently. */
|
|
22
|
+
maskAllElementAttributes?: boolean;
|
|
23
|
+
/** Defaults to false. */
|
|
24
|
+
maskAllText?: boolean;
|
|
25
|
+
/** Strip URL fragments from captured links. Defaults to true. */
|
|
26
|
+
disableCaptureUrlHashes?: boolean;
|
|
27
|
+
getCurrentUrl?: (defaultUrl: string) => string;
|
|
28
|
+
/** Defaults to enabled, ignoring stepper/navigation content and text-selection surfaces. */
|
|
29
|
+
rageclick?: boolean | RageclickOptions;
|
|
30
|
+
}
|
|
31
|
+
export type AutocaptureConfiguration = false | AutocaptureOptions;
|
|
32
|
+
export declare const snapshotAutocaptureOptions: (options?: AutocaptureOptions) => AutocaptureOptions;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
const copyArrays = (options)=>Object.fromEntries(Object.entries(options).map(([key, value])=>[
|
|
31
|
+
key,
|
|
32
|
+
Array.isArray(value) ? value.map((entry)=>entry instanceof RegExp ? new RegExp(entry.source, entry.flags) : entry) : value
|
|
33
|
+
]));
|
|
34
|
+
const snapshotAutocaptureOptions = (options = {})=>({
|
|
35
|
+
...copyArrays(options),
|
|
36
|
+
...'object' == typeof options.rageclick ? {
|
|
37
|
+
rageclick: copyArrays(options.rageclick)
|
|
38
|
+
} : {}
|
|
39
|
+
});
|
|
40
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
41
|
+
snapshotAutocaptureOptions: snapshotAutocaptureOptions
|
|
42
|
+
});
|
|
43
|
+
exports.snapshotAutocaptureOptions = __webpack_exports__.snapshotAutocaptureOptions;
|
|
44
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
45
|
+
"snapshotAutocaptureOptions"
|
|
46
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
47
|
+
Object.defineProperty(exports, '__esModule', {
|
|
48
|
+
value: true
|
|
49
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const copyArrays = (options)=>Object.fromEntries(Object.entries(options).map(([key, value])=>[
|
|
2
|
+
key,
|
|
3
|
+
Array.isArray(value) ? value.map((entry)=>entry instanceof RegExp ? new RegExp(entry.source, entry.flags) : entry) : value
|
|
4
|
+
]));
|
|
5
|
+
const snapshotAutocaptureOptions = (options = {})=>({
|
|
6
|
+
...copyArrays(options),
|
|
7
|
+
...'object' == typeof options.rageclick ? {
|
|
8
|
+
rageclick: copyArrays(options.rageclick)
|
|
9
|
+
} : {}
|
|
10
|
+
});
|
|
11
|
+
export { snapshotAutocaptureOptions };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Extension } from '@posthog/browser-common';
|
|
2
|
+
import { type AutocaptureOptions } from './autocapture-options';
|
|
3
|
+
export type { AutocaptureOptions, RageclickOptions } from './autocapture-options';
|
|
4
|
+
/** Include DOM autocapture statically instead of loading it during initialization. */
|
|
5
|
+
export declare const autocapture: (options?: AutocaptureOptions) => Extension;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
autocapture: ()=>autocapture
|
|
32
|
+
});
|
|
33
|
+
const autocapture_namespaceObject = require("@posthog/browser-common/autocapture");
|
|
34
|
+
const autocapture_utils_namespaceObject = require("@posthog/browser-common/utils/autocapture-utils");
|
|
35
|
+
const external_autocapture_options_js_namespaceObject = require("./autocapture-options.js");
|
|
36
|
+
const autocapture = (options = {})=>{
|
|
37
|
+
const snapshot = (0, external_autocapture_options_js_namespaceObject.snapshotAutocaptureOptions)(options);
|
|
38
|
+
const rageclick = 'object' == typeof snapshot.rageclick ? snapshot.rageclick : {};
|
|
39
|
+
const config = {
|
|
40
|
+
enabled: true,
|
|
41
|
+
remoteRequestsDisabled: false,
|
|
42
|
+
maskAllElementAttributes: snapshot.maskAllElementAttributes ?? false,
|
|
43
|
+
maskAllText: snapshot.maskAllText ?? false,
|
|
44
|
+
disableCaptureUrlHashes: snapshot.disableCaptureUrlHashes ?? true,
|
|
45
|
+
rageclick: false === snapshot.rageclick ? false : {
|
|
46
|
+
...void 0 === rageclick.cssSelectorIgnorelist ? {} : {
|
|
47
|
+
css_selector_ignorelist: rageclick.cssSelectorIgnorelist
|
|
48
|
+
},
|
|
49
|
+
content_ignorelist: rageclick.contentIgnorelist ?? [
|
|
50
|
+
...autocapture_utils_namespaceObject.DEFAULT_CONTENT_IGNORELIST_WITH_STEPPERS
|
|
51
|
+
],
|
|
52
|
+
ignore_text_selection: rageclick.ignoreTextSelection ?? true,
|
|
53
|
+
...void 0 === rageclick.thresholdPx ? {} : {
|
|
54
|
+
threshold_px: rageclick.thresholdPx
|
|
55
|
+
},
|
|
56
|
+
...void 0 === rageclick.clickCount ? {} : {
|
|
57
|
+
click_count: rageclick.clickCount
|
|
58
|
+
},
|
|
59
|
+
...void 0 === rageclick.timeoutMs ? {} : {
|
|
60
|
+
timeout_ms: rageclick.timeoutMs
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
...snapshot.getCurrentUrl ? {
|
|
64
|
+
getCurrentUrl: snapshot.getCurrentUrl
|
|
65
|
+
} : {},
|
|
66
|
+
...snapshot.urlAllowlist ? {
|
|
67
|
+
url_allowlist: snapshot.urlAllowlist
|
|
68
|
+
} : {},
|
|
69
|
+
...snapshot.urlIgnorelist ? {
|
|
70
|
+
url_ignorelist: snapshot.urlIgnorelist
|
|
71
|
+
} : {},
|
|
72
|
+
...snapshot.domEventAllowlist ? {
|
|
73
|
+
dom_event_allowlist: snapshot.domEventAllowlist
|
|
74
|
+
} : {},
|
|
75
|
+
...snapshot.elementAllowlist ? {
|
|
76
|
+
element_allowlist: snapshot.elementAllowlist
|
|
77
|
+
} : {},
|
|
78
|
+
...snapshot.cssSelectorAllowlist ? {
|
|
79
|
+
css_selector_allowlist: snapshot.cssSelectorAllowlist
|
|
80
|
+
} : {},
|
|
81
|
+
...snapshot.cssSelectorIgnorelist ? {
|
|
82
|
+
css_selector_ignorelist: snapshot.cssSelectorIgnorelist
|
|
83
|
+
} : {},
|
|
84
|
+
...snapshot.elementAttributeIgnorelist ? {
|
|
85
|
+
element_attribute_ignorelist: snapshot.elementAttributeIgnorelist
|
|
86
|
+
} : {},
|
|
87
|
+
capture_copied_text: snapshot.captureCopiedText ?? false
|
|
88
|
+
};
|
|
89
|
+
return new class extends autocapture_namespaceObject.Autocapture {
|
|
90
|
+
setup(client) {
|
|
91
|
+
const selectors = client.getExtension('surveys')?.getElementSelectors?.();
|
|
92
|
+
if (selectors) this.setElementSelectors(selectors);
|
|
93
|
+
super.setup(client);
|
|
94
|
+
}
|
|
95
|
+
setElementSelectors(selectors) {
|
|
96
|
+
super.setElementSelectors(new Set(selectors));
|
|
97
|
+
}
|
|
98
|
+
}({
|
|
99
|
+
refresh: (target)=>Object.assign(target, config)
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
exports.autocapture = __webpack_exports__.autocapture;
|
|
103
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
104
|
+
"autocapture"
|
|
105
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
106
|
+
Object.defineProperty(exports, '__esModule', {
|
|
107
|
+
value: true
|
|
108
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Autocapture } from "@posthog/browser-common/autocapture";
|
|
2
|
+
import { DEFAULT_CONTENT_IGNORELIST_WITH_STEPPERS } from "@posthog/browser-common/utils/autocapture-utils";
|
|
3
|
+
import { snapshotAutocaptureOptions } from "./autocapture-options.mjs";
|
|
4
|
+
const autocapture = (options = {})=>{
|
|
5
|
+
const snapshot = snapshotAutocaptureOptions(options);
|
|
6
|
+
const rageclick = 'object' == typeof snapshot.rageclick ? snapshot.rageclick : {};
|
|
7
|
+
const config = {
|
|
8
|
+
enabled: true,
|
|
9
|
+
remoteRequestsDisabled: false,
|
|
10
|
+
maskAllElementAttributes: snapshot.maskAllElementAttributes ?? false,
|
|
11
|
+
maskAllText: snapshot.maskAllText ?? false,
|
|
12
|
+
disableCaptureUrlHashes: snapshot.disableCaptureUrlHashes ?? true,
|
|
13
|
+
rageclick: false === snapshot.rageclick ? false : {
|
|
14
|
+
...void 0 === rageclick.cssSelectorIgnorelist ? {} : {
|
|
15
|
+
css_selector_ignorelist: rageclick.cssSelectorIgnorelist
|
|
16
|
+
},
|
|
17
|
+
content_ignorelist: rageclick.contentIgnorelist ?? [
|
|
18
|
+
...DEFAULT_CONTENT_IGNORELIST_WITH_STEPPERS
|
|
19
|
+
],
|
|
20
|
+
ignore_text_selection: rageclick.ignoreTextSelection ?? true,
|
|
21
|
+
...void 0 === rageclick.thresholdPx ? {} : {
|
|
22
|
+
threshold_px: rageclick.thresholdPx
|
|
23
|
+
},
|
|
24
|
+
...void 0 === rageclick.clickCount ? {} : {
|
|
25
|
+
click_count: rageclick.clickCount
|
|
26
|
+
},
|
|
27
|
+
...void 0 === rageclick.timeoutMs ? {} : {
|
|
28
|
+
timeout_ms: rageclick.timeoutMs
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
...snapshot.getCurrentUrl ? {
|
|
32
|
+
getCurrentUrl: snapshot.getCurrentUrl
|
|
33
|
+
} : {},
|
|
34
|
+
...snapshot.urlAllowlist ? {
|
|
35
|
+
url_allowlist: snapshot.urlAllowlist
|
|
36
|
+
} : {},
|
|
37
|
+
...snapshot.urlIgnorelist ? {
|
|
38
|
+
url_ignorelist: snapshot.urlIgnorelist
|
|
39
|
+
} : {},
|
|
40
|
+
...snapshot.domEventAllowlist ? {
|
|
41
|
+
dom_event_allowlist: snapshot.domEventAllowlist
|
|
42
|
+
} : {},
|
|
43
|
+
...snapshot.elementAllowlist ? {
|
|
44
|
+
element_allowlist: snapshot.elementAllowlist
|
|
45
|
+
} : {},
|
|
46
|
+
...snapshot.cssSelectorAllowlist ? {
|
|
47
|
+
css_selector_allowlist: snapshot.cssSelectorAllowlist
|
|
48
|
+
} : {},
|
|
49
|
+
...snapshot.cssSelectorIgnorelist ? {
|
|
50
|
+
css_selector_ignorelist: snapshot.cssSelectorIgnorelist
|
|
51
|
+
} : {},
|
|
52
|
+
...snapshot.elementAttributeIgnorelist ? {
|
|
53
|
+
element_attribute_ignorelist: snapshot.elementAttributeIgnorelist
|
|
54
|
+
} : {},
|
|
55
|
+
capture_copied_text: snapshot.captureCopiedText ?? false
|
|
56
|
+
};
|
|
57
|
+
return new class extends Autocapture {
|
|
58
|
+
setup(client) {
|
|
59
|
+
const selectors = client.getExtension('surveys')?.getElementSelectors?.();
|
|
60
|
+
if (selectors) this.setElementSelectors(selectors);
|
|
61
|
+
super.setup(client);
|
|
62
|
+
}
|
|
63
|
+
setElementSelectors(selectors) {
|
|
64
|
+
super.setElementSelectors(new Set(selectors));
|
|
65
|
+
}
|
|
66
|
+
}({
|
|
67
|
+
refresh: (target)=>Object.assign(target, config)
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
export { autocapture };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
analytics: ()=>analytics
|
|
32
|
+
});
|
|
33
|
+
const external_analytics_buffer_js_namespaceObject = require("./analytics-buffer.js");
|
|
34
|
+
const analytics = (options)=>(0, external_analytics_buffer_js_namespaceObject.createAnalyticsExtension)(options, async ()=>{
|
|
35
|
+
const { createAnalyticsDelivery } = await import("./analytics-delivery.js");
|
|
36
|
+
return createAnalyticsDelivery;
|
|
37
|
+
});
|
|
38
|
+
exports.analytics = __webpack_exports__.analytics;
|
|
39
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
40
|
+
"analytics"
|
|
41
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
42
|
+
Object.defineProperty(exports, '__esModule', {
|
|
43
|
+
value: true
|
|
44
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createAnalyticsExtension } from "./analytics-buffer.mjs";
|
|
2
|
+
const analytics = (options)=>createAnalyticsExtension(options, async ()=>{
|
|
3
|
+
const { createAnalyticsDelivery } = await import("./analytics-delivery.mjs");
|
|
4
|
+
return createAnalyticsDelivery;
|
|
5
|
+
});
|
|
6
|
+
export { analytics };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
surveys: ()=>surveys
|
|
32
|
+
});
|
|
33
|
+
const external_surveys_extension_js_namespaceObject = require("./surveys-extension.js");
|
|
34
|
+
const surveys = (options = {})=>(0, external_surveys_extension_js_namespaceObject.createSurveys)(options, ()=>import("@posthog/browser-common/surveys-renderer"));
|
|
35
|
+
exports.surveys = __webpack_exports__.surveys;
|
|
36
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
37
|
+
"surveys"
|
|
38
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
39
|
+
Object.defineProperty(exports, '__esModule', {
|
|
40
|
+
value: true
|
|
41
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
const BLOCKED_USER_AGENTS = [
|
|
31
|
+
'amazonbot',
|
|
32
|
+
'applebot',
|
|
33
|
+
'archive.org_bot',
|
|
34
|
+
'baiduspider',
|
|
35
|
+
'bingbot',
|
|
36
|
+
'bingpreview',
|
|
37
|
+
'chrome-lighthouse',
|
|
38
|
+
'crawler',
|
|
39
|
+
'duckduckbot',
|
|
40
|
+
'facebookexternal',
|
|
41
|
+
'facebookcatalog',
|
|
42
|
+
'gptbot',
|
|
43
|
+
'googlebot',
|
|
44
|
+
'googleother',
|
|
45
|
+
'headlesschrome',
|
|
46
|
+
'ia_archiver',
|
|
47
|
+
'linkedinbot',
|
|
48
|
+
'meta-externalagent',
|
|
49
|
+
'mj12bot',
|
|
50
|
+
'oai-searchbot',
|
|
51
|
+
'perplexitybot',
|
|
52
|
+
'pinterest',
|
|
53
|
+
'prerender',
|
|
54
|
+
'semrushbot',
|
|
55
|
+
'slackbot',
|
|
56
|
+
'slurp',
|
|
57
|
+
'spider',
|
|
58
|
+
'twitterbot',
|
|
59
|
+
'uptimerobot',
|
|
60
|
+
'vercel-screenshot',
|
|
61
|
+
'vercelbot',
|
|
62
|
+
'yahoo! slurp',
|
|
63
|
+
'yandexbot'
|
|
64
|
+
];
|
|
65
|
+
const isLikelyBot = (navigator, blockedUserAgents)=>{
|
|
66
|
+
if (!navigator) return false;
|
|
67
|
+
try {
|
|
68
|
+
if (navigator.webdriver) return true;
|
|
69
|
+
const userAgent = navigator.userAgent?.toLowerCase();
|
|
70
|
+
return !!userAgent && [
|
|
71
|
+
...BLOCKED_USER_AGENTS,
|
|
72
|
+
...blockedUserAgents
|
|
73
|
+
].some((value)=>userAgent.includes(value.toLowerCase()));
|
|
74
|
+
} catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
79
|
+
isLikelyBot: isLikelyBot
|
|
80
|
+
});
|
|
81
|
+
exports.isLikelyBot = __webpack_exports__.isLikelyBot;
|
|
82
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
83
|
+
"isLikelyBot"
|
|
84
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
85
|
+
Object.defineProperty(exports, '__esModule', {
|
|
86
|
+
value: true
|
|
87
|
+
});
|