@posthog/browser-common 0.10.0 → 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/dist/utils/uuidv7.js +10 -1
- package/dist/utils/uuidv7.mjs +10 -1
- package/package.json +2 -2
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/dist/utils/uuidv7.js
CHANGED
|
@@ -140,7 +140,16 @@ const weakRandomValues = (buffer)=>{
|
|
|
140
140
|
return buffer;
|
|
141
141
|
};
|
|
142
142
|
let getRandomValues;
|
|
143
|
-
const selectRandomValues = ()=>
|
|
143
|
+
const selectRandomValues = ()=>{
|
|
144
|
+
if ("u" > typeof window && !(0, core_namespaceObject.isUndefined)(window.crypto) && crypto.getRandomValues) return (buffer)=>{
|
|
145
|
+
try {
|
|
146
|
+
return crypto.getRandomValues(buffer);
|
|
147
|
+
} catch {
|
|
148
|
+
return weakRandomValues(buffer);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
return weakRandomValues;
|
|
152
|
+
};
|
|
144
153
|
class DefaultRandom {
|
|
145
154
|
nextUint32() {
|
|
146
155
|
if (this._cursor >= this._buffer.length) {
|
package/dist/utils/uuidv7.mjs
CHANGED
|
@@ -106,7 +106,16 @@ const weakRandomValues = (buffer)=>{
|
|
|
106
106
|
return buffer;
|
|
107
107
|
};
|
|
108
108
|
let getRandomValues;
|
|
109
|
-
const selectRandomValues = ()=>
|
|
109
|
+
const selectRandomValues = ()=>{
|
|
110
|
+
if ("u" > typeof window && !isUndefined(window.crypto) && crypto.getRandomValues) return (buffer)=>{
|
|
111
|
+
try {
|
|
112
|
+
return crypto.getRandomValues(buffer);
|
|
113
|
+
} catch {
|
|
114
|
+
return weakRandomValues(buffer);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
return weakRandomValues;
|
|
118
|
+
};
|
|
110
119
|
class DefaultRandom {
|
|
111
120
|
nextUint32() {
|
|
112
121
|
if (this._cursor >= this._buffer.length) {
|
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,7 +240,7 @@
|
|
|
240
240
|
},
|
|
241
241
|
"dependencies": {
|
|
242
242
|
"preact": "^10.29.3",
|
|
243
|
-
"@posthog/core": "^1.61.
|
|
243
|
+
"@posthog/core": "^1.61.2",
|
|
244
244
|
"@posthog/types": "^1.418.0"
|
|
245
245
|
},
|
|
246
246
|
"devDependencies": {
|