@posthog/core 1.29.5 → 1.29.6

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.
@@ -7,4 +7,4 @@ export declare class DOMExceptionCoercer implements ErrorTrackingCoercer<DOMExce
7
7
  private isDOMException;
8
8
  private isDOMError;
9
9
  }
10
- //# sourceMappingURL=dom-exception-coercer.d.ts.map
10
+ //# sourceMappingURL=dom-exception-coercer.d.ts.mapercer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"user-agent-utils.d.ts","sourceRoot":"","sources":["../../src/utils/user-agent-utils.ts"],"names":[],"mappings":"AAqFA;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAa,YAAY,MAAM,EAAE,QAAQ,MAAM,GAAG,SAAS,KAAG,MA4CvF,CAAA;AAsBD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAa,WAAW,MAAM,EAAE,QAAQ,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,IAetG,CAAA;AA0FD,eAAO,MAAM,QAAQ,GAAa,YAAY,MAAM,KAAG,CAAC,MAAM,EAAE,MAAM,CAUrE,CAAA;AAED,eAAO,MAAM,YAAY,GAAa,YAAY,MAAM,KAAG,MAuD1D,CAAA;AAED,eAAO,MAAM,gBAAgB,GAC3B,YAAY,MAAM,EAClB,UAAU;IACR,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,KACA,MA4BF,CAAA"}
1
+ {"version":3,"file":"user-agent-utils.d.ts","sourceRoot":"","sources":["../../src/utils/user-agent-utils.ts"],"names":[],"mappings":"AAsFA;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAa,YAAY,MAAM,EAAE,QAAQ,MAAM,GAAG,SAAS,KAAG,MAmDvF,CAAA;AAuBD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAa,WAAW,MAAM,EAAE,QAAQ,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,IAetG,CAAA;AA0FD,eAAO,MAAM,QAAQ,GAAa,YAAY,MAAM,KAAG,CAAC,MAAM,EAAE,MAAM,CAUrE,CAAA;AAED,eAAO,MAAM,YAAY,GAAa,YAAY,MAAM,KAAG,MAuD1D,CAAA;AAED,eAAO,MAAM,gBAAgB,GAC3B,YAAY,MAAM,EAClB,UAAU;IACR,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,KACA,MA4BF,CAAA"}
@@ -70,6 +70,7 @@ const GENERIC = 'Generic';
70
70
  const GENERIC_MOBILE = GENERIC + ' ' + MOBILE.toLowerCase();
71
71
  const GENERIC_TABLET = GENERIC + ' ' + TABLET.toLowerCase();
72
72
  const KONQUEROR = 'Konqueror';
73
+ const OCULUS_BROWSER = 'Oculus Browser';
73
74
  const BROWSER_VERSION_REGEX_SUFFIX = '(\\d+(\\.\\d+)?)';
74
75
  const DEFAULT_BROWSER_VERSION_REGEX = new RegExp('Version/' + BROWSER_VERSION_REGEX_SUFFIX);
75
76
  const XBOX_REGEX = new RegExp(XBOX, 'i');
