@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.mjs
CHANGED
|
@@ -307,7 +307,7 @@ function hzAnonId() {
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
// src/version.ts
|
|
310
|
-
var VERSION = "0.3.
|
|
310
|
+
var VERSION = "0.3.25";
|
|
311
311
|
|
|
312
312
|
// src/sentry.ts
|
|
313
313
|
var MAX_FRAMES = 50;
|
|
@@ -666,6 +666,7 @@ function mergeCohort(patch) {
|
|
|
666
666
|
var EVENT_PATH = "/v1/event";
|
|
667
667
|
var DEFAULT_HOST = "https://api.hanzo.ai";
|
|
668
668
|
var ENVELOPE_CONTENT_TYPE = "application/x-sentry-envelope";
|
|
669
|
+
var BEACON_CONTENT_TYPE = "text/plain";
|
|
669
670
|
function readEnvDsn() {
|
|
670
671
|
try {
|
|
671
672
|
if (typeof process !== "undefined" && process.env) {
|
|
@@ -710,17 +711,22 @@ function serializeBatch(batch) {
|
|
|
710
711
|
}
|
|
711
712
|
var DefaultTransport = class {
|
|
712
713
|
send(url, body, opts) {
|
|
713
|
-
const contentType = opts.contentType ?? "application/json";
|
|
714
714
|
if (opts.beacon && isBrowser() && typeof navigator.sendBeacon === "function") {
|
|
715
715
|
const beaconUrl = opts.ingestKey ? appendQuery(url, "ingest_key", opts.ingestKey) : url;
|
|
716
716
|
try {
|
|
717
|
-
navigator.sendBeacon(
|
|
718
|
-
|
|
717
|
+
const queued = navigator.sendBeacon(
|
|
718
|
+
beaconUrl,
|
|
719
|
+
new Blob([body], { type: BEACON_CONTENT_TYPE })
|
|
720
|
+
);
|
|
721
|
+
if (queued) return;
|
|
722
|
+
if (opts.debug) console.warn("[event] beacon refused, falling back to fetch");
|
|
719
723
|
} catch {
|
|
720
724
|
}
|
|
721
725
|
}
|
|
722
726
|
if (typeof fetch !== "function") return;
|
|
723
|
-
const headers = {
|
|
727
|
+
const headers = {
|
|
728
|
+
"Content-Type": opts.contentType ?? "application/json"
|
|
729
|
+
};
|
|
724
730
|
const bearer = opts.ingestKey ?? opts.token;
|
|
725
731
|
if (bearer) headers.Authorization = `Bearer ${bearer}`;
|
|
726
732
|
void fetch(url, {
|