@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 CHANGED
@@ -27,7 +27,7 @@ var __webpack_require__ = {};
27
27
  })();
28
28
  var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
- const packageVersion = "0.10.1";
30
+ const packageVersion = "0.10.2";
31
31
  const Config = {
32
32
  DEBUG: false,
33
33
  LIB_VERSION: packageVersion,
package/dist/config.mjs CHANGED
@@ -1,4 +1,4 @@
1
- const packageVersion = "0.10.1";
1
+ const packageVersion = "0.10.2";
2
2
  const Config = {
3
3
  DEBUG: false,
4
4
  LIB_VERSION: packageVersion,
@@ -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 keyValuePair = queryParts[i].split('=');
114
- if ((0, core_namespaceObject.isArray)(keyValuePair)) if (maskedParams.includes(keyValuePair[0])) paramStrings.push(keyValuePair[0] + '=' + mask);
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 keyValuePair = queryParts[i].split('=');
72
- if (isArray(keyValuePair)) if (maskedParams.includes(keyValuePair[0])) paramStrings.push(keyValuePair[0] + '=' + mask);
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.1",
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/types": "^1.418.0",
244
- "@posthog/core": "^1.61.1"
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",