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/lib/index.d.ts CHANGED
@@ -317,6 +317,12 @@ declare abstract class PostHogCore extends PostHogCoreStateless {
317
317
  onFeatureFlags(cb: (flags: PostHogDecideResponse['featureFlags']) => void): () => void;
318
318
  onFeatureFlag(key: string, cb: (value: string | boolean) => void): () => void;
319
319
  overrideFeatureFlag(flags: PostHogDecideResponse['featureFlags'] | null): Promise<void>;
320
+ /***
321
+ *** ERROR TRACKING
322
+ ***/
323
+ captureException(error: Error, additionalProperties?: {
324
+ [key: string]: any;
325
+ }): void;
320
326
  }
321
327
 
322
328
  type PostHogOptions = {
package/lib/index.esm.js CHANGED
@@ -1914,9 +1914,30 @@ class PostHogCore extends PostHogCoreStateless {
1914
1914
  return this.setPersistedProperty(PostHogPersistedProperty.OverrideFeatureFlags, flags);
1915
1915
  });
1916
1916
  }
1917
+ /***
1918
+ *** ERROR TRACKING
1919
+ ***/
1920
+ captureException(error, additionalProperties) {
1921
+ const properties = {
1922
+ $exception_level: 'error',
1923
+ $exception_list: [
1924
+ {
1925
+ type: error.name,
1926
+ value: error.message,
1927
+ mechanism: {
1928
+ handled: true,
1929
+ synthetic: false,
1930
+ },
1931
+ },
1932
+ ],
1933
+ ...additionalProperties,
1934
+ };
1935
+ properties.$exception_personURL = new URL(`/project/${this.apiKey}/person/${this.getDistinctId()}`, this.host).toString();
1936
+ this.capture('$exception', properties);
1937
+ }
1917
1938
  }
1918
1939
 
1919
- var version = "3.2.1";
1940
+ var version = "3.3.0";
1920
1941
 
1921
1942
  function getContext(window) {
1922
1943
  let context = {};