@hanzo/event 0.3.23 → 0.3.24

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as Cohort, A as Attribution, S as SentryEvent, D as Dsn, a as CaptureErrorOptions, b as SentryFrame, E as ExceptionEntry, c as SentryLevel, d as ExceptionProperties } from './core-CHLpJy51.js';
2
- export { e as Analytics, f as AnalyticsConfig, g as EventKind, h as Exception, i as ExceptionFrame, T as Transport, W as WireEvent, j as createAnalytics } from './core-CHLpJy51.js';
1
+ import { C as Cohort, A as Attribution, S as SentryEvent, D as Dsn, a as CaptureErrorOptions, b as SentryFrame, E as ExceptionEntry, c as SentryLevel, d as ExceptionProperties } from './core-DO8tBUy7.js';
2
+ export { e as Analytics, f as AnalyticsConfig, g as EventKind, h as Exception, i as ExceptionFrame, T as Transport, W as WireEvent, j as createAnalytics } from './core-DO8tBUy7.js';
3
3
  import { FunnelId } from '@hanzo/events';
4
4
  export { EVENTS, EXCEPTION, EventName, FUNNELS, FunnelDef, FunnelId, FunnelStep, PAGEVIEW, PRODUCTS, ProductId, eventsOf } from '@hanzo/events';
5
5
 
@@ -8,7 +8,7 @@ declare function getFirstTouch(): Attribution | undefined;
8
8
  /** Read persisted cohort dimensions. */
9
9
  declare function getCohort(): Cohort | undefined;
10
10
 
11
- declare const VERSION = "0.3.23";
11
+ declare const VERSION = "0.3.24";
12
12
 
13
13
  /**
14
14
  * parseDsn parses "https://<version>:<hmac>@<host>/v1/sentry/<projectId>" into its
package/dist/index.mjs CHANGED
@@ -318,7 +318,7 @@ function uuidv7Time(id) {
318
318
  }
319
319
 
320
320
  // src/version.ts
321
- var VERSION = "0.3.23";
321
+ var VERSION = "0.3.24";
322
322
 
323
323
  // src/sentry.ts
324
324
  var MAX_FRAMES = 50;
@@ -677,6 +677,7 @@ function mergeCohort(patch) {
677
677
  var EVENT_PATH = "/v1/event";
678
678
  var DEFAULT_HOST = "https://api.hanzo.ai";
679
679
  var ENVELOPE_CONTENT_TYPE = "application/x-sentry-envelope";
680
+ var BEACON_CONTENT_TYPE = "text/plain";
680
681
  function readEnvDsn() {
681
682
  try {
682
683
  if (typeof process !== "undefined" && process.env) {
@@ -721,17 +722,22 @@ function serializeBatch(batch) {
721
722
  }
722
723
  var DefaultTransport = class {
723
724
  send(url, body, opts) {
724
- const contentType = opts.contentType ?? "application/json";
725
725
  if (opts.beacon && isBrowser() && typeof navigator.sendBeacon === "function") {
726
726
  const beaconUrl = opts.ingestKey ? appendQuery(url, "ingest_key", opts.ingestKey) : url;
727
727
  try {
728
- navigator.sendBeacon(beaconUrl, new Blob([body], { type: contentType }));
729
- return;
728
+ const queued = navigator.sendBeacon(
729
+ beaconUrl,
730
+ new Blob([body], { type: BEACON_CONTENT_TYPE })
731
+ );
732
+ if (queued) return;
733
+ if (opts.debug) console.warn("[event] beacon refused, falling back to fetch");
730
734
  } catch {
731
735
  }
732
736
  }
733
737
  if (typeof fetch !== "function") return;
734
- const headers = { "Content-Type": contentType };
738
+ const headers = {
739
+ "Content-Type": opts.contentType ?? "application/json"
740
+ };
735
741
  const bearer = opts.ingestKey ?? opts.token;
736
742
  if (bearer) headers.Authorization = `Bearer ${bearer}`;
737
743
  void fetch(url, {