mixpanel-browser 2.73.0 → 2.74.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/.claude/settings.local.json +12 -0
- package/.eslintrc.json +7 -4
- package/.github/workflows/integration-tests.yml +52 -0
- package/.github/workflows/unit-tests.yml +40 -0
- package/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/build.sh +1 -5
- package/dist/mixpanel-core.cjs.d.ts +12 -1
- package/dist/mixpanel-core.cjs.js +115 -15
- package/dist/mixpanel-recorder.js +5255 -687
- package/dist/mixpanel-recorder.min.js +1 -1
- package/dist/mixpanel-recorder.min.js.map +1 -1
- package/dist/mixpanel-with-async-recorder.cjs.d.ts +12 -1
- package/dist/mixpanel-with-async-recorder.cjs.js +115 -15
- package/dist/mixpanel-with-recorder.d.ts +12 -1
- package/dist/mixpanel-with-recorder.js +6720 -2079
- package/dist/mixpanel-with-recorder.min.d.ts +12 -1
- package/dist/mixpanel-with-recorder.min.js +1 -1
- package/dist/mixpanel.amd.d.ts +12 -1
- package/dist/mixpanel.amd.js +6720 -2079
- package/dist/mixpanel.cjs.d.ts +12 -1
- package/dist/mixpanel.cjs.js +6720 -2079
- package/dist/mixpanel.globals.js +115 -15
- package/dist/mixpanel.min.js +174 -172
- package/dist/mixpanel.module.d.ts +12 -1
- package/dist/mixpanel.module.js +6720 -2079
- package/dist/mixpanel.umd.d.ts +12 -1
- package/dist/mixpanel.umd.js +6720 -2079
- package/dist/rrweb-bundled.js +4315 -591
- package/dist/rrweb-compiled.js +4962 -641
- package/package.json +30 -5
- package/rollup.config.mjs +254 -224
- package/src/autocapture/utils.js +15 -7
- package/src/config.js +1 -1
- package/src/index.d.ts +12 -1
- package/src/mixpanel-core.js +89 -5
- package/src/recorder/masking.js +197 -0
- package/src/recorder/rrweb-entrypoint.js +2 -1
- package/src/recorder/session-recording.js +43 -4
- package/src/recorder/utils.js +5 -1
- package/src/utils.js +11 -2
- package/testServer.js +51 -7
- package/.github/workflows/tests.yml +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mixpanel-browser",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.74.0",
|
|
4
4
|
"description": "The official Mixpanel JavaScript browser client library",
|
|
5
5
|
"main": "dist/mixpanel.cjs.js",
|
|
6
6
|
"module": "dist/mixpanel.module.js",
|
|
@@ -9,17 +9,29 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "./build.sh",
|
|
12
|
+
"build-watch": "npx rollup -c rollup.config.mjs -w",
|
|
13
|
+
"build-watch:full": "FULL=1 npx rollup -c rollup.config.mjs -w",
|
|
12
14
|
"build-dist": "DIST=1 ./build.sh",
|
|
13
15
|
"build-full": "FULL=1 ./build.sh",
|
|
14
16
|
"build-test-polyfill": "webpack tests/vendor/core-js-polyfills.src.js tests/vendor/core-js-polyfills.js",
|
|
17
|
+
"build-browser-tests": "npx rollup -c tests/browser/client/rollup.config.mjs -w",
|
|
15
18
|
"dox": "node doc/build-docs.js",
|
|
16
19
|
"dox-publish": "rdme docs:single doc/readme.io/javascript-full-api-reference.md --key=$RDME_API_KEY --version=$RDME_DOC_VERSION",
|
|
17
|
-
"
|
|
20
|
+
"test-server": "echo 'Browse to localhost:3001/tests' && node testServer.js",
|
|
21
|
+
"test-server:background": "screen -S testServer -X stuff $^C; screen -X -S testServer quit; screen -d -m -S testServer bash -c 'npm run test-server; exec bash' && wait-on --timeout 10000 http://localhost:3001/tests",
|
|
18
22
|
"lint": "eslint ./src",
|
|
23
|
+
"lint-fix": "eslint --fix ./src && eslint --fix ./tests/browser",
|
|
19
24
|
"prepublishOnly": "npm run build-dist",
|
|
20
25
|
"start": "pushd examples; python -m SimpleHTTPServer; popd",
|
|
21
26
|
"test": "npm run lint && npm run unit-test",
|
|
27
|
+
"test:ci": "npm run lint && npm run unit-test:ci",
|
|
22
28
|
"unit-test": "BABEL_ENV=test mocha --require babel-core/register tests/unit/*.js",
|
|
29
|
+
"unit-test:ci": "BABEL_ENV=test mocha --require babel-core/register tests/unit/*.js --reporter json --reporter-option output=tests/unit/results/results.json",
|
|
30
|
+
"integration-test:local": "wdio run tests/browser/wdio.local.mjs",
|
|
31
|
+
"integration-test:local:watch": "wdio run tests/browser/wdio.local.mjs --watch",
|
|
32
|
+
"integration-test:sauce": "wdio run tests/browser/wdio.sauce.mjs",
|
|
33
|
+
"integration-test": "DEV=1 npm run integration-test:local:watch",
|
|
34
|
+
"integration-test:full": "npm run integration-test:local:watch",
|
|
23
35
|
"validate": "npm ls"
|
|
24
36
|
},
|
|
25
37
|
"types": "./src/index.d.ts",
|
|
@@ -33,36 +45,49 @@
|
|
|
33
45
|
"url": "https://github.com/mixpanel/mixpanel-js/issues"
|
|
34
46
|
},
|
|
35
47
|
"homepage": "https://github.com/mixpanel/mixpanel-js",
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=20 <26"
|
|
50
|
+
},
|
|
36
51
|
"devDependencies": {
|
|
37
52
|
"@ampproject/rollup-plugin-closure-compiler": "0.27.0",
|
|
38
53
|
"@rollup/plugin-alias": "5.1.1",
|
|
54
|
+
"@rollup/plugin-commonjs": "28.0.3",
|
|
39
55
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
40
56
|
"@rollup/plugin-swc": "0.4.0",
|
|
41
57
|
"@swc/core": "1.11.7",
|
|
42
|
-
"
|
|
58
|
+
"@wdio/cli": "9.12.0",
|
|
59
|
+
"@wdio/junit-reporter": "9.12.2",
|
|
60
|
+
"@wdio/local-runner": "9.12.0",
|
|
61
|
+
"@wdio/mocha-framework": "9.11.0",
|
|
62
|
+
"@wdio/sauce-service": "9.21.0",
|
|
63
|
+
"@wdio/spec-reporter": "9.11.0",
|
|
43
64
|
"babel-core": "6.7.2",
|
|
44
65
|
"babel-preset-es2015": "6.6.0",
|
|
45
66
|
"babelify": "6.1.2",
|
|
46
67
|
"browserify": "10.2.4",
|
|
47
68
|
"chai": "4.0.0",
|
|
69
|
+
"chromedriver": "134.0.3",
|
|
48
70
|
"cookie-parser": "1.3.4",
|
|
49
71
|
"core-js": "3.6.5",
|
|
50
72
|
"dox": "0.9.0",
|
|
51
73
|
"eslint": "4.18.2",
|
|
52
|
-
"express": "
|
|
74
|
+
"express": "5.2.1",
|
|
53
75
|
"fake-indexeddb": "6.0.0",
|
|
54
76
|
"jsdom": "16.5.0",
|
|
55
77
|
"jsdom-global": "3.0.2",
|
|
56
78
|
"localStorage": "1.0.4",
|
|
57
79
|
"lodash": "4.17.21",
|
|
58
|
-
"mocha": "
|
|
80
|
+
"mocha": "11.1.0",
|
|
59
81
|
"morgan": "1.9.1",
|
|
82
|
+
"pug": "3.0.3",
|
|
60
83
|
"rdme": "7.5.0",
|
|
61
84
|
"request": "2.88.0",
|
|
62
85
|
"rollup": "4.34.9",
|
|
63
86
|
"rollup-plugin-esbuild": "6.2.1",
|
|
64
87
|
"sinon": "8.1.1",
|
|
65
88
|
"sinon-chai": "3.5.0",
|
|
89
|
+
"wait-on": "8.0.3",
|
|
90
|
+
"wdio-ctrf-json-reporter": "0.0.13",
|
|
66
91
|
"webpack": "1.12.2"
|
|
67
92
|
},
|
|
68
93
|
"dependencies": {
|
package/rollup.config.mjs
CHANGED
|
@@ -1,258 +1,288 @@
|
|
|
1
|
-
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
2
|
-
import swc from '@rollup/plugin-swc';
|
|
3
|
-
import esbuild from 'rollup-plugin-esbuild';
|
|
4
1
|
import alias from '@rollup/plugin-alias';
|
|
5
2
|
import closureCompiler from '@ampproject/rollup-plugin-closure-compiler';
|
|
6
3
|
import fs from 'fs';
|
|
7
4
|
import path from 'path';
|
|
5
|
+
import esbuild from 'rollup-plugin-esbuild';
|
|
6
|
+
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
7
|
+
import swc from '@rollup/plugin-swc';
|
|
8
|
+
import browserTestBuilds from './tests/browser/client/rollup.config.mjs';
|
|
9
|
+
|
|
10
|
+
const COMPILED_RRWEB_PATH = `build/rrweb-compiled.js`;
|
|
11
|
+
const BUNDLED_RRWEB_PATH = `build/rrweb-bundled.js`;
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
const
|
|
13
|
+
// Delete output files at build start so build errors don't silently use stale files
|
|
14
|
+
const cleanOnRebuild = () => {
|
|
15
|
+
let outputFiles = [];
|
|
16
|
+
return {
|
|
17
|
+
name: `clean-on-rebuild`,
|
|
18
|
+
options(opts) {
|
|
19
|
+
const outputs = Array.isArray(opts.output) ? opts.output : [opts.output];
|
|
20
|
+
outputFiles = outputs.map(o => o && o.file).filter(Boolean);
|
|
21
|
+
},
|
|
22
|
+
buildStart() {
|
|
23
|
+
// Delete outputs right before this specific build runs
|
|
24
|
+
for (const file of outputFiles) {
|
|
25
|
+
if (fs.existsSync(file)) {
|
|
26
|
+
fs.unlinkSync(file);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const withCleanOnRebuild = (builds) => builds.map(build => ({
|
|
34
|
+
...build,
|
|
35
|
+
plugins: [cleanOnRebuild(), ...(build.plugins || [])]
|
|
36
|
+
}));
|
|
11
37
|
|
|
12
38
|
const aliasRrweb = () => alias({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
entries: [
|
|
40
|
+
{ find: /rrweb-entrypoint(?:\.js)?$/, replacement: COMPILED_RRWEB_PATH },
|
|
41
|
+
]
|
|
16
42
|
});
|
|
17
43
|
|
|
18
44
|
const copyTypes = () => ({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
45
|
+
name: `copy-types`,
|
|
46
|
+
generateBundle(_options, bundle) {
|
|
47
|
+
try {
|
|
48
|
+
for (const builtFileName of Object.keys(bundle)) {
|
|
49
|
+
const buildDir = `build`;
|
|
50
|
+
const types = fs.readFileSync(`src/index.d.ts`, `utf8`);
|
|
51
|
+
const builtFile = path.basename(builtFileName, path.extname(builtFileName)) + `.d.ts`;
|
|
52
|
+
fs.writeFileSync(path.join(buildDir, builtFile), types);
|
|
53
|
+
}
|
|
28
54
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
55
|
+
} catch (err) {
|
|
56
|
+
console.warn(`Could not copy type files:`, err.message);
|
|
57
|
+
throw err;
|
|
33
58
|
}
|
|
59
|
+
}
|
|
34
60
|
});
|
|
35
61
|
|
|
36
62
|
const COMMON_CLOSURE_FLAGS = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
63
|
+
compilation_level: `ADVANCED_OPTIMIZATIONS`,
|
|
64
|
+
language_in: `ECMASCRIPT5`,
|
|
65
|
+
externs: [`src/externs.js`],
|
|
66
|
+
create_source_map: true,
|
|
40
67
|
};
|
|
41
68
|
|
|
42
69
|
const MINIFY = process.env.MINIFY || process.env.FULL;
|
|
43
70
|
|
|
44
71
|
// Main builds used to develop / iterate quickly
|
|
45
72
|
const MAIN_BUILDS = [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
{
|
|
74
|
+
'input': `src/recorder/rrweb-entrypoint.js`,
|
|
75
|
+
'output': [
|
|
76
|
+
{
|
|
77
|
+
file: BUNDLED_RRWEB_PATH,
|
|
78
|
+
format: `es`,
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
plugins: [nodeResolve({browser: true})]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
'input': BUNDLED_RRWEB_PATH,
|
|
85
|
+
'output': [
|
|
86
|
+
{
|
|
87
|
+
file: COMPILED_RRWEB_PATH,
|
|
88
|
+
format: `es`,
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
plugins: [swc({swc: {jsc: {target: `es5`}}})]
|
|
92
|
+
},
|
|
66
93
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
// IIFE recorder bundle that is loaded asynchronously
|
|
95
|
+
// rrweb uses esbuild to minify, so do that here as well
|
|
96
|
+
{
|
|
97
|
+
input: `src/recorder/index.js`,
|
|
98
|
+
output: [
|
|
99
|
+
{
|
|
100
|
+
file: `build/mixpanel-recorder.js`,
|
|
101
|
+
name: `mixpanel_recorder`,
|
|
102
|
+
format: `iife`,
|
|
103
|
+
},
|
|
104
|
+
...(MINIFY
|
|
105
|
+
? [
|
|
106
|
+
{
|
|
107
|
+
file: `build/mixpanel-recorder.min.js`,
|
|
108
|
+
name: `mixpanel_recorder`,
|
|
109
|
+
format: `iife`,
|
|
110
|
+
plugins: [esbuild({target: `es5`, minify: true, sourceMap: true})],
|
|
111
|
+
sourcemap: true,
|
|
112
|
+
},
|
|
113
|
+
]
|
|
114
|
+
: []),
|
|
115
|
+
],
|
|
116
|
+
plugins: [aliasRrweb()],
|
|
117
|
+
},
|
|
91
118
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
]
|
|
109
|
-
: []),
|
|
110
|
-
],
|
|
111
|
-
plugins: [
|
|
112
|
-
nodeResolve({
|
|
113
|
-
browser: true,
|
|
114
|
-
main: true,
|
|
115
|
-
jsnext: true,
|
|
116
|
-
})
|
|
119
|
+
// IIFE main mixpanel build
|
|
120
|
+
{
|
|
121
|
+
input: `src/loaders/loader-globals.js`,
|
|
122
|
+
output: [
|
|
123
|
+
{
|
|
124
|
+
file: `build/mixpanel.globals.js`,
|
|
125
|
+
name: `mixpanel`,
|
|
126
|
+
format: `iife`,
|
|
127
|
+
},
|
|
128
|
+
...(MINIFY
|
|
129
|
+
? [
|
|
130
|
+
{
|
|
131
|
+
file: `build/mixpanel.min.js`,
|
|
132
|
+
format: `iife`,
|
|
133
|
+
plugins: [closureCompiler(COMMON_CLOSURE_FLAGS)],
|
|
134
|
+
},
|
|
117
135
|
]
|
|
118
|
-
|
|
119
|
-
]
|
|
136
|
+
: []),
|
|
137
|
+
],
|
|
138
|
+
plugins: [
|
|
139
|
+
nodeResolve({
|
|
140
|
+
browser: true,
|
|
141
|
+
main: true,
|
|
142
|
+
jsnext: true,
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
];
|
|
120
147
|
|
|
121
148
|
const ALL_BUILDS = [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
149
|
+
...MAIN_BUILDS,
|
|
150
|
+
// Minified snippets for loading mixpanel
|
|
151
|
+
{
|
|
152
|
+
input: `src/loaders/mixpanel-jslib-snippet.js`,
|
|
153
|
+
output: [
|
|
154
|
+
{
|
|
155
|
+
file: `build/mixpanel-jslib-snippet.min.js`,
|
|
156
|
+
plugins: [closureCompiler(COMMON_CLOSURE_FLAGS)]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
file: `build/mixpanel-jslib-snippet.min.test.js`,
|
|
160
|
+
plugins: [closureCompiler({...COMMON_CLOSURE_FLAGS, define: `MIXPANEL_LIB_URL="../build/mixpanel.min.js"`})],
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
},
|
|
137
164
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
165
|
+
// IIFE mixpanel snippet loader
|
|
166
|
+
{
|
|
167
|
+
input: `src/loaders/mixpanel-js-wrapper.js`,
|
|
168
|
+
output: [
|
|
169
|
+
{
|
|
170
|
+
file: `build/mixpanel-js-wrapper.js`,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
file: `build/mixpanel-js-wrapper.min.js`,
|
|
174
|
+
plugins: [closureCompiler(COMMON_CLOSURE_FLAGS)],
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
},
|
|
151
178
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
179
|
+
// IIFE mixpanel core with bundled recorder
|
|
180
|
+
{
|
|
181
|
+
input: `src/loaders/loader-globals-with-recorder.js`,
|
|
182
|
+
output: [
|
|
183
|
+
{
|
|
184
|
+
file: `build/mixpanel-with-recorder.js`,
|
|
185
|
+
name: `mixpanel`,
|
|
186
|
+
format: `iife`,
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
file: `build/mixpanel-with-recorder.min.js`,
|
|
190
|
+
name: `mixpanel`,
|
|
191
|
+
format: `iife`,
|
|
192
|
+
plugins: [esbuild({target: `es5`, minify: true, sourceMap: true})],
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
plugins: [
|
|
196
|
+
aliasRrweb(),
|
|
197
|
+
nodeResolve({
|
|
198
|
+
browser: true,
|
|
199
|
+
main: true,
|
|
200
|
+
jsnext: true,
|
|
201
|
+
}),
|
|
202
|
+
copyTypes(),
|
|
203
|
+
],
|
|
204
|
+
},
|
|
178
205
|
|
|
179
206
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
207
|
+
// Modules builds that are bundled with the recorder
|
|
208
|
+
{
|
|
209
|
+
input: `src/loaders/loader-module.js`,
|
|
210
|
+
output: [
|
|
211
|
+
{
|
|
212
|
+
file: `build/mixpanel.cjs.js`,
|
|
213
|
+
name: `mixpanel`,
|
|
214
|
+
format: `cjs`,
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
file: `build/mixpanel.amd.js`,
|
|
218
|
+
name: `mixpanel`,
|
|
219
|
+
format: `amd`,
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
file: `build/mixpanel.umd.js`,
|
|
223
|
+
name: `mixpanel`,
|
|
224
|
+
format: `umd`,
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
file: `build/mixpanel.module.js`,
|
|
228
|
+
name: `mixpanel`,
|
|
229
|
+
format: `es`,
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
plugins: [
|
|
233
|
+
aliasRrweb(),
|
|
234
|
+
nodeResolve({
|
|
235
|
+
browser: true,
|
|
236
|
+
main: true,
|
|
237
|
+
jsnext: true,
|
|
238
|
+
}),
|
|
239
|
+
copyTypes(),
|
|
240
|
+
],
|
|
241
|
+
},
|
|
215
242
|
|
|
216
243
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
244
|
+
// Alternative CJS builds without recorder
|
|
245
|
+
{
|
|
246
|
+
input: `src/loaders/loader-module-core.js`,
|
|
247
|
+
output: [
|
|
248
|
+
{
|
|
249
|
+
file: `build/mixpanel-core.cjs.js`,
|
|
250
|
+
name: `mixpanel`,
|
|
251
|
+
format: `cjs`,
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
plugins: [
|
|
255
|
+
aliasRrweb(),
|
|
256
|
+
nodeResolve({
|
|
257
|
+
browser: true,
|
|
258
|
+
main: true,
|
|
259
|
+
jsnext: true,
|
|
260
|
+
}),
|
|
261
|
+
copyTypes(),
|
|
262
|
+
],
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
input: `src/loaders/loader-module-with-async-recorder.js`,
|
|
266
|
+
output: [
|
|
267
|
+
{
|
|
268
|
+
file: `build/mixpanel-with-async-recorder.cjs.js`,
|
|
269
|
+
name: `mixpanel`,
|
|
270
|
+
format: `cjs`,
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
plugins: [
|
|
274
|
+
aliasRrweb(),
|
|
275
|
+
nodeResolve({
|
|
276
|
+
browser: true,
|
|
277
|
+
main: true,
|
|
278
|
+
jsnext: true,
|
|
279
|
+
}),
|
|
280
|
+
copyTypes(),
|
|
281
|
+
],
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
...browserTestBuilds,
|
|
256
285
|
];
|
|
257
286
|
|
|
258
|
-
|
|
287
|
+
const builds = process.env.FULL ? ALL_BUILDS : MAIN_BUILDS;
|
|
288
|
+
export default withCleanOnRebuild(builds);
|
package/src/autocapture/utils.js
CHANGED
|
@@ -505,6 +505,18 @@ function shouldTrackDomEvent(el, ev) {
|
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
|
|
508
|
+
function elementLooksSensitive(el) {
|
|
509
|
+
var name = (el.name || el.id || '').toString().toLowerCase();
|
|
510
|
+
if (typeof name === 'string') { // it's possible for el.name or el.id to be a DOM element if el is a form with a child input[name="name"]
|
|
511
|
+
var sensitiveNameRegex = /^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;
|
|
512
|
+
if (sensitiveNameRegex.test(name.replace(/[^a-zA-Z0-9]/g, ''))) {
|
|
513
|
+
return true;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
return false;
|
|
518
|
+
}
|
|
519
|
+
|
|
508
520
|
/*
|
|
509
521
|
* Check whether a DOM element should be "tracked" or if it may contain sensitive data
|
|
510
522
|
* using a variety of heuristics.
|
|
@@ -557,13 +569,8 @@ function shouldTrackElementDetails(el, ev, allowElementCallback, allowSelectors)
|
|
|
557
569
|
}
|
|
558
570
|
}
|
|
559
571
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
if (typeof name === 'string') { // it's possible for el.name or el.id to be a DOM element if el is a form with a child input[name="name"]
|
|
563
|
-
var sensitiveNameRegex = /^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;
|
|
564
|
-
if (sensitiveNameRegex.test(name.replace(/[^a-zA-Z0-9]/g, ''))) {
|
|
565
|
-
return false;
|
|
566
|
-
}
|
|
572
|
+
if (elementLooksSensitive(el)) {
|
|
573
|
+
return false;
|
|
567
574
|
}
|
|
568
575
|
|
|
569
576
|
return true;
|
|
@@ -775,6 +782,7 @@ function getClickEventTargetElement(event) {
|
|
|
775
782
|
export {
|
|
776
783
|
EV_CHANGE, EV_CLICK, EV_HASHCHANGE, EV_INPUT, EV_LOAD,EV_MP_LOCATION_CHANGE, EV_POPSTATE,
|
|
777
784
|
EV_SCROLL, EV_SCROLLEND, EV_SELECT, EV_SUBMIT, EV_TOGGLE, EV_VISIBILITYCHANGE,
|
|
785
|
+
elementLooksSensitive,
|
|
778
786
|
getClickEventComposedPath,
|
|
779
787
|
getClickEventTargetElement,
|
|
780
788
|
getPolyfillScrollEndFunction,
|