posthog-js-lite 3.2.1 → 3.3.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Next
2
2
 
3
+ # 3.3.0 - 2025-02-06
4
+
5
+ ## Added
6
+
7
+ 1. Adds `captureException` function to allow manual capture of exceptions
8
+
3
9
  # 3.2.1 - 2025-01-17
4
10
 
5
11
  ## Fixed
@@ -12,13 +18,12 @@
12
18
 
13
19
  1. Add new debugging property `$feature_flag_bootstrapped_response`, `$feature_flag_bootstrapped_payload` and `$used_bootstrap_value` to `$feature_flag_called` event
14
20
 
15
-
16
21
  # 3.1.0 - 2024-11-21
17
22
 
18
23
  ## Changed
19
24
 
20
25
  1. chore: default `captureMode` changed to `json`.
21
- 1. To keep using the `form` mode, just set the `captureMode` option to `form` when initializing the PostHog client.
26
+ 1. To keep using the `form` mode, just set the `captureMode` option to `form` when initializing the PostHog client.
22
27
  2. fix: identify method allows passing a $set_once object
23
28
 
24
29
  # 3.0.2 - 2024-06-15
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > 🚧 This is a reduced feature set package. Currently the only officially supported feature complete way of using PostHog on the web is [posthog-js](https://github.com/PostHog/posthog-js)
4
4
 
5
- This package is currently published to npm as [posthog-js-lite](https://www.npmjs.com/package/posthog-js-lite) and is a simplified version of the recommended and offically supported `posthog-js`.
5
+ This package is currently published to npm as [posthog-js-lite](https://www.npmjs.com/package/posthog-js-lite) and is a simplified version of the recommended and officially supported `posthog-js`.
6
6
 
7
7
  You'd want to use this only if you're very conscious about package sizes, and this reduced feature set (only analytics and feature flags) works for your use case. The most common use case is in chrome extensions.
8
8
 
package/lib/index.cjs.js CHANGED
@@ -1918,9 +1918,30 @@ class PostHogCore extends PostHogCoreStateless {
1918
1918
  return this.setPersistedProperty(PostHogPersistedProperty.OverrideFeatureFlags, flags);
1919
1919
  });
1920
1920
  }
1921
+ /***
1922
+ *** ERROR TRACKING
1923
+ ***/
1924
+ captureException(error, additionalProperties) {
1925
+ const properties = {
1926
+ $exception_level: 'error',
1927
+ $exception_list: [
1928
+ {
1929
+ type: error.name,
1930
+ value: error.message,
1931
+ mechanism: {
1932
+ handled: true,
1933
+ synthetic: false,
1934
+ },
1935
+ },
1936
+ ],
1937
+ ...additionalProperties,
1938
+ };
1939
+ properties.$exception_personURL = new URL(`/project/${this.apiKey}/person/${this.getDistinctId()}`, this.host).toString();
1940
+ this.capture('$exception', properties);
1941
+ }
1921
1942
  }
1922
1943
 
1923
- var version = "3.2.1";
1944
+ var version = "3.3.0";
1924
1945
 
1925
1946
  function getContext(window) {
1926
1947
  let context = {};