@posthog/browser-common 0.10.1 → 0.10.2
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/config.js +1 -1
- package/dist/config.mjs +1 -1
- package/dist/utils/request-utils.js +6 -4
- package/dist/utils/request-utils.mjs +6 -4
- package/package.json +3 -3
package/dist/config.js
CHANGED
package/dist/config.mjs
CHANGED
|
@@ -101,17 +101,19 @@ const getQueryParam = function(url, param) {
|
|
|
101
101
|
};
|
|
102
102
|
const maskQueryParams = function(url, maskedParams, mask) {
|
|
103
103
|
if (!url || !maskedParams || !maskedParams.length) return url;
|
|
104
|
-
const splitHash = url.split(
|
|
104
|
+
const splitHash = url.split(/#(.*)/);
|
|
105
105
|
const withoutHash = splitHash[0] || '';
|
|
106
106
|
const hash = splitHash[1];
|
|
107
|
-
const splitQuery = withoutHash.split(
|
|
107
|
+
const splitQuery = withoutHash.split(/\?(.*)/);
|
|
108
108
|
const queryString = splitQuery[1];
|
|
109
109
|
const urlWithoutQueryAndHash = splitQuery[0];
|
|
110
110
|
const queryParts = (queryString || '').split('&');
|
|
111
111
|
const paramStrings = [];
|
|
112
112
|
for(let i = 0; i < queryParts.length; i++){
|
|
113
|
-
const
|
|
114
|
-
|
|
113
|
+
const pieces = queryParts[i].split('?');
|
|
114
|
+
let j = 0;
|
|
115
|
+
while(j < pieces.length && !maskedParams.includes(pieces[j].split('=')[0]))j++;
|
|
116
|
+
if (j < pieces.length) paramStrings.push(pieces.slice(0, j).concat(pieces[j].split('=')[0] + '=' + mask).join('?'));
|
|
115
117
|
else paramStrings.push(queryParts[i]);
|
|
116
118
|
}
|
|
117
119
|
let result = urlWithoutQueryAndHash;
|
|
@@ -59,17 +59,19 @@ const getQueryParam = function(url, param) {
|
|
|
59
59
|
};
|
|
60
60
|
const maskQueryParams = function(url, maskedParams, mask) {
|
|
61
61
|
if (!url || !maskedParams || !maskedParams.length) return url;
|
|
62
|
-
const splitHash = url.split(
|
|
62
|
+
const splitHash = url.split(/#(.*)/);
|
|
63
63
|
const withoutHash = splitHash[0] || '';
|
|
64
64
|
const hash = splitHash[1];
|
|
65
|
-
const splitQuery = withoutHash.split(
|
|
65
|
+
const splitQuery = withoutHash.split(/\?(.*)/);
|
|
66
66
|
const queryString = splitQuery[1];
|
|
67
67
|
const urlWithoutQueryAndHash = splitQuery[0];
|
|
68
68
|
const queryParts = (queryString || '').split('&');
|
|
69
69
|
const paramStrings = [];
|
|
70
70
|
for(let i = 0; i < queryParts.length; i++){
|
|
71
|
-
const
|
|
72
|
-
|
|
71
|
+
const pieces = queryParts[i].split('?');
|
|
72
|
+
let j = 0;
|
|
73
|
+
while(j < pieces.length && !maskedParams.includes(pieces[j].split('=')[0]))j++;
|
|
74
|
+
if (j < pieces.length) paramStrings.push(pieces.slice(0, j).concat(pieces[j].split('=')[0] + '=' + mask).join('?'));
|
|
73
75
|
else paramStrings.push(queryParts[i]);
|
|
74
76
|
}
|
|
75
77
|
let result = urlWithoutQueryAndHash;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/browser-common",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Internal shared browser utilities and extension primitives for PostHog Browser SDKs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -240,8 +240,8 @@
|
|
|
240
240
|
},
|
|
241
241
|
"dependencies": {
|
|
242
242
|
"preact": "^10.29.3",
|
|
243
|
-
"@posthog/
|
|
244
|
-
"@posthog/
|
|
243
|
+
"@posthog/core": "^1.61.2",
|
|
244
|
+
"@posthog/types": "^1.418.0"
|
|
245
245
|
},
|
|
246
246
|
"devDependencies": {
|
|
247
247
|
"@rsbuild/plugin-react": "^2.1.0",
|