@posthog/browser-common 0.9.7 → 0.9.9

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.
@@ -1,6 +1,6 @@
1
1
  import { isArray, isError, isFile, isUndefined, safeJsonStringify } from "@posthog/core";
2
2
  import { each, errorToProperties } from "./general-utils.mjs";
3
- import { document as external_globals_mjs_document, location as external_globals_mjs_location } from "./globals.mjs";
3
+ import { location as external_globals_mjs_location } from "./globals.mjs";
4
4
  import { logger } from "./logger.mjs";
5
5
  const localDomains = [
6
6
  'localhost',
@@ -21,12 +21,6 @@ const jsonStringify = (data, space)=>{
21
21
  return safeJsonStringify(data);
22
22
  }
23
23
  };
24
- const convertToURL = (url)=>{
25
- const location = external_globals_mjs_document?.createElement('a');
26
- if (isUndefined(location)) return null;
27
- location.href = url;
28
- return location;
29
- };
30
24
  const formDataToQuery = function(formdata, arg_separator = '&') {
31
25
  let use_val;
32
26
  let use_key;
@@ -88,5 +82,6 @@ const _getHashParam = function(hash, param) {
88
82
  return matches ? matches[1] : null;
89
83
  };
90
84
  const isLocalhost = ()=>localDomains.includes(external_globals_mjs_location.hostname);
85
+ export { convertToURL } from "./convert-to-url.mjs";
91
86
  export { isStatusZeroFailureCircuitBreakerTripped, updateStatusZeroFailureCount } from "./request-reachability.mjs";
92
- export { _getHashParam, convertToURL, formDataToQuery, getQueryParam, isLocalhost, jsonStringify, maskQueryParams };
87
+ export { _getHashParam, formDataToQuery, getQueryParam, isLocalhost, jsonStringify, maskQueryParams };
@@ -45,7 +45,8 @@ function applyUrlTargetingOverride(instance, defaultUrl) {
45
45
  }
46
46
  }
47
47
  function getTargetingUrl(instance) {
48
- const defaultUrl = "u" > typeof window ? window.location?.href : void 0;
48
+ const win = "u" < typeof window ? void 0 : window;
49
+ const defaultUrl = win?.location?.href;
49
50
  return (0, core_namespaceObject.isUndefined)(defaultUrl) ? void 0 : applyUrlTargetingOverride(instance, defaultUrl);
50
51
  }
51
52
  exports.applyUrlTargetingOverride = __webpack_exports__.applyUrlTargetingOverride;
@@ -12,7 +12,8 @@ function applyUrlTargetingOverride(instance, defaultUrl) {
12
12
  }
13
13
  }
14
14
  function getTargetingUrl(instance) {
15
- const defaultUrl = "u" > typeof window ? window.location?.href : void 0;
15
+ const win = "u" < typeof window ? void 0 : window;
16
+ const defaultUrl = win?.location?.href;
16
17
  return isUndefined(defaultUrl) ? void 0 : applyUrlTargetingOverride(instance, defaultUrl);
17
18
  }
18
19
  export { applyUrlTargetingOverride, getTargetingUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/browser-common",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "Internal shared browser utilities and extension primitives for PostHog Browser SDKs",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -91,6 +91,15 @@
91
91
  ],
92
92
  "surveys/survey-translations": [
93
93
  "dist/surveys/survey-translations.d.ts"
94
+ ],
95
+ "autocapture": [
96
+ "dist/autocapture.d.ts"
97
+ ],
98
+ "autocapture-config": [
99
+ "dist/autocapture-config.d.ts"
100
+ ],
101
+ "rageclick": [
102
+ "dist/rageclick.d.ts"
94
103
  ]
95
104
  }
96
105
  },
@@ -214,11 +223,26 @@
214
223
  "types": "./dist/surveys/survey-translations.d.ts",
215
224
  "require": "./dist/surveys/survey-translations.js",
216
225
  "import": "./dist/surveys/survey-translations.mjs"
226
+ },
227
+ "./autocapture": {
228
+ "types": "./dist/autocapture.d.ts",
229
+ "require": "./dist/autocapture.js",
230
+ "import": "./dist/autocapture.mjs"
231
+ },
232
+ "./autocapture-config": {
233
+ "types": "./dist/autocapture-config.d.ts",
234
+ "require": "./dist/autocapture-config.js",
235
+ "import": "./dist/autocapture-config.mjs"
236
+ },
237
+ "./rageclick": {
238
+ "types": "./dist/rageclick.d.ts",
239
+ "require": "./dist/rageclick.js",
240
+ "import": "./dist/rageclick.mjs"
217
241
  }
218
242
  },
219
243
  "dependencies": {
220
244
  "preact": "^10.29.3",
221
- "@posthog/core": "^1.59.3",
245
+ "@posthog/core": "^1.60.0",
222
246
  "@posthog/types": "^1.416.0"
223
247
  },
224
248
  "devDependencies": {