@@ -99,7 +100,8 @@ const detectBrowser = function(user_agent, vendor) {
99
100
  if ((0, external_string_utils_js_namespaceObject.includes)(user_agent, ' OPR/')) return OPERA;
100
101
  if (BLACKBERRY_REGEX.test(user_agent)) return BLACKBERRY;
101
102
  if ((0, external_string_utils_js_namespaceObject.includes)(user_agent, 'IE' + MOBILE) || (0, external_string_utils_js_namespaceObject.includes)(user_agent, 'WPDesktop')) return INTERNET_EXPLORER_MOBILE;
102
- if ((0, external_string_utils_js_namespaceObject.includes)(user_agent, SAMSUNG_BROWSER)) return SAMSUNG_INTERNET;
103
+ if ((0, external_string_utils_js_namespaceObject.includes)(user_agent, 'OculusBrowser')) return OCULUS_BROWSER;
104
+ else if ((0, external_string_utils_js_namespaceObject.includes)(user_agent, SAMSUNG_BROWSER)) return SAMSUNG_INTERNET;
103
105
  else if ((0, external_string_utils_js_namespaceObject.includes)(user_agent, EDGE) || (0, external_string_utils_js_namespaceObject.includes)(user_agent, 'Edg/')) return MICROSOFT_EDGE;
104
106
  else if ((0, external_string_utils_js_namespaceObject.includes)(user_agent, 'FBIOS')) return FACEBOOK + ' ' + MOBILE;
105
107
  else if ((0, external_string_utils_js_namespaceObject.includes)(user_agent, 'UCWEB') || (0, external_string_utils_js_namespaceObject.includes)(user_agent, 'UCBrowser')) return 'UC Browser';
@@ -159,6 +161,9 @@ const versionRegexes = {
159
161
  [SAMSUNG_INTERNET]: [
160
162
  new RegExp(SAMSUNG_BROWSER + '\\/' + BROWSER_VERSION_REGEX_SUFFIX)
161
163
  ],
164
+ [OCULUS_BROWSER]: [
165
+ new RegExp('OculusBrowser\\/' + BROWSER_VERSION_REGEX_SUFFIX)
166
+ ],
162
167
  [INTERNET_EXPLORER]: [
163
168
  new RegExp('(rv:|MSIE )' + BROWSER_VERSION_REGEX_SUFFIX)
164
169
  ],
@@ -38,6 +38,7 @@ const GENERIC = 'Generic';
38
38
  const GENERIC_MOBILE = GENERIC + ' ' + MOBILE.toLowerCase();
39
39
  const GENERIC_TABLET = GENERIC + ' ' + TABLET.toLowerCase();
40
40
  const KONQUEROR = 'Konqueror';
41
+ const OCULUS_BROWSER = 'Oculus Browser';
41
42
  const BROWSER_VERSION_REGEX_SUFFIX = '(\\d+(\\.\\d+)?)';
42
43
  const DEFAULT_BROWSER_VERSION_REGEX = new RegExp('Version/' + BROWSER_VERSION_REGEX_SUFFIX);
43
44
  const XBOX_REGEX = new RegExp(XBOX, 'i');
@@ -67,7 +68,8 @@ const detectBrowser = function(user_agent, vendor) {
67
68
  if (includes(user_agent, ' OPR/')) return OPERA;
68
69
  if (BLACKBERRY_REGEX.test(user_agent)) return BLACKBERRY;
69
70
  if (includes(user_agent, 'IE' + MOBILE) || includes(user_agent, 'WPDesktop')) return INTERNET_EXPLORER_MOBILE;
70
- if (includes(user_agent, SAMSUNG_BROWSER)) return SAMSUNG_INTERNET;
71
+ if (includes(user_agent, 'OculusBrowser')) return OCULUS_BROWSER;
72
+ else if (includes(user_agent, SAMSUNG_BROWSER)) return SAMSUNG_INTERNET;
71
73
  else if (includes(user_agent, EDGE) || includes(user_agent, 'Edg/')) return MICROSOFT_EDGE;
72
74
  else if (includes(user_agent, 'FBIOS')) return FACEBOOK + ' ' + MOBILE;
73
75
  else if (includes(user_agent, 'UCWEB') || includes(user_agent, 'UCBrowser')) return 'UC Browser';
@@ -127,6 +129,9 @@ const versionRegexes = {
127
129
  [SAMSUNG_INTERNET]: [
128
130
  new RegExp(SAMSUNG_BROWSER + '\\/' + BROWSER_VERSION_REGEX_SUFFIX)
129
131
  ],
132
+ [OCULUS_BROWSER]: [
133
+ new RegExp('OculusBrowser\\/' + BROWSER_VERSION_REGEX_SUFFIX)
134
+ ],
130
135
  [INTERNET_EXPLORER]: [
131
136
  new RegExp('(rv:|MSIE )' + BROWSER_VERSION_REGEX_SUFFIX)
132
137
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/core",
3
- "version": "1.29.5",
3
+ "version": "1.29.6",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -67,7 +67,7 @@
67
67
  }
68
68
  },
69
69
  "dependencies": {
70
- "@posthog/types": "1.374.2"
70
+ "@posthog/types": "1.374.3"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@rslib/core": "0.10.6",
@@ -49,6 +49,7 @@ const GENERIC = 'Generic'
49
49
  const GENERIC_MOBILE = GENERIC + ' ' + MOBILE.toLowerCase()
50
50
  const GENERIC_TABLET = GENERIC + ' ' + TABLET.toLowerCase()
51
51
  const KONQUEROR = 'Konqueror'
52
+ const OCULUS_BROWSER = 'Oculus Browser'
52
53
 
53
54
  const BROWSER_VERSION_REGEX_SUFFIX = '(\\d+(\\.\\d+)?)'
54
55
  const DEFAULT_BROWSER_VERSION_REGEX = new RegExp('Version/' + BROWSER_VERSION_REGEX_SUFFIX)
@@ -100,6 +101,13 @@ export const detectBrowser = function (user_agent: string, vendor: string | unde
100
101
  } else if (includes(user_agent, 'IE' + MOBILE) || includes(user_agent, 'WPDesktop')) {
101
102
  return INTERNET_EXPLORER_MOBILE
102
103
  }
104
+ // Oculus Browser (Meta Quest) is Chromium-based, so its UA includes
105
+ // `OculusBrowser` alongside `Chrome` (and sometimes `SamsungBrowser`).
106
+ // We must check for it before those, otherwise it would be misdetected.
107
+ // See https://github.com/PostHog/posthog-js/issues/3574
108
+ else if (includes(user_agent, 'OculusBrowser')) {
109
+ return OCULUS_BROWSER
110
+ }
103
111
  // https://developer.samsung.com/internet/user-agent-string-format
104
112
  else if (includes(user_agent, SAMSUNG_BROWSER)) {
105
113
  return SAMSUNG_INTERNET
@@ -150,6 +158,7 @@ const versionRegexes: Record<string, RegExp[]> = {
150
158
  [BLACKBERRY]: [new RegExp(BLACKBERRY + ' ' + BROWSER_VERSION_REGEX_SUFFIX), DEFAULT_BROWSER_VERSION_REGEX],
151
159
  [ANDROID_MOBILE]: [new RegExp('android\\s' + BROWSER_VERSION_REGEX_SUFFIX, 'i')],
152
160
  [SAMSUNG_INTERNET]: [new RegExp(SAMSUNG_BROWSER + '\\/' + BROWSER_VERSION_REGEX_SUFFIX)],
161
+ [OCULUS_BROWSER]: [new RegExp('OculusBrowser\\/' + BROWSER_VERSION_REGEX_SUFFIX)],
153
162
  [INTERNET_EXPLORER]: [new RegExp('(rv:|MSIE )' + BROWSER_VERSION_REGEX_SUFFIX)],
154
163
  Mozilla: [new RegExp('rv:' + BROWSER_VERSION_REGEX_SUFFIX)],
155
164
  }