@hanzo/event 0.3.23 → 0.3.25
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/{core-CHLpJy51.d.cts → core-DO8tBUy7.d.cts} +4 -2
- package/dist/{core-CHLpJy51.d.ts → core-DO8tBUy7.d.ts} +4 -2
- package/dist/index.cjs +11 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +11 -5
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +11 -5
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.mjs +11 -5
- package/dist/react.mjs.map +1 -1
- package/hz.js +24 -5
- package/package.json +10 -10
- package/src/core.ts +25 -5
- package/src/hz.test.ts +88 -7
- package/src/stack.ts +144 -0
- package/src/transport.test.ts +139 -0
- package/src/types.ts +4 -2
- package/src/version.ts +1 -1
- package/LICENSE.md +0 -21
package/dist/react.cjs
CHANGED
|
@@ -309,7 +309,7 @@ function hzAnonId() {
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
// src/version.ts
|
|
312
|
-
var VERSION = "0.3.
|
|
312
|
+
var VERSION = "0.3.25";
|
|
313
313
|
|
|
314
314
|
// src/sentry.ts
|
|
315
315
|
var MAX_FRAMES = 50;
|
|
@@ -668,6 +668,7 @@ function mergeCohort(patch) {
|
|
|
668
668
|
var EVENT_PATH = "/v1/event";
|
|
669
669
|
var DEFAULT_HOST = "https://api.hanzo.ai";
|
|
670
670
|
var ENVELOPE_CONTENT_TYPE = "application/x-sentry-envelope";
|
|
671
|
+
var BEACON_CONTENT_TYPE = "text/plain";
|
|
671
672
|
function readEnvDsn() {
|
|
672
673
|
try {
|
|
673
674
|
if (typeof process !== "undefined" && process.env) {
|
|
@@ -712,17 +713,22 @@ function serializeBatch(batch) {
|
|
|
712
713
|
}
|
|
713
714
|
var DefaultTransport = class {
|
|
714
715
|
send(url, body, opts) {
|
|
715
|
-
const contentType = opts.contentType ?? "application/json";
|
|
716
716
|
if (opts.beacon && isBrowser() && typeof navigator.sendBeacon === "function") {
|
|
717
717
|
const beaconUrl = opts.ingestKey ? appendQuery(url, "ingest_key", opts.ingestKey) : url;
|
|
718
718
|
try {
|
|
719
|
-
navigator.sendBeacon(
|
|
720
|
-
|
|
719
|
+
const queued = navigator.sendBeacon(
|
|
720
|
+
beaconUrl,
|
|
721
|
+
new Blob([body], { type: BEACON_CONTENT_TYPE })
|
|
722
|
+
);
|
|
723
|
+
if (queued) return;
|
|
724
|
+
if (opts.debug) console.warn("[event] beacon refused, falling back to fetch");
|
|
721
725
|
} catch {
|
|
722
726
|
}
|
|
723
727
|
}
|
|
724
728
|
if (typeof fetch !== "function") return;
|
|
725
|
-
const headers = {
|
|
729
|
+
const headers = {
|
|
730
|
+
"Content-Type": opts.contentType ?? "application/json"
|
|
731
|
+
};
|
|
726
732
|
const bearer = opts.ingestKey ?? opts.token;
|
|
727
733
|
if (bearer) headers.Authorization = `Bearer ${bearer}`;
|
|
728
734
|
void fetch(url, {
